From 060d53257310b511bb89cfa357375cf6f572f765 Mon Sep 17 00:00:00 2001
From: prasad <prasad@vtiger.com>
Date: Sun, 2 Jul 2023 00:04:54 +0530
Subject: [PATCH] Added composer support and refactored library dependency

---
 .gitignore                                    |    2 +
 composer.json                                 |   21 +
 install-composer-deps.sh                      |   21 +
 libraries/.htaccess                           |    4 +
 libraries/Smarty/CHANGELOG.md                 | 3466 --------
 libraries/Smarty/COMPOSER_RELEASE_NOTES.txt   |   31 -
 .../Smarty/INHERITANCE_RELEASE_NOTES.txt      |   91 -
 libraries/Smarty/LICENSE                      |  179 -
 libraries/Smarty/NEW_FEATURES.txt             |  291 -
 libraries/Smarty/README                       |  575 --
 libraries/Smarty/README.md                    |   78 -
 libraries/Smarty/SMARTY_2_BC_NOTES.txt        |  109 -
 libraries/Smarty/SMARTY_3.0_BC_NOTES.txt      |   24 -
 libraries/Smarty/SMARTY_3.1_NOTES.txt         |  306 -
 libraries/Smarty/composer.json                |   46 -
 libraries/Smarty/expectException              |    0
 .../smarty_internal_configfilelexer.plex      |  318 -
 .../lexer/smarty_internal_configfileparser.y  |  346 -
 .../lexer/smarty_internal_templatelexer.plex  |  696 --
 .../lexer/smarty_internal_templateparser.y    | 1277 ---
 libraries/Smarty/libs/Autoloader.php          |  110 -
 libraries/Smarty/libs/Smarty.class.php        | 1424 ----
 libraries/Smarty/libs/SmartyBC.class.php      |  477 --
 libraries/Smarty/libs/bootstrap.php           |   16 -
 libraries/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   |  137 -
 .../Smarty/libs/plugins/function.math.php     |  112 -
 .../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   |  255 -
 .../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  |  112 -
 .../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        | 3623 --------
 .../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 -
 .../{adodb => adodb_vtigerfix}/LICENSE.md     |    0
 .../{adodb => adodb_vtigerfix}/README.md      |    0
 libraries/adodb_vtigerfix/VTIGERFIX.md        |    6 +
 .../adodb-active-record.inc.php               |    0
 .../adodb-active-recordx.inc.php              |    0
 .../adodb-csvlib.inc.php                      |    0
 .../adodb-datadict.inc.php                    |    0
 .../adodb-error.inc.php                       |    0
 .../adodb-errorhandler.inc.php                |    0
 .../adodb-errorpear.inc.php                   |    0
 .../adodb-exceptions.inc.php                  |    0
 .../adodb-lib.inc.php                         |    0
 .../adodb-loadbalancer.inc.php                |    0
 .../adodb-memcache.lib.inc.php                |    0
 .../adodb-pager.inc.php                       |    0
 .../adodb-pear.inc.php                        |    0
 .../adodb-perf.inc.php                        |    0
 .../adodb-time.inc.php                        |    0
 .../adodb-xmlschema.inc.php                   |    0
 .../adodb-xmlschema03.inc.php                 |    0
 .../{adodb => adodb_vtigerfix}/adodb.inc.php  |    0
 .../{adodb => adodb_vtigerfix}/composer.json  |    0
 .../datadict/datadict-access.inc.php          |    0
 .../datadict/datadict-db2.inc.php             |    0
 .../datadict/datadict-firebird.inc.php        |    0
 .../datadict/datadict-generic.inc.php         |    0
 .../datadict/datadict-ibase.inc.php           |    0
 .../datadict/datadict-informix.inc.php        |    0
 .../datadict/datadict-mssql.inc.php           |    0
 .../datadict/datadict-mssqlnative.inc.php     |    0
 .../datadict/datadict-mysql.inc.php           |    0
 .../datadict/datadict-oci8.inc.php            |    0
 .../datadict/datadict-postgres.inc.php        |    0
 .../datadict/datadict-sapdb.inc.php           |    0
 .../datadict/datadict-sqlite.inc.php          |    0
 .../datadict/datadict-sybase.inc.php          |    0
 .../{adodb => adodb_vtigerfix}/docs/README.md |    0
 .../{adodb => adodb_vtigerfix}/docs/adodb.gif |  Bin
 .../docs/adodb2.gif                           |  Bin
 .../docs/changelog.md                         |    0
 .../docs/changelog_v2.x.md                    |    0
 .../docs/changelog_v3.x.md                    |    0
 .../docs/changelog_v4+5.md                    |    0
 .../docs/changelog_v4.x.md                    |    0
 .../drivers/adodb-access.inc.php              |    0
 .../drivers/adodb-ado.inc.php                 |    0
 .../drivers/adodb-ado5.inc.php                |    0
 .../drivers/adodb-ado_access.inc.php          |    0
 .../drivers/adodb-ado_mssql.inc.php           |    0
 .../drivers/adodb-ads.inc.php                 |    0
 .../drivers/adodb-borland_ibase.inc.php       |    0
 .../drivers/adodb-csv.inc.php                 |    0
 .../drivers/adodb-db2.inc.php                 |    0
 .../drivers/adodb-db2oci.inc.php              |    0
 .../drivers/adodb-db2ora.inc.php              |    0
 .../drivers/adodb-fbsql.inc.php               |    0
 .../drivers/adodb-firebird.inc.php            |    0
 .../drivers/adodb-ibase.inc.php               |    0
 .../drivers/adodb-informix.inc.php            |    0
 .../drivers/adodb-informix72.inc.php          |    0
 .../drivers/adodb-ldap.inc.php                |    0
 .../drivers/adodb-mssql.inc.php               |    0
 .../drivers/adodb-mssql_n.inc.php             |    0
 .../drivers/adodb-mssqlnative.inc.php         |    0
 .../drivers/adodb-mssqlpo.inc.php             |    0
 .../drivers/adodb-mysql.inc.php               |    0
 .../drivers/adodb-mysqli.inc.php              |    0
 .../drivers/adodb-mysqlpo.inc.php             |    0
 .../drivers/adodb-mysqlt.inc.php              |    0
 .../drivers/adodb-netezza.inc.php             |    0
 .../drivers/adodb-oci8.inc.php                |    0
 .../drivers/adodb-oci805.inc.php              |    0
 .../drivers/adodb-oci8po.inc.php              |    0
 .../drivers/adodb-oci8quercus.inc.php         |    0
 .../drivers/adodb-odbc.inc.php                |    0
 .../drivers/adodb-odbc_db2.inc.php            |    0
 .../drivers/adodb-odbc_mssql.inc.php          |    0
 .../drivers/adodb-odbc_mssql2012.inc.php      |    0
 .../drivers/adodb-odbc_oracle.inc.php         |    0
 .../drivers/adodb-odbtp.inc.php               |    0
 .../drivers/adodb-odbtp_unicode.inc.php       |    0
 .../drivers/adodb-oracle.inc.php              |    0
 .../drivers/adodb-pdo.inc.php                 |    0
 .../drivers/adodb-pdo_dblib.inc.php           |    0
 .../drivers/adodb-pdo_firebird.inc.php        |    0
 .../drivers/adodb-pdo_mssql.inc.php           |    0
 .../drivers/adodb-pdo_mysql.inc.php           |    0
 .../drivers/adodb-pdo_oci.inc.php             |    0
 .../drivers/adodb-pdo_pgsql.inc.php           |    0
 .../drivers/adodb-pdo_sqlite.inc.php          |    0
 .../drivers/adodb-pdo_sqlsrv.inc.php          |    0
 .../drivers/adodb-postgres.inc.php            |    0
 .../drivers/adodb-postgres64.inc.php          |    0
 .../drivers/adodb-postgres7.inc.php           |    0
 .../drivers/adodb-postgres8.inc.php           |    0
 .../drivers/adodb-postgres9.inc.php           |    0
 .../drivers/adodb-proxy.inc.php               |    0
 .../drivers/adodb-sapdb.inc.php               |    0
 .../drivers/adodb-sqlanywhere.inc.php         |    0
 .../drivers/adodb-sqlite.inc.php              |    0
 .../drivers/adodb-sqlite3.inc.php             |    0
 .../drivers/adodb-sqlitepo.inc.php            |    0
 .../drivers/adodb-sybase.inc.php              |    0
 .../drivers/adodb-sybase_ase.inc.php          |    0
 .../drivers/adodb-text.inc.php                |    0
 .../drivers/adodb-vfp.inc.php                 |    0
 .../lang/adodb-ar.inc.php                     |    0
 .../lang/adodb-bg.inc.php                     |    0
 .../lang/adodb-ca.inc.php                     |    0
 .../lang/adodb-cn.inc.php                     |    0
 .../lang/adodb-cz.inc.php                     |    0
 .../lang/adodb-da.inc.php                     |    0
 .../lang/adodb-de.inc.php                     |    0
 .../lang/adodb-en.inc.php                     |    0
 .../lang/adodb-eo.inc.php                     |    0
 .../lang/adodb-es.inc.php                     |    0
 .../lang/adodb-fa.inc.php                     |    0
 .../lang/adodb-fr.inc.php                     |    0
 .../lang/adodb-hu.inc.php                     |    0
 .../lang/adodb-id.inc.php                     |    0
 .../lang/adodb-it.inc.php                     |    0
 .../lang/adodb-nl.inc.php                     |    0
 .../lang/adodb-oc.inc.php                     |    0
 .../lang/adodb-pl.inc.php                     |    0
 .../lang/adodb-pt-br.inc.php                  |    0
 .../lang/adodb-ro.inc.php                     |    0
 .../lang/adodb-ru.inc.php                     |    0
 .../lang/adodb-sv.inc.php                     |    0
 .../lang/adodb-th.inc.php                     |    0
 .../lang/adodb-uk.inc.php                     |    0
 .../pear/Auth/Container/ADOdb.php             |    0
 .../pear/auth_adodb_example.php               |    0
 .../pear/readme.Auth.txt                      |    0
 .../perf/perf-db2.inc.php                     |    0
 .../perf/perf-informix.inc.php                |    0
 .../perf/perf-mssql.inc.php                   |    0
 .../perf/perf-mssqlnative.inc.php             |    0
 .../perf/perf-mysql.inc.php                   |    0
 .../perf/perf-oci8.inc.php                    |    0
 .../perf/perf-postgres.inc.php                |    0
 libraries/{adodb => adodb_vtigerfix}/phpdoc   |    0
 .../pivottable.inc.php                        |    0
 .../rsfilter.inc.php                          |    0
 .../{adodb => adodb_vtigerfix}/server.php     |    0
 .../session/adodb-compress-bzip2.php          |    0
 .../session/adodb-compress-gzip.php           |    0
 .../session/adodb-cryptsession.php            |    0
 .../session/adodb-cryptsession2.php           |    0
 .../session/adodb-encrypt-mcrypt.php          |    0
 .../session/adodb-encrypt-md5.php             |    0
 .../session/adodb-encrypt-secret.php          |    0
 .../session/adodb-encrypt-sha1.php            |    0
 .../session/adodb-sess.txt                    |    0
 .../session/adodb-session-clob.php            |    0
 .../session/adodb-session-clob2.php           |    0
 .../session/adodb-session.php                 |    0
 .../session/adodb-session2.php                |    0
 .../session/adodb-sessions.mysql.sql          |    0
 .../session/adodb-sessions.oracle.clob.sql    |    0
 .../session/adodb-sessions.oracle.sql         |    0
 .../session/crypt.inc.php                     |    0
 .../session/old/adodb-cryptsession.php        |    0
 .../session/old/adodb-session-clob.php        |    0
 .../session/old/adodb-session.php             |    0
 .../session/old/crypt.inc.php                 |    0
 .../session/session_schema.xml                |    0
 .../session/session_schema2.xml               |    0
 .../toexport.inc.php                          |    0
 .../{adodb => adodb_vtigerfix}/tohtml.inc.php |    0
 .../{adodb => adodb_vtigerfix}/xmlschema.dtd  |    0
 .../xmlschema03.dtd                           |    0
 .../xsl/convert-0.1-0.2.xsl                   |    0
 .../xsl/convert-0.1-0.3.xsl                   |    0
 .../xsl/convert-0.2-0.1.xsl                   |    0
 .../xsl/convert-0.2-0.3.xsl                   |    0
 .../xsl/remove-0.2.xsl                        |    0
 .../xsl/remove-0.3.xsl                        |    0
 libraries/htmlpurifier410/CREDITS             |    9 -
 libraries/htmlpurifier410/INSTALL             |  373 -
 libraries/htmlpurifier410/LICENSE             |  504 --
 .../library/HTMLPurifier.auto.php             |   11 -
 .../library/HTMLPurifier.autoload-legacy.php  |   15 -
 .../library/HTMLPurifier.autoload.php         |   24 -
 .../library/HTMLPurifier.composer.php         |    4 -
 .../library/HTMLPurifier.func.php             |   25 -
 .../library/HTMLPurifier.includes.php         |  234 -
 .../library/HTMLPurifier.kses.php             |   30 -
 .../library/HTMLPurifier.path.php             |   11 -
 .../htmlpurifier410/library/HTMLPurifier.php  |  292 -
 .../library/HTMLPurifier.safe-includes.php    |  228 -
 .../library/HTMLPurifier/Arborize.php         |   71 -
 .../library/HTMLPurifier/AttrCollections.php  |  148 -
 .../library/HTMLPurifier/AttrDef.php          |  144 -
 .../library/HTMLPurifier/AttrDef/CSS.php      |  136 -
 .../HTMLPurifier/AttrDef/CSS/AlphaValue.php   |   34 -
 .../HTMLPurifier/AttrDef/CSS/Background.php   |  111 -
 .../AttrDef/CSS/BackgroundPosition.php        |  157 -
 .../HTMLPurifier/AttrDef/CSS/Border.php       |   56 -
 .../HTMLPurifier/AttrDef/CSS/Color.php        |  161 -
 .../HTMLPurifier/AttrDef/CSS/Composite.php    |   48 -
 .../AttrDef/CSS/DenyElementDecorator.php      |   44 -
 .../HTMLPurifier/AttrDef/CSS/Filter.php       |   77 -
 .../library/HTMLPurifier/AttrDef/CSS/Font.php |  176 -
 .../HTMLPurifier/AttrDef/CSS/FontFamily.php   |  219 -
 .../HTMLPurifier/AttrDef/CSS/Ident.php        |   32 -
 .../AttrDef/CSS/ImportantDecorator.php        |   56 -
 .../HTMLPurifier/AttrDef/CSS/Length.php       |   77 -
 .../HTMLPurifier/AttrDef/CSS/ListStyle.php    |  112 -
 .../HTMLPurifier/AttrDef/CSS/Multiple.php     |   71 -
 .../HTMLPurifier/AttrDef/CSS/Number.php       |   84 -
 .../HTMLPurifier/AttrDef/CSS/Percentage.php   |   54 -
 .../AttrDef/CSS/TextDecoration.php            |   46 -
 .../library/HTMLPurifier/AttrDef/CSS/URI.php  |   77 -
 .../library/HTMLPurifier/AttrDef/Clone.php    |   44 -
 .../library/HTMLPurifier/AttrDef/Enum.php     |   73 -
 .../HTMLPurifier/AttrDef/HTML/Bool.php        |   48 -
 .../HTMLPurifier/AttrDef/HTML/Class.php       |   48 -
 .../HTMLPurifier/AttrDef/HTML/Color.php       |   51 -
 .../HTMLPurifier/AttrDef/HTML/FrameTarget.php |   38 -
 .../library/HTMLPurifier/AttrDef/HTML/ID.php  |  113 -
 .../HTMLPurifier/AttrDef/HTML/Length.php      |   56 -
 .../HTMLPurifier/AttrDef/HTML/LinkTypes.php   |   72 -
 .../HTMLPurifier/AttrDef/HTML/MultiLength.php |   60 -
 .../HTMLPurifier/AttrDef/HTML/Nmtokens.php    |   70 -
 .../HTMLPurifier/AttrDef/HTML/Pixels.php      |   76 -
 .../library/HTMLPurifier/AttrDef/Integer.php  |   91 -
 .../library/HTMLPurifier/AttrDef/Lang.php     |   86 -
 .../library/HTMLPurifier/AttrDef/Switch.php   |   53 -
 .../library/HTMLPurifier/AttrDef/Text.php     |   21 -
 .../library/HTMLPurifier/AttrDef/URI.php      |  111 -
 .../HTMLPurifier/AttrDef/URI/Email.php        |   20 -
 .../AttrDef/URI/Email/SimpleCheck.php         |   29 -
 .../library/HTMLPurifier/AttrDef/URI/Host.php |  138 -
 .../library/HTMLPurifier/AttrDef/URI/IPv4.php |   45 -
 .../library/HTMLPurifier/AttrDef/URI/IPv6.php |   89 -
 .../library/HTMLPurifier/AttrTransform.php    |   60 -
 .../HTMLPurifier/AttrTransform/Background.php |   28 -
 .../HTMLPurifier/AttrTransform/BdoDir.php     |   27 -
 .../HTMLPurifier/AttrTransform/BgColor.php    |   28 -
 .../HTMLPurifier/AttrTransform/BoolToCSS.php  |   47 -
 .../HTMLPurifier/AttrTransform/Border.php     |   26 -
 .../HTMLPurifier/AttrTransform/EnumToCSS.php  |   68 -
 .../AttrTransform/ImgRequired.php             |   47 -
 .../HTMLPurifier/AttrTransform/ImgSpace.php   |   61 -
 .../HTMLPurifier/AttrTransform/Input.php      |   56 -
 .../HTMLPurifier/AttrTransform/Lang.php       |   31 -
 .../HTMLPurifier/AttrTransform/Length.php     |   45 -
 .../HTMLPurifier/AttrTransform/Name.php       |   33 -
 .../HTMLPurifier/AttrTransform/NameSync.php   |   41 -
 .../HTMLPurifier/AttrTransform/Nofollow.php   |   52 -
 .../HTMLPurifier/AttrTransform/SafeEmbed.php  |   25 -
 .../HTMLPurifier/AttrTransform/SafeObject.php |   28 -
 .../HTMLPurifier/AttrTransform/SafeParam.php  |   79 -
 .../AttrTransform/ScriptRequired.php          |   23 -
 .../AttrTransform/TargetBlank.php             |   45 -
 .../AttrTransform/TargetNoopener.php          |   37 -
 .../AttrTransform/TargetNoreferrer.php        |   37 -
 .../HTMLPurifier/AttrTransform/Textarea.php   |   27 -
 .../library/HTMLPurifier/AttrTypes.php        |   96 -
 .../library/HTMLPurifier/AttrValidator.php    |  178 -
 .../library/HTMLPurifier/Bootstrap.php        |  124 -
 .../library/HTMLPurifier/CSSDefinition.php    |  491 --
 .../library/HTMLPurifier/ChildDef.php         |   52 -
 .../HTMLPurifier/ChildDef/Chameleon.php       |   67 -
 .../library/HTMLPurifier/ChildDef/Custom.php  |  102 -
 .../library/HTMLPurifier/ChildDef/Empty.php   |   38 -
 .../library/HTMLPurifier/ChildDef/List.php    |   92 -
 .../HTMLPurifier/ChildDef/Optional.php        |   45 -
 .../HTMLPurifier/ChildDef/Required.php        |  118 -
 .../ChildDef/StrictBlockquote.php             |  110 -
 .../library/HTMLPurifier/ChildDef/Table.php   |  224 -
 .../library/HTMLPurifier/Config.php           |  920 ---
 .../library/HTMLPurifier/ConfigSchema.php     |  176 -
 .../ConfigSchema/Builder/ConfigSchema.php     |   48 -
 .../HTMLPurifier/ConfigSchema/Builder/Xml.php |  144 -
 .../HTMLPurifier/ConfigSchema/Exception.php   |   11 -
 .../HTMLPurifier/ConfigSchema/Interchange.php |   47 -
 .../ConfigSchema/Interchange/Directive.php    |   89 -
 .../ConfigSchema/Interchange/Id.php           |   58 -
 .../ConfigSchema/InterchangeBuilder.php       |  226 -
 .../HTMLPurifier/ConfigSchema/Validator.php   |  248 -
 .../ConfigSchema/ValidatorAtom.php            |  130 -
 .../HTMLPurifier/ConfigSchema/schema.ser      |  Bin 15923 -> 0 bytes
 .../schema/Attr.AllowedClasses.txt            |    8 -
 .../schema/Attr.AllowedFrameTargets.txt       |   12 -
 .../ConfigSchema/schema/Attr.AllowedRel.txt   |    9 -
 .../ConfigSchema/schema/Attr.AllowedRev.txt   |    9 -
 .../schema/Attr.ClassUseCDATA.txt             |   19 -
 .../schema/Attr.DefaultImageAlt.txt           |   11 -
 .../schema/Attr.DefaultInvalidImage.txt       |    9 -
 .../schema/Attr.DefaultInvalidImageAlt.txt    |    8 -
 .../schema/Attr.DefaultTextDir.txt            |   10 -
 .../ConfigSchema/schema/Attr.EnableID.txt     |   16 -
 .../schema/Attr.ForbiddenClasses.txt          |    8 -
 .../ConfigSchema/schema/Attr.ID.HTML5.txt     |   10 -
 .../ConfigSchema/schema/Attr.IDBlacklist.txt  |    5 -
 .../schema/Attr.IDBlacklistRegexp.txt         |    9 -
 .../ConfigSchema/schema/Attr.IDPrefix.txt     |   12 -
 .../schema/Attr.IDPrefixLocal.txt             |   14 -
 .../schema/AutoFormat.AutoParagraph.txt       |   31 -
 .../ConfigSchema/schema/AutoFormat.Custom.txt |   12 -
 .../schema/AutoFormat.DisplayLinkURI.txt      |   11 -
 .../schema/AutoFormat.Linkify.txt             |   12 -
 .../AutoFormat.PurifierLinkify.DocURL.txt     |   12 -
 .../schema/AutoFormat.PurifierLinkify.txt     |   12 -
 .../AutoFormat.RemoveEmpty.Predicate.txt      |   14 -
 ...rmat.RemoveEmpty.RemoveNbsp.Exceptions.txt |   11 -
 .../AutoFormat.RemoveEmpty.RemoveNbsp.txt     |   15 -
 .../schema/AutoFormat.RemoveEmpty.txt         |   46 -
 ...utoFormat.RemoveSpansWithoutAttributes.txt |   11 -
 .../schema/CSS.AllowDuplicates.txt            |   11 -
 .../schema/CSS.AllowImportant.txt             |    8 -
 .../ConfigSchema/schema/CSS.AllowTricky.txt   |   11 -
 .../ConfigSchema/schema/CSS.AllowedFonts.txt  |   12 -
 .../schema/CSS.AllowedProperties.txt          |   18 -
 .../ConfigSchema/schema/CSS.DefinitionRev.txt |   11 -
 .../schema/CSS.ForbiddenProperties.txt        |   13 -
 .../ConfigSchema/schema/CSS.MaxImgLength.txt  |   16 -
 .../ConfigSchema/schema/CSS.Proprietary.txt   |   10 -
 .../ConfigSchema/schema/CSS.Trusted.txt       |    9 -
 .../schema/Cache.DefinitionImpl.txt           |   14 -
 .../schema/Cache.SerializerPath.txt           |   13 -
 .../schema/Cache.SerializerPermissions.txt    |   16 -
 .../schema/Core.AggressivelyFixLt.txt         |   18 -
 .../schema/Core.AggressivelyRemoveScript.txt  |   16 -
 .../schema/Core.AllowHostnameUnderscore.txt   |   16 -
 .../schema/Core.CollectErrors.txt             |   12 -
 .../schema/Core.ColorKeywords.txt             |   29 -
 .../schema/Core.ConvertDocumentToFragment.txt |   14 -
 .../Core.DirectLexLineNumberSyncInterval.txt  |   17 -
 .../schema/Core.DisableExcludes.txt           |   14 -
 .../ConfigSchema/schema/Core.EnableIDNA.txt   |    9 -
 .../ConfigSchema/schema/Core.Encoding.txt     |   15 -
 .../schema/Core.EscapeInvalidChildren.txt     |   12 -
 .../schema/Core.EscapeInvalidTags.txt         |    7 -
 .../schema/Core.EscapeNonASCIICharacters.txt  |   13 -
 .../schema/Core.HiddenElements.txt            |   19 -
 .../ConfigSchema/schema/Core.Language.txt     |   10 -
 .../schema/Core.LegacyEntityDecoder.txt       |   36 -
 .../ConfigSchema/schema/Core.LexerImpl.txt    |   34 -
 .../schema/Core.MaintainLineNumbers.txt       |   16 -
 .../schema/Core.NormalizeNewlines.txt         |   11 -
 .../schema/Core.RemoveInvalidImg.txt          |   12 -
 .../Core.RemoveProcessingInstructions.txt     |   11 -
 .../schema/Core.RemoveScriptContents.txt      |   12 -
 .../ConfigSchema/schema/Filter.Custom.txt     |   11 -
 .../Filter.ExtractStyleBlocks.Escaping.txt    |   14 -
 .../Filter.ExtractStyleBlocks.Scope.txt       |   29 -
 .../Filter.ExtractStyleBlocks.TidyImpl.txt    |   16 -
 .../schema/Filter.ExtractStyleBlocks.txt      |   74 -
 .../ConfigSchema/schema/Filter.YouTube.txt    |   16 -
 .../ConfigSchema/schema/HTML.Allowed.txt      |   25 -
 .../schema/HTML.AllowedAttributes.txt         |   19 -
 .../schema/HTML.AllowedComments.txt           |   10 -
 .../schema/HTML.AllowedCommentsRegexp.txt     |   15 -
 .../schema/HTML.AllowedElements.txt           |   23 -
 .../schema/HTML.AllowedModules.txt            |   20 -
 .../schema/HTML.Attr.Name.UseCDATA.txt        |   11 -
 .../ConfigSchema/schema/HTML.BlockWrapper.txt |   18 -
 .../ConfigSchema/schema/HTML.CoreModules.txt  |   23 -
 .../schema/HTML.CustomDoctype.txt             |    9 -
 .../ConfigSchema/schema/HTML.DefinitionID.txt |   33 -
 .../schema/HTML.DefinitionRev.txt             |   16 -
 .../ConfigSchema/schema/HTML.Doctype.txt      |   11 -
 .../schema/HTML.FlashAllowFullScreen.txt      |   11 -
 .../schema/HTML.ForbiddenAttributes.txt       |   21 -
 .../schema/HTML.ForbiddenElements.txt         |   20 -
 .../ConfigSchema/schema/HTML.MaxImgLength.txt |   14 -
 .../ConfigSchema/schema/HTML.Nofollow.txt     |    7 -
 .../ConfigSchema/schema/HTML.Parent.txt       |   12 -
 .../ConfigSchema/schema/HTML.Proprietary.txt  |   12 -
 .../ConfigSchema/schema/HTML.SafeEmbed.txt    |   13 -
 .../ConfigSchema/schema/HTML.SafeIframe.txt   |   13 -
 .../ConfigSchema/schema/HTML.SafeObject.txt   |   13 -
 .../schema/HTML.SafeScripting.txt             |   10 -
 .../ConfigSchema/schema/HTML.Strict.txt       |    9 -
 .../ConfigSchema/schema/HTML.TargetBlank.txt  |    8 -
 .../schema/HTML.TargetNoopener.txt            |   10 -
 .../schema/HTML.TargetNoreferrer.txt          |    9 -
 .../ConfigSchema/schema/HTML.TidyAdd.txt      |    8 -
 .../ConfigSchema/schema/HTML.TidyLevel.txt    |   24 -
 .../ConfigSchema/schema/HTML.TidyRemove.txt   |    8 -
 .../ConfigSchema/schema/HTML.Trusted.txt      |    9 -
 .../ConfigSchema/schema/HTML.XHTML.txt        |   11 -
 .../schema/Output.CommentScriptContents.txt   |   10 -
 .../schema/Output.FixInnerHTML.txt            |   15 -
 .../schema/Output.FlashCompat.txt             |   11 -
 .../ConfigSchema/schema/Output.Newline.txt    |   13 -
 .../ConfigSchema/schema/Output.SortAttr.txt   |   14 -
 .../ConfigSchema/schema/Output.TidyFormat.txt |   25 -
 .../ConfigSchema/schema/Test.ForceNoIconv.txt |    7 -
 .../schema/URI.AllowedSchemes.txt             |   18 -
 .../ConfigSchema/schema/URI.Base.txt          |   17 -
 .../ConfigSchema/schema/URI.DefaultScheme.txt |   15 -
 .../ConfigSchema/schema/URI.DefinitionID.txt  |   11 -
 .../ConfigSchema/schema/URI.DefinitionRev.txt |   11 -
 .../ConfigSchema/schema/URI.Disable.txt       |   14 -
 .../schema/URI.DisableExternal.txt            |   11 -
 .../schema/URI.DisableExternalResources.txt   |   13 -
 .../schema/URI.DisableResources.txt           |   15 -
 .../ConfigSchema/schema/URI.Host.txt          |   19 -
 .../ConfigSchema/schema/URI.HostBlacklist.txt |    9 -
 .../ConfigSchema/schema/URI.MakeAbsolute.txt  |   13 -
 .../ConfigSchema/schema/URI.Munge.txt         |   83 -
 .../schema/URI.MungeResources.txt             |   17 -
 .../schema/URI.MungeSecretKey.txt             |   30 -
 .../schema/URI.OverrideAllowedSchemes.txt     |    9 -
 .../schema/URI.SafeIframeRegexp.txt           |   22 -
 .../HTMLPurifier/ConfigSchema/schema/info.ini |    3 -
 .../library/HTMLPurifier/ContentSets.php      |  170 -
 .../library/HTMLPurifier/Context.php          |   95 -
 .../library/HTMLPurifier/Definition.php       |   55 -
 .../library/HTMLPurifier/DefinitionCache.php  |  129 -
 .../DefinitionCache/Decorator.php             |  112 -
 .../DefinitionCache/Decorator/Cleanup.php     |   78 -
 .../DefinitionCache/Decorator/Memory.php      |   85 -
 .../DefinitionCache/Decorator/Template.php.in |   82 -
 .../HTMLPurifier/DefinitionCache/Null.php     |   76 -
 .../DefinitionCache/Serializer.php            |  311 -
 .../DefinitionCache/Serializer/README         |    3 -
 .../HTMLPurifier/DefinitionCacheFactory.php   |  106 -
 .../library/HTMLPurifier/Doctype.php          |   73 -
 .../library/HTMLPurifier/DoctypeRegistry.php  |  142 -
 .../library/HTMLPurifier/ElementDef.php       |  216 -
 .../library/HTMLPurifier/Encoder.php          |  617 --
 .../library/HTMLPurifier/EntityLookup.php     |   48 -
 .../HTMLPurifier/EntityLookup/entities.ser    |    1 -
 .../library/HTMLPurifier/EntityParser.php     |  285 -
 .../library/HTMLPurifier/ErrorCollector.php   |  244 -
 .../library/HTMLPurifier/ErrorStruct.php      |   74 -
 .../library/HTMLPurifier/Exception.php        |   12 -
 .../library/HTMLPurifier/Filter.php           |   56 -
 .../Filter/ExtractStyleBlocks.php             |  341 -
 .../library/HTMLPurifier/Filter/YouTube.php   |   65 -
 .../library/HTMLPurifier/Generator.php        |  286 -
 .../library/HTMLPurifier/HTMLDefinition.php   |  493 --
 .../library/HTMLPurifier/HTMLModule.php       |  284 -
 .../library/HTMLPurifier/HTMLModule/Bdo.php   |   44 -
 .../HTMLModule/CommonAttributes.php           |   31 -
 .../library/HTMLPurifier/HTMLModule/Edit.php  |   55 -
 .../library/HTMLPurifier/HTMLModule/Forms.php |  190 -
 .../HTMLPurifier/HTMLModule/Hypertext.php     |   40 -
 .../HTMLPurifier/HTMLModule/Iframe.php        |   51 -
 .../library/HTMLPurifier/HTMLModule/Image.php |   49 -
 .../HTMLPurifier/HTMLModule/Legacy.php        |  186 -
 .../library/HTMLPurifier/HTMLModule/List.php  |   51 -
 .../library/HTMLPurifier/HTMLModule/Name.php  |   26 -
 .../HTMLPurifier/HTMLModule/Nofollow.php      |   25 -
 .../HTMLModule/NonXMLCommonAttributes.php     |   20 -
 .../HTMLPurifier/HTMLModule/Object.php        |   62 -
 .../HTMLPurifier/HTMLModule/Presentation.php  |   42 -
 .../HTMLPurifier/HTMLModule/Proprietary.php   |   40 -
 .../library/HTMLPurifier/HTMLModule/Ruby.php  |   36 -
 .../HTMLPurifier/HTMLModule/SafeEmbed.php     |   40 -
 .../HTMLPurifier/HTMLModule/SafeObject.php    |   62 -
 .../HTMLPurifier/HTMLModule/SafeScripting.php |   40 -
 .../HTMLPurifier/HTMLModule/Scripting.php     |   73 -
 .../HTMLModule/StyleAttribute.php             |   33 -
 .../HTMLPurifier/HTMLModule/Tables.php        |   75 -
 .../HTMLPurifier/HTMLModule/Target.php        |   28 -
 .../HTMLPurifier/HTMLModule/TargetBlank.php   |   24 -
 .../HTMLModule/TargetNoopener.php             |   21 -
 .../HTMLModule/TargetNoreferrer.php           |   21 -
 .../library/HTMLPurifier/HTMLModule/Text.php  |   87 -
 .../library/HTMLPurifier/HTMLModule/Tidy.php  |  230 -
 .../HTMLPurifier/HTMLModule/Tidy/Name.php     |   33 -
 .../HTMLModule/Tidy/Proprietary.php           |   34 -
 .../HTMLPurifier/HTMLModule/Tidy/Strict.php   |   43 -
 .../HTMLModule/Tidy/Transitional.php          |   16 -
 .../HTMLPurifier/HTMLModule/Tidy/XHTML.php    |   26 -
 .../HTMLModule/Tidy/XHTMLAndHTML4.php         |  179 -
 .../HTMLModule/XMLCommonAttributes.php        |   20 -
 .../HTMLPurifier/HTMLModuleManager.php        |  467 --
 .../library/HTMLPurifier/IDAccumulator.php    |   57 -
 .../library/HTMLPurifier/Injector.php         |  283 -
 .../HTMLPurifier/Injector/AutoParagraph.php   |  356 -
 .../HTMLPurifier/Injector/DisplayLinkURI.php  |   40 -
 .../library/HTMLPurifier/Injector/Linkify.php |   64 -
 .../HTMLPurifier/Injector/PurifierLinkify.php |   71 -
 .../HTMLPurifier/Injector/RemoveEmpty.php     |  112 -
 .../Injector/RemoveSpansWithoutAttributes.php |   84 -
 .../HTMLPurifier/Injector/SafeObject.php      |  124 -
 .../library/HTMLPurifier/Language.php         |  204 -
 .../Language/classes/en-x-test.php            |    9 -
 .../Language/messages/en-x-test.php           |   11 -
 .../Language/messages/en-x-testmini.php       |   12 -
 .../HTMLPurifier/Language/messages/en.php     |   55 -
 .../library/HTMLPurifier/LanguageFactory.php  |  209 -
 .../library/HTMLPurifier/Length.php           |  162 -
 .../library/HTMLPurifier/Lexer.php            |  382 -
 .../library/HTMLPurifier/Lexer/DOMLex.php     |  328 -
 .../library/HTMLPurifier/Lexer/DirectLex.php  |  539 --
 .../library/HTMLPurifier/Lexer/PH5P.php       | 4788 -----------
 .../library/HTMLPurifier/Node.php             |   49 -
 .../library/HTMLPurifier/Node/Comment.php     |   36 -
 .../library/HTMLPurifier/Node/Element.php     |   59 -
 .../library/HTMLPurifier/Node/Text.php        |   54 -
 .../library/HTMLPurifier/PercentEncoder.php   |  111 -
 .../library/HTMLPurifier/Printer.php          |  218 -
 .../HTMLPurifier/Printer/CSSDefinition.php    |   44 -
 .../HTMLPurifier/Printer/ConfigForm.css       |   10 -
 .../HTMLPurifier/Printer/ConfigForm.js        |    5 -
 .../HTMLPurifier/Printer/ConfigForm.php       |  451 -
 .../HTMLPurifier/Printer/HTMLDefinition.php   |  324 -
 .../library/HTMLPurifier/PropertyList.php     |  122 -
 .../HTMLPurifier/PropertyListIterator.php     |   42 -
 .../library/HTMLPurifier/Queue.php            |   56 -
 .../library/HTMLPurifier/Strategy.php         |   26 -
 .../HTMLPurifier/Strategy/Composite.php       |   30 -
 .../library/HTMLPurifier/Strategy/Core.php    |   17 -
 .../HTMLPurifier/Strategy/FixNesting.php      |  181 -
 .../HTMLPurifier/Strategy/MakeWellFormed.php  |  659 --
 .../Strategy/RemoveForeignElements.php        |  207 -
 .../Strategy/ValidateAttributes.php           |   45 -
 .../library/HTMLPurifier/StringHash.php       |   47 -
 .../library/HTMLPurifier/StringHashParser.php |  136 -
 .../library/HTMLPurifier/TagTransform.php     |   37 -
 .../HTMLPurifier/TagTransform/Font.php        |  114 -
 .../HTMLPurifier/TagTransform/Simple.php      |   44 -
 .../library/HTMLPurifier/Token.php            |  100 -
 .../library/HTMLPurifier/Token/Comment.php    |   38 -
 .../library/HTMLPurifier/Token/Empty.php      |   15 -
 .../library/HTMLPurifier/Token/End.php        |   24 -
 .../library/HTMLPurifier/Token/Start.php      |   10 -
 .../library/HTMLPurifier/Token/Tag.php        |   68 -
 .../library/HTMLPurifier/Token/Text.php       |   53 -
 .../library/HTMLPurifier/TokenFactory.php     |  118 -
 .../library/HTMLPurifier/URI.php              |  316 -
 .../library/HTMLPurifier/URIDefinition.php    |  112 -
 .../library/HTMLPurifier/URIFilter.php        |   74 -
 .../URIFilter/DisableExternal.php             |   54 -
 .../URIFilter/DisableExternalResources.php    |   25 -
 .../URIFilter/DisableResources.php            |   22 -
 .../HTMLPurifier/URIFilter/HostBlacklist.php  |   46 -
 .../HTMLPurifier/URIFilter/MakeAbsolute.php   |  158 -
 .../library/HTMLPurifier/URIFilter/Munge.php  |  115 -
 .../HTMLPurifier/URIFilter/SafeIframe.php     |   68 -
 .../library/HTMLPurifier/URIParser.php        |   71 -
 .../library/HTMLPurifier/URIScheme.php        |  102 -
 .../library/HTMLPurifier/URIScheme/data.php   |  136 -
 .../library/HTMLPurifier/URIScheme/file.php   |   44 -
 .../library/HTMLPurifier/URIScheme/ftp.php    |   58 -
 .../library/HTMLPurifier/URIScheme/http.php   |   36 -
 .../library/HTMLPurifier/URIScheme/https.php  |   18 -
 .../library/HTMLPurifier/URIScheme/mailto.php |   40 -
 .../library/HTMLPurifier/URIScheme/news.php   |   35 -
 .../library/HTMLPurifier/URIScheme/nntp.php   |   32 -
 .../library/HTMLPurifier/URIScheme/tel.php    |   46 -
 .../HTMLPurifier/URISchemeRegistry.php        |   81 -
 .../library/HTMLPurifier/UnitConverter.php    |  307 -
 .../library/HTMLPurifier/VarParser.php        |  198 -
 .../HTMLPurifier/VarParser/Flexible.php       |  130 -
 .../library/HTMLPurifier/VarParser/Native.php |   38 -
 .../HTMLPurifier/VarParserException.php       |   11 -
 .../library/HTMLPurifier/Zipper.php           |  157 -
 libraries/magpierss/extlib/Snoopy.class.inc   |  915 ---
 libraries/magpierss/rss_cache.inc             |  200 -
 libraries/magpierss/rss_fetch.inc             |  458 --
 libraries/magpierss/rss_parse.inc             |  605 --
 libraries/magpierss/rss_utils.inc             |   67 -
 libraries/mobileDetect/Mobile_Detect.php      | 1428 ----
 libraries/nusoap/changelog                    |  438 -
 libraries/nusoap/class.nusoap_base.php        |  905 --
 libraries/nusoap/class.soap_fault.php         |   86 -
 libraries/nusoap/class.soap_parser.php        |  599 --
 libraries/nusoap/class.soap_server.php        | 1038 ---
 .../nusoap/class.soap_transport_http.php      | 1038 ---
 libraries/nusoap/class.soap_val.php           |  107 -
 libraries/nusoap/class.soapclient.php         |  859 --
 libraries/nusoap/class.wsdl.php               | 1727 ----
 libraries/nusoap/class.wsdlcache.php          |  184 -
 libraries/nusoap/class.xmlschema.php          |  906 --
 libraries/nusoap/nusoap.php                   | 7264 -----------------
 libraries/nusoap/nusoapmime.php               |  478 --
 799 files changed, 54 insertions(+), 93319 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 composer.json
 create mode 100755 install-composer-deps.sh
 create mode 100644 libraries/.htaccess
 delete mode 100644 libraries/Smarty/CHANGELOG.md
 delete mode 100644 libraries/Smarty/COMPOSER_RELEASE_NOTES.txt
 delete mode 100644 libraries/Smarty/INHERITANCE_RELEASE_NOTES.txt
 delete mode 100644 libraries/Smarty/LICENSE
 delete mode 100644 libraries/Smarty/NEW_FEATURES.txt
 delete mode 100644 libraries/Smarty/README
 delete mode 100644 libraries/Smarty/README.md
 delete mode 100644 libraries/Smarty/SMARTY_2_BC_NOTES.txt
 delete mode 100644 libraries/Smarty/SMARTY_3.0_BC_NOTES.txt
 delete mode 100644 libraries/Smarty/SMARTY_3.1_NOTES.txt
 delete mode 100644 libraries/Smarty/composer.json
 delete mode 100644 libraries/Smarty/expectException
 delete mode 100644 libraries/Smarty/lexer/smarty_internal_configfilelexer.plex
 delete mode 100644 libraries/Smarty/lexer/smarty_internal_configfileparser.y
 delete mode 100644 libraries/Smarty/lexer/smarty_internal_templatelexer.plex
 delete mode 100644 libraries/Smarty/lexer/smarty_internal_templateparser.y
 delete mode 100644 libraries/Smarty/libs/Autoloader.php
 delete mode 100644 libraries/Smarty/libs/Smarty.class.php
 delete mode 100644 libraries/Smarty/libs/SmartyBC.class.php
 delete mode 100644 libraries/Smarty/libs/bootstrap.php
 delete mode 100644 libraries/Smarty/libs/debug.tpl
 delete mode 100644 libraries/Smarty/libs/plugins/block.textformat.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.counter.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.cycle.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.fetch.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_checkboxes.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_image.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_options.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_radios.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_select_date.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_select_time.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.html_table.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.mailto.php
 delete mode 100644 libraries/Smarty/libs/plugins/function.math.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.capitalize.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.date_format.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.debug_print_var.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.escape.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.mb_wordwrap.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.regex_replace.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.replace.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.spacify.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifier.truncate.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.cat.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.count_characters.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.count_paragraphs.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.count_sentences.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.count_words.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.default.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.escape.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.from_charset.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.indent.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.lower.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.noprint.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.string_format.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.strip.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.strip_tags.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.to_charset.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.unescape.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.upper.php
 delete mode 100644 libraries/Smarty/libs/plugins/modifiercompiler.wordwrap.php
 delete mode 100644 libraries/Smarty/libs/plugins/outputfilter.trimwhitespace.php
 delete mode 100644 libraries/Smarty/libs/plugins/shared.escape_special_chars.php
 delete mode 100644 libraries/Smarty/libs/plugins/shared.literal_compiler_param.php
 delete mode 100644 libraries/Smarty/libs/plugins/shared.make_timestamp.php
 delete mode 100644 libraries/Smarty/libs/plugins/shared.mb_str_replace.php
 delete mode 100644 libraries/Smarty/libs/plugins/shared.mb_unicode.php
 delete mode 100644 libraries/Smarty/libs/plugins/variablefilter.htmlspecialchars.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_cacheresource.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_cacheresource_custom.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_data.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_block.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_cacheresource_file.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_append.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_assign.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_block.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_child.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_parent.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_break.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_call.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_capture.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_child.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_config_load.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_continue.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_debug.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_eval.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_extends.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_for.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_foreach.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_function.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_if.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_include.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_ldelim.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_nocache.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_parent.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_php.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_rdelim.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_section.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_setfilter.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compile_while.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_compilebase.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_config_file_compiler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_configfilelexer.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_configfileparser.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_data.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_debug.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_errorhandler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_extension_handler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_append.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_configload.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_createdata.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getglobal.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_gettags.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_literals.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_nocache_insert.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_code.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dq.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_tag.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_template.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_text.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_eval.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_extends.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_file.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_php.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_registered.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_stream.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_resource_string.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_capture.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_template.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_templatebase.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_templatelexer.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_templateparser.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_testinstall.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_internal_undefined.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_resource.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_resource_custom.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_resource_recompiled.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_resource_uncompiled.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_security.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_template_cached.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_template_compiled.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_template_config.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_template_resource_base.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_template_source.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_undefined_variable.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smarty_variable.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smartycompilerexception.php
 delete mode 100644 libraries/Smarty/libs/sysplugins/smartyexception.php
 rename libraries/{adodb => adodb_vtigerfix}/LICENSE.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/README.md (100%)
 create mode 100644 libraries/adodb_vtigerfix/VTIGERFIX.md
 rename libraries/{adodb => adodb_vtigerfix}/adodb-active-record.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-active-recordx.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-csvlib.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-datadict.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-error.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-errorhandler.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-errorpear.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-exceptions.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-lib.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-loadbalancer.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-memcache.lib.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-pager.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-pear.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-perf.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-time.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-xmlschema.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb-xmlschema03.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/adodb.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/composer.json (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-access.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-db2.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-firebird.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-generic.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-ibase.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-informix.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-mssql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-mssqlnative.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-mysql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-oci8.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-postgres.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-sapdb.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-sqlite.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/datadict/datadict-sybase.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/README.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/adodb.gif (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/adodb2.gif (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/changelog.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/changelog_v2.x.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/changelog_v3.x.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/changelog_v4+5.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/docs/changelog_v4.x.md (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-access.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ado.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ado5.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ado_access.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ado_mssql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ads.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-borland_ibase.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-csv.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-db2.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-db2oci.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-db2ora.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-fbsql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-firebird.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ibase.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-informix.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-informix72.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-ldap.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mssql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mssql_n.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mssqlnative.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mssqlpo.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mysql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mysqli.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mysqlpo.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-mysqlt.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-netezza.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-oci8.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-oci805.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-oci8po.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-oci8quercus.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbc.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbc_db2.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbc_mssql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbc_mssql2012.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbc_oracle.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbtp.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-odbtp_unicode.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-oracle.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_dblib.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_firebird.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_mssql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_mysql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_oci.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_pgsql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_sqlite.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-pdo_sqlsrv.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-postgres.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-postgres64.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-postgres7.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-postgres8.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-postgres9.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-proxy.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sapdb.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sqlanywhere.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sqlite.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sqlite3.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sqlitepo.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sybase.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-sybase_ase.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-text.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/drivers/adodb-vfp.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-ar.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-bg.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-ca.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-cn.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-cz.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-da.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-de.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-en.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-eo.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-es.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-fa.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-fr.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-hu.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-id.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-it.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-nl.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-oc.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-pl.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-pt-br.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-ro.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-ru.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-sv.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-th.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/lang/adodb-uk.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/pear/Auth/Container/ADOdb.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/pear/auth_adodb_example.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/pear/readme.Auth.txt (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-db2.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-informix.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-mssql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-mssqlnative.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-mysql.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-oci8.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/perf/perf-postgres.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/phpdoc (100%)
 rename libraries/{adodb => adodb_vtigerfix}/pivottable.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/rsfilter.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/server.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-compress-bzip2.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-compress-gzip.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-cryptsession.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-cryptsession2.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-encrypt-mcrypt.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-encrypt-md5.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-encrypt-secret.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-encrypt-sha1.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-sess.txt (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-session-clob.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-session-clob2.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-session.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-session2.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-sessions.mysql.sql (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-sessions.oracle.clob.sql (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/adodb-sessions.oracle.sql (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/crypt.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/old/adodb-cryptsession.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/old/adodb-session-clob.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/old/adodb-session.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/old/crypt.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/session_schema.xml (100%)
 rename libraries/{adodb => adodb_vtigerfix}/session/session_schema2.xml (100%)
 rename libraries/{adodb => adodb_vtigerfix}/toexport.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/tohtml.inc.php (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xmlschema.dtd (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xmlschema03.dtd (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xsl/convert-0.1-0.2.xsl (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xsl/convert-0.1-0.3.xsl (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xsl/convert-0.2-0.1.xsl (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xsl/convert-0.2-0.3.xsl (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xsl/remove-0.2.xsl (100%)
 rename libraries/{adodb => adodb_vtigerfix}/xsl/remove-0.3.xsl (100%)
 delete mode 100644 libraries/htmlpurifier410/CREDITS
 delete mode 100644 libraries/htmlpurifier410/INSTALL
 delete mode 100644 libraries/htmlpurifier410/LICENSE
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.auto.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.autoload-legacy.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.autoload.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.composer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.func.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.includes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.kses.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.path.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier.safe-includes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Arborize.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrCollections.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Background.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Border.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Color.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Composite.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Filter.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Font.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Ident.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Length.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ListStyle.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Multiple.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Number.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Percentage.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/URI.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Clone.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Enum.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Bool.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Class.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Color.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/ID.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Length.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/MultiLength.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Pixels.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Integer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Lang.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Switch.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Text.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Host.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv4.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv6.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Background.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BdoDir.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BgColor.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BoolToCSS.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Border.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/EnumToCSS.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgRequired.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgSpace.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Input.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Lang.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Length.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Name.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/NameSync.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Nofollow.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeEmbed.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeObject.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeParam.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ScriptRequired.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetBlank.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoopener.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Textarea.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrTypes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/AttrValidator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Bootstrap.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/CSSDefinition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Chameleon.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Custom.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Empty.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/List.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Optional.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Required.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/StrictBlockquote.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Table.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Config.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/Xml.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Exception.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Directive.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Id.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Validator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/ValidatorAtom.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema.ser
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ID.HTML5.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowDuplicates.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedFonts.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Trusted.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPermissions.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AllowHostnameUnderscore.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DisableExcludes.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EnableIDNA.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Language.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedComments.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedCommentsRegexp.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Nofollow.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeIframe.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeScripting.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetBlank.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoreferrer.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FixInnerHTML.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Base.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Host.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeRegexp.txt
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/info.ini
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ContentSets.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Context.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Definition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Memory.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Template.php.in
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Null.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer/README
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCacheFactory.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Doctype.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/DoctypeRegistry.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ElementDef.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Encoder.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup/entities.ser
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/EntityParser.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ErrorCollector.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/ErrorStruct.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Exception.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Filter.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Filter/ExtractStyleBlocks.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Filter/YouTube.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Generator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLDefinition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Bdo.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/CommonAttributes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Edit.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Forms.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Hypertext.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Iframe.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Image.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Legacy.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/List.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Name.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Nofollow.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Object.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Presentation.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Proprietary.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Ruby.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeEmbed.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeObject.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeScripting.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Scripting.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/StyleAttribute.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tables.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Target.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetBlank.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoopener.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoreferrer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Text.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Name.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Strict.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTML.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/HTMLModuleManager.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/IDAccumulator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/AutoParagraph.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/DisplayLinkURI.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/Linkify.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/PurifierLinkify.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveEmpty.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Injector/SafeObject.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Language.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Language/classes/en-x-test.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-test.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-testmini.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/LanguageFactory.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Length.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Lexer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DOMLex.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DirectLex.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Lexer/PH5P.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Node.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Node/Comment.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Node/Element.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Node/Text.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/PercentEncoder.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Printer.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Printer/CSSDefinition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.css
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.js
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Printer/HTMLDefinition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/PropertyList.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/PropertyListIterator.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Queue.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Composite.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Core.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy/FixNesting.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy/MakeWellFormed.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy/RemoveForeignElements.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Strategy/ValidateAttributes.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/StringHash.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/StringHashParser.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/TagTransform.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Font.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Simple.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token/Comment.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token/Empty.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token/End.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token/Start.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token/Tag.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Token/Text.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/TokenFactory.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URI.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIDefinition.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternal.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternalResources.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableResources.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/HostBlacklist.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/MakeAbsolute.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/Munge.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/SafeIframe.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIParser.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/data.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/file.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/ftp.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/http.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/https.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/mailto.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/news.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/nntp.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/tel.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/URISchemeRegistry.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/UnitConverter.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/VarParser.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Flexible.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Native.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/VarParserException.php
 delete mode 100644 libraries/htmlpurifier410/library/HTMLPurifier/Zipper.php
 delete mode 100755 libraries/magpierss/extlib/Snoopy.class.inc
 delete mode 100755 libraries/magpierss/rss_cache.inc
 delete mode 100755 libraries/magpierss/rss_fetch.inc
 delete mode 100755 libraries/magpierss/rss_parse.inc
 delete mode 100755 libraries/magpierss/rss_utils.inc
 delete mode 100644 libraries/mobileDetect/Mobile_Detect.php
 delete mode 100644 libraries/nusoap/changelog
 delete mode 100644 libraries/nusoap/class.nusoap_base.php
 delete mode 100644 libraries/nusoap/class.soap_fault.php
 delete mode 100644 libraries/nusoap/class.soap_parser.php
 delete mode 100644 libraries/nusoap/class.soap_server.php
 delete mode 100644 libraries/nusoap/class.soap_transport_http.php
 delete mode 100644 libraries/nusoap/class.soap_val.php
 delete mode 100644 libraries/nusoap/class.soapclient.php
 delete mode 100644 libraries/nusoap/class.wsdl.php
 delete mode 100644 libraries/nusoap/class.wsdlcache.php
 delete mode 100644 libraries/nusoap/class.xmlschema.php
 delete mode 100644 libraries/nusoap/nusoap.php
 delete mode 100644 libraries/nusoap/nusoapmime.php

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..3a9875b46
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/vendor/
+composer.lock
diff --git a/composer.json b/composer.json
new file mode 100644
index 000000000..ca9345b64
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,21 @@
+{
+    "name": "vtiger/vtigercrm",
+    "description": "Vtiger CRM",
+    "type": "project",
+    "license": "VPL",
+    "authors": [
+        {
+            "name": "Vtiger",
+            "email": "info@vtiger.com"
+        }
+    ],
+    "autoload": {
+        "files": ["includes/Loader.php"]
+    },
+    "minimum-stability": "stable",
+    "require": {
+        "smarty/smarty": "^4.3",
+        "dg/rss-php": "^1.5",
+        "ezyang/htmlpurifier": "^4.16"
+    }
+}
diff --git a/install-composer-deps.sh b/install-composer-deps.sh
new file mode 100755
index 000000000..63638bae2
--- /dev/null
+++ b/install-composer-deps.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+composer update
+
+# remove files not required in production
+readarray -t FILES << EOS
+
+smarty/smarty/demo
+smarty/smarty/docs
+smarty/smarty/*.sh
+dg/rss-php/.github
+EOS
+
+# set -x
+for FILE in ${FILES[*]}; do
+    if [[ $FILE ]]
+    then
+        rm -rf ./vendor/${FILE}
+    fi
+done
+
+echo "OK"
\ No newline at end of file
diff --git a/libraries/.htaccess b/libraries/.htaccess
new file mode 100644
index 000000000..a2c9c2087
--- /dev/null
+++ b/libraries/.htaccess
@@ -0,0 +1,4 @@
+<Files ~ "^.*.(md|php|pem|p12)">  
+  Order Allow,Deny
+  Deny from all
+</Files>
\ No newline at end of file
diff --git a/libraries/Smarty/CHANGELOG.md b/libraries/Smarty/CHANGELOG.md
deleted file mode 100644
index e3bb93a4f..000000000
--- a/libraries/Smarty/CHANGELOG.md
+++ /dev/null
@@ -1,3466 +0,0 @@
-# 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.39] - 2021-02-17
-
-### Security
-- Prevent access to `$smarty.template_object` in sandbox mode
-- Fixed code injection vulnerability by using illegal function names in `{function name='blah'}{/function}` 
-
-## [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 <?xml ?> 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 <?something https://github.com/smarty-php/smarty/issues/74
-
- 20.07.2015
-  - bugfix config files got recompiled on each request
-  - improvement invalidate PHP 5.5 opcache for recompiled and cached templates  https://github.com/smarty-php/smarty/issues/72
-
- 12.07.2015
-  - optimize {extends} compilation
-
- 10.07.2015
-  - bugfix force file: resource in demo resource.extendsall.php
-
- 08.07.2015
-  - bugfix convert each word of class names to ucfirst in in compiler. (forum topic 25588)
-
- 07.07.2015
-  - improvement allow fetch() or display() called on a template object to get output from other template
-     like $template->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 <?xml ... ?> 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 <?php tags https://github.com/smarty-php/smarty/issues/40
-  - bugfix named {foreach} comparison like $smarty.foreach.foobar.index > 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 ?><?php transitions from compiled code
-  - improvement reduce number of lexer tokens on operators and if conditions
-  - improvement higher compilation speed by modified lexer/parser generator at "smarty/smarty-lexer"
-
- 13.05.2015
-  - improvement remove not needed ?><?php transitions from compiled code
-  - improvement of debugging:
-      - use fresh Smarty object to display the debug console because of possible problems when the Smarty
-        was extended or Smarty properties had been modified in the class source
-      - display Smarty version number
-      - Truncate lenght of Origin display and extend strin value display to 80 character
-  - bugfix in Smarty_Security  'nl2br' should be a trusted modifier, not PHP function (code.google issue 223)
-
- 12.05.2015
-  - bugfix {$smarty.constant.TEST} did fail  on undefined constant https://github.com/smarty-php/smarty/issues/28
-  - bugfix access to undefined config variable like {#undef#} did fail https://github.com/smarty-php/smarty/issues/29
-  - bugfix in nested {foreach} saved item attributes got overwritten https://github.com/smarty-php/smarty/issues/33
-
- - 3.1.23 - (12.05.2015)
- 12.05.2015
-  - bugfix of smaller performance issue introduce in 3.1.22 when caching is enabled
-  - bugfix missig entry for smarty-temmplate-config in autoloader
-
- - 3.1.22 - tag was deleted because 3.1.22 did fail caused by the missing entry for smarty-temmplate-config in autoloader
- 10.05.2015
-  - bugfix custom cache resource did not observe compile_id and cache_id when $cache_locking == true
-  - bugfix cache lock was not handled correctly after timeout when $cache_locking == true
-  - improvement added constants for $debugging
-
- 07.05.2015
-  - improvement of the debugging console. Read NEW_FEATURES.txt
-  - optimization of resource class loading
-
- 06.05.2015
-  - bugfix in 3.1.22-dev cache resource must not be loaded for subtemplates
-  - bugfix/improvement in 3.1.22-dev cache locking did not work as expected
-
- 05.05.2015
-  - optimization on cache update when main template is modified
-  - optimization move <?php ?> 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 "<script language=php>" will throw a security exception to close all thinkable holes
- - bugfix classmap in root composer.json should start at "libs/..."
- - improvement cache is_file(file_exists) results of loadPlugin() to avoid unnecessary calls during compilation (Issue 201}
-
- 12.10.2014
- - bugfix a comment like "<script{*foo*} language=php>" bypassed $php_handling checking (Thue Kristensen)
- - bugfix change of 08.10.2014 could create E_NOTICE meassage when using "<?php" tags
- - bugfix "<script language=php>" with $php_handling PHP_PASSTHRU was executed in {nocache} sections
-
- - 3.1.20 - (09.10.2014)
- 08.10.2014
- - bugfix security mode of "<script language=php>" must be controlled by $php_handling property (Thue Kristensen)
-
- 01.10.2014
- - bugfix template resource of inheritance blocks could get invalid if the default resource type is not 'file'(Issue 202)
- - bugfix existing child {block} tag must override parent {block} tag append / prepend setting (topic 25259)
-
- 02.08.2014
- - bugfix modifier wordwrap did output break string wrong if first word was exceeding length with cut = true (topic 25193)
-
- 24.07.2014
- - bugfix cache clear when cache folder does not exist
-
- 16.07.2014
- - enhancement remove BOM automatically from template source (topic 25161)
-
- 04.07.2014
- - bugfix the bufix of 02.06.2014 broke correct handling of child templates with same name but different template folders in extends resource (issue 194 and topic 25099)
-
- - 3.1.19 - (30.06.2014)
- 20.06.2014
- - bugfix template variables could not be passed as parameter in {include} when the include was in a {nocache} section (topic 25131)
-
- 17.06.2014
- - bugfix large template text of some charsets could cause parsing errors (topic 24630)
-
- 08.06.2014
- - bugfix registered objects did not work after spelling fixes of 06.06.2014
- - bugfix {block} tags within {literal} .. {/literal} got not displayed correctly (topic 25024)
- - bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192)
- - bugfix {html_image} security check did fail on files relative to basedir (Issue 191)
-
- 06.06.2014
- - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result
- - fixed spelling, PHPDoc , minor errors, code cleanup
-
- 02.06.2014
- - using multiple cwd with relative template dirs could result in identical compiled file names. (issue 194 and topic 25099)
-
- 19.04.2014
- - bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189)
- - bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified
-
- 18.04.2014
- - revert bugfix of 5.4.2014 because %-e date format is not supported on all operating systems
-
- - 3.1.18 - (07.04.2014)
- 06.04.2014
- - bugfix template inheritance fail when using custom resource after patch of 8.3.2014 (Issue 187)
- - bugfix update of composer file (Issue 168 and 184)
-
- 05.04.2014
- - bugfix default date format leads to extra spaces when displaying dates with single digit days (Issue 165)
-
- 26.03.2014
- - bugfix Smart_Resource_Custom should not lowercase the resource name (Issue 183)
-
- 24.03.2014
- - bugfix using a {foreach} property like @iteration could fail when used in inheritance parent templates (Issue 182)
-
- 20.03.2014
- - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899)
-
- 18.03.2014
- - revert change of 17.03.2014
-
-17.03.2014
- - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899)
-
- 15.03.2014
- - bugfix Smarty_CacheResource_Keyvaluestore did use different keys on read/writes and clearCache() calls (Issue 169)
-
- 13.03.2014
- - bugfix clearXxx() change of 27.1.2014 did not work when specifing cache_id or compile_id  (forum topic 24868 and 24867)
-
- - 3.1.17 -
- 08.03.2014
- - bugfix relative file path {include} within {block} of child templates did throw exception on first call (Issue 177)
-
- 17.02.2014
- - bugfix Smarty failed when executing PHP on HHVM (Hip Hop 2.4) because uniqid('',true) does return string with ',' (forum topic 20343)
-
- 16.02.2014
- - bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175)
-
- 05.02.2014
- - bugfix shared.literal_compiler_param.php did throw an exception when literal did contain a '-' (smarty-developers group)
-
- 27.01.2014
- - bugfix $smarty->debugging = true; did show the variable of the $smarty object not the variables used in display() call (forum topic 24764)
- - bugfix clearCompiledTemplate(), clearAll() and clear() should use realpath to avoid possible exception from RecursiveDirectoryIterator (Issue 171)
-
- 26.01.2014
- - bugfix  undo block nesting checks for {nocache} for reasons like forum topic 23280 (forum topic 24762)
-
- 18.01.2014
- - bugfix the compiler did fail when using template inheritance and recursive {include} (smarty-developers group)
-
- 11.01.2014
- - bugfix "* }" (spaces before right delimiter) was interpreted by mistake as comment end tag (Issue 170)
- - internals  content cache should be clear when updating cache file
-
- 08.01.2014
- - bugfix Smarty_CacheResource_Custom did not handle template resource type specifications on clearCache() calls (Issue 169)
- - bugfix SmartyBC.class.php should use require_once to load Smarty.class.php (forum topic 24683)
-
- - 3.1.16 -
- 15.12.2013
- - bugfix {include} with {block} tag handling (forum topic 24599, 24594, 24682) (Issue 161)
-   Read 3.1.16_RELEASE_NOTES for more details
- - enhancement additional debug output at $smarty->_parserdebug = true;
-
- 07.11.2013
- - bugfix too restrictive handling of {include} within {block} tags. 3.1.15 did throw errors where 3.1.14 did not (forum topic 24599)
- - bugfix compiler could fail if PHP mbstring.func_overload is enabled  (Issue 164)
-
- 28.10.2013
- - bugfix variable resource name at custom resource plugin did not work within {block} tags (Issue 163)
- - bugfix notice "Trying to get property of non-object" removed (Issue 163)
- - bugfix correction of modifier capitalize fix from 3.10.2013  (issue 159)
- - bugfix multiple {block}s with same name in parent did not work (forum topic 24631)
-
- 20.10.2013
- - bugfix a variable file name at {extends} tag did fail (forum topic 24618)
-
- 14.10.2013
- - bugfix yesterdays fix could result in an undefined variable
-
- 13.10.2013
- - bugfix variable names on {include} in template inheritance did unextepted error message (forum topic 24594) (Issue 161)
-.- bugfix relative includes with same name like {include './foo.tpl'} from different folder failed (forum topic 24590)(Issue 161)
-
- 04.10.2013
- - bugfix variable file names at {extends} had been disbabled by mistake with the rewrite of
-   template inheritance of 24.08.2013   (forum topic 24585)
-
-03.10.2013
- - bugfix loops using modifier capitalize did eat up memory (issue 159)
-
- - Smarty 3.1.15 -
-01.10.2013
- - use current delimiters in compiler error messages (issue 157)
- - improvement on performance when using error handler and multiple template folders (issue 152)
-
-17.09.2013
- - improvement added patch for additional SmartyCompilerException properties for better access to source information (forum topic 24559)
-
-16.09.2013
- - bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320)
-
-13.09.2013
- - bugfix html_select_time defaulting error for the Meridian dropdown (forum topic 24549)
-
-09.09.2012
-- bugfix incorrect compiled code with array(object,method) callback at registered Variable Filter (forum topic 24542)
-
-27.08.2013
-- bugfix delimiter followed by linebreak did not work as auto literal after update from 24.08.2013 (forum topic 24518)
-
-24.08.2013
-- bugfix and enhancement
-  Because several recent problems with template inheritance the {block} tag compiler has been rewriten
-   - Error messages shown now the correct child template file and line number
-   - The compiler could fail on some larger UTF-8 text block (forum topic 24455)
-   - The {strip} tag can now be placed outside {block} tags in child templates (forum topic 24289)
-- change SmartyException::$escape  is now false by default
-- change PHP traceback has been remove for SmartyException and SmartyCompilerException
-
-14.08.2013
-- bugfix compiled filepath of config file did not observe different config_dir (forum topic 24493)
-
-13.08.2013
-- bugfix the internal resource cache did not observe config_dir changes (forum topic 24493)
-
-12.08.2013
-- bugfix internal $tmpx variables must be unique over all inheritance templates (Issue 149)
-
-10.08.2013
-- bugfix a newline was eaten when a <?xml ... ?> was passed by a Smarty variable and caching was enabled (forum topic 24482)
-
-29.07.2013
-- bugfix headers already send warning thrown when using 'SMARTY_DEBUG=on' from URL (Issue 148)
-
-27.07.2013
-- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)
-
-26.07.2013
-- bugfix template inheritance nesting problem (forum topic 24387)
-
-15.7.2013
-- update code generated by PSR-2 standards fixer which introduced PHP 5.4 incompatibilities of 14.7.2013
-
-14.7.2013
-- bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426}
-- update for PHP 5.4 compatibility
-- reformat source to PSR-2 standard
-
-12.7.2013
-- bugfix Do not remove '//' from file path at normalization (Issue 142)
-
-2.7.2013
-- bugfix trimwhitespace would replace captured items in wrong order (forum topic 24387)
-
-## Smarty-3.1.14 -
-27.06.2013
-- bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389)
-
-17.06.2013
-- fixed spelling in sources and documentation (from smarty-developers forum Veres Lajos)
-- enhancement added constant SMARTY::CLEAR_EXPIRED for the change of 26.05.2013 (forum topic 24310)
-- bugfix added smarty_security.php to composer.json (Issue 135)
-
-26.05.2013
-- enhancement an expire_time of -1 in clearCache() and clearAllCache() will delete outdated cache files
-  by their individual cache_lifetime used at creation (forum topic 24310)
-
-21.05.2013
-- bugfix modifier strip_tags:true was compiled into wrong code (Forum Topic 24287)
-- bugfix /n after ?> in Smarty.class.php did start output buffering (Issue 138)
-
-25.04.2013
-- bugfix escape and wordrap modifier could be compiled into wrong code when used in {nocache}{/nocache}
-  section but caching is disabled  (Forum Topic 24260)
-
-05.04.2013
-- bugfix post filter must not run when compiling inheritance child blocks (Forum Topic 24094)
-- bugfix after the fix for Issue #130 compiler exceptions got double escaped (Forum Topic 24199)
-
-28.02.2013
-- bugfix nocache blocks could be lost when using CACHING_LIFETIME_SAVED (Issue #133)
-- bugfix Compile ID gets nulled when compiling child blocks (Issue #134)
-
-
-24.01.2013
-- bugfix wrong tag type in smarty_internal_templatecompilerbase.php could cause wrong plugin search order (Forum Topic 24028)
-
-## Smarty-3.1.13 -
-13.01.2013
-- enhancement allow to disable exception message escaping by SmartyException::$escape = false;  (Issue #130)
-
-09.01.2013
-- bugfix compilation did fail when a prefilter did modify an {extends} tag c
-- bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127)
-- bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128)
-- added abstract method declaration doCompile() in Smarty_Internal_TemplateCompilerBase (Forum Topic 23969)
-
-06.01.2013
-- Allow '://' URL syntax in template names of stream resources  (Issue #129)
-
-27.11.2012
-- bugfix wrong variable usage in smarty_internal_utility.php (Issue #125)
-
-26.11.2012
-- bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800)
-
-24.11.2012
-- made SmartyBC loadable via composer (Issue #124)
-
-20.11.2012
-- bugfix assignGlobal() called from plugins did not work (Forum Topic 23771)
-
-13.11.2012
-- adding attribute "strict" to html_options, html_checkboxes, html_radios to only print disabled/readonly attributes if their values are true or "disabled"/"readonly" (Issue #120)
-
-01.11.2012
-- bugfix muteExcpetedErrors() would screw up for non-readable paths (Issue #118)
-
-## Smarty-3.1.12  -
-14.09.2012
-- bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008)
-
-11.09.2012
-- bugfix escape Smarty exception messages to avoid possible script execution
-
-10.09.2012
-- bugfix tag option flags and shorttag attributes did not work when rdel started with '=' (Forum Topic 22979)
-
-31.08.2012
-- bugfix resolving relative paths broke in some circumstances (Issue #114)
-
-22.08.2012
-- bugfix test MBString availability through mb_split, as it could've been compiled without regex support (--enable-mbregex).
-  Either we get MBstring's full package, or we pretend it's not there at all.
-
-21.08.2012
-- bugfix $auto_literal = false did not work with { block} tags in child templates
-  (problem was reintroduced after fix in 3.1.7)(Forum Topic 20581)
-
-17.08.2012
-- bugfix compiled code of nocache sections could contain wrong escaping (Forum Topic 22810)
-
-15.08.2012
-- bugfix template inheritance did produce wrong code if subtemplates with {block} was
-  included several times (from smarty-developers forum)
-
-14.08.2012
-- bugfix PHP5.2 compatibility compromised by SplFileInfo::getBasename() (Issue 110)
-
-01.08.2012
-- bugfix avoid PHP error on $smarty->configLoad(...) with invalid section specification (Forum Topic 22608)
-
-30.07.2012
--bugfix {assign} in a nocache section should not overwrite existing variable values
-   during compilation (issue 109)
-
-28.07.2012
-- bugfix array access of config variables did not work (Forum Topic 22527)
-
-19.07.2012
-- bugfix the default plugin handler did create wrong compiled code for static class methods
-  from external script files (issue 108)
-
-## Smarty-3.1.11 -
-30.06.2012
-- bugfix {block.. hide} did not work as nested child (Forum Topic 22216)
-
-25.06.2012
-- bugfix the default plugin handler did not allow static class methods for modifier (issue 85)
-
-24.06.2012
-- bugfix escape modifier support for PHP < 5.2.3 (Forum Topic 21176)
-
-11.06.2012
-- bugfix the patch for Topic 21856 did break tabs between tag attributes (Forum Topic 22124)
-
-## Smarty-3.1.10  -
-09.06.2012
-- bugfix the compiler did ignore registered compiler plugins for closing tags (Forum Topic 22094)
-- bugfix the patch for Topic 21856 did break multiline tags (Forum Topic 22124)
-
-## Smarty-3.1.9 -
-07.06.2012
-- bugfix fetch() and display() with relative paths (Issue 104)
-- bugfix treat "0000-00-00" as 0 in modifier.date_format (Issue 103)
-
-24.05.2012
-- bugfix Smarty_Internal_Write_File::writeFile() could cause race-conditions on linux systems (Issue 101)
-- bugfix attribute parameter names of plugins may now contain also "-"  and ":"  (Forum Topic 21856)
-- bugfix add compile_id to cache key of of source (Issue 97)
-
-22.05.2012
-- bugfix recursive {include} within {section} did fail (Smarty developer group)
-
-12.05.2012
-- bugfix {html_options} did not properly escape values (Issue 98)
-
-03.05.2012
-- bugfix make HTTP protocall version variable (issue 96)
-
-02.05.2012
-- bugfix  {nocache}{block}{plugin}... did produce wrong compiled code when caching is disabled (Forum Topic 21572, issue 95)
-
-12.04.2012
-- bugfix Smarty did eat the linebreak after the <?xml...?> closing tag (Issue 93)
-- bugfix concurrent cache updates could create a warning (Forum Topic 21403)
-
-08.04.2012
-- bugfix "\\" was not escaped correctly when generating nocache code (Forum Topic 21364)
-
-30.03.2012
-- bugfix template inheritance did  not throw exception when a parent template was deleted (issue 90)
-
-27.03.2012
-- bugfix prefilter did run multiple times on inline subtemplates compiled into several main templates (Forum Topic 21325)
-- bugfix implement Smarty2's behaviour of variables assigned by reference in SmartyBC. {assign} will affect all references.
-  (issue 88)
-
-21.03.2012
-- bugfix compileAllTemplates() and compileAllConfig() did not return the number of compiled files (Forum Topic 21286)
-
-13.03.2012
-- correction of yesterdays bugfix (Forum Topic 21175 and 21182)
-
-12.03.2012
-- bugfix a double quoted string of "$foo" did not compile into PHP "$foo" (Forum Topic 21175)
-- bugfix template inheritance did set $merge_compiled_includes globally true
-
-03.03.2012
-- optimization of compiling speed when same modifier was used several times
-
-02.03.2012
-- enhancement the default plugin handler can now also resolve undefined modifier (Smarty::PLUGIN_MODIFIER)
-  (Issue 85)
-
-## Smarty-3.1.8  -
-19.02.2012
-- bugfix {include} could result in a fatal error if used in appended or prepended nested {block} tags
-  (reported by mh and Issue 83)
-- enhancement added Smarty special variable $smarty.template_object to return the current template object (Forum Topic 20289)
-
-
-07.02.2012
-- bugfix increase entropy of internal function names in compiled and cached template files (Forum Topic 20996)
-- enhancement cacheable parameter added to default plugin handler, same functionality as in registerPlugin (request by calguy1000)
-
-06.02.2012
-- improvement stream_resolve_include_path() added to Smarty_Internal_Get_Include_Path (Forum Topic 20980)
-- bugfix fetch('extends:foo.tpl') always yielded $source->exists == true (Forum Topic 20980)
-- added modifier unescape:"url", fix (Forum Topic 20980)
-- improvement replaced some calls of preg_replace with str_replace (Issue 73)
-
-30.01.2012
-- bugfix Smarty_Security internal $_resource_dir cache wasn't properly propagated
-
-27.01.2012
-- bugfix Smarty did not a template name of "0" (Forum Topic 20895)
-
-20.01.2012
-- bugfix typo in Smarty_Internal_Get_IncludePath did cause runtime overhead (Issue 74)
-- improvment remove unneeded assigments (Issue 75 and 76)
-- fixed typo in template parser
-- bugfix output filter must not run before writing cache when template does contain nocache code (Issue 71)
-
-02.01.2012
-- bugfix {block foo nocache} did not load plugins within child {block} in nocache mode (Forum Topic 20753)
-
-29.12.2011
-- bugfix enable more entropy in Smarty_Internal_Write_File for "more uniqueness" and Cygwin compatibility (Forum Topic 20724)
-- bugfix embedded quotes in single quoted strings did not compile correctly in {nocache} sections (Forum Topic 20730)
-
-28.12.2011
-- bugfix Smarty's internal header code must be excluded from postfilters (issue 71)
-
-22.12.2011
-- bugfix the new lexer of 17.12.2011 did fail if mbstring.func_overload != 0 (issue 70) (Forum Topic 20680)
-- bugfix template inheritace did fail if mbstring.func_overload != 0 (issue 70) (Forum Topic 20680)
-
-20.12.2011
-- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return
-  content after {$smarty.block.child} (Forum Topic 20564)
-
-## Smarty-3.1.7 -
-18.12.2011
-- bugfix strings ending with " in multiline strings of config files failed to compile (issue #67)
-- added chaining to Smarty_Internal_Templatebase
-- changed unloadFilter() to not return a boolean in favor of chaining and API conformity
-- bugfix unregisterObject() raised notice when object to unregister did not exist
-- changed internals to use Smarty::$_MBSTRING ($_CHARSET, $_DATE_FORMAT) for better unit testing
-- added Smarty::$_UTF8_MODIFIER for proper PCRE charset handling (Forum Topic 20452)
-- added Smarty_Security::isTrustedUri() and Smarty_Security::$trusted_uri to validate
-  remote resource calls through {fetch} and {html_image} (Forum Topic 20627)
-
-17.12.2011
-- improvement of compiling speed by new handling of plain text blocks in the lexer/parser (issue #68)
-
-16.12.2011
-- bugfix the source exits flag and timestamp was not setup when template was in php include path (issue #69)
-
-9.12.2011
-- bugfix {capture} tags around recursive {include} calls did throw exception (Forum Topic 20549)
-- bugfix $auto_literal = false did not work with { block} tags in child templates (Forum Topic 20581)
-- bugfix template inheritance: do not include code of {include} in overloaded {block} into compiled
-  parent template (Issue #66}
-- bugfix template inheritance: {$smarty.block.child} in nested child {block} tags did not return expected
-  result (Forum Topic 20564)
-
-## Smarty-3.1.6  -
-30.11.2011
-- bugfix is_cache() for individual cached subtemplates with $smarty->caching = CACHING_OFF did produce
-  an exception (Forum Topic 20531)
-
-29.11.2011
-- bugfix added exception if the default plugin handler did return a not static callback (Forum Topic 20512)
-
-25.11.2011
-- bugfix {html_select_date} and {html_slecet_time} did not default to current time if "time" was not specified
-  since r4432 (issue 60)
-
-24.11.2011
-- bugfix a subtemplate later used as main template did use old variable values
-
-21.11.2011
-- bugfix cache file could include unneeded modifier plugins under certain condition
-
-18.11.2011
-- bugfix declare all directory properties private to map direct access to getter/setter also on extended Smarty class
-
-16.11.2011
-- bugfix Smarty_Resource::load() did not always return a proper resource handler (Forum Topic 20414)
-- added escape argument to html_checkboxes and html_radios (Forum Topic 20425)
-
-## Smarty-3.1.5  -
-14.11.2011
-- bugfix allow space between function name and open bracket (forum topic 20375)
-
-09.11.2011
-- bugfix different behaviour of uniqid() on cygwin. See https://bugs.php.net/bug.php?id=34908
-  (forum topic 20343)
-
-01.11.2011
-- bugfix {if} and {while} tags without condition did not throw a SmartyCompilerException (Issue #57)
-- bugfix multiline strings in config files could fail on longer strings (reopened Issue #55)
-
-22.10.2011
-- bugfix smarty_mb_from_unicode() would not decode unicode-points properly
-- bugfix use catch Exception instead UnexpectedValueException in
-  clearCompiledTemplate to be PHP 5.2 compatible
-
-21.10.2011
-- bugfix apostrophe in plugins_dir path name failed (forum topic 20199)
-- improvement sha1() for array keys longer than 150 characters
-- add Smarty::$allow_ambiguous_resources to activate unique resource handling (Forum Topic 20128)
-
-20.10.2011
-- @silenced unlink() in Smarty_Internal_Write_File since debuggers go haywire without it.
-- bugfix Smarty::clearCompiledTemplate() threw an Exception if $cache_id was not present in $compile_dir when $use_sub_dirs = true.
-- bugfix {html_select_date} and {html_select_time} did not properly handle empty time arguments (Forum Topic 20190)
-- improvement removed unnecessary sha1()
-
-19.10.2011
-- revert PHP4 constructor message
-- fixed PHP4 constructor message
-
-## Smarty-3.1.4 -
-19.10.2011
-- added exception when using PHP4 style constructor
-
-16.10.2011
-- bugfix testInstall() did not propery check cache_dir and compile_dir
-
-15.10.2011
-- bugfix Smarty_Resource and Smarty_CacheResource runtime caching (Forum Post 75264)
-
-14.10.2011
-- bugfix unique_resource did not properly apply to compiled resources (Forum Topic 20128)
-- add locking to custom resources (Forum Post 75252)
-- add Smarty_Internal_Template::clearCache() to accompany isCached() fetch() etc.
-
-13.10.2011
-- add caching for config files in Smarty_Resource
-- bugfix disable of caching after isCached() call did not work (Forum Topic 20131)
-- add concept unique_resource to combat potentially ambiguous template_resource values when custom resource handlers are used (Forum Topic 20128)
-- bugfix multiline strings in config files could fail on longer strings (Issue #55)
-
-11.10.2011
-- add runtime checks for not matching {capture}/{/capture} calls (Forum Topic 20120)
-
-10.10.2011
-- bugfix variable name typo in {html_options} and {html_checkboxes} (Issue #54)
-- bugfix <?xml> tag did create wrong output when caching enabled and the tag was in included subtemplate
-- bugfix Smarty_CacheResource_mysql example was missing strtotime() calls
-
-## Smarty-3.1.3  -
-07.10.2011
-- improvement removed html comments from {mailto} (Forum Topic 20092)
-- bugfix testInstall() would not show path to internal plugins_dir (Forum Post 74627)
-- improvement testInstall() now showing resolved paths and checking the include_path if necessary
-- bugfix html_options plugin did not handle object values properly (Issue #49, Forum Topic 20049)
-- improvement html_checkboxes and html_radios to accept null- and object values, and label_ids attribute
-- improvement removed some unnecessary count()s
-- bugfix parent pointer was not set when fetch() for other template was called on template object
-
-06.10.2011
-- bugfix switch lexer internals depending on mbstring.func_overload
-- bugfix start_year and end_year of {html_select_date} did not use current year as offset base (Issue #53)
-
-05.10.2011
-- bugfix of problem introduced with r4342 by replacing strlen() with isset()
-- add environment configuration issue with mbstring.func_overload Smarty cannot compensate for (Issue #45)
-- bugfix nofilter tag option did not disable default modifier
-- bugfix html_options plugin did not handle null- and object values properly (Issue #49, Forum Topic 20049)
-
-04.10.2011
-- bugfix assign() in plugins called in subtemplates did change value also in parent template
-- bugfix of problem introduced with r4342 on math plugin
-- bugfix output filter should not run on individually cached subtemplates
-- add unloadFilter() method
-- bugfix has_nocache_code flag was not reset before compilation
-
-## Smarty-3.1.2  -
-03.10.2011
-- improvement add internal $joined_template_dir property instead computing it on the fly several times
-
-01.10.2011
-- improvement replaced most in_array() calls by more efficient isset() on array_flip()ed haystacks
-- improvement replaced some strlen($foo) > 3 calls by isset($foo[3])
-- improvement Smarty_Internal_Utility::clearCompiledTemplate() removed redundant strlen()s
-
-29.09.2011
-- improvement of Smarty_Internal_Config::loadConfigVars() dropped the in_array for index look up
-
-28.09.2011
-- bugfix on template functions called nocache calling other template functions
-
-27.09.2011
-- bugfix possible warning "attempt to modify property of non-object" in {section} (issue #34)
-- added chaining to Smarty_Internal_Data so $smarty->assign('a',1)->assign('b',2); is possible now
-- bugfix remove race condition when a custom resource did change timestamp during compilation
-- bugfix variable property did not work on objects variable in template
-- bugfix smarty_make_timestamp() failed to process DateTime objects properly
-- bugfix wrong resource could be used on compile check of custom resource
-
-26.09.2011
-- bugfix repeated calls to same subtemplate did not make use of cached template object
-
-24.09.2011
-- removed internal muteExpectedErrors() calls in favor of having the implementor call this once from his application
-- optimized muteExpectedErrors() to pass errors to the latest registered error handler, if appliccable
-- added compile_dir and cache_dir to list of muted directories
-- improvment better error message for undefined templates at {include}
-
-23.09.2011
-- remove unused properties
-- optimization use real function instead anonymous function for preg_replace_callback
-- bugfix a relative {include} in child template blocks failed
-- bugfix direct setting of $template_dir, $config_dir, $plugins_dir in __construct() of an
-  extended Smarty class created problems
-- bugfix error muting was not implemented for cache locking
-
-## Smarty 3.1.1  -
-22.09.2011
-- bugfix {foreachelse} does fail if {section} was nested inside {foreach}
-- bugfix debug.tpl did not display correctly when it was compiled with escape_html = true
-
-21.09.2011
-- bugfix look for mixed case plugin file names as in 3.0 if not found try all lowercase
-- added $error_muting to suppress error messages even for badly implemented error_handlers
-- optimized autoloader
-- reverted ./ and ../ handling in fetch() and display() - they're allowed again
-
-20.09.2011
-- bugfix removed debug echo output while compiling template inheritance
-- bugfix relative paths in $template_dir broke relative path resolving in {include "../foo.tpl"}
-- bugfix {include} did not work inside nested {block} tags
-- bugfix {assign} with scope root and global did not work in all cases
-
-19.09.2011
-- bugfix regression in Smarty_CacheReource_KeyValueStore introduced by r4261
-- bugfix output filter shall not run on included subtemplates
-
-18.09.2011
-- bugfix template caching did not care about file.tpl in different template_dir
-- bugfix {include $file} was broken when merge_compiled_incluges = true
-- bugfix {include} was broken when merge_compiled_incluges = true and same indluded template
-  was used in different main templates in one compilation run
-- bugfix for Smarty2 style compiler plugins on unnamed attribute passing like {tag $foo $bar}
-- bugfix debug.tpl did not display correctly when it was compiled with escape_html = true
-
-17.09.2011
-- bugfix lock_id for file resource would create invalid filepath
-- bugfix resource caching did not care about file.tpl in different template_dir
-
-## Smarty 3.1.0  -
-15/09/2011
-- optimization of {foreach}; call internal _count() method only when "total" or "last" {foreach} properties are used
-
-11/09/2011
-- added  unregisterObject() method
-
-06/09/2011
-- bugfix  isset() did not work in templates on config variables
-
-03/09/2011
-- bugfix createTemplate() must default to cache_id and compile_id of Smarty object
-- bugfix Smarty_CacheResource_KeyValueStore must include $source->uid in cache filepath to keep templates with same
-  name but different folders separated
-- added cacheresource.apc.php example in demo folder
-
-02/09/2011
-- bugfix cache lock file must use absolute filepath
-
-01/09/2011
-- update of cache locking
-
-30/08/2011
-- added locking mechanism to CacheResource API (implemented with File and KeyValueStores)
-
-28/08/2011
-- bugfix clearCompileTemplate() did not work for specific template subfolder or resource
-
-27/08/2011
-- bugfix {$foo|bar+1} did create syntax error
-
-26/08/2011
-- bugfix when generating nocache code which contains double \
-- bugfix handle race condition if cache file was deleted between filemtime and include
-
-17/08/2011
-- bugfix CacheResource_Custom bad internal fetch() call
-
-15/08/2011
-- bugfix CacheResource would load content twice for KeyValueStore and Custom handlers
-
-06/08/2011
-- bugfix {include} with scope attribute could execute in wrong scope
-- optimization of compile_check processing
-
-03/08/2011
-- allow comment tags to comment {block} tags out in child templates
-
-26/07/2011
-- bugfix experimental getTags() method did not work
-
-24/07/2011
-- sure opened output buffers are closed on exception
-- bugfix {foreach} did not work on IteratorAggregate
-
-22/07/2011
-- clear internal caches on clearAllCache(), clearCache(), clearCompiledTemplate()
-
-21/07/2011
-- bugfix value changes of variable values assigned to Smarty object could not be seen on repeated $smarty->fetch() calls
-
-17/07/2011
-- bugfix {$smarty.block.child} did drop a notice at undefined child
-
-15/07/2011
-- bugfix individual cache_lifetime of {include} did not work correctly inside {block} tags
-- added caches for Smarty_Internal_TemplateSource and Smarty_Internal_TemplateCompiled to reduce I/O for multiple cache_id rendering
-
-14/07/2011
-- made Smarty::loadPlugin() respect the include_path if required
-
-13/07/2011
-- optimized internal file write functionality
-- bugfix PHP did eat line break on nocache sections
-- fixed typo of Smarty_Security properties $allowed_modifiers and $disabled_modifiers
-
-06/07/2011
-- bugfix variable modifier must run befor gereral filtering/escaping
-
-04/07/2011
-- bugfix use (?P<name>) syntax at preg_match as some pcre libraries failed on (?<name>)
-- some performance improvement when using generic getter/setter on template objects
-
-30/06/2011
-- bugfix generic getter/setter of Smarty properties used on template objects did throw exception
-- removed is_dir and is_readable checks from directory setters for better performance
-
-28/06/2011
-- added back support of php template resource as undocumented feature
-- bugfix automatic recompilation on version change could drop undefined index notice on old 3.0 cache and compiled files
-- update of README_3_1_DEV.txt and moved into the distribution folder
-- improvement show first characters of eval and string templates instead sha1 Uid in debug window
-
-## Smarty 3.1-RC1 -
-25/06/2011
-- revert change of 17/06/2011. $_smarty varibale removed. call loadPlugin() from inside plugin code if required
-- code cleanup, remove no longer used properties and methods
-- update of PHPdoc comments
-
-23/06/2011
-- bugfix {html_select_date} would not respect current time zone
-
-19/06/2011
-- added $errors argument to testInstall() functions to suppress output.
-- added plugin-file checks to testInstall()
-
-18/06/2011
-- bugfix mixed use of same subtemplate inline and not inline in same script could cause a warning during compilation
-
-17/06/2011
-- bugfix/change use $_smarty->loadPlugin() when loading nested depending plugins via loadPlugin
-- bugfix {include ... inline} within {block}...{/block} did fail
-
-16/06/2011
-- bugfix do not overwrite '$smarty' template variable when {include ... scope=parent} is called
-- bugfix complete empty inline subtemplates did fail
-
-15/06/2011
-- bugfix template variables where not accessable within inline subtemplates
-
-12/06/2011
-- bugfix removed unneeded merging of template variable when fetching includled subtemplates
-
-10/06/2011
-- made protected properties $template_dir, $plugins_dir, $cache_dir, $compile_dir, $config_dir accessible via magic methods
-
-09/06/2011
-- fix smarty security_policy issue in plugins {html_image} and {fetch}
-
-05/06/2011
-- update of SMARTY_VERSION
-- bugfix made getTags() working again
-
-04/06/2011
-- allow extends resource in file attribute of {extends} tag
-
-03/06/2011
-- added {setfilter} tag to set filters for variable output
-- added escape_html property to control autoescaping of variable output
-
-27/05/2011
-- added allowed/disabled tags and modifiers in security for sandboxing
-
-23/05/2011
-- added base64: and urlencode: arguments to eval and string resource types
-
-22/05/2011
-- made time-attribute of {html_select_date} and {html_select_time} accept arrays as defined by attributes prefix and field_array
-
-13/05/2011
-- remove setOption / getOption calls from SamrtyBC class
-
-02/05/2011
-- removed experimental setOption() getOption() methods
-- output returned content also on opening tag calls of block plugins
-- rewrite of default plugin handler
-- compile code of variable filters for better performance
-
-20/04/2011
-- allow {php} {include_php} tags and PHP_ALLOW handling only with the SmartyBC class
-- removed support of php template resource
-
-20/04/2011
-- added extendsall resource example
-- optimization of template variable access
-- optimization of subtemplate handling {include}
-- optimization of template class
-
-01/04/2011
-- bugfix quote handling in capitalize modifier
-
-28/03/2011
-- bugfix stripslashes() requried when using PCRE e-modifier
-
-04/03/2011
-- upgrade to new PHP_LexerGenerator version 0.4.0 for better performance
-
-27/02/2011
-- ignore .svn folders when clearing cache and compiled files
-- string resources do not need a modify check
-
-26/02/2011
-- replaced smarty_internal_wrapper by SmartyBC class
-- load utility functions as static methods instead through __call()
-- bugfix in extends resource when subresources are used
-- optimization of modify checks
-
-25/02/2011
-- use $smarty->error_unassigned to control NOTICE handling on unassigned variables
-
-21/02/2011
-- added new new compile_check mode COMPILECHECK_CACHEMISS
-- corrected new cloning behaviour of createTemplate()
-- do no longer store the compiler object as property in the compile_tag classes to avoid possible memory leaks
-  during compilation
-
-19/02/2011
-- optimizations on merge_compiled_includes handling
-- a couple of optimizations and bugfixes related to new resource structure
-
-17/02/2011
-- changed ./ and ../ behaviour
-
-14/02/2011
-- added {block ... hide} option to suppress block if no child is defined
-
-13/02/2011
-- update handling of recursive subtemplate calls
-- bugfix replace $smarty->triggerError() by exception in smarty_internal_resource_extends.php
-
-12/02/2011
-- new class Smarty_Internal_TemplateBase with shared methods of Smarty and Template objects
-- optimizations of template processing
-- made register... methods permanet
-- code for default_plugin_handler
-- add automatic recompilation at version change
-
-04/02/2011
-- change in Smarty_CacheResource_Custom
-- bugfix cache_lifetime did not compile correctly at {include} after last update
-- moved isCached processing into CacheResource class
-- bugfix new CacheResource API did not work with disabled compile_check
-
-03/02/2011
-- handle template content as function to improve speed on multiple calls of same subtemplate and isCached()/display() calls
-- bugfixes and improvents in the new resource API
-- optimizations of template class code
-
-25/01/2011
-- optimized function html_select_time
-
-22/01/2011
-- added Smarty::$use_include_path configuration directive for Resource API
-
-21/01/2011
-- optimized function html_select_date
-
-19/01/2011
-- optimized outputfilter trimwhitespace
-
-18/01/2011
-- bugfix Config to use Smarty_Resource to fetch sources
-- optimized Smarty_Security's isTrustedDir() and isTrustedPHPDir()
-
-17/01/2011
-- bugfix HTTP headers for CGI SAPIs
-
-16/01/2011
-- optimized internals of Smarty_Resource and Smarty_CacheResource
-
-14/01/2011
-- added modifiercompiler escape to improve performance of escaping html, htmlall, url, urlpathinfo, quotes, javascript
-- added support to choose template_dir to load from: [index]filename.tpl
-
-12/01/2011
-- added unencode modifier to revert results of encode modifier
-- added to_charset and from_charset modifier for character encoding
-
-11/01/2011
-- added SMARTY_MBSTRING to generalize MBString detection
-- added argument $lc_rest to modifier.capitalize to lower-case anything but the first character of a word
-- changed strip modifier to consider unicode white-space, too
-- changed wordwrap modifier to accept UTF-8 strings
-- changed count_sentences modifier to consider unicode characters and treat sequences delimited by ? and ! as sentences, too
-- added argument $double_encode to modifier.escape (applies to html and htmlall only)
-- changed escape modifier to be UTF-8 compliant
-- changed textformat block to be UTF-8 compliant
-- optimized performance of mailto function
-- fixed spacify modifier so characters are not prepended and appended, made it unicode compatible
-- fixed truncate modifier to properly use mb_string if possible
-- removed UTF-8 frenzy from count_characters modifier
-- fixed count_words modifier to treat "hello-world" as a single word like str_count_words() does
-- removed UTF-8 frenzy from upper modifier
-- removed UTF-8 frenzy from lower modifier
-
-01/01/2011
-- optimize smarty_modified_escape for hex, hexentity, decentity.
-
-28/12/2010
-- changed $tpl_vars, $config_vars and $parent to belong to Smarty_Internal_Data
-- added Smarty::registerCacheResource() for dynamic cache resource object registration
-
-27/12/2010
-- added Smarty_CacheResource API and refactored existing cache resources accordingly
-- added Smarty_CacheResource_Custom and Smarty_CacheResource_Mysql
-
-26/12/2010
-- added Smarty_Resource API and refactored existing resources accordingly
-- added Smarty_Resource_Custom and Smarty_Resource_Mysql
-- bugfix Smarty::createTemplate() to return properly cloned template instances
-
-24/12/2010
-- optimize smarty_function_escape_special_chars() for PHP >= 5.2.3
-
-## SVN 3.0 trunk  -
-14/05/2011
-- bugfix error handling at stream resources
-
-13/05/2011
-- bugfix condition starting with "-" did fail at {if} and {while} tags
-
-22/04/2011
-- bugfix allow only fixed string as file attribute at {extends} tag
-
-01/04/2011
-- bugfix do not run filters and default modifier when displaying the debug template
-- bugfix of embedded double quotes within multi line strings (""")
-
-29/03/2011
-- bugfix on error message in smarty_internal_compile_block.php
-- bugfix mb handling in strip modifier
-- bugfix for Smarty2 style registered compiler function on unnamed attribute passing like {tag $foo $bar}
-
-17/03/2011
-- bugfix on default {function} parameters when {function} was used in nocache sections
-- bugfix on compiler object destruction. compiler_object property was by mistake unset.
-
-09/03/2011
--bugfix a variable filter should run before modifiers on an output tag (see change of 23/07/2010)
-
-08/03/2011
-- bugfix loading config file without section should load only defaults
-
-03/03/2011
-- bugfix "smarty" template variable was not recreated when cached templated had expired
-- bugfix internal rendered_content must be cleared after subtemplate was included
-
-01/03/2011
-- bugfix replace modifier did not work in 3.0.7 on systems without multibyte support
-- bugfix {$smarty.template} could return in 3.0.7 parent template name instead of
-         child name when it needed to compile
-
-25/02/2011
-- bugfix for Smarty2 style compiler plugins on unnamed attribute passing like {tag $foo $bar}
-
-24/02/2011
-- bugfix $smarty->clearCache('some.tpl') did by mistake cache the template object
-
-18/02/2011
-- bugfix removed possible race condition when isCached() was called for an individually cached subtemplate
-- bugfix force default debug.tpl to be loaded by the file resource
-
-17/02/2011
--improvement not to delete files starting with '.' from cache and template_c folders on clearCompiledTemplate() and clearCache()
-
-16/02/2011
--fixed typo in exception message of Smarty_Internal_Template
--improvement allow leading spaces on } tag closing if auto_literal is enabled
-
-13/02/2011
-- bufix replace $smarty->triggerError() by exception
-- removed obsolete {popup_init..} plugin from demo templates
-- bugfix replace $smarty->triggerError() by exception in smarty_internal_resource_extends.php
-
-## Smarty 3.0.7  -
-09/02/2011
-- patched vulnerability when using {$smarty.template}
-
-01/02/2011
-- removed assert() from config and template parser
-
-31/01/2011
-- bugfix the lexer/parser did fail on special characters like VT
-
-16/01/2011
--bugfix of ArrayAccess object handling in internal _count() method
--bugfix of Iterator object handling in internal _count() method
-
-14/01/2011
--bugfix removed memory leak while processing compileAllTemplates
-
-12/01/2011
-- bugfix in {if} and {while} tag compiler when using assignments as condition and nocache mode
-
-10/01/2011
-- bugfix when using {$smarty.block.child} and name of {block} was in double quoted string
-- bugfix updateParentVariables() was called twice when leaving {include} processing
-
-- bugfix mb_str_replace in replace and escape modifiers work with utf8
-
-31/12/2010
-- bugfix dynamic configuration of $debugging_crtl did not work
-- bugfix default value of $config_read_hidden changed to false
-- bugfix format of attribute array on compiler plugins
-- bugfix getTemplateVars() could return value from wrong scope
-
-28/12/2010
-- bugfix multiple {append} tags failed to compile.
-
-22/12/2010
-- update do not clone the Smarty object an internal createTemplate() calls to increase performance
-
-21/12/2010
-- update html_options to support class and id attrs
-
-17/12/2010
-- bugfix added missing support of $cache_attrs for registered plugins
-
-15/12/2010
-- bugfix assignment as condition in {while} did drop an E_NOTICE
-
-14/12/2010
-- bugfix when passing an array as default parameter at {function} tag
-
-13/12/2010
-- bugfix {$smarty.template} in child template did not return right content
-- bugfix Smarty3 did not search the PHP include_path for template files
-
-## Smarty 3.0.6  -
-
-12/12/2010
-- bugfix fixed typo regarding yesterdays change to allow streamWrapper
-
-11/12/2010
-- bugfix nested block tags in template inheritance child templates did not work correctly
-- bugfix {$smarty.current_dir} in child template did not point to dir of child template
-- bugfix changed code when writing temporary compiled files to allow stream_wrapper
-
-06/12/2010
-- bugfix getTemplateVars() should return 'null' instead dropping E_NOTICE on an unassigned variable
-
-05/12/2010
-- bugfix missing declaration of $smarty in Smarty class
-- bugfix empty($foo) in {if} did drop a notice when $foo was not assigned
-
-01/12/2010
-- improvement of {debug} tag output
-
-27/11/2010
--change run output filter before cache file is written. (same as in Smarty2)
-
-24/11/2011
--bugfix on parser at  !$foo|modifier
--change parser logic when assignments used as condition in {if] and {while} to allow assign to array element
-
-23/11/2011
--bugfix allow integer as attribute name in plugin calls
--change  trimm whitespace from error message, removed long list of expected tokens
-
-22/11/2010
-- bugfix on template inheritance when an {extends} tag was inserted by a prefilter
-- added error message for illegal variable file attributes at {extends...} tags
-
-## Smarty 3.0.5  -
-
-
-19/11/2010
-- bugfix on block plugins with modifiers
-
-18/11/2010
-- change on handling of unassigned template variable -- default will drop E_NOTICE
-- bugfix on Smarty2 wrapper load_filter() did not work
-
-17/11/2010
-- bugfix on {call} with variable function name
-- bugfix on {block} if name did contain '-'
-- bugfix in function.fetch.php , referece to undefined $smarty
-
-16/11/2010
-- bugfix whitespace in front of "<?php" in smarty_internal_compile_private_block_plugin.php
-- bugfix {$smarty.now} did compile incorrectly
-- bugfix on reset(),end(),next(),prev(),current() within templates
-- bugfix on default parameter for {function}
-
-15/11/2010
-- bugfix when using {$smarty.session} as object
-- bugfix scoping problem on $smarty object passed to filters
-- bugfix captured content could not be accessed globally
-- bugfix Smarty2 wrapper functions could not be call from within plugins
-
-## Smarty 3.0.4  -
-
-14/11/2010
-- bugfix isset() did not allow multiple parameter
-- improvment of some error messages
-- bugfix html_image did use removed property $request_use_auto_globals
-- small performace patch in Smarty class
-
-13/11/2010
-- bugfix  overloading problem when $smarty->fetch()/display() have been used in plugins
-				(introduced with 3.0.2)
-- code cleanup
-								
-## Smarty 3.0.3  -
-
-13/11/2010
-- bugfix on {debug}
-- reverted location of loadPlugin() to Smarty class
-- fixed comments in plugins
-- fixed internal_config (removed unwanted code line)
-- improvement  remove last linebreak from {function} definition
-
-## Smarty 3.0.2  -
-
-12/11/2010
-- reactivated $error_reporting property handling
-- fixed typo in compile_continue
-- fixed security in {fetch} plugin
-- changed back plugin parameters to two. second is template object
-  with transparent access to Smarty object
-- fixed {config_load} scoping form compile time to run time
-
-## Smarty 3.0.0  -
-
-
-
-11/11/2010
-- major update including some API changes
-
-10/11/2010
-- observe compile_id also for config files
-
-09/11/2010
--bugfix on  complex expressions as start value for {for} tag
-request_use_auto_globals
-04/11/2010
-- bugfix do not allow access of dynamic and private object members of assigned objects when
-  security is enabled.
-
-01/11/2010
-- bugfix related to E_NOTICE change.  {if empty($foo)} did fail when $foo contained a string
-
-28/10/2010
-- bugfix on compiling modifiers within $smarty special vars like {$smarty.post.{$foo|lower}}
-
-27/10/2010
-- bugfix default parameter values did not work for template functions included with {include}
-
-25/10/2010
-- bugfix for E_NOTICE change, array elements did not work as modifier parameter
-
-20/10/2010
-- bugfix for the E_NOTICE change
-
-19/10/2010
-- change Smarty does no longer mask out E_NOTICE by default during template processing
-
-13/10/2010
-- bugfix removed ambiguity between ternary and stream variable in template syntax
-- bugfix use caching properties of template instead of smarty object when compiling child {block}
-- bugfix {*block}...{/block*} did throw an exception in template inheritance
-- bugfix on template inheritance using nested eval or string resource in {extends} tags
-- bugfix on output buffer handling in isCached() method
-
-##  RC4 -
-
-01/10/2010
-- added {break} and {continue} tags for flow control of {foreach},{section},{for} and {while} loops
-- change of 'string' resource. It's no longer evaluated and compiled files are now stored
-- new 'eval' resource which evaluates a template without saving the compiled file
-- change in isCached() method to allow multiple calls for the same template
-
-25/09/2010
-- bugfix on some compiling modifiers
-
-24/09/2010
-- bugfix merge_compiled_includes flag was not restored correctly in {block} tag
-
-22/09/2010
-- bugfix on default modifier
-
-18/09/2010
-- bugfix untility compileAllConfig() did not create sha1 code for compiled template file names if template_dir was defined with no trailing DS
-- bugfix on templateExists() for extends resource
-
-17/09/2010
-- bugfix {$smarty.template} and {$smarty.current_dir} did not compile correctly within {block} tags
-- bugfix corrected error message on missing template files in extends resource
-- bugfix untility compileAllTemplates() did not create sha1 code for compiled template file names if template_dir was defined with no trailing DS
-
-16/09/2010
-- bugfix when a doublequoted modifier parameter did contain Smarty tags and ':'
-
-15/09/2010
-- bugfix resolving conflict between '<%'/'%>' as custom Smarty delimiter and ASP tags
-- use ucfirst for resource name on internal resource class names
-
-12/09/2010
-- bugfix for change of 08/09/2010 (final {block} tags in subtemplates did not produce correct results)
-
-10/09/2010
-- bugfix for change of 08/09/2010 (final {block} tags in subtemplates did not produce correct results)
-
-08/09/2010
-- allow multiple template inheritance branches starting in subtemplates
-
-07/09/2010
-- bugfix {counter} and {cycle} plugin assigned result to smarty variable not in local(template) scope
-- bugfix templates containing just {strip} {/strip} tags did produce an error
-
-
-23/08/2010
-- fixed E_STRICT errors for uninitialized variables
-
-22/08/2010
-- added attribute cache_id to {include} tag
-
-13/08/2010
-- remove exception_handler property from Smarty class
-- added Smarty's own exceptions SmartyException and SmartyCompilerException
-
-09/08/2010
-- bugfix on modifier with doublequoted strings as parameter containing embedded tags
-
-06/08/2010
-- bugfix when cascading some modifier like |strip|strip_tags modifier
-
-05/08/2010
-- added plugin type modifiercompiler to produce compiled modifier code
-- changed standard modifier plugins to the compiling versions whenever possible
-- bugfix in nocache sections {include} must not cache the subtemplate
-
-02/08/2010
-- bugfix strip did not work correctly in conjunction with comment lines
-
-31/07/2010
-- bugfix on nocache attribute at {assign} and {append}
-
-30/07/2010
-- bugfix passing scope attributes in doublequoted strings did not work at {include} {assign} and {append}
-
-25/07/2010
-- another bugfix of change from 23/07/2010 when compiling modifier
-
-24/07/2010
-- bugfix of change from 23/07/2010 when compiling modifier
-
-23/07/2010
-- changed execution order. A variable filter does now run before modifiers on output of variables
-- bugfix use always { and } as delimiter for debug.tpl
-
-
-22/07/2010
-- bugfix in templateExists() method
-
-20/07/2010
-- fixed handling of { strip } tag with whitespaces
-
-15/07/2010
-- bufix  {$smarty.template} does include now the relative path, not just filename
-
-##  RC3 -
-
-
-
-
-15/07/2010
-- make the date_format modifier work also on objects of the DateTime class
-- implementation of parsetrees in the parser to close security holes and remove unwanted empty line in HTML output
-
-08/07/2010
-- bugfix on assigning multidimensional arrays within templates
-- corrected bugfix for truncate modifier
-
-07/07/2010
-- bugfix the truncate modifier needs to check if the string is utf-8 encoded or not
-- bugfix support of script files relative to trusted_dir
-
-06/07/2010
-- create exception on recursive {extends} calls
-- fixed reported line number at "unexpected closing tag " exception
-- bugfix on escape:'mail' modifier
-- drop exception if 'item' variable is equal 'from' variable in {foreach} tag
-
-01/07/2010
-- removed call_user_func_array calls for optimization of compiled code when using registered modifiers and plugins
-
-25/06/2010
-- bugfix escaping " when block tags are used within doublequoted strings
-
-24/06/2010
-- replace internal get_time() calls with standard PHP5 microtime(true) calls in Smarty_Internal_Utility
-- added $smarty->register->templateClass() and $smarty->unregister->templateClass() methods for supporting static classes with namespace
-
-
-22/06/2010
-- allow spaces between typecast and value in template syntax
-- bugfix get correct count of traversables in {foreach} tag
-
-21/06/2010
-- removed use of PHP shortags SMARTY_PHP_PASSTHRU mode
-- improved speed of cache->clear() when a compile_id was specified and use_sub_dirs is true
-
-20/06/2010
-- replace internal get_time() calls with standard PHP5 microtime(true) calls
-- closed security hole when php.ini asp_tags = on
-
-18/06/2010
-- added __toString method to the Smarty_Variable class
-
-
-14/06/2010
-- make handling of Smarty comments followed by newline BC to Smarty2
-
-
-##  RC2 -
-
-
-
-13/06/2010
-- bugfix Smarty3 did not handle hexadecimals like 0x0F as numerical value
-- bugifx Smarty3 did not accept numerical constants like .1 or 2. (without a leading or trailing digit)
-
-11/06/2010
-- bugfix the lexer did fail on larger {literal} ... {/literal} sections
-
-03/06/2010
-- bugfix on calling template functions like Smarty tags
-
-01/06/2010
-- bugfix on template functions used with template inheritance
-- removed /* vim: set expandtab: */ comments
-- bugfix of auto literal problem introduce with fix of 31/05/2010
-
-31/05/2010
-- bugfix the parser did not allow some smarty variables with special name like $for, $if, $else and others.
-
-27/05/2010
-- bugfix on object chaining using variable properties
-- make scope of {counter} and {cycle} tags again global as in Smarty2
-
-26/05/2010
-- bugfix removed decrepated register_resource call in smarty_internal_template.php
-
-25/05/2010
-- rewrite of template function handling to improve speed
-- bugfix on file dependency when merge_compiled_includes = true
-
-
-16/05/2010
-- bugfix when passing parameter with numeric name like {foo 1='bar' 2='blar'}
-
-14/05/2010
-- bugfix compile new config files if compile_check and force_compile = false
-- added variable static classes names to template syntax
-
-11/05/2010
-- bugfix  make sure that the cache resource is loaded in all conditions when template methods getCached... are called externally
-- reverted the change 0f 30/04/2010. With the exception of forward references template functions can be again called by a standard tag.
-
-10/05/2010
-- bugfix on {foreach} and {for} optimizations of 27/04/2010
-
-09/05/2010
-- update of template and config file parser because of minor parser generator bugs
-
-07/05/2010
-- bugfix on {insert}
-
-06/05/2010
-- bugfix when merging compiled templates and objects are passed as parameter of the {include} tag
-
-05/05/2010
-- bugfix on {insert} to cache parameter
-- implementation of $smarty->default_modifiers as in Smarty2
-- bugfix on getTemplateVars method
-
-01/05/2010
-- bugfix on handling of variable method names at object chaning
-
-30/04/2010
-- bugfix when comparing timestamps in sysplugins/smarty_internal_config.php
-- work around of a substr_compare bug in older PHP5 versions
-- bugfix on template inheritance for tag names starting with "block"
-- bugfix on {function} tag with name attribute in doublequoted strings
-- fix to make calling of template functions unambiguously by madatory usage of the {call} tag
-
-##  RC1 -
-
-27/04/2010
-- change default of $debugging_ctrl to 'NONE'
-- optimization of compiled code of {foreach} and {for} loops
-- change of compiler for config variables
-
-27/04/2010
-- bugfix in $smarty->cache->clear() method. (do not cache template object)
-
-
-17/04/2010
-- security fix in {math} plugin
-
-
-12/04/2010
-- bugfix in smarty_internal_templatecompilerbase (overloaded property)
-- removed parser restrictions in using true,false and null as ID
-
-07/04/2010
-- bugfix typo in smarty_internal_templatecompilerbase
-
-31/03/2010
-- compile locking by touching old compiled files to avoid concurrent compilations
-
-29/03/2010
-- bugfix allow array definitions as modifier parameter
-- bugfix observe compile_check property when loading config files
-- added the template object as third filter parameter
-
-25/03/2010
-- change of utility->compileAllTemplates() log messages
-- bugfix on nocache code in {function} tags
-- new method utility->compileAllConfig() to compile all config files
-
-24/03/2010
-- bugfix on register->modifier() error messages
-
-23/03/2010
-- bugfix on template inheritance when calling multiple child/parent relations
-- bugfix on caching mode SMARTY_CACHING_LIFETIME_SAVED and cache_lifetime = 0
-
-22/03/2010
-- bugfix make directory separator operating system independend in compileAllTemplates()
-
-21/03/2010
-- removed unused code in compileAllTemplates()
-
-19/03/2010
-- bugfix for multiple {/block} tags on same line
-
-17/03/2010
-- bugfix make $smarty->cache->clear() function independent from caching status
-
-16/03/2010
-- bugfix on assign attribute at registered template objects
-- make handling of modifiers on expression BC to Smarty2
-
-15/03/2010
-- bugfix on block plugin calls
-
-11/03/2010
-- changed parsing of <?php and ?> back to Smarty2 behaviour
-
-08/03/2010
-- bugfix on uninitialized properties in smarty_internal_template
-- bugfix on $smarty->disableSecurity()
-
-04/03/2010
-- bugfix allow uppercase chars in registered resource names
-- bugfix on accessing chained objects of static classes
-
-01/03/2010
-- bugfix on nocache code in {block} tags if child template was included by {include}
-
-27/02/2010
-- allow block tags inside double quoted string
-
-26/02/2010
-- cache modified check implemented
-- support of access to a class constant from an object (since PHP 5.3)
-
-24/02/2010
-- bugfix on expressions in doublequoted string enclosed in backticks
-- added security property $static_classes for static class security
-
-18/02/2010
-- bugfix on parsing Smarty tags inside <?xml ... ?>
-- bugfix on truncate modifier
-
-17/02/2010
-- removed restriction that modifiers did require surrounding parenthesis in some cases
-- added {$smarty.block.child} special variable for template inheritance
-
-16/02/2010
-- bugfix on <?xml ... ?> tags for all php_handling modes
-- bugfix on parameter of variablefilter.htmlspecialchars.php plugin
-
-14/02/2010
-- added missing _plugins property in smarty.class.php
-- bugfix $smarty.const... inside doublequoted strings and backticks was compiled into wrong PHP code
-
-12/02/2010
-- bugfix on nested {block} tags
-- changed Smarty special variable $smarty.parent to $smarty.block.parent
-- added support of nested {bock} tags
-
-10/02/2010
-- avoid possible notice on $smarty->cache->clear(...), $smarty->clear_cache(....)
-- allow Smarty tags inside <? ... ?> tags in SMARTY_PHP_QUOTE and SMARTY_PHP_PASSTHRU mode
-- bugfix at new "for" syntax like {for $x=1 to 10 step 2}
-
-09/02/2010
-- added $smarty->_tag_stack for tracing block tag hierarchy
-
-08/02/2010
-- bugfix  use template fullpath at §smarty->cache->clear(...), $smarty->clear_cache(....)
-- bugfix of cache filename on extended templates when force_compile=true
-
-07/02/2010
-- bugfix on changes of 05/02/2010
-- preserve line endings type form template source
-- API changes (see README file)
-
-05/02/2010
-- bugfix on modifier and block plugins with same name
-
-02/02/2010
-- retaining newlines at registered functions and function plugins
-
-01/25/2010
-- bugfix cache resource was not loaded when caching was globally off but enabled at a template object
-- added test that $_SERVER['SCRIPT_NAME'] does exist in Smarty.class.php
-
-01/22/2010
-- new method $smarty->createData([$parent]) for creating a data object (required for bugfixes below)
-- bugfix config_load() method now works also on a data object
-- bugfix get_config_vars() method now works also on a data and template objects
-- bugfix clear_config() method now works also on a data and template objects
-
-01/19/2010
-- bugfix on plugins if same plugin was called from a nocache section first and later from a cached section
-
-
-###beta 7###
-
-
-01/17/2010
-- bugfix on $smarty.const... in double quoted strings
-
-01/16/2010
-- internal change of config file lexer/parser on handling of section names
-- bugfix on registered objects (format parameter of register_object was not handled correctly)
-
-01/14/2010
-- bugfix on backslash within single quoted strings
-- bugfix allow absolute filepath for config files
-- bugfix on special Smarty variable $smarty.cookies
-- revert handling of newline on no output tags like {if...}
-- allow special characters in config file section names for Smarty2 BC
-
-01/13/2010
-- bugfix on {if} tags
-
-01/12/2010
-- changed back modifier handling in parser. Some restrictions still apply:
-    if modifiers are used in side {if...} expression or in mathematical expressions
-    parentheses must be used.
-- bugfix the {function..} tag did not accept the name attribute in double quotes
-- closed possible security hole at <?php ... ?> tags
-- bugfix of config file parser on large config files
-
-
-###beta 6####
-
-01/11/2010
-- added \n to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source
-- added missing support of insert plugins
-- added optional nocache attribute to {block} tags in parent template
-- updated <?php...?> handling supporting now heredocs and newdocs. (thanks to Thue Jnaus Kristensen)
-
-01/09/2010
-- bugfix on nocache {block} tags in parent templates
-
-01/08/2010
-- bugfix on variable filters. filter/nofilter attributes did not work on output statements
-
-01/07/2010
-- bugfix on file dependency at template inheritance
-- bugfix on nocache code at template inheritance
-
-01/06/2010
-- fixed typo in smarty_internal_resource_registered
-- bugfix for custom delimiter at extends resource and {extends} tag
-
-01/05/2010
-- bugfix sha1() calculations at extends resource and some general improvments on sha1() handling
-
-
-01/03/2010
-- internal change on building cache files
-
-01/02/2010
-- update cached_timestamp at the template object after cache file is written to avoid possible side effects
-- use internally always SMARTY_CACHING_LIFETIME_* constants
-
-01/01/2010
-- bugfix for obtaining plugins which must be included (related to change of 12/30/2009)
-- bugfix for {php} tag (trow an exception if allow_php_tag = false)
-
-12/31/2009
-- optimization of generated code for doublequoted strings containing variables
-- rewrite of {function} tag handling
-  - can now be declared in an external subtemplate
-  - can contain nocache sections (nocache_hash handling)
-  - can be called in noccache sections (nocache_hash handling)
-  - new {call..} tag to call template functions with a variable name {call name=$foo}
-- fixed nocache_hash handling in merged compiled templates
-
-12/30/2009
-- bugfix for plugins defined in the script as smarty_function_foo
-
-12/29/2009
-- use sha1() for filepath encoding
-- updates on nocache_hash handling
-- internal change on merging some data
-- fixed cache filename for custom resources
-
-12/28/2009
-- update for security fixes
-- make modifier plugins always trusted
-- fixed bug loading modifiers in child template at template inheritance
-
-12/27/2009
---- this is a major update with a couple of internal changes ---
-- new config file lexer/parser (thanks to Thue Jnaus Kristensen)
-- template lexer/parser fixes for PHP and {literal} handing (thanks to Thue Jnaus Kristensen)
-- fix on registered plugins with different type but same name
-- rewrite of plugin handling (optimized execution speed)
-- closed a security hole regarding PHP code injection into cache files
-- fixed bug in clear cache handling
-- Renamed a couple of internal classes
-- code cleanup for merging compiled templates
-- couple of runtime optimizations (still not all done)
-- update of getCachedTimestamp()
-- fixed bug on modifier plugins at nocache output
-
-12/19/2009
-- bugfix on comment lines in config files
-
-12/17/2009
-- bugfix of parent/global variable update at included/merged subtemplates
-- encode final template filepath into filename of compiled and cached files
-- fixed {strip} handling in auto literals
-
-12/16/2009
-- update of changelog
-- added {include file='foo.tpl' inline}  inline option to merge compiled code of subtemplate into the calling template
-
-12/14/2009
-- fixed sideefect of last modification (objects in array index did not work anymore)
-
-12/13/2009
-- allow boolean negation ("!") as operator on variables outside {if} tag
-
-12/12/2009
-- bugfix on single quotes inside {function} tag
-- fix short append/prepend attributes in {block} tags
-
-12/11/2009
-- bugfix on clear_compiled_tpl (avoid possible warning)
-
-12/10/2009
-- bugfix on {function} tags and template inheritance
-
-12/05/2009
-- fixed problem when a cached file was fetched several times
-- removed unneeded lexer code
-
-12/04/2009
-- added max attribute to for loop
-- added security mode allow_super_globals
-
-12/03/2009
-- template inheritance: child templates can now call functions defined by the {function} tag in the parent template
-- added {for $foo = 1 to 5 step 2}  syntax
-- bugfix for {$foo.$x.$y.$z}
-
-12/01/2009
-- fixed parsing of names of special formated tags like if,elseif,while,for,foreach
-- removed direct access to constants in templates because of some syntax problems
-- removed cache resource plugin for mysql from the distribution
-- replaced most hard errors (exceptions) by softerrors(trigger_error) in plugins
-- use $template_class property for template class name when compiling {include},{eval} and {extends} tags
-
-11/30/2009
-- map 'true' to SMARTY_CACHING_LIFETIME_CURRENT for the $smarty->caching parameter
-- allow {function} tags within {block} tags
-
-11/28/2009
-- ignore compile_id at debug template
-- added direct access to constants in templates
-- some lexer/parser optimizations
-
-11/27/2009
-- added cache resource MYSQL plugin
-
-11/26/2009
-- bugfix on nested doublequoted strings
-- correct line number on unknown tag error message
-- changed {include} compiled code
-- fix on checking dynamic varibales with error_unassigned = true
-
-11/25/2009
-- allow the following writing for boolean: true, TRUE, True, false, FALSE, False
-- {strip} tag functionality rewritten
-
-11/24/2009
-- bugfix for $smarty->config_overwrite = false
-
-11/23/2009
-- suppress warnings on unlink caused by race conditions
-- correct line number on unknown tag error message
-
-------- beta 5
-11/23/2009
-- fixed configfile parser for text starting with a numeric char
-- the default_template_handler_func may now return a filepath to a template source
-
-11/20/2009
-- bugfix for empty config files
-- convert timestamps of registered resources to integer
-
-11/19/2009
-- compiled templates are no longer touched with the filemtime of template source
-
-11/18/2009
-- allow integer as attribute name in plugin calls
-
-------- beta 4
-11/18/2009
-- observe umask settings when setting file permissions
-- avoide unneeded cache file creation for subtemplates which did occur in some situations
-- make $smarty->_current_file available during compilation for Smarty2 BC
-
-11/17/2009
-- sanitize compile_id and cache_id (replace illegal chars with _)
-- use _dir_perms and _file_perms properties at file creation
-- new constant SMARTY_RESOURCE_DATE_FORMAT (default '%b %e, %Y') which is used as default format in modifier date_format
-- added {foreach $array as $key=>$value} syntax
-- renamed extend tag and resource to extends: {extends file='foo.tol'} , $smarty->display('extends:foo.tpl|bar.tpl);
-- bugfix cycle plugin
-
-11/15/2009
-- lexer/parser optimizations on quoted strings
-
-11/14/2009
-- bugfix on merging compiled templates when source files got removed or renamed.
-- bugfix modifiers on registered object tags
-- fixed locaion where outputfilters are running
-- fixed config file definitions at EOF
-- fix on merging compiled templates with nocache sections in nocache includes
-- parser could run into a PHP error on wrong file attribute
-
-11/12/2009
-- fixed variable filenames in {include_php} and {insert}
-- added scope to Smarty variables in the {block} tag compiler
-- fix on nocache code in child {block} tags
-
-11/11/2009
-- fixed {foreachelse}, {forelse}, {sectionelse} compiled code at nocache variables
-- removed checking for reserved variables
-- changed debugging handling
-
-11/10/2009
-- fixed preg_qoute on delimiters
-
-11/09/2009
-- lexer/parser bugfix
-- new SMARTY_SPL_AUTOLOAD constant to control the autoloader option
-- bugfix for {function} block tags in included templates
-
-11/08/2009
-- fixed alphanumeric array index
-- bugfix on complex double quoted strings
-
-11/05/2009
-- config_load method can now be called on data and template objects
-
-11/04/2009
-- added typecasting support for template variables
-- bugfix on complex indexed special Smarty variables
-
-11/03/2009
-- fixed parser error on objects with special smarty vars
-- fixed file dependency for {incude} inside {block} tag
-- fixed not compiling on non existing compiled templates when compile_check = false
-- renamed function names of autoloaded Smarty methods to Smarty_Method_....
-- new security_class property (default is Smarty_Security)
-
-11/02/2009
-- added neq,lte,gte,mod as aliases to if conditions
-- throw exception on illegal Smarty() constructor calls
-
-10/31/2009
-- change of filenames in sysplugins folder for internal spl_autoload function
-- lexer/parser changed for increased compilation speed
-
-10/27/2009
-- fixed missing quotes in include_php.php
-
-10/27/2009
-- fixed typo in method.register_resource
-- pass {} through as literal
-
-10/26/2009
-- merge only compiled subtemplates into the compiled code of the main template
-
-10/24/2009
-- fixed nocache vars at internal block tags
-- fixed merging of recursive includes
-
-10/23/2009
-- fixed nocache var problem
-
-10/22/2009
-- fix trimwhitespace outputfilter parameter
-
-10/21/2009
-- added {$foo++}{$foo--} syntax
-- buxfix changed PHP "if (..):" to "if (..){" because of possible bad code when concenating PHP tags
-- autoload Smarty internal classes
-- fixed file dependency for config files
-- some code optimizations
-- fixed function definitions on some autoloaded methods
-- fixed nocache variable inside if condition of {if} tag
-
-10/20/2009
-- check at compile time for variable filter to improve rendering speed if no filter is used
-- fixed bug at combination of {elseif} tag and {...} in double quoted strings of static class parameter
-
-10/19/2009
-- fixed compiled template merging on variable double quoted strings as name
-- fixed bug in caching mode 2 and cache_lifetime -1
-- fixed modifier support on block tags
-
-10/17/2009
-- remove ?>\n<?php and ?><?php sequences from compiled template
-
-10/15/2009
-- buxfix on assigning array elements inside templates
-- parser bugfix on array access
-
-10/15/2009
-- allow bit operator '&' inside {if} tag
-- implementation of ternary operator
-
-10/13/2009
-- do not recompile evaluated templates if reused just with other data
-- recompile config files when config properties did change
-- some lexer/parser otimizations
-
-10/11/2009
-- allow {block} tags inside included templates
-- bugfix for resource plugins in Smarty2 format
-- some optimizations of internal.template.php
-
-10/11/2009
-- fixed bug when template with same name is used with different data objects
-- fixed bug with double quoted name attribute at {insert} tag
-- reenabled assign_by_ref and append_by_ref methods
-
-10/07/2009
-- removed block nesting checks for {capture}
-
-10/05/2009
-- added support of "isinstance" to {if} tag
-
-10/03/2009
-- internal changes to improve performance
-- fix registering of filters for classes
-
-10/01/2009
-- removed default timezone setting
-- reactivated PHP resource for simple PHP templates. Must set allow_php_templates = true to enable
-- {PHP} tag can be enabled by allow_php_tag = true
-
-09/30/2009
-- fixed handling template_exits method for all resource types
-- bugfix for other cache resources than file
-- the methods assign_by_ref is now wrapped to assign, append_by_ref to append
-- allow arrays of variables pass in display, fetch and createTemplate calls
-  $data = array('foo'=>'bar','foo2'=>'blar');
-  $smarty->display('my.tpl',$data);
-
-09/29/2009
-- changed {php} tag handling
-- removed support of Smarty::instance()
-- removed support of PHP resource type
-- improved execution speed of {foreach} tags
-- fixed bug in {section} tag
-
-09/23/2009
-- improvements and bugfix on {include} tag handling
-NOTICE: existing compiled template and cache files must be deleted
-
-09/19/2009
-- replace internal "eval()" calls by "include" during rendering process
-- speed improvment for templates which have included subtemplates
-    the compiled code of included templates is merged into the compiled code of the parent template
-- added logical operator "xor" for {if} tag
-- changed parameter ordering for Smarty2 BC
-    fetch($template, $cache_id = null, $compile_id = null, $parent = null)
-    display($template, $cache_id = null, $compile_id = null, $parent = null)
-    createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
-- property resource_char_set is now replaced by constant SMARTY_RESOURCE_CHAR_SET
-- fixed handling of classes in registered blocks
-- speed improvement of lexer on text sections
-
-09/01/2009
-- dropped nl2br as plugin
-- added '<>' as comparission operator in {if} tags
-- cached caching_lifetime property to cache_liftime for backward compatibility with Smarty2.
-  {include} optional attribute is also now cache_lifetime
-- fixed trigger_error method (moved into Smarty class)
-- version is now  Beta!!!
-
-
-08/30/2009
-- some speed optimizations on loading internal plugins
-
-
-08/29/2009
-- implemented caching of registered Resources
-- new property 'auto_literal'. if true(default)  '{ ' and ' }' interpreted as literal, not as Smarty delimiter
-
-
-08/28/2009
-- Fix on line breaks inside {if} tags
-
-08/26/2009
-- implemented registered resources as in Smarty2. NOTE: caching does not work yet
-- new property 'force_cache'. if true it forces the creation of a new cache file
-- fixed modifiers on arrays
-- some speed optimization on loading internal classes
-
-
-08/24/2009
-- fixed typo in lexer definition for '!==' operator
-- bugfix - the ouput of plugins was not cached
-- added global variable SCRIPT_NAME
-
-08/21/2009
-- fixed problems whitespace in conjuction with custom delimiters
-- Smarty tags can now be used as value anywhere
-
-08/18/2009
-- definition of template class name moded in internal.templatebase.php
-- whitespace parser changes
-
-08/12/2009
-- fixed parser problems
-
-08/11/2009
-- fixed parser problems with custom delimiter
-
-08/10/2009
-- update of mb support in plugins
-
-
-08/09/2009
-- fixed problems with doublequoted strings at name attribute of {block} tag
-- bugfix at scope attribute of {append} tag
-
-08/08/2009
-- removed all internal calls of Smarty::instance()
-- fixed code in double quoted strings
-
-08/05/2009
-- bugfix mb_string support
-- bugfix of \n.\t etc in double quoted strings
-
-07/29/2009
-- added syntax for variable config vars  like  #$foo#
-
-07/28/2009
-- fixed parsing of $smarty.session vars containing objects
-
-07/22/2009
-- fix of "$" handling in double quoted strings
-
-07/21/2009
-- fix that {$smarty.current_dir} return correct value within {block} tags.
-
-07/20/2009
-- drop error message on unmatched {block} {/block} pairs
-
-07/01/2009
-- fixed smarty_function_html_options call in plugin function.html_select_date.php (missing ,)
-
-06/24/2009
-- fixed smarty_function_html_options call in plugin function.html_select_date.php
-
-06/22/2009
-- fix on \n and spaces inside smarty tags
-- removed request_use_auto_globals propert as it is no longer needed because Smarty 3 will always run under PHP 5
-
-
-06/18/2009
-- fixed compilation of block plugins when caching enabled
-- added $smarty.current_dir  which returns the current working directory
-
-06/14/2009
-- fixed array access on super globals
-- allow smarty tags within xml tags
-
-06/13/2009
-- bugfix at extend resource: create unique files for compiled template and cache for each combination of template files
-- update extend resource to handle appen and prepend block attributes
-- instantiate classes of plugins instead of calling them static
-
-06/03/2009
-- fixed repeat at block plugins
-
-05/25/2009
-- fixed problem with caching of compiler plugins
-
-05/14/2009
-- fixed directory separator handling
-
-05/09/2009
-- syntax change for stream variables
-- fixed bug when using absolute template filepath and caching
-
-05/08/2009
-- fixed bug of {nocache}  tag in included templates
-
-05/06/2009
-- allow that plugins_dir folder names can end without directory separator
-
-05/05/2009
-- fixed E_STRICT incompabilities
-- {function} tag bug fix
-- security policy definitions have been moved from plugins folder to file Security.class.php in libs folder
-- added allow_super_global configuration to security
-
-04/30/2009
-- functions defined with the {function} tag now always have global scope
-
-04/29/2009
-- fixed problem with directory setter methods
-- allow that cache_dir can end without directory separator
-
-04/28/2009
-- the {function} tag can no longer overwrite standard smarty tags
-- inherit functions defined by the {fuction} tag into subtemplates
-- added {while <statement>} sytax to while tag
-
-04/26/2009
-- added trusted stream checking to security
-- internal changes at file dependency check for caching
-
-04/24/2009
-- changed name of {template} tag to {function}
-- added new {template} tag
-
-04/23/2009
-- fixed access of special smarty variables from included template
-
-04/22/2009
-- unified template stream syntax with standard Smarty resource syntax  $smarty->display('mystream:mytemplate')
-
-04/21/2009
-- change of new style syntax for forach. Now:  {foreach $array as $var}  like in PHP
-
-04/20/2009
-- fixed "$foo.bar  ..." variable replacement in double quoted strings
-- fixed error in {include} tag with variable file attribute
-
-04/18/2009
-- added stream resources  ($smarty->display('mystream://mytemplate'))
-- added stream variables  {$mystream:myvar}
-
-04/14/2009
-- fixed compile_id handling on {include} tags
-- fixed append/prepend attributes in {block} tag
-- added  {if  'expression' is in 'array'}  syntax
-- use crc32 as hash for compiled config files.
-
-04/13/2009
-- fixed scope problem with parent variables when appending variables within templates.
-- fixed code for {block} without childs (possible sources for notice errors removed)
-
-04/12/2009
-- added append and prepend attribute to {block} tag
-
-04/11/2009
-- fixed variables in 'file' attribute of {extend} tag
-- fixed problems in modifiers (if mb string functions not present)
-
-04/10/2009
-- check if mb string functions available otherwise fallback to normal string functions
-- added global variable scope SMARTY_GLOBAL_SCOPE
-- enable 'variable' filter by default
-- fixed {$smarty.block.parent.foo}
-- implementation of a 'variable' filter as replacement for default modifier
-
-04/09/2009
-- fixed execution of filters defined by classes
-- compile the always the content of {block} tags to make shure that the filters are running over it
-- syntax corrections on variable object property
-- syntax corrections on array access in dot syntax
-
-04/08/2009
-- allow variable object property
-
-04/07/2009
-- changed variable scopes to SMARTY_LOCAL_SCOPE, SMARTY_PARENT_SCOPE, SMARTY_ROOT_SCOPE to avoid possible conflicts with user constants
-- Smarty variable global attribute replaced with scope attribute
-
-04/06/2009
-- variable scopes LOCAL_SCOPE, PARENT_SCOPE, ROOT_SCOPE
-- more getter/setter methods
-
-04/05/2009
-- replaced new array looping syntax {for $foo in $array} with {foreach $foo in $array} to avoid confusion
-- added append array for short form of assign  {$foo[]='bar'} and allow assignments to nested arrays {$foo['bla']['blue']='bar'}
-
-04/04/2009
-- make output of template default handlers cachable and save compiled source
-- some fixes on yesterdays update
-
-04/03/2006
-- added registerDefaultTemplateHandler method and functionallity
-- added registerDefaultPluginHandler method and functionallity
-- added {append} tag to extend Smarty array variabled
-
-04/02/2009
-- added setter/getter methods
-- added $foo@first and $foo@last properties at {for} tag
-- added $set_timezone (true/false) property to setup optionally the default time zone
-
-03/31/2009
-- bugfix smarty.class and internal.security_handler
-- added compile_check configuration
-- added setter/getter methods
-
-03/30/2009
-- added all major setter/getter methods
-
-03/28/2009
-- {block} tags can be nested now
-- md5 hash function replace with crc32 for speed optimization
-- file order for exted resource inverted
-- clear_compiled_tpl and clear_cache_all will not touch .svn folder any longer
-
-03/27/2009
-- added extend resource
-
-03/26/2009
-- fixed parser not to create error on `word` in double quoted strings
-- allow PHP  array(...)
-- implemented  $smarty.block.name.parent to access parent block content
-- fixed smarty.class
-
-
-03/23/2009
-- fixed {foreachelse} and {forelse} tags
-
-03/22/2009
-- fixed possible sources for notice errors
-- rearrange SVN into distribution and development folders
-
-03/21/2009
-- fixed exceptions in function plugins
-- fixed notice error in Smarty.class.php
-- allow chained objects to span multiple lines
-- fixed error in modifiers
-
-03/20/2009
-- moved /plugins folder into /libs folder
-- added noprint modifier
-- autoappend a directory separator if the xxxxx_dir definition have no trailing one
-
-03/19/2009
-- allow array definition as modifier parameter
-- changed modifier to use multi byte string funktions.
-
-03/17/2009
-- bugfix
-
-03/15/2009
-- added {include_php} tag for BC
-- removed @ error suppression
-- bugfix fetch did always repeat output of first call when calling same template several times
-- PHPunit tests extended
-
-03/13/2009
-- changed block syntax to be Smarty like  {block:titel} -> {block name=titel}
-- compiling of {block} and {extend} tags rewriten for better performance
-- added special Smarty variable block  ($smarty.block.foo} returns the parent definition of block foo
-- optimization of {block} tag compiled code.
-- fixed problem with escaped double quotes in double quoted strings
-
-03/12/2009
-- added support of template inheritance by {extend } and {block } tags.
-- bugfix comments within literals
-- added scope attribuie to {include} tag
-
-03/10/2009
-- couple of bugfixes and improvements
-- PHPunit tests extended
-
-03/09/2009
-- added support for global template vars.  {assign_global...}  $smarty->assign_global(...)
-- added direct_access_security
-- PHPunit tests extended
-- added missing {if} tag conditions like "is div by" etc.
-
-03/08/2009
-- splitted up the Compiler class to make it easier to use a coustom compiler
-- made default plugins_dir relative to Smarty root and not current working directory
-- some changes to make the lexer parser better configurable
-- implemented {section} tag for Smarty2 BC
-
-03/07/2009
-- fixed problem with comment tags
-- fixed problem with #xxxx in double quoted string
-- new {while} tag implemented
-- made lexer and paser class configurable as $smarty property
-- Smarty method get_template_vars implemented
-- Smarty method get_registered_object implemented
-- Smarty method trigger_error implemented
-- PHPunit tests extended
-
-03/06/2009
-- final changes on config variable handling
-- parser change - unquoted strings will by be converted into single quoted strings
-- PHPunit tests extended
-- some code cleanup
-- fixed problem on catenate strings with expression
-- update of count_words modifier
-- bugfix on comment tags
-
-
-03/05/2009
-- bugfix on <?xml...> tag with caching enabled
-- changes on exception handling (by Monte)
-
-03/04/2009
-- added support for config variables
-- bugfix on <?xml...> tag
-
-03/02/2009
-- fixed unqouted strings within modifier parameter
-- bugfix parsing of mofifier parameter
-
-03/01/2009
-- modifier chaining works now as in Smarty2
-
-02/28/2009
-- changed handling of unqouted strings
-
-02/26/2009
-- bugfix
-- changed $smarty.capture.foo to be global for Smarty2 BC.
-
-02/24/2009
-- bugfix {php} {/php} tags for backward compatibility
-- bugfix for expressions on arrays
-- fixed usage of "null" value
-- added $smarty.foreach.foo.first and $smarty.foreach.foo.last
-
-02/06/2009
-- bugfix for request variables without index  for example $smarty.get
-- experimental solution for variable functions in static class
-
-02/05/2009
-- update of popup plugin
-- added config variables to template parser (load config functions still missing)
-- parser bugfix for empty quoted strings
-
-02/03/2009
-- allow array of objects as static class variabales.
-- use htmlentities at source output at template errors.
-
-02/02/2009
-- changed search order on modifiers to look at plugins folder first
-- parser bug fix for modifier on array elements  $foo.bar|modifier
-- parser bug fix on single quoted srings
-- internal: splitted up compiler plugin files
-
-02/01/2009
-- allow method chaining on static classes
-- special Smarty variables  $smarty.... implemented
-- added {PHP} {/PHP} tags for backward compatibility
-
-01/31/2009
-- added {math} plugin for Smarty2 BC
-- added template_exists method
-- changed Smarty3 method enable_security() to enableSecurity() to follow camelCase standards
-
-01/30/2009
-- bugfix in single quoted strings
-- changed syntax for variable property access from $foo:property to $foo@property because of ambiguous syntax at modifiers
-
-01/29/2009
-- syntax for array definition changed from (1,2,3) to [1,2,3] to remove ambiguous syntax
-- allow  {for $foo in [1,2,3]} syntax
-- bugfix in double quoted strings
-- allow <?xml...?> tags in template even if short_tags are enabled
-
-01/28/2009
-- fixed '!==' if condition.
-
-01/28/2009
-- added support of {strip} {/strip} tag.
-
-01/27/2009
-- bug fix on backticks in double quoted strings at objects
-
-01/25/2009
-- Smarty2 modfiers added to SVN
-
-01/25/2009
-- bugfix allow arrays at object properties in Smarty syntax
-- the template object is now passed as additional parameter at plugin calls
-- clear_compiled_tpl method completed
-
-01/20/2009
-- access to class constants implemented  ( class::CONSTANT )
-- access to static class variables implemented ( class::$variable )
-- call of static class methods implemented ( class::method() )
-
-01/16/2009
-- reallow leading _ in variable names  {$_var}
-- allow array of objects  {$array.index->method()} syntax
-- finished work on clear_cache and clear_cache_all methods
-
-01/11/2009
-- added support of {literal} tag
-- added support of {ldelim} and {rdelim} tags
-- make code compatible to run with E_STRICT error setting
-
-01/08/2009
-- moved clear_assign and clear_all_assign to internal.templatebase.php
-- added assign_by_ref, append and append_by_ref methods
-
-01/02/2009
-- added load_filter method
-- fished work on filter handling
-- optimization of plugin loading
-
-12/30/2008
-- added compiler support of registered object
-- added backtick support in doubled quoted strings for backward compatibility
-- some minor bug fixes and improvments
-
-12/23/2008
-- fixed problem of not working "not" operator in if-expressions
-- added handling of compiler function plugins
-- finished work on (un)register_compiler_function method
-- finished work on (un)register_modifier method
-- plugin handling from plugins folder changed for modifier plugins
-  deleted - internal.modifier.php
-- added modifier chaining to parser
-
-12/17/2008
-- finished (un)register_function method
-- finished (un)register_block method
-- added security checking for PHP functions in PHP templates
-- plugin handling from plugins folder rewritten
-  new - internal.plugin_handler.php
-  deleted - internal.block.php
-  deleted - internal.function.php
-- removed plugin checking from security handler
-
-12/16/2008
-
-- new start of this change_log file
diff --git a/libraries/Smarty/COMPOSER_RELEASE_NOTES.txt b/libraries/Smarty/COMPOSER_RELEASE_NOTES.txt
deleted file mode 100644
index 0644719c9..000000000
--- a/libraries/Smarty/COMPOSER_RELEASE_NOTES.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-Starting with Smarty 3.1.21 Composer has been configured to load the packages from github.
-
-*******************************************************************************
-*                                                                             *
-*  NOTE: Because of this change you must clear your local composer cache with *
-*                 the "composer clearcache" command                           *
-*                                                                             *
-*******************************************************************************
-
-To get the latest stable version use
-    "require": {
-        "smarty/smarty": "~3.1"
-    }
-in your composer.json file.
-
-To get the trunk version use
-    "require": {
-        "smarty/smarty": "~3.1@dev"
-    }
-
-The "smarty/smarty" package will start at libs/....   subfolder.
-
-To retrieve the development and documentation folders add
-    "require-dev": {
-        "smarty/smarty-dev": "~3.1@dev"
-    }
-
-If you are using (include) the composer generated autoloader.php which is located
-in the /vendor folder it is no longer needed to require the Smarty.class.php file.
\ No newline at end of file
diff --git a/libraries/Smarty/INHERITANCE_RELEASE_NOTES.txt b/libraries/Smarty/INHERITANCE_RELEASE_NOTES.txt
deleted file mode 100644
index 67936a81a..000000000
--- a/libraries/Smarty/INHERITANCE_RELEASE_NOTES.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-3.1.3"
-New tags for inheritance parent and chilD
-{parent}  == {$smarty.block.parent}
-{child}  == {$smarty.block.child}
-Both tags support the assign attribute like
-{child assign=foo}
-
-3.1.31
-New tags for inheritance parent and child
-{block_parent}  == {$smarty.block.parent}
-{block_child}  == {$smarty.block.child}
-
-Since 3.1.28 you can mix inheritance by extends resource with the {extends} tag.
-A template called by extends resource can extend a subtemplate or chain buy the {extends} tag.
-Since 3.1.31 this feature can be turned off by setting the new Smarty property Smarty::$extends_recursion to false.
-
-3.1.28
-Starting with version 3.1.28 template inheritance is no longer a compile time process.
-All {block} tag parent/child relations are resolved at run time.
-This does resolve all known existing restrictions (see below).
-
-The $smarty::$inheritance_merge_compiled_includes property has been removed.
-Any access to it is ignored.
-
-New features:
-
-Any code outside root {block} tags in child templates is now executed but any output will be ignored.
-
-   {extends 'foo.tpl'}
-   {$bar = 'on'}           // assigns variable $bar seen in parent templates
-   {block 'buh'}{/block}
-
-   {extends 'foo.tpl'}
-   {$bar}           // the output of variable bar is ignored
-   {block 'buh'}{/block}
-
-{block} tags can be dynamically en/disabled by conditions.
-
-   {block 'root'}
-      {if $foo}
-         {block 'v1'}
-             ....
-         {/block}
-      {else}
-         {block 'v1'}
-             ....
-         {/block}
-      {/if}
-   {/block}
-
-{block} tags can have variable names.
-
-   {block $foo}
-        ....
-   {/block}
-
-Starting with 3.1.28 you can mix inheritance by extends resource with the {extends} tag.
-A template called by extends resource can extend a subtemplate or chain buy the {extends} tag.
-
-NOTE There is a BC break. If you used the extends resource {extends} tags have been ignored.
-
-THE FOLLOWING RESTRICTIONS ARE NO LONGER EXISTING:
-In Smarty 3.1 template inheritance is a compile time process. All the extending of {block} tags
-is done at compile time and the parent and child templates are compiled in a single compiled template.
-{include} subtemplate could also {block} tags. Such subtemplate could not compiled by it's own because
-it could be used in other context where the {block} extended with a different result. For that reasion
-the compiled code of {include} subtemplates gets also merged in compiled inheritance template.
-
-Merging the code into a single compile template has some drawbacks.
-1. You could not use variable file names in {include} Smarty would use the {include} of compilation time.
-2. You could not use individual compile_id in {include}
-3. Separate caching of subtemplate was not possible
-4. Any change of the template directory structure between calls was not necessarily seen.
-
-Starting with 3.1.15 some of the above conditions got checked and resulted in an exception. It turned out
-that a couple of users did use some of above and now got exceptions.
-
-To resolve this starting with 3.1.16 there is a new configuration parameter $inheritance_merge_compiled_includes.
-For most backward compatibility its default setting is true.
-With this setting all {include} subtemplate will be merge into the compiled inheritance template, but the above cases
-could be rejected by exception.
-
-
-If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged.You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option.
-{include file='foo.bar' inline}
-
-1. In case of a variable file name like {include file=$foo inline} you must use the variable in a compile_id  $smarty->compile_id = $foo;
-2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the   global compile_id as well  $smarty->compile_id = $bar;
-3. If call templates with different template_dir configurations and a parent could same named child template from different folders
-   you must make the folder name part of the compile_id.
-
diff --git a/libraries/Smarty/LICENSE b/libraries/Smarty/LICENSE
deleted file mode 100644
index 595e5993d..000000000
--- a/libraries/Smarty/LICENSE
+++ /dev/null
@@ -1,179 +0,0 @@
-Smarty: the PHP compiling template engine
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 3.0 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- See the GNU Lesser General Public License below for more details.
-
-
-                   GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
-   document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of this
-       License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version.
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/libraries/Smarty/NEW_FEATURES.txt b/libraries/Smarty/NEW_FEATURES.txt
deleted file mode 100644
index 0b2cae1e0..000000000
--- a/libraries/Smarty/NEW_FEATURES.txt
+++ /dev/null
@@ -1,291 +0,0 @@
-
-
-This file contains a brief description of new features which have been added to Smarty 3.1
-
-Smarty 3.1.33-dev
-    Variable capture name in Smarty special variable
-    ================================================
-    {$smarty.capture.$foo} can now be used to access the content of a named
-     capture block
-
-Smarty 3.1.32
-    New tags for inheritance parent and child
-    =========================================
-    {parent}  == {$smarty.block.parent}
-    {child}  == {$smarty.block.child}
-    Both tags support the assign attribute like
-    {child assign=foo}
-
-    Deprecate functions Smarty::muteExpectedErrors() and Smarty::unmuteExpectedErrors()
-    ===================================================================================
-    These functions to start a special error handler are no longer needed as Smarty does
-    no longer use error suppression like @filemtime().
-    For backward compatibility the functions still can be called.
-
-    Using literals containing Smarty's left and right delimiter
-    ===========================================================
-    New Methods
-        $smarty->setLiterals(array $literals)
-        $smarty->addLiterals(array $literals)
-    to define literals  containing Smarty delimiter. This can avoid the need for extreme usage
-    of {literal} {/literal} tags.
-    A) Treat '{{' and '}}' as literal
-    If Smarty::$auto_literal is enabled
-        {{ foo }}
-    will be treated now as literal. (This does apply for any number of delimiter repeatations).
-    However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag.
-    If you use
-         $smarty->setLiterals(array('{{','}}'));
-         {{foo}}  is now a literal as well.
-    NOTE: In the last example nested Smarty tags starting with '{{' or ending with '}}' will not
-    work any longer, but this should be very very raw occouring restriction.
-    B) Example 2
-    Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals 
-          $smarty->setLiterals(array('<--','-->'));
-
-
-    The capture buffers can now be accessed as array
-    ================================================
-    {capture name='foo'}
-        bah
-     {\capture}
-     {capture name='buh'}
-       blar
-     {\capture}
-     {foreach $smarty.capture as $name => $buffer}
-        ....
-      {/foreach}
-
-Smarty 3.1.31
-    New tags for inheritance parent and child
-    =========================================
-    {block_parent}  == {$smarty.block.parent}
-    {block_child}  == {$smarty.block.child}
-
-Smarty 3.1.30
-
-    Loop optimization {foreach} and {section}
-    =========================================
-    Smarty does optimize the {foreach} and {section} loops by removing code for not needed loop
-    properties.
-    The compiler collects needed properties by scanning the current template for $item@property,
-    $smarty.foreach.name.property and $smarty.section.name.property.
-    The compiler does not know if additional properties will be needed outside the current template scope.
-    Additional properties can be generated by adding them with the property attribute.
-
-    Example:
-        index.tpl
-        {foreach $from as $item properties=[iteration, index]}
-            {include 'sub.tpl'}
-            {$item.total}
-        {/foreach}
-
-        sub.tpl
-        {$item.index} {$item.iteration} {$item.total}
-
-    In above example code for the 'total' property is automatically generated as $item.total is used in
-    index.tpl. Code for 'iteration' and 'index' must be added with properties=[iteration, index].
-
-    New tag {make_nocache}
-    ======================
-    Syntax: {make_nocache $foo}
-
-    This tag makes a variable which does exists normally only while rendering the compiled template
-    available in the cached template for use in not cached expressions.
-
-    Expample:
-        {foreach from=$list item=item}
-            <li>{$item.name} {make_nocache $item}{if $current==$item.id} ACTIVE{/if}</li>
-        {/foreach}
-
-    The {foreach} loop is rendered while processing the compiled template, but $current is a nocache
-    variable. Normally the {if $current==$item.id} would fail as the $item variable is unknown in the     cached template. {make_nocache $item} does make the current $item value known in thee cached template.
-
-    {make_nocache} is ignored when caching is disabled or the variable does exists as nocache variable.
-
-    NOTE: if the variable value does contain objects these must have the __set_state method implemented.
-
-
-    Scope Attributes
-    ================
-    The scope handling has been updated to cover all cases of variable assignments in templates.
-
-    The tags {assign}, {append} direct assignments like {$foo = ...}, {$foo[...]= ...} support
-    the following optional scope attributes:
-    scope='parent'    - the variable will be assigned in the current template and if the template
-                        was included by {include} the calling template
-    scope='tpl_root'  - the variable will be assigned in the outermost root template called by $smarty->display()
-                        or $smarty->fetch() and is bubbled up all {include} sub-templates to the current template.
-    scope='smarty'    - the variable will be assigned in the Smarty object and is bubbled up all {include} sub-templates
-                        to the current template.
-    scope='global'    - the variable will be assigned as Smarty object global variable and is bubbled up all {include}
-                        sub-templates to the current template.
-    scope='root'      - the variable will be assigned if a data object was used for variable definitions in the data
-                        object or in the Smarty object otherwise and is bubbled up all {include} sub-templates to the
-                        current template.
-    scope='local'     - this scope has only a meaning if the tag is called within a template {function}.
-                        The variable will be assigned in the local scope of the template function and the
-                        template which did call the template function.
-
-
-    The {config_load} tag supports all of the above except the global scope.
-
-    The scope attribute can be used also with the {include} tag.
-    Supported scope are parent, tpl_root, smarty, global and root.
-    A scope used together with the {include} tag will cause that with some exceptions any variable
-    assignment within that sub-template will update/assign the variable in other scopes according
-    to the above rules. It does include also variables assigned by plugins, tags supporting the assign=foo     attribute and direct assignments in {if} and {while} like {if $foo=$bar}.
-    Excluded are the key and value variables of {foreach}, {for} loop variables , variables passed by attributes
-    in {include} and direct increments/decrements like {$foo++}, {$foo--}
-
-    Note: The scopes should be used only to the extend really need. If a variable value assigned in an included
-          sub-template should be returned to the calling sub-template just use {$foo='bar' scope='parent'}.
-          Use scopes only with variables for which it's realy needed. Avoid general scope settings with the
-          {include} tag as it can have a performance impact.
-
-     The {assign}, {append}, {config_load} and {$foo...=...} tags have a new option flag 'noscope'.Thi
-     Example: {$foo='bar' noscope}  This will assign $foo only in the current template and any scope settings
-               at {include} is ignored.
-
-
-    Caching
-    =======
-    Caching does now observe the template_dir setting and will create separate cache files if required
-
-    Compiled Templates
-    ==================
-    The template_dir setting is now encoded in the uid of the file name.
-    The content of the compiled template may depend on the template_dir search order
-    {include .... inline} is used or $smarty->merge_compiled_includes is enabled
-
-    APC
-    ===
-    If APC is enabled force an apc_compile_file() when compiled or cached template was updated
-
-Smarty 3.1.28
-
-    OPCACHE
-    =======
-    Smarty does now invalidate automatically updated and cleared compiled or cached template files in OPCACHE.
-    Correct operation is no longer dependent on OPCACHE configuration settings.
-
-    Template inheritance
-    ====================
-    Template inheritance is now processed in run time.
-    See the INHERITANCE_RELEASE_NOTES
-
-    Modifier regex_replace
-    ======================
-    An optional limit parameter was added
-
-    fetch() and display()
-    =====================
-    The fetch() and display() methods of the template object accept now optionally the same parameter
-    as the corresponding Smarty methods to get the content of another template.
-    Example:
-        $template->display();           Does display template of template object
-        $template->display('foo.tpl');  Does display template 'foo.bar'     
-        
-    File: resource
-    ==============
-    Multiple template_dir entries can now be selected  by a comma separated list of indices.
-    The template_dir array is searched in the order of the indices. (Could be used to change the default search order)
-    Example:
-        $smarty->display('[1],[0]foo.bar');
-
-    Filter support
-    ==============
-    Optional filter names
-      An optional filter name was added to $smarty->registerFilter(). It can be used to unregister a filter by name.
-      - $smarty->registerFilter('output', $callback, 'name');
-        $smarty->unregister('output', 'name');
-
-    Closures
-      $smarty->registerFilter() does now accept closures.
-      - $smarty->registerFilter('pre', function($source) {return $source;});
-      If no optional filter name was specified it gets the default name 'closure'.
-      If you register multiple closures register each with a unique filter name.
-      - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_1');
-      - $smarty->registerFilter('pre', function($source) {return $source;}, 'closure_2');
-
-
-Smarty 3.1.22
-
-    Namespace support within templates
-    ==================================
-    Within templates you can now use namespace specifications on:
-     - Constants                like    foo\bar\FOO
-     - Class names              like    foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo()
-     - PHP function names       like    foo\bar\baz()
-
-    Security
-    ========
-    - disable special $smarty variable -
-    The Smarty_Security class has the new property $disabled_special_smarty_vars.
-    It's an array which can be loaded with the $smarty special variable names like
-    'template_object', 'template', 'current_dir' and others which will be disabled.
-    Note: That this security check is performed at compile time.
-
-    - limit template nesting -
-    Property $max_template_nesting of Smarty_Security does set the maximum template nesting level.
-    The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded
-    an Exception will be thrown. The default setting is 0 which does disable this check.
-
-    - trusted static methods -
-   The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods.
-   It's an nested array of trusted class and method names.
-         Format:
-         array (
-                    'class_1' => array('method_1', 'method_2'), // allowed methods
-                    'class_2' => array(),                       // all methods of class allowed
-               )
-   To disable access for all methods of all classes set $trusted_static_methods = null;
-   The default value is an empty array() which does enables all methods of all classes, but for backward compatibility
-   the setting of $static_classes will be checked.
-   Note: That this security check is performed at compile time.
-
-    - trusted static properties -
-   The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties.
-   It's an nested array of trusted class and property names.
-         Format:
-         array (
-                    'class_1' => array('prop_1', 'prop_2'), // allowed properties listed
-                    'class_2' => array(),                   // all properties of class allowed
-                }
-   To disable access for all properties of all classes set $trusted_static_properties = null;
-   The default value is an empty array() which does enables all properties of all classes, but for backward compatibility
-   the setting of $static_classes will be checked.
-   Note: That this security check is performed at compile time.
-
-    - trusted constants .
-   The Smarty_Security class has the new property $trusted_constants to restrict access to constants.
-   It's an array of trusted constant names.
-         Format:
-         array (
-                    'SMARTY_DIR' , // allowed constant
-                }
-   If the array is empty (default) the usage of constants  can be controlled with the
-   Smarty_Security::$allow_constants property (default true)
-
-
-
-    Compiled Templates
-    ==================
-    Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html
-    property and creates different compiled templates files depending on the setting.
-
-    Same applies to config files and the $config_overwrite, $config_booleanize and
-    $config_read_hidden properties.
-
-    Debugging
-    =========
-    The layout of the debug window has been changed for better readability
-
-    New class constants
-        Smarty::DEBUG_OFF
-        Smarty::DEBUG_ON
-        Smarty::DEBUG_INDIVIDUAL
-    have been introduced for setting the $debugging property.
-
-    Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual debug window.
-
diff --git a/libraries/Smarty/README b/libraries/Smarty/README
deleted file mode 100644
index 9a71519bd..000000000
--- a/libraries/Smarty/README
+++ /dev/null
@@ -1,575 +0,0 @@
-Smarty 3.x
-
-Author: Monte Ohrt <monte at ohrt dot com >
-Author: Uwe Tews
-
-AN INTRODUCTION TO SMARTY 3
-
-NOTICE FOR 3.1 release:
-
-Please see the SMARTY_3.1_NOTES.txt file that comes with the distribution.
-
-NOTICE for 3.0.5 release:
-
-Smarty now follows the PHP error_reporting level by default. If PHP does not mask E_NOTICE and you try to access an unset template variable, you will now get an E_NOTICE warning. To revert to the old behavior:
-
-$smarty->error_reporting = E_ALL & ~E_NOTICE;
-
-NOTICE for 3.0 release:
-
-IMPORTANT: Some API adjustments have been made between the RC4 and 3.0 release.
-We felt it is better to make these now instead of after a 3.0 release, then have to
-immediately deprecate APIs in 3.1. Online documentation has been updated
-to reflect these changes. Specifically:
-
----- API CHANGES RC4 -> 3.0 ----
-
-$smarty->register->*
-$smarty->unregister->*
-$smarty->utility->*
-$samrty->cache->*
-
-Have all been changed to local method calls such as:
-
-$smarty->clearAllCache()
-$smarty->registerFoo()
-$smarty->unregisterFoo()
-$smarty->testInstall()
-etc.
-
-Registration of function, block, compiler, and modifier plugins have been
-consolidated under two API calls:
-
-$smarty->registerPlugin(...)
-$smarty->unregisterPlugin(...)
-
-Registration of pre, post, output and variable filters have been
-consolidated under two API calls:
-
-$smarty->registerFilter(...)
-$smarty->unregisterFilter(...)
-
-Please refer to the online documentation for all specific changes:
-
-http://www.smarty.net/documentation
-
-----
-
-The Smarty 3 API has been refactored to a syntax geared
-for consistency and modularity. The Smarty 2 API syntax is still supported, but
-will throw a deprecation notice. You can disable the notices, but it is highly
-recommended to adjust your syntax to Smarty 3, as the Smarty 2 syntax must run
-through an extra rerouting wrapper.
-
-Basically, all Smarty methods now follow the "fooBarBaz" camel case syntax. Also,
-all Smarty properties now have getters and setters. So for example, the property
-$smarty->cache_dir can be set with $smarty->setCacheDir('foo/') and can be
-retrieved with $smarty->getCacheDir().
-
-Some of the Smarty 3 APIs have been revoked such as the "is*" methods that were
-just duplicate functions of the now available "get*" methods.
-
-Here is a rundown of the Smarty 3 API:
-
-$smarty->fetch($template, $cache_id = null, $compile_id = null, $parent = null)
-$smarty->display($template, $cache_id = null, $compile_id = null, $parent = null)
-$smarty->isCached($template, $cache_id = null, $compile_id = null)
-$smarty->createData($parent = null)
-$smarty->createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
-$smarty->enableSecurity()
-$smarty->disableSecurity()
-$smarty->setTemplateDir($template_dir)
-$smarty->addTemplateDir($template_dir)
-$smarty->templateExists($resource_name)
-$smarty->loadPlugin($plugin_name, $check = true)
-$smarty->loadFilter($type, $name)
-$smarty->setExceptionHandler($handler)
-$smarty->addPluginsDir($plugins_dir)
-$smarty->getGlobal($varname = null)
-$smarty->getRegisteredObject($name)
-$smarty->getDebugTemplate()
-$smarty->setDebugTemplate($tpl_name)
-$smarty->assign($tpl_var, $value = null, $nocache = false)
-$smarty->assignGlobal($varname, $value = null, $nocache = false)
-$smarty->assignByRef($tpl_var, &$value, $nocache = false)
-$smarty->append($tpl_var, $value = null, $merge = false, $nocache = false)
-$smarty->appendByRef($tpl_var, &$value, $merge = false)
-$smarty->clearAssign($tpl_var)
-$smarty->clearAllAssign()
-$smarty->configLoad($config_file, $sections = null)
-$smarty->getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
-$smarty->getConfigVariable($variable)
-$smarty->getStreamVariable($variable)
-$smarty->getConfigVars($varname = null)
-$smarty->clearConfig($varname = null)
-$smarty->getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
-$smarty->clearAllCache($exp_time = null, $type = null)
-$smarty->clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
-
-$smarty->registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = array())
-
-$smarty->registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
-
-$smarty->registerFilter($type, $function_name)
-$smarty->registerResource($resource_type, $function_names)
-$smarty->registerDefaultPluginHandler($function_name)
-$smarty->registerDefaultTemplateHandler($function_name)
-
-$smarty->unregisterPlugin($type, $tag)
-$smarty->unregisterObject($object_name)
-$smarty->unregisterFilter($type, $function_name)
-$smarty->unregisterResource($resource_type)
-
-$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
-$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
-$smarty->testInstall()
-
-// then all the getters/setters, available for all properties. Here are a few:
-
-$caching = $smarty->getCaching();      // get $smarty->caching
-$smarty->setCaching(true);             // set $smarty->caching
-$smarty->setDeprecationNotices(false); // set $smarty->deprecation_notices
-$smarty->setCacheId($id);              // set $smarty->cache_id
-$debugging = $smarty->getDebugging();  // get $smarty->debugging
-
-
-FILE STRUCTURE
-
-The Smarty 3 file structure is similar to Smarty 2:
-
-/libs/
-  Smarty.class.php
-/libs/sysplugins/
-  internal.*
-/libs/plugins/
-  function.mailto.php
-  modifier.escape.php
-  ...
-
-A lot of Smarty 3 core functionality lies in the sysplugins directory; you do
-not need to change any files here. The /libs/plugins/ folder is where Smarty
-plugins are located. You can add your own here, or create a separate plugin
-directory, just the same as Smarty 2. You will still need to create your own
-/cache/, /templates/, /templates_c/, /configs/ folders. Be sure /cache/ and
-/templates_c/ are writable.
-
-The typical way to use Smarty 3 should also look familiar:
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-$smarty->assign('foo','bar');
-$smarty->display('index.tpl');
-
-
-However, Smarty 3 works completely different on the inside. Smarty 3 is mostly
-backward compatible with Smarty 2, except for the following items:
-
-*) Smarty 3 is PHP 5 only. It will not work with PHP 4.
-*) The {php} tag is disabled by default. Enable with $smarty->allow_php_tag=true.
-*) Delimiters surrounded by whitespace are no longer treated as Smarty tags.
-   Therefore, { foo } will not compile as a tag, you must use {foo}. This change
-   Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
-   This can be disabled by setting $smarty->auto_literal = false;
-*) The Smarty 3 API is a bit different. Many Smarty 2 API calls are deprecated
-   but still work. You will want to update your calls to Smarty 3 for maximum
-   efficiency.
-
-
-There are many things that are new to Smarty 3. Here are the notable items:
-
-LEXER/PARSER
-============
-
-Smarty 3 now uses a lexing tokenizer for its parser/compiler. Basically, this
-means Smarty has some syntax additions that make life easier such as in-template
-math, shorter/intuitive function parameter options, infinite function recursion,
-more accurate error handling, etc.
-
-
-WHAT IS NEW IN SMARTY TEMPLATE SYNTAX
-=====================================
-
-Smarty 3 allows expressions almost anywhere. Expressions can include PHP
-functions as long as they are not disabled by the security policy, object
-methods and properties, etc. The {math} plugin is no longer necessary but
-is still supported for BC.
-
-Examples:
-{$x+$y}                           will output the sum of x and y.
-{$foo = strlen($bar)}             function in assignment
-{assign var=foo value= $x+$y}     in attributes
-{$foo = myfunct( ($x+$y)*3 )}     as function parameter
-{$foo[$x+3]}                      as array index
-
-Smarty tags can be used as values within other tags.
-Example:  {$foo={counter}+3}
-
-Smarty tags can also be used inside double quoted strings.
-Example:  {$foo="this is message {counter}"}
-
-You can define arrays within templates.
-Examples:
-{assign var=foo value=[1,2,3]}
-{assign var=foo value=['y'=>'yellow','b'=>'blue']}
-Arrays can be nested.
-{assign var=foo value=[1,[9,8],3]}
-
-There is a new short syntax supported for assigning variables.
-Example: {$foo=$bar+2}
-
-You can assign a value to a specific array element. If the variable exists but
-is not an array, it is converted to an array before the new values are assigned.
-Examples:
-{$foo['bar']=1}
-{$foo['bar']['blar']=1}
-
-You can append values to an array. If the variable exists but is not an array,
-it is converted to an array before the new values are assigned.
-Example: {$foo[]=1}
-
-You can use a PHP-like syntax for accessing array elements, as well as the
-original "dot" notation.
-Examples:
-{$foo[1]}             normal access
-{$foo['bar']}
-{$foo['bar'][1]}
-{$foo[$x+$x]}         index may contain any expression
-{$foo[$bar[1]]}       nested index
-{$foo[section_name]}  smarty section access, not array access!
-
-The original "dot" notation stays, and with improvements.
-Examples:
-{$foo.a.b.c}        =>  $foo['a']['b']['c']
-{$foo.a.$b.c}       =>  $foo['a'][$b]['c']        with variable index
-{$foo.a.{$b+4}.c}   =>  $foo['a'][$b+4]['c']       with expression as index
-{$foo.a.{$b.c}}     =>  $foo['a'][$b['c']]         with nested index
-
-note that { and } are used to address ambiguties when nesting the dot syntax.
-
-Variable names themselves can be variable and contain expressions.
-Examples:
-$foo         normal variable
-$foo_{$bar}  variable name containing other variable
-$foo_{$x+$y} variable name containing expressions
-$foo_{$bar}_buh_{$blar}  variable name with multiple segments
-{$foo_{$x}}  will output the variable $foo_1 if $x has a value of 1.
-
-Object method chaining is implemented.
-Example: {$object->method1($x)->method2($y)}
-
-{for} tag added for looping (replacement for {section} tag):
-{for $x=0, $y=count($foo); $x<$y; $x++}  ....  {/for}
-Any number of statements can be used separated by comma as the first
-initial expression at {for}.
-
-{for $x = $start to $end step $step} ... {/for}is in the SVN now .
-You can use also
-{for $x = $start to $end} ... {/for}
-In this case the step value will be automatically 1 or -1 depending on the start and end values.
-Instead of $start and $end you can use any valid expression.
-Inside the loop the following special vars can be accessed:
-$x@iteration = number of iteration
-$x@total = total number of iterations
-$x@first = true on first iteration
-$x@last = true on last iteration
-
-
-The Smarty 2 {section} syntax is still supported.
-
-New shorter {foreach} syntax to loop over an array.
-Example: {foreach $myarray as $var}...{/foreach}
-
-Within the foreach loop, properties are access via:
-
-$var@key            foreach $var array key
-$var@iteration      foreach current iteration count (1,2,3...)
-$var@index          foreach current index count (0,1,2...)
-$var@total          foreach $var array total
-$var@first          true on first iteration
-$var@last           true on last iteration
-
-The Smarty 2 {foreach} tag syntax is still supported.
-
-NOTE: {$bar[foo]} still indicates a variable inside of a {section} named foo.
-If you want to access an array element with index foo, you must use quotes
-such as {$bar['foo']}, or use the dot syntax {$bar.foo}.
-
-while block tag is now implemented:
-{while $foo}...{/while}
-{while $x lt 10}...{/while}
-
-Direct access to PHP functions:
-Just as you can use PHP functions as modifiers directly, you can now access
-PHP functions directly, provided they are permitted by security settings:
-{time()}
-
-There is a new {function}...{/function} block tag to implement a template function.
-This enables reuse of code sequences like a plugin function. It can call itself recursively.
-Template function must be called with the new {call name=foo...} tag.
-
-Example:
-
-Template file:
-{function name=menu level=0}
-  <ul class="level{$level}">
-  {foreach $data as $entry}
-    {if is_array($entry)}
-      <li>{$entry@key}</li>
-       {call name=menu data=$entry level=$level+1}
-    {else}
-      <li>{$entry}</li>
-    {/if}
-  {/foreach}
-  </ul>
-{/function}
-
-{$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' =>
-  ['item3-3-1','item3-3-2']],'item4']}
-
-{call name=menu data=$menu}
-
-
-Generated output:
-    * item1
-    * item2
-    * item3
-          o item3-1
-          o item3-2
-          o item3-3
-                + item3-3-1
-                + item3-3-2
-    * item4
-
-The function tag itself must have the "name" attribute. This name is the tag
-name when calling the function. The function tag may have any number of
-additional attributes. These will be default settings for local variables.
-
-New {nocache} block function:
-{nocache}...{/nocache} will declare a section of the template to be non-cached
-when template caching is enabled.
-
-New nocache attribute:
-You can declare variable/function output as non-cached with the nocache attribute.
-Examples:
-
-{$foo nocache=true}
-{$foo nocache} /* same */
-
-{foo bar="baz" nocache=true}
-{foo bar="baz" nocache} /* same */
-
-{time() nocache=true}
-{time() nocache} /* same */
-
-Or you can also assign the variable in your script as nocache:
-$smarty->assign('foo',$something,true); // third param is nocache setting
-{$foo} /* non-cached */
-
-$smarty.current_dir returns the directory name of the current template.
-
-You can use strings directly as templates with the "string" resource type.
-Examples:
-$smarty->display('string:This is my template, {$foo}!'); // php
-{include file="string:This is my template, {$foo}!"} // template
-
-
-
-VARIABLE SCOPE / VARIABLE STORAGE
-=================================
-
-In Smarty 2, all assigned variables were stored within the Smarty object.
-Therefore, all variables assigned in PHP were accessible by all subsequent
-fetch and display template calls.
-
-In Smarty 3, we have the choice to assign variables to the main Smarty object,
-to user-created data objects, and to user-created template objects.
-These objects can be chained. The object at the end of a chain can access all
-variables belonging to that template and all variables within the parent objects.
-The Smarty object can only be the root of a chain, but a chain can be isolated
-from the Smarty object.
-
-All known Smarty assignment interfaces will work on the data and template objects.
-
-Besides the above mentioned objects, there is also a special storage area for
-global variables.
-
-A Smarty data object can be created as follows:
-$data = $smarty->createData();    // create root data object
-$data->assign('foo','bar');       // assign variables as usual
-$data->config_load('my.conf');									 // load config file
-
-$data= $smarty->createData($smarty);  // create data object having a parent link to
-the Smarty object
-
-$data2= $smarty->createData($data);   // create data object having a parent link to
-the $data data object
-
-A template object can be created by using the createTemplate method. It has the
-same parameter assignments as the fetch() or display() method.
-Function definition:
-function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
-
-The first parameter can be a template name, a smarty object or a data object.
-
-Examples:
-$tpl = $smarty->createTemplate('mytpl.tpl'); // create template object not linked to any parent
-$tpl->assign('foo','bar');                   // directly assign variables
-$tpl->config_load('my.conf');									 // load config file
-
-$tpl = $smarty->createTemplate('mytpl.tpl',$smarty);  // create template having a parent link to the Smarty object
-$tpl = $smarty->createTemplate('mytpl.tpl',$data);    // create template having a parent link to the $data object
-
-The standard fetch() and display() methods will implicitly create a template object.
-If the $parent parameter is not specified in these method calls, the template object
-is will link back to the Smarty object as it's parent.
-
-If a template is called by an {include...} tag from another template, the
-subtemplate links back to the calling template as it's parent.
-
-All variables assigned locally or from a parent template are accessible. If the
-template creates or modifies a variable by using the {assign var=foo...} or
-{$foo=...} tags, these new values are only known locally (local scope). When the
-template exits, none of the new variables or modifications can be seen in the
-parent template(s). This is same behavior as in Smarty 2.
-
-With Smarty 3, we can assign variables with a scope attribute which allows the
-availablility of these new variables or modifications globally (ie in the parent
-templates.)
-
-Possible scopes are local, parent, root and global.
-Examples:
-{assign var=foo value='bar'}       // no scope is specified, the default 'local'
-{$foo='bar'}                       // same, local scope
-{assign var=foo value='bar' scope='local'} // same, local scope
-
-{assign var=foo value='bar' scope='parent'} // Values will be available to the parent object
-{$foo='bar' scope='parent'}                 // (normally the calling template)
-
-{assign var=foo value='bar' scope='root'}   // Values will be exported up to the root object, so they can
-{$foo='bar' scope='root'}                   // be seen from all templates using the same root.
-
-{assign var=foo value='bar' scope='global'} // Values will be exported to global variable storage,
-{$foo='bar' scope='global'}                 // they are available to any and all templates.
-
-
-The scope attribute can also be attached to the {include...} tag. In this case,
-the specified scope will be the default scope for all assignments within the
-included template.
-
-
-PLUGINS
-=======
-
-Smarty 3 plugins follow the same coding rules as in Smarty 2.
-The main difference is that the template object is now passed in place of the smarty object.
-The smarty object can be still be accessed through $template->smarty.
-
-smarty_plugintype_name (array $params, Smarty_Internal_Template $template)
-
-The Smarty 2 plugins are still compatible as long as they do not make use of specific Smarty 2 internals.
-
-
-TEMPLATE INHERITANCE:
-=====================
-
-With template inheritance you can define blocks, which are areas that can be
-overridden by child templates, so your templates could look like this:
-
-parent.tpl:
-<html>
-  <head>
-    <title>{block name='title'}My site name{/block}</title>
-  </head>
-  <body>
-    <h1>{block name='page-title'}Default page title{/block}</h1>
-    <div id="content">
-      {block name='content'}
-        Default content
-      {/block}
-    </div>
-  </body>
-</html>
-
-child.tpl:
-{extends file='parent.tpl'}
-{block name='title'}
-Child title
-{/block}
-
-grandchild.tpl:
-{extends file='child.tpl'}
-{block name='title'}Home - {$smarty.block.parent}{/block}
-{block name='page-title'}My home{/block}
-{block name='content'}
-  {foreach $images as $img}
-    <img src="{$img.url}" alt="{$img.description}" />
-  {/foreach}
-{/block}
-
-We redefined all the blocks here, however in the title block we used {$smarty.block.parent},
-which tells Smarty to insert the default content from the parent template in its place.
-The content block was overridden to display the image files, and page-title has also be
-overridden to display a completely different title.
-
-If we render grandchild.tpl we will get this:
-<html>
-  <head>
-    <title>Home - Child title</title>
-  </head>
-  <body>
-    <h1>My home</h1>
-    <div id="content">
-      <img src="/example.jpg" alt="image" />
-      <img src="/example2.jpg" alt="image" />
-      <img src="/example3.jpg" alt="image" />
-    </div>
-  </body>
-</html>
-
-NOTE: In the child templates everything outside the {extends} or {block} tag sections
-is ignored.
-
-The inheritance tree can be as big as you want (meaning you can extend a file that
-extends another one that extends another one and so on..), but be aware that all files
-have to be checked for modifications at runtime so the more inheritance the more overhead you add.
-
-Instead of defining the parent/child relationships with the {extends} tag in the child template you
-can use the resource as follow:
-
-$smarty->display('extends:parent.tpl|child.tpl|grandchild.tpl');
-
-Child {block} tags may optionally have a append or prepend attribute. In this case the parent block content
-is appended or prepended to the child block content.
-
-{block name='title' append} My title {/block}
-
-
-PHP STREAMS:
-============
-
-(see online documentation)
-
-VARIBLE FILTERS:
-================
-
-(see online documentation)
-
-
-STATIC CLASS ACCESS AND NAMESPACE SUPPORT
-=========================================
-
-You can register a class with optional namespace for the use in the template like:
-
-$smarty->register->templateClass('foo','name\name2\myclass');
-
-In the template you can use it like this:
-{foo::method()}  etc.
-
-
-=======================
-
-Please look through it and send any questions/suggestions/etc to the forums.
-
-http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14168
-
-Monte and Uwe
diff --git a/libraries/Smarty/README.md b/libraries/Smarty/README.md
deleted file mode 100644
index ee7edb1ab..000000000
--- a/libraries/Smarty/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# Smarty 3 template engine
-[smarty.net](https://www.smarty.net/) 
-
-[![Build Status](https://travis-ci.org/smarty-php/smarty.svg?branch=master)](https://travis-ci.org/smarty-php/smarty)
-
-## Documentation
-
-For documentation see 
-[www.smarty.net/docs/en/](https://www.smarty.net/docs/en/) 
-
-## Requirements
-
-Smarty can be run with PHP 5.2 to PHP 7.4.
-
-## Distribution repository
-
-> Smarty 3.1.28 introduces run time template inheritance
-
-> Read the NEW_FEATURES and INHERITANCE_RELEASE_NOTES file for recent extensions to Smarty 3.1 functionality
-
-Smarty versions 3.1.11 or later are now on github and can be installed with Composer.
-
-
-The "smarty/smarty" package will start at libs/....   subfolder.
-
-To get the latest stable version of Smarty 3.1 use:
-
-```json
-"require": {
-    "smarty/smarty": "~3.1"
-}
-```
-
-in your composer.json file.
-
-To get the trunk version use:
-
-```json
-"require": {
-    "smarty/smarty": "~3.1@dev"
-}
-```
-
-For a specific version use something like:
-
-```json
-"require": {
-    "smarty/smarty": "3.1.19"
-}
-```
-
-PHPUnit test can be installed by corresponding composer entries like:
-
-```json
-"require": {
-    "smarty/smarty-phpunit": "3.1.19"
-}
-```
-
-Similar applies for the lexer/parser generator.
-
-```json
-"require": {
-    "smarty/smarty-lexer": "3.1.19"
-}
-```
-
-Or you could use:
-
-```json
-"require": {
-    "smarty/smarty-dev": "3.1.19"
-}
-```
-
-Which is a wrapper to install all 3 packages.
-
-Composer can also be used for Smarty2 versions 2.6.24 to 2.6.30.
diff --git a/libraries/Smarty/SMARTY_2_BC_NOTES.txt b/libraries/Smarty/SMARTY_2_BC_NOTES.txt
deleted file mode 100644
index fd36bd33b..000000000
--- a/libraries/Smarty/SMARTY_2_BC_NOTES.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-= Known incompatibilities with Smarty 2 =
-
-== Syntax ==
-
-Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported
-by a wrapper but deprecated. See the README that comes with Smarty 3 for more
-information.
-
-The {$array|@mod} syntax has always been a bit confusing, where an "@" is required
-to apply a modifier to an array instead of the individual elements. Normally you
-always want the modifier to apply to the variable regardless of its type. In Smarty 3,
-{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the
-modifier will still apply to the array. If you really want the modifier to apply to
-each array element, you must loop the array in-template, or use a custom modifier that
-supports array iteration. Most smarty functions already escape values where necessary
-such as {html_options}
-
-== PHP Version ==
-Smarty 3 is PHP 5 only. It will not work with PHP 4.
-
-== {php} Tag ==
-The {php} tag is disabled by default. The use of {php} tags is
-deprecated. It can be enabled with $smarty->allow_php_tag=true.
-
-But if you scatter PHP code which belongs together into several
-{php} tags it may not work any longer.
-
-== Delimiters and whitespace ==
-Delimiters surrounded by whitespace are no longer treated as Smarty tags.
-Therefore, { foo } will not compile as a tag, you must use {foo}. This change
-Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
-This can be disabled by setting $smarty->auto_literal = false;
-
-== Unquoted Strings ==
-Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
-in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
-so long as they contain no special characters. (anything outside of A-Za-z0-9_)
-
-For example filename strings must be quoted
-<source lang="smarty">
-{include file='path/foo.tpl'}
-</source>
-
-== Extending the Smarty class ==
-Smarty 3 makes use of the __construct method for initialization. If you are extending
-the Smarty class, its constructor is not called implicitly if the your child class defines
-its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
-within your child constructor is required.
-
-<source lang="php">
-class MySmarty extends Smarty {
-   function __construct() {
-       parent::__construct();
-
-       // your initialization code goes here
-
-   }
-}
-</source>
-
-== Autoloader ==
-Smarty 3 does register its own autoloader with spl_autoload_register. If your code has
-an existing __autoload function then this function must be explicitly registered on
-the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php
-for further details.
-
-== Plugin Filenames ==
-Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames
-to be lower case. Because of this, Smarty plugin file names must also be lowercase.
-In Smarty 2, mixed case file names did work.
-
-== Scope of Special Smarty Variables ==
-In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach...
-had global scope. If you had loops with the same name in subtemplates you could accidentally
-overwrite values of parent template.
-
-In Smarty 3 these special Smarty variable have only local scope in the template which
-is defining the loop. If you need their value in a subtemplate you have to pass them
-as parameter.
-<source lang="smarty">
-{include file='path/foo.tpl' index=$smarty.section.foo.index}
-</source>
-
-== SMARTY_RESOURCE_CHAR_SET ==
-Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset.
-This is now used also on modifiers like escape as default charset. If your templates use
-other charsets make sure that you define the constant accordingly. Otherwise you may not
-get any output.
-
-== newline at {if} tags ==
-A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
-If one of the {if} tags is at the line end you will now get a newline in the HTML output.
-
-== trigger_error() ==
-The API function trigger_error() has been removed because it did just map to PHP trigger_error.
-However it's still included in the Smarty2 API wrapper.
-
-== Smarty constants ==
-The constants
-SMARTY_PHP_PASSTHRU
-SMARTY_PHP_QUOTE
-SMARTY_PHP_REMOVE
-SMARTY_PHP_ALLOW
-have been replaced with class constants
-Smarty::PHP_PASSTHRU
-Smarty::PHP_QUOTE
-Smarty::PHP_REMOVE
-Smarty::PHP_ALLOW
-
diff --git a/libraries/Smarty/SMARTY_3.0_BC_NOTES.txt b/libraries/Smarty/SMARTY_3.0_BC_NOTES.txt
deleted file mode 100644
index 24bdec61a..000000000
--- a/libraries/Smarty/SMARTY_3.0_BC_NOTES.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-== Smarty2 backward compatibility ==
-All Smarty2 specific API functions and deprecated functionality has been moved
-to the SmartyBC class.
-
-== {php} Tag ==
-The {php} tag is no longer available in the standard Smarty calls.
-The use of {php} tags is deprecated and only available in the SmartyBC class.
-
-== {include_php} Tag ==
-The {include_php} tag is no longer available in the standard Smarty calls.
-The use of {include_php} tags is deprecated and only available in the SmartyBC class.
-
-== php template resource ==
-The support of the php template resource is removed.
-
-== $cache_dir, $compile_dir, $config_dir, $template_dir access ==
-The mentioned properties can't be accessed directly any longer. You must use
-corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir()
-
-== obsolete Smarty class properties ==
-The following no longer used properties are removed:
-$allow_php_tag
-$allow_php_template
-$deprecation_notices
\ No newline at end of file
diff --git a/libraries/Smarty/SMARTY_3.1_NOTES.txt b/libraries/Smarty/SMARTY_3.1_NOTES.txt
deleted file mode 100644
index d7c23ccc4..000000000
--- a/libraries/Smarty/SMARTY_3.1_NOTES.txt
+++ /dev/null
@@ -1,306 +0,0 @@
-Smarty 3.1 Notes
-================
-
-Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all
-backward compatibility has been moved to a separate class file named
-SmartyBC.class.php. If you require compatibility with 2.0, you will
-need to use this class.
-
-Some differences from 3.0 are also present. 3.1 begins the journey of
-requiring setters/getters for property access. So far this is only
-implemented on the five directory properties: template_dir,
-plugins_dir, configs_dir, compile_dir and cache_dir. These properties
-are now protected, it is required to use the setters/getters instead.
-That said, direct property access will still work, however slightly
-slower since they will now fall through __set() and __get() and in
-turn passed through the setter/getter methods. 3.2 will exhibit a full
-list of setter/getter methods for all (currently) public properties,
-so code-completion in your IDE will work as expected.
-
-There is absolutely no PHP allowed in templates any more. All
-deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC
-class if you need any backward compatibility.
-
-Internal Changes
-
-  Full UTF-8 Compatibility
-
-The plugins shipped with Smarty 3.1 have been rewritten to fully
-support UTF-8 strings if Multibyte String is available. Without
-MBString UTF-8 cannot be handled properly. For those rare cases where
-templates themselves have to juggle encodings, the new modifiers
-to_charset and from_charset may come in handy.
-
-  Plugin API and Performance
-
-All Plugins (modifiers, functions, blocks, resources,
-default_template_handlers, etc) are now receiving the
-Smarty_Internal_Template instance, where they were supplied with the
-Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template
-mimics the behavior of Smarty, this API simplification should not
-require any changes to custom plugins.
-
-The plugins shipped with Smarty 3.1 have been rewritten for better
-performance. Most notably {html_select_date} and {html_select_time}
-have been improved vastly. Performance aside, plugins have also been
-reviewed and generalized in their API. {html_select_date} and
-{html_select_time} now share almost all available options.
-
-The escape modifier now knows the $double_encode option, which will
-prevent entities from being encoded again.
-
-The capitalize modifier now know the $lc_rest option, which makes sure
-all letters following a capital letter are lower-cased.
-
-The count_sentences modifier now accepts (.?!) as
-legitimate endings of a sentence - previously only (.) was
-accepted
-
-The new unescape modifier is there to reverse the effects of the
-escape modifier. This applies to the escape formats html, htmlall and
-entity.
-
-  default_template_handler_func
-
-The invocation of $smarty->$default_template_handler_func had to be
-altered. Instead of a Smarty_Internal_Template, the fifth argument is
-now provided with the Smarty instance. New footprint:
-
-
-/**
- * Default Template Handler
- *
- * called when Smarty's file: resource is unable to load a requested file
- *
- * @param string   $type     resource type (e.g. "file", "string", "eval", "resource")
- * @param string   $name     resource name (e.g. "foo/bar.tpl")
- * @param string  &$content  template's content
- * @param integer &$modified template's modification time
- * @param Smarty   $smarty   Smarty instance
- * @return string|boolean   path to file or boolean true if $content and $modified
- *                          have been filled, boolean false if no default template
- *                          could be loaded
- */
-function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) {
-    if (false) {
-        // return corrected filepath
-        return "/tmp/some/foobar.tpl";
-    } elseif (false) {
-        // return a template directly
-        $content = "the template source";
-        $modified = time();
-        return true;
-    } else {
-        // tell smarty that we failed
-        return false;
-    }
-}
-
-  Stuff done to the compiler
-
-Many performance improvements have happened internally. One notable
-improvement is that all compiled templates are now handled as PHP
-functions. This speeds up repeated templates tremendously, as each one
-calls an (in-memory) PHP function instead of performing another file
-include/scan.
-
-New Features
-
-  Template syntax
-
- {block}..{/block}
-
-The {block} tag has a new hide option flag. It does suppress the block
-content if no corresponding child block exists.
-EXAMPLE:
-parent.tpl
-{block name=body hide} child content "{$smarty.block.child}" was
-inserted {block}
-In the above example the whole block will be suppressed if no child
-block "body" is existing.
-
- {setfilter}..{/setfilter}
-
-The new {setfilter} block tag allows the definition of filters which
-run on variable output.
-SYNTAX:
-{setfilter filter1|filter2|filter3....}
-Smarty3 will lookup up matching filters in the following search order:
-1. variable filter plugin in plugins_dir.
-2. a valid modifier. A modifier specification will also accept
-additional parameter like filter2:'foo'
-3. a PHP function
-{/setfilter} will turn previous filter setting off again.
-{setfilter} tags can be nested.
-EXAMPLE:
-{setfilter filter1}
-  {$foo}
-  {setfilter filter2}
-    {$bar}
-  {/setfilter}
-  {$buh}
-{/setfilter}
-{$blar}
-In the above example filter1 will run on the output of $foo, filter2
-on $bar, filter1 again on $buh and no filter on $blar.
-NOTES:
-- {$foo nofilter} will suppress the filters
-- These filters will run in addition to filters defined by
-registerFilter('variable',...), autoLoadFilter('variable',...) and
-defined default modifier.
-- {setfilter} will effect only the current template, not included
-subtemplates.
-
-  Resource API
-
-Smarty 3.1 features a new approach to resource management. The
-Smarty_Resource API allows simple, yet powerful integration of custom
-resources for templates and configuration files. It offers simple
-functions for loading data from a custom resource (e.g. database) as
-well as define new template types adhering to the special
-non-compiling (e,g, plain php) and non-compile-caching (e.g. eval:
-resource type) resources.
-
-See demo/plugins/resource.mysql.php for an example custom database
-resource.
-
-Note that old-fashioned registration of callbacks for resource
-management has been deprecated but is still possible with SmartyBC.
-
-  CacheResource API
-
-In line with the Resource API, the CacheResource API offers a more
-comfortable handling of output-cache data. With the
-Smarty_CacheResource_Custom accessing databases is made simple. With
-the introduction of Smarty_CacheResource_KeyValueStore the
-implementation of resources like memcache or APC became a no-brainer;
-simple hash-based storage systems are now supporting hierarchical
-output-caches.
-
-See demo/plugins/cacheresource.mysql.php for an example custom
-database CacheResource.
-See demo/plugins/cacheresource.memcache.php for an example custom
-memcache CacheResource using the KeyValueStore helper.
-
-Note that old-fashioned registration of $cache_handler is not possible
-anymore. As the functionality had not been ported to Smarty 3.0.x
-properly, it has been dropped from 3.1 completely.
-
-Locking facilities have been implemented to avoid concurrent cache
-generation. Enable cache locking by setting
-$smarty->cache_locking = true;
-
-  Relative Paths in Templates (File-Resource)
-
-As of Smarty 3.1 {include file="../foo.tpl"} and {include
-file="./foo.tpl"} will resolve relative to the template they're in.
-Relative paths are available with {include file="..."} and
-{extends file="..."}. As $smarty->fetch('../foo.tpl') and
-$smarty->fetch('./foo.tpl') cannot be relative to a template, an
-exception is thrown.
-
-  Addressing a specific $template_dir
-
-Smarty 3.1 introduces the $template_dir index notation.
-$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"}
-require the template bar.tpl to be loaded from $template_dir['foo'];
-Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to
-define indexes along with the actual directories.
-
-  Mixing Resources in extends-Resource
-
-Taking the php extends: template resource one step further, it is now
-possible to mix resources within an extends: call like
-$smarty->fetch("extends:file:foo.tpl|db:bar.tpl");
-
-To make eval: and string: resources available to the inheritance
-chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been
-introduced. Supplying the base64 or urlencode flags will trigger
-decoding the TPL_STRING in with either base64_decode() or urldecode().
-
-  extends-Resource in template inheritance
-
-Template based inheritance may now inherit from php's extends:
-resource like {extends file="extends:foo.tpl|db:bar.tpl"}.
-
-  New Smarty property escape_html
-
-$smarty->escape_html = true will autoescape all template variable
-output by calling htmlspecialchars({$output}, ENT_QUOTES,
-SMARTY_RESOURCE_CHAR_SET).
-NOTE:
-This is a compile time option. If you change the setting you must make
-sure that the templates get recompiled.
-
-  New option at Smarty property compile_check
-
-The automatic recompilation of modified templates can now be
-controlled by the following settings:
-$smarty->compile_check = COMPILECHECK_OFF (false) - template files
-will not be checked
-$smarty->compile_check = COMPILECHECK_ON (true) - template files will
-always be checked
-$smarty->compile_check = COMPILECHECK_CACHEMISS - template files will
-be checked if caching is enabled and there is no existing cache file
-or it has expired
-
-  Automatic recompilation on Smarty version change
-
-Templates will now be automatically recompiled on Smarty version
-changes to avoide incompatibillities in the compiled code. Compiled
-template checked against the current setting of the SMARTY_VERSION
-constant.
-
-  default_config_handler_func()
-
-Analogous to the default_template_handler_func()
-default_config_handler_func() has been introduced.
-
-  default_plugin_handler_func()
-
-An optional default_plugin_handler_func() can be defined which gets called
-by the compiler on tags which can't be resolved internally or by plugins.
-The default_plugin_handler() can map tags to plugins on the fly.
-
-New getters/setters
-
-The following setters/getters will be part of the official
-documentation, and will be strongly recommended. Direct property
-access will still work for the foreseeable future... it will be
-transparently routed through the setters/getters, and consequently a
-bit slower.
-
-array|string getTemplateDir( [string $index] )
-replaces $smarty->template_dir; and $smarty->template_dir[$index];
-Smarty setTemplateDir( array|string $path )
-replaces $smarty->template_dir = "foo"; and $smarty->template_dir =
-array("foo", "bar");
-Smarty addTemplateDir( array|string $path, [string $index])
-replaces $smarty->template_dir[] = "bar"; and
-$smarty->template_dir[$index] = "bar";
-
-array|string getConfigDir( [string $index] )
-replaces $smarty->config_dir; and $smarty->config_dir[$index];
-Smarty setConfigDir( array|string $path )
-replaces $smarty->config_dir = "foo"; and $smarty->config_dir =
-array("foo", "bar");
-Smarty addConfigDir( array|string $path, [string $index])
-replaces $smarty->config_dir[] = "bar"; and
-$smarty->config_dir[$index] = "bar";
-
-array getPluginsDir()
-replaces $smarty->plugins_dir;
-Smarty setPluginsDir( array|string $path )
-replaces $smarty->plugins_dir = "foo";
-Smarty addPluginsDir( array|string $path )
-replaces $smarty->plugins_dir[] = "bar";
-
-string getCompileDir()
-replaces $smarty->compile_dir;
-Smarty setCompileDir( string $path )
-replaces $smarty->compile_dir = "foo";
-
-string getCacheDir()
-replaces $smarty->cache_dir;
-Smarty setCacheDir( string $path )
-replaces $smarty->cache_dir;
diff --git a/libraries/Smarty/composer.json b/libraries/Smarty/composer.json
deleted file mode 100644
index 183f9f240..000000000
--- a/libraries/Smarty/composer.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
-    "name": "smarty/smarty",
-    "type": "library",
-    "description": "Smarty - the compiling PHP template engine",
-    "keywords": [
-        "templating"
-    ],
-    "homepage": "http://www.smarty.net",
-    "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"
-        }
-    ],
-    "support": {
-        "irc": "irc://irc.freenode.org/smarty",
-        "issues": "https://github.com/smarty-php/smarty/issues",
-        "forum": "http://www.smarty.net/forums/"
-    },
-    "require": {
-        "php": ">=5.2"
-    },
-    "autoload": {
-        "classmap": [
-            "libs/"
-        ]
-    },
-    "extra": {
-        "branch-alias": {
-            "dev-master": "3.1.x-dev"
-        }
-    },
-    "require-dev": {
-        "phpunit/phpunit": "^7.5 || ^6.5 || ^5.7 || ^4.8",
-        "smarty/smarty-lexer": "^3.1"
-    }
-}
diff --git a/libraries/Smarty/expectException b/libraries/Smarty/expectException
deleted file mode 100644
index e69de29bb..000000000
diff --git a/libraries/Smarty/lexer/smarty_internal_configfilelexer.plex b/libraries/Smarty/lexer/smarty_internal_configfilelexer.plex
deleted file mode 100644
index 7a86fadc4..000000000
--- a/libraries/Smarty/lexer/smarty_internal_configfilelexer.plex
+++ /dev/null
@@ -1,318 +0,0 @@
-<?php
-/**
-* Smarty Internal Plugin Configfilelexer
-*
-* This is the lexer to break the config file source into tokens 
-* @package Smarty
-* @subpackage Config
-* @author Uwe Tews 
-*/
-/**
-* Smarty_Internal_Configfilelexer
-*
-* This is the config file lexer.
-* It is generated from the smarty_internal_configfilelexer.plex file
-*
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
-class Smarty_Internal_Configfilelexer
-{
-    /**
-     * Source
-     *
-     * @var string
-     */
-    public $data;
-      /**
-      * Source length
-      *
-      * @var int
-      */
-     public $dataLength = null;
-   /**
-     * byte counter
-     *
-     * @var int
-     */
-    public $counter;
-    /**
-     * token number
-     *
-     * @var int
-     */
-    public $token;
-    /**
-     * token value
-     *
-     * @var string
-     */
-    public $value;
-    /**
-     * current line
-     *
-     * @var int
-     */
-    public $line;
-    /**
-     * state number
-     *
-     * @var int
-     */
-    public $state = 1;
-    /**
-     * Smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_Config_File_Compiler
-     */
-    private $compiler = null;
-    /**
-     * copy of config_booleanize
-     *
-     * @var bool
-     */
-    private $configBooleanize = false;
-    /**
-     * trace file
-     *
-     * @var resource
-     */
-    public $yyTraceFILE;
-    /**
-     * trace prompt
-     *
-     * @var string
-     */
-    public $yyTracePrompt;
-    /**
-     * state names
-     *
-     * @var array
-     */
-    public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
-
-    /**
-     * storage for assembled token patterns
-     *
-     * @var string
-     */
-    private $yy_global_pattern1 = null;
-    private $yy_global_pattern2 = null;
-    private $yy_global_pattern3 = null;
-    private $yy_global_pattern4 = null;
-    private $yy_global_pattern5 = null;
-    private $yy_global_pattern6 = null;
-
-    /**
-     * token names
-     *
-     * @var array
-     */
-    public $smarty_token_names = array(        // Text for parser error messages
-    );
-
-    /**
-     * constructor
-     *
-     * @param   string                             $data template source
-     * @param Smarty_Internal_Config_File_Compiler $compiler
-     */
-    public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler)
-    {
-        $this->data = $data . "\n"; //now all lines are \n-terminated
-        $this->dataLength = strlen($data);
-        $this->counter = 0;
-        if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
-            $this->counter += strlen($match[0]);
-        }
-        $this->line = 1;
-        $this->compiler = $compiler;
-        $this->smarty = $compiler->smarty;
-        $this->configBooleanize = $this->smarty->config_booleanize;
-    }
-
-   public function replace ($input) {
-        return $input;
-   }
-
-    public function PrintTrace()
-    {
-        $this->yyTraceFILE = fopen('php://output', 'w');
-        $this->yyTracePrompt = '<br>';
-    }
-
-
-/*!lex2php
-%input $this->data
-%counter $this->counter
-%token $this->token
-%value $this->value
-%line $this->line
-commentstart = /#|;/
-openB = /\[/
-closeB = /\]/
-section = /.*?(?=[\.=\[\]\r\n])/
-equal = /=/
-whitespace = /[ \t\r]+/
-dot = /\./
-id = /[0-9]*[a-zA-Z_]\w*/
-newline = /\n/
-single_quoted_string = /'[^'\\]*(?:\\.[^'\\]*)*'(?=[ \t\r]*[\n#;])/
-double_quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"(?=[ \t\r]*[\n#;])/
-tripple_quotes = /"""/
-tripple_quotes_end = /"""(?=[ \t\r]*[\n#;])/
-text = /[\S\s]/
-float = /\d+\.\d+(?=[ \t\r]*[\n#;])/
-int = /\d+(?=[ \t\r]*[\n#;])/
-maybe_bool = /[a-zA-Z]+(?=[ \t\r]*[\n#;])/
-naked_string = /[^\n]+?(?=[ \t\r]*\n)/
-*/
-
-/*!lex2php
-%statename START
-
-commentstart {
-    $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
-    $this->yypushstate(self::COMMENT);
-}
-openB {
-    $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
-    $this->yypushstate(self::SECTION);
-}
-closeB {
-    $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
-}
-equal {
-    $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
-    $this->yypushstate(self::VALUE);
-}
-whitespace {
-    return false;
-}
-newline {
-    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
-}
-id {
-    $this->token = Smarty_Internal_Configfileparser::TPC_ID;
-}
-text {
-    $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
-}
-
-*/
-
-/*!lex2php
-%statename VALUE
-
-whitespace {
-    return false;
-}
-float {
-    $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
-    $this->yypopstate();
-}
-int {
-    $this->token = Smarty_Internal_Configfileparser::TPC_INT;
-    $this->yypopstate();
-}
-tripple_quotes {
-    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
-    $this->yypushstate(self::TRIPPLE);
-}
-single_quoted_string {
-    $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
-    $this->yypopstate();
-}
-double_quoted_string {
-    $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
-    $this->yypopstate();
-}
-maybe_bool {
-    if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) ) {
-        $this->yypopstate();
-        $this->yypushstate(self::NAKED_STRING_VALUE);
-        return true; //reprocess in new state
-    } else {
-        $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
-        $this->yypopstate();
-    }
-}
-naked_string {
-    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-    $this->yypopstate();
-}
-newline {
-    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-    $this->value = '';
-    $this->yypopstate();
-}
-
-*/
-
-/*!lex2php
-%statename NAKED_STRING_VALUE
-
-naked_string {
-    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-    $this->yypopstate();
-}
-
-*/
-
-/*!lex2php
-%statename COMMENT
-
-whitespace {
-    return false;
-}
-naked_string {
-    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-}
-newline {
-    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
-    $this->yypopstate();
-}
-
-*/
-
-/*!lex2php
-%statename SECTION
-
-dot {
-    $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
-}
-section {
-    $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
-    $this->yypopstate();
-}
-
-*/
-/*!lex2php
-%statename TRIPPLE
-
-tripple_quotes_end {
-    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
-    $this->yypopstate();
-    $this->yypushstate(self::START);
-}
-text {
-  $to = strlen($this->data);
-  preg_match("/\"\"\"[ \t\r]*[\n#;]/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
-  if (isset($match[0][1])) {
-    $to = $match[0][1];
-  } else {
-    $this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag');
-  }  
-  $this->value = substr($this->data,$this->counter,$to-$this->counter);
-  $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
-}
-*/
-
-}
diff --git a/libraries/Smarty/lexer/smarty_internal_configfileparser.y b/libraries/Smarty/lexer/smarty_internal_configfileparser.y
deleted file mode 100644
index c981b58e9..000000000
--- a/libraries/Smarty/lexer/smarty_internal_configfileparser.y
+++ /dev/null
@@ -1,346 +0,0 @@
-/**
-* Smarty Internal Plugin Configfileparser
-*
-* This is the config file parser
-* 
-* 
-* @package Smarty
-* @subpackage Config
-* @author Uwe Tews
-*/
-%name TPC_
-%declare_class {
-/**
-* Smarty Internal Plugin Configfileparse
-*
-* This is the config file parser.
-* It is generated from the smarty_internal_configfileparser.y file
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
-class Smarty_Internal_Configfileparser
-}
-%include_class
-{
-    /**
-     * result status
-     *
-     * @var bool
-     */
-    public $successful = true;
-    /**
-     * return value
-     *
-     * @var mixed
-     */
-    public $retvalue = 0;
-    /**
-     * @var
-     */
-    public $yymajor;
-    /**
-     * lexer object
-     *
-     * @var Smarty_Internal_Configfilelexer
-     */
-    private $lex;
-    /**
-     * internal error flag
-     *
-     * @var bool
-     */
-    private $internalError = false;
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_Config_File_Compiler
-     */
-    public $compiler = null;
-    /**
-     * smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-    /**
-     * copy of config_overwrite property
-     *
-     * @var bool
-     */
-    private $configOverwrite = false;
-    /**
-     * copy of config_read_hidden property
-     *
-     * @var bool
-     */
-    private $configReadHidden = false;
-    /**
-     * helper map
-     *
-     * @var array
-     */
-    private static $escapes_single = array('\\' => '\\',
-                                           '\'' => '\'');
-
-    /**
-     * constructor
-     *
-     * @param Smarty_Internal_Configfilelexer      $lex
-     * @param Smarty_Internal_Config_File_Compiler $compiler
-     */
-    public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
-    {
-        $this->lex = $lex;
-        $this->smarty = $compiler->smarty;
-        $this->compiler = $compiler;
-        $this->configOverwrite = $this->smarty->config_overwrite;
-        $this->configReadHidden = $this->smarty->config_read_hidden;
-    }
-
-    /**
-     * parse optional boolean keywords
-     *
-     * @param string $str
-     *
-     * @return bool
-     */
-    private function parse_bool($str)
-    {
-        $str = strtolower($str);
-        if (in_array($str, array('on', 'yes', 'true'))) {
-            $res = true;
-        } else {
-            $res = false;
-        }
-        return $res;
-    }
-
-    /**
-     * parse single quoted string
-     *  remove outer quotes
-     *  unescape inner quotes
-     *
-     * @param string $qstr
-     *
-     * @return string
-     */
-    private static function parse_single_quoted_string($qstr)
-    {
-        $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
-
-        $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
-
-        $str = '';
-        foreach ($ss as $s) {
-            if (strlen($s) === 2 && $s[0] === '\\') {
-                if (isset(self::$escapes_single[$s[1]])) {
-                    $s = self::$escapes_single[$s[1]];
-                }
-            }
-            $str .= $s;
-        }
-        return $str;
-    }
-
-    /**
-     * parse double quoted string
-     *
-     * @param string $qstr
-     *
-     * @return string
-     */
-    private static function parse_double_quoted_string($qstr)
-    {
-        $inner_str = substr($qstr, 1, strlen($qstr) - 2);
-        return stripcslashes($inner_str);
-    }
-
-    /**
-     * parse triple quoted string
-     *
-     * @param string $qstr
-     *
-     * @return string
-     */
-    private static function parse_tripple_double_quoted_string($qstr)
-    {
-        return stripcslashes($qstr);
-    }
-
-    /**
-     * set a config variable in target array
-     *
-     * @param array $var
-     * @param array $target_array
-     */
-    private function set_var(array $var, array &$target_array)
-    {
-        $key = $var['key'];
-        $value = $var['value'];
-
-        if ($this->configOverwrite || !isset($target_array['vars'][$key])) {
-            $target_array['vars'][$key] = $value;
-        } else {
-            settype($target_array['vars'][$key], 'array');
-            $target_array['vars'][$key][] = $value;
-        }
-    }
-
-    /**
-     * add config variable to global vars
-     *
-     * @param array $vars
-     */
-    private function add_global_vars(array $vars)
-    {
-        if (!isset($this->compiler->config_data['vars'])) {
-            $this->compiler->config_data['vars'] = array();
-        }
-        foreach ($vars as $var) {
-            $this->set_var($var, $this->compiler->config_data);
-        }
-    }
-
-    /**
-     * add config variable to section
-     *
-     * @param string $section_name
-     * @param array  $vars
-     */
-    private function add_section_vars($section_name, array $vars)
-    {
-        if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
-            $this->compiler->config_data['sections'][$section_name]['vars'] = array();
-        }
-        foreach ($vars as $var) {
-            $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
-        }
-    }
-}
-
-%token_prefix TPC_
-
-%parse_accept
-{
-    $this->successful = !$this->internalError;
-    $this->internalError = false;
-    $this->retvalue = $this->_retvalue;
-}
-
-%syntax_error
-{
-    $this->internalError = true;
-    $this->yymajor = $yymajor;
-    $this->compiler->trigger_config_file_error();
-}
-
-%stack_overflow
-{
-    $this->internalError = true;
-    $this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
-}
-
-// Complete config file
-start(res) ::= global_vars sections. {
-    res = null;
-}
-
-// Global vars
-global_vars(res) ::= var_list(vl). {
-    $this->add_global_vars(vl);
-    res = null;
-}
-
-// Sections
-sections(res) ::= sections section. {
-    res = null;
-}
-
-sections(res) ::= . {
-    res = null;
-}
-
-section(res) ::= OPENB SECTION(i) CLOSEB newline var_list(vars). {
-    $this->add_section_vars(i, vars);
-    res = null;
-}
-
-section(res) ::= OPENB DOT SECTION(i) CLOSEB newline var_list(vars). {
-    if ($this->configReadHidden) {
-        $this->add_section_vars(i, vars);
-    }
-    res = null;
-}
-
-// Var list
-var_list(res) ::= var_list(vl) newline. {
-    res = vl;
-}
-
-var_list(res) ::= var_list(vl) var(v). {
-    res = array_merge(vl, array(v));
-}
-
-var_list(res) ::= . {
-    res = array();
-}
-
-
-// Var
-var(res) ::= ID(id) EQUAL value(v). {
-    res = array('key' => id, 'value' => v);
-}
-
-
-value(res) ::= FLOAT(i). {
-    res = (float) i;
-}
-
-value(res) ::= INT(i). {
-    res = (int) i;
-}
-
-value(res) ::= BOOL(i). {
-    res = $this->parse_bool(i);
-}
-
-value(res) ::= SINGLE_QUOTED_STRING(i). {
-    res = self::parse_single_quoted_string(i);
-}
-
-value(res) ::= DOUBLE_QUOTED_STRING(i). {
-    res = self::parse_double_quoted_string(i);
-}
-
-value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_TEXT(c) TRIPPLE_QUOTES_END(ii). {
-    res = self::parse_tripple_double_quoted_string(c);
-}
-
-value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_QUOTES_END(ii). {
-    res = '';
-}
-
-value(res) ::= NAKED_STRING(i). {
-    res = i;
-}
-
-// NOTE: this is not a valid rule
-// It is added hier to produce a usefull error message on a missing '=';
-value(res) ::= OTHER(i). {
-    res = i;
-}
-
-
-// Newline and comments
-newline(res) ::= NEWLINE. {
-    res = null;
-}
-
-newline(res) ::= COMMENTSTART NEWLINE. {
-    res = null;
-}
-
-newline(res) ::= COMMENTSTART NAKED_STRING NEWLINE. {
-    res = null;
-}
diff --git a/libraries/Smarty/lexer/smarty_internal_templatelexer.plex b/libraries/Smarty/lexer/smarty_internal_templatelexer.plex
deleted file mode 100644
index ac1250255..000000000
--- a/libraries/Smarty/lexer/smarty_internal_templatelexer.plex
+++ /dev/null
@@ -1,696 +0,0 @@
-<?php
-/*
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty_Internal_Templatelexer
- * This is the template file lexer.
- * It is generated from the smarty_internal_templatelexer.plex file
- *
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Templatelexer
-{
-    /**
-     * Source
-     *
-     * @var string
-     */
-    public $data;
-
-    /**
-     * Source length
-     *
-     * @var int
-     */
-    public $dataLength = null;
-
-    /**
-     * byte counter
-     *
-     * @var int
-     */
-    public $counter;
-
-    /**
-     * token number
-     *
-     * @var int
-     */
-    public $token;
-
-    /**
-     * token value
-     *
-     * @var string
-     */
-    public $value;
-
-    /**
-     * current line
-     *
-     * @var int
-     */
-    public $line;
-
-    /**
-     * tag start line
-     *
-     * @var
-     */
-    public $taglineno;
-
-    /**
-     * php code type
-     *
-     * @var string
-     */
-    public $phpType = '';
-
-   /**
-     * state number
-     *
-     * @var int
-     */
-    public $state = 1;
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_TemplateCompilerBase
-     */
-    public $compiler = null;
-
-    /**
-     * trace file
-     *
-     * @var resource
-     */
-    public $yyTraceFILE;
-
-    /**
-     * trace prompt
-     *
-     * @var string
-     */
-    public $yyTracePrompt;
-
-    /**
-     * XML flag true while processing xml
-     *
-     * @var bool
-     */
-    public $is_xml = false;
-
-    /**
-     * state names
-     *
-     * @var array
-     */
-    public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
-
-    /**
-     * token names
-     *
-     * @var array
-     */
-    public $smarty_token_names = array(        // Text for parser error messages
-                                               'NOT'         => '(!,not)',
-                                               'OPENP'       => '(',
-                                               'CLOSEP'      => ')',
-                                               'OPENB'       => '[',
-                                               'CLOSEB'      => ']',
-                                               'PTR'         => '->',
-                                               'APTR'        => '=>',
-                                               'EQUAL'       => '=',
-                                               'NUMBER'      => 'number',
-                                               'UNIMATH'     => '+" , "-',
-                                               'MATH'        => '*" , "/" , "%',
-                                               'INCDEC'      => '++" , "--',
-                                               'SPACE'       => ' ',
-                                               'DOLLAR'      => '$',
-                                               'SEMICOLON'   => ';',
-                                               'COLON'       => ':',
-                                               'DOUBLECOLON' => '::',
-                                               'AT'          => '@',
-                                               'HATCH'       => '#',
-                                               'QUOTE'       => '"',
-                                               'BACKTICK'    => '`',
-                                               'VERT'        => '"|" modifier',
-                                               'DOT'         => '.',
-                                               'COMMA'       => '","',
-                                               'QMARK'       => '"?"',
-                                               'ID'          => 'id, name',
-                                               'TEXT'        => 'text',
-                                               'LDELSLASH'   => '{/..} closing tag',
-                                               'LDEL'        => '{...} Smarty tag',
-                                               'COMMENT'     => 'comment',
-                                               'AS'          => 'as',
-                                               'TO'          => 'to',
-                                               'PHP'         => '"<?php", "<%", "{php}" tag',
-                                               'LOGOP'       => '"<", "==" ... logical operator',
-                                               'TLOGOP'      => '"lt", "eq" ... logical operator; "is div by" ... if condition',
-                                               'SCOND'       => '"is even" ... if condition',
-    );
-
-    /**
-     * literal tag nesting level
-     *
-     * @var int
-     */
-    private $literal_cnt = 0;
-
-    /**
-     * preg token pattern for state TEXT
-     *
-     * @var string
-     */
-    private $yy_global_pattern1 = null;
-
-    /**
-     * preg token pattern for state TAG
-     *
-     * @var string
-     */
-    private $yy_global_pattern2 = null;
-
-    /**
-     * preg token pattern for state TAGBODY
-     *
-     * @var string
-     */
-    private $yy_global_pattern3 = null;
-
-    /**
-     * preg token pattern for state LITERAL
-     *
-     * @var string
-     */
-    private $yy_global_pattern4 = null;
-
-    /**
-     * preg token pattern for state DOUBLEQUOTEDSTRING
-     *
-     * @var null
-     */
-    private $yy_global_pattern5 = null;
-
-    /**
-     * preg token pattern for text
-     *
-     * @var null
-     */
-    private $yy_global_text = null;
-
-    /**
-     * preg token pattern for literal
-     *
-     * @var null
-     */
-    private $yy_global_literal = null;
-
-    /**
-     * constructor
-     *
-     * @param   string                             $source template source
-     * @param Smarty_Internal_TemplateCompilerBase $compiler
-     */
-    public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->data = $source;
-        $this->dataLength = strlen($this->data);
-        $this->counter = 0;
-        if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
-            $this->counter += strlen($match[0]);
-        }
-        $this->line = 1;
-        $this->smarty = $compiler->template->smarty;
-        $this->compiler = $compiler;
-        $this->compiler->initDelimiterPreg();
-        $this->smarty_token_names['LDEL'] = $this->smarty->getLeftDelimiter();
-        $this->smarty_token_names['RDEL'] = $this->smarty->getRightDelimiter();
-    }
-
-    /**
-     * open lexer/parser trace file
-     *
-     */
-    public function PrintTrace()
-    {
-        $this->yyTraceFILE = fopen('php://output', 'w');
-        $this->yyTracePrompt = '<br>';
-    }
-
-   /**
-     * replace placeholders with runtime preg  code
-     *
-     * @param string $preg
-     *
-     * @return string
-     */
-   public function replace($preg)
-   {
-        return $this->compiler->replaceDelimiter($preg);
-   }
-
-    /**
-     * check if current value is an autoliteral left delimiter
-     *
-     * @return bool
-     */
-    public function isAutoLiteral()
-    {
-        return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
-            strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
-    }
-
-     /*!lex2php
-     %input $this->data
-     %counter $this->counter
-     %token $this->token
-     %value $this->value
-     %line $this->line
-     userliteral = ~(SMARTYldel)SMARTYautoliteral\s+SMARTYliteral~
-     char = ~[\S\s]~
-     textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=((SMARTYldel)SMARTYal|\$|`\$|"SMARTYliteral))~
-     namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
-     emptyjava = ~[{][}]~
-     phptag = ~(SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[/]phpSMARTYrdel~
-     phpstart = ~[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]~
-     slash = ~[/]~
-     ldel = ~(SMARTYldel)SMARTYal~
-     rdel = ~\s*SMARTYrdel~
-     nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~
-     smartyblockchildparent = ~[\$]smarty\.block\.(child|parent)~
-     integer = ~\d+~
-     hex =  ~0[xX][0-9a-fA-F]+~
-     math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~
-     comment = ~(SMARTYldel)SMARTYal[*]~
-     incdec = ~([+]|[-]){2}~
-     unimath = ~\s*([+]|[-])\s*~
-     openP = ~\s*[(]\s*~
-     closeP = ~\s*[)]~
-     openB = ~\[\s*~
-     closeB = ~\s*\]~
-     dollar = ~[$]~
-     dot = ~[.]~
-     comma = ~\s*[,]\s*~
-     doublecolon = ~[:]{2}~
-     colon = ~\s*[:]\s*~
-     at = ~[@]~
-     hatch = ~[#]~
-     semicolon = ~\s*[;]\s*~
-     equal = ~\s*[=]\s*~
-     space = ~\s+~
-     ptr = ~\s*[-][>]\s*~
-     aptr = ~\s*[=][>]\s*~
-     singlequotestring = ~'[^'\\]*(?:\\.[^'\\]*)*'~
-     backtick = ~[`]~
-     vert = ~[|][@]?~
-     qmark = ~\s*[?]\s*~
-     constant = ~[_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*(?![0-9A-Z_]*[a-z])~
-     attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~
-     id = ~[0-9]*[a-zA-Z_]\w*~
-     literal = ~literal~
-     strip = ~strip~
-     lop = ~\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\s*~
-     slop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\s+~
-     tlop = ~\s+is\s+(not\s+)?(odd|even|div)\s+by\s+~
-     scond = ~\s+is\s+(not\s+)?(odd|even)~
-     isin = ~\s+is\s+in\s+~
-     as = ~\s+as\s+~
-     to = ~\s+to\s+~
-     step = ~\s+step\s+~
-     if = ~(if|elseif|else if|while)\s+~
-     for = ~for\s+~
-     makenocache = ~make_nocache\s+~
-     array = ~array~
-     foreach = ~foreach(?![^\s])~
-     setfilter = ~setfilter\s+~
-     instanceof = ~\s+instanceof\s+~
-     not = ~[!]\s*|not\s+~
-     typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
-     double_quote = ~["]~
-     */
-     /*!lex2php
-     %statename TEXT
-     emptyjava {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     comment {
-       $to = $this->dataLength;
-       preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
-        if (isset($match[0][1])) {
-            $to = $match[0][1] + strlen($match[0][0]);
-        } else {
-            $this->compiler->trigger_template_error ("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
-        }
-        $this->value = substr($this->data,$this->counter,$to-$this->counter);
-        return false;
-     }
-     phptag {
-        $this->compiler->getTagCompiler('private_php')->parsePhp($this);
-     }
-     userliteral {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     ldel literal rdel {
-        $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
-        $this->yypushstate(self::LITERAL);
-     }
-     ldel slash literal rdel {
-        $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
-        $this->yypushstate(self::LITERAL);
-     }
-     ldel {
-        $this->yypushstate(self::TAG);
-        return true;
-     }
-     phpstart {
-        $this->compiler->getTagCompiler('private_php')->parsePhp($this);
-     }
-     char {
-       if (!isset($this->yy_global_text)) {
-           $this->yy_global_text = $this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
-       }
-       $to = $this->dataLength;
-       preg_match($this->yy_global_text, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
-       if (isset($match[0][1])) {
-         $to = $match[0][1];
-       }
-       $this->value = substr($this->data,$this->counter,$to-$this->counter);
-       $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     */
-     /*!lex2php
-     %statename TAG
-     ldel if {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     ldel for {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     ldel foreach {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     ldel setfilter {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     ldel makenocache {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     ldel id nocacherdel {
-        $this->yypopstate();
-        $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
-        $this->taglineno = $this->line;
-     }
-     ldel smartyblockchildparent rdel {
-         $this->yypopstate();
-         $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
-         $this->taglineno = $this->line;
-     }
-     ldel slash id rdel {
-        $this->yypopstate();
-        $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
-        $this->taglineno = $this->line;
-     }
-     ldel dollar id nocacherdel {
-        if ($this->_yy_stack[count($this->_yy_stack)-1] === self::TEXT) {
-            $this->yypopstate();
-            $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
-            $this->taglineno = $this->line;
-        } else {
-            $this->value = $this->smarty->getLeftDelimiter();
-            $this->token = Smarty_Internal_Templateparser::TP_LDEL;
-            $this->yybegin(self::TAGBODY);
-            $this->taglineno = $this->line;
-        }
-     }
-     ldel slash {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     ldel {
-        $this->token = Smarty_Internal_Templateparser::TP_LDEL;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     */
-     /*!lex2php
-     %statename TAGBODY
-     rdel {
-        $this->token = Smarty_Internal_Templateparser::TP_RDEL;
-        $this->yypopstate();
-     }
-     ldel {
-        $this->yypushstate(self::TAG);
-        return true;
-     }
-     double_quote {
-        $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
-        $this->yypushstate(self::DOUBLEQUOTEDSTRING);
-        $this->compiler->enterDoubleQuote();
-     }
-     singlequotestring {
-        $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
-     }
-     dollar id {
-        $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
-     }
-     dollar {
-        $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
-     }
-     isin {
-        $this->token = Smarty_Internal_Templateparser::TP_ISIN;
-     }
-     as {
-        $this->token = Smarty_Internal_Templateparser::TP_AS;
-     }
-     to {
-        $this->token = Smarty_Internal_Templateparser::TP_TO;
-     }
-     step {
-        $this->token = Smarty_Internal_Templateparser::TP_STEP;
-     }
-     instanceof {
-        $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
-     }
-     lop {
-        $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
-     }
-     slop {
-        $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
-     }
-     tlop {
-        $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
-     }
-     scond {
-        $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
-     }
-     not{
-        $this->token = Smarty_Internal_Templateparser::TP_NOT;
-     }
-     typecast {
-        $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
-     }
-     openP {
-        $this->token = Smarty_Internal_Templateparser::TP_OPENP;
-     }
-     closeP {
-        $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
-     }
-     openB {
-        $this->token = Smarty_Internal_Templateparser::TP_OPENB;
-     }
-     closeB {
-        $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
-     }
-     ptr {
-        $this->token = Smarty_Internal_Templateparser::TP_PTR;
-     }
-     aptr {
-        $this->token = Smarty_Internal_Templateparser::TP_APTR;
-     }
-     equal {
-        $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
-     }
-     incdec {
-        $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
-     }
-     unimath {
-        $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
-     }
-     math {
-        $this->token = Smarty_Internal_Templateparser::TP_MATH;
-     }
-     at {
-        $this->token = Smarty_Internal_Templateparser::TP_AT;
-     }
-     array openP {
-        $this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
-     }
-     hatch {
-        $this->token = Smarty_Internal_Templateparser::TP_HATCH;
-     }
-     attr {
-        // resolve conflicts with shorttag and right_delimiter starting with '='
-        if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) {
-            preg_match('/\s+/',$this->value,$match);
-            $this->value = $match[0];
-            $this->token = Smarty_Internal_Templateparser::TP_SPACE;
-        } else {
-            $this->token = Smarty_Internal_Templateparser::TP_ATTR;
-        }
-     }
-     namespace {
-        $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
-     }
-     id {
-        $this->token = Smarty_Internal_Templateparser::TP_ID;
-     }
-     integer {
-        $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
-     }
-     backtick {
-        $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
-        $this->yypopstate();
-     }
-     vert {
-        $this->token = Smarty_Internal_Templateparser::TP_VERT;
-     }
-     dot {
-        $this->token = Smarty_Internal_Templateparser::TP_DOT;
-     }
-     comma {
-        $this->token = Smarty_Internal_Templateparser::TP_COMMA;
-     }
-     semicolon {
-        $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
-     }
-     doublecolon {
-        $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
-     }
-     colon {
-        $this->token = Smarty_Internal_Templateparser::TP_COLON;
-     }
-     qmark {
-        $this->token = Smarty_Internal_Templateparser::TP_QMARK;
-     }
-     hex {
-        $this->token = Smarty_Internal_Templateparser::TP_HEX;
-     }
-     space {
-        $this->token = Smarty_Internal_Templateparser::TP_SPACE;
-     }
-     char {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     */
-
-     /*!lex2php
-     %statename LITERAL
-     ldel literal rdel {
-        $this->literal_cnt++;
-        $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
-     }
-     ldel slash literal rdel {
-        if ($this->literal_cnt) {
-             $this->literal_cnt--;
-            $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
-        } else {
-            $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
-            $this->yypopstate();
-        }
-     }
-     char {
-       if (!isset($this->yy_global_literal)) {
-           $this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
-       }
-       $to = $this->dataLength;
-       preg_match($this->yy_global_literal, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
-       if (isset($match[0][1])) {
-         $to = $match[0][1];
-       } else {
-          $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
-       }
-       $this->value = substr($this->data,$this->counter,$to-$this->counter);
-       $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
-     }
-     */
-     /*!lex2php
-     %statename DOUBLEQUOTEDSTRING
-     userliteral {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     ldel literal rdel {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     ldel slash literal rdel {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     ldel slash {
-        $this->yypushstate(self::TAG);
-        return true;
-     }
-     ldel id {
-        $this->yypushstate(self::TAG);
-        return true;
-     }
-     ldel {
-        $this->token = Smarty_Internal_Templateparser::TP_LDEL;
-        $this->taglineno = $this->line;
-        $this->yypushstate(self::TAGBODY);
-     }
-     double_quote {
-        $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
-        $this->yypopstate();
-     }
-     backtick dollar {
-        $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
-        $this->value = substr($this->value,0,-1);
-        $this->yypushstate(self::TAGBODY);
-        $this->taglineno = $this->line;
-     }
-     dollar id {
-        $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
-     }
-     dollar {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     textdoublequoted {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-     char {
-        $to = $this->dataLength;
-        $this->value = substr($this->data,$this->counter,$to-$this->counter);
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-     }
-    */
-  }
-
-     
\ No newline at end of file
diff --git a/libraries/Smarty/lexer/smarty_internal_templateparser.y b/libraries/Smarty/lexer/smarty_internal_templateparser.y
deleted file mode 100644
index c6890642f..000000000
--- a/libraries/Smarty/lexer/smarty_internal_templateparser.y
+++ /dev/null
@@ -1,1277 +0,0 @@
-/*
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-%stack_size 500
-%name TP_
-%declare_class {
-/**
-* Smarty Template Parser Class
-*
-* This is the template parser.
-* It is generated from the smarty_internal_templateparser.y file
-* 
-* @author Uwe Tews <uwe.tews@googlemail.com>
-*/
-class Smarty_Internal_Templateparser
-}
-%include_class
-{
-    const ERR1 = 'Security error: Call to private object member not allowed';
-    const ERR2 = 'Security error: Call to dynamic object member not allowed';
-    const ERR3 = 'PHP in template not allowed. Use SmartyBC to enable it';
-
-    /**
-     * result status
-     *
-     * @var bool
-     */
-    public $successful = true;
-
-    /**
-     * return value
-     *
-     * @var mixed
-     */
-    public $retvalue = 0;
-
-    /**
-     * @var
-     */
-    public $yymajor;
-
-    /**
-     * last index of array variable
-     *
-     * @var mixed
-     */
-    public $last_index;
-
-    /**
-     * last variable name
-     *
-     * @var string
-     */
-    public $last_variable;
-
-    /**
-     * root parse tree buffer
-     *
-     * @var Smarty_Internal_ParseTree_Template
-     */
-    public $root_buffer;
-
-    /**
-     * current parse tree object
-     *
-     * @var Smarty_Internal_ParseTree
-     */
-    public $current_buffer;
-
-    /**
-     * lexer object
-     *
-     * @var Smarty_Internal_Templatelexer
-     */
-    public $lex;
-
-    /**
-     * internal error flag
-     *
-     * @var bool
-     */
-    private $internalError = false;
-
-    /**
-     * {strip} status
-     *
-     * @var bool
-     */
-    public $strip = false;
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_TemplateCompilerBase
-     */
-    public $compiler = null;
-
-    /**
-     * smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * template object
-     *
-     * @var Smarty_Internal_Template
-     */
-    public $template = null;
-
-    /**
-     * block nesting level
-     *
-     * @var int
-     */
-    public $block_nesting_level = 0;
-
-    /**
-     * security object
-     *
-     * @var Smarty_Security
-     */
-    public $security = null;
-
-    /**
-     * template prefix array
-     *
-     * @var \Smarty_Internal_ParseTree[]
-     */
-    public $template_prefix = array();
-
-    /**
-     * template prefix array
-     *
-     * @var \Smarty_Internal_ParseTree[]
-     */
-    public $template_postfix = array();
-
-    /**
-     * constructor
-     *
-     * @param Smarty_Internal_Templatelexer        $lex
-     * @param Smarty_Internal_TemplateCompilerBase $compiler
-     */
-    public function __construct(Smarty_Internal_Templatelexer $lex, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->lex = $lex;
-        $this->compiler = $compiler;
-        $this->template = $this->compiler->template;
-        $this->smarty = $this->template->smarty;
-        $this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false;
-        $this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template();
-    }
-
-     /**
-     * insert PHP code in current buffer
-     *
-     * @param string $code
-     */
-    public function insertPhpCode($code)
-    {
-        $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Tag($this, $code));
-    }
-
-    /**
-     * error rundown
-     *
-     */
-    public function errorRunDown()
-    {
-        while ($this->yystack !== array()) {
-            $this->yy_pop_parser_stack();
-        }
-        if (is_resource($this->yyTraceFILE)) {
-            fclose($this->yyTraceFILE);
-        }
-    }
-
-    /**
-     *  merge PHP code with prefix code and return parse tree tag object
-     *
-     * @param string $code
-     *
-     * @return Smarty_Internal_ParseTree_Tag
-     */
-    public function mergePrefixCode($code)
-    {
-        $tmp = '';
-        foreach ($this->compiler->prefix_code as $preCode) {
-            $tmp .= $preCode;
-        }
-        $this->compiler->prefix_code = array();
-        $tmp .= $code;
-        return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true));
-    }
-
-}
-
-%token_prefix TP_
-
-%parse_accept
-{
-    $this->successful = !$this->internalError;
-    $this->internalError = false;
-    $this->retvalue = $this->_retvalue;
-}
-
-%syntax_error
-{
-    $this->internalError = true;
-    $this->yymajor = $yymajor;
-    $this->compiler->trigger_template_error();
-}
-
-%stack_overflow
-{
-    $this->internalError = true;
-    $this->compiler->trigger_template_error('Stack overflow in template parser');
-}
-
-
-%right VERT.
-%left COLON.
-
-
-    //
-    // complete template
-    //
-start(res)       ::= template. {
-    $this->root_buffer->prepend_array($this, $this->template_prefix);
-    $this->root_buffer->append_array($this, $this->template_postfix);
-    res = $this->root_buffer->to_smarty_php($this);
-}
-
-
-                      // php tags
-template       ::= template PHP(B). {
-    $code = $this->compiler->compileTag('private_php',array(array('code' => B), array('type' => $this->lex->phpType )),array());
-    if ($this->compiler->has_code && !empty($code)) {
-        $tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();
-         $this->current_buffer->append_subtree($this,  new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp.$code,true)));
-    }
-}
-
-                      // template text
-template       ::= template  TEXT(B). {
-         $text = $this->yystack[ $this->yyidx + 0 ]->minor;
-
-         if ((string)$text == '') {
-            $this->current_buffer->append_subtree($this, null);
-         }
-
-         $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text($text, $this->strip));
-}
-                      // strip on
-template       ::= template  STRIPON. {
-    $this->strip = true;
-}
-                      // strip off
-template       ::= template STRIPOFF. {
-    $this->strip = false;
-}
-
-                     // Literal
-template       ::= template LITERALSTART literal_e2(B) LITERALEND. {
-       $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text(B));
-}
-
-
-literal_e2(A) ::= literal_e1(B) LITERALSTART literal_e1(C) LITERALEND. {
-    A = B.C;
-}
-literal_e2(A) ::= literal_e1(B). {
-    A = B;
-}
-
-literal_e1(A) ::= literal_e1(B) LITERAL(C). {
-        A = B.C;
-
-}
-
-literal_e1(A) ::= . {
-    A = '';
-}
-                      // Smarty tag
-template       ::= template smartytag(B). {
-      if ($this->compiler->has_code) {
-          $this->current_buffer->append_subtree($this, $this->mergePrefixCode(B));
-      }
-     $this->compiler->has_variable_string = false;
-     $this->block_nesting_level = count($this->compiler->_tag_stack);
-}
-
-
-                      // empty template
-template       ::= .
-
-smartytag(A)   ::= SIMPELOUTPUT(B). {
-    $var = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
-    if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
-        A = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
-    } else {
-        A = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->compiler->compileVariable('\''.$var.'\'')));
-    }
-}
-
-// simple tag like {name}
-smartytag(A)::= SIMPLETAG(B). {
-    $tag = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()));
-    if ($tag == 'strip') {
-        $this->strip = true;
-        A = null;
-    } else {
-        if (defined($tag)) {
-            if ($this->security) {
-               $this->security->isTrustedConstant($tag, $this->compiler);
-            }
-            A = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag));
-        } else {
-            if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
-                A = $this->compiler->compileTag($match[1],array('\'nocache\''));
-            } else {
-                A = $this->compiler->compileTag($tag,array());
-            }
-        }
-    }
-}
-                  // {$smarty.block.child} or {$smarty.block.parent}
-smartytag(A)   ::= SMARTYBLOCKCHILDPARENT(i). {
-    $j = strrpos(i,'.');
-    if (i[$j+1] == 'c') {
-        // {$smarty.block.child}
-        A = $this->compiler->compileTag('child',array(),array(i));
-    } else {
-        // {$smarty.block.parent}
-       A = $this->compiler->compileTag('parent',array(),array(i));
-     }
-}
-
-smartytag(A)   ::= LDEL tagbody(B) RDEL. {
-    A  = B;
-}
-
- smartytag(A)   ::=  tag(B) RDEL. {
-     A  = B;
- }
-                  // output with optional attributes
-tagbody(A) ::= outattr(B). {
-    A = $this->compiler->compileTag('private_print_expression',B[1],array('value'=>B[0]));
-}
-
-//
-// Smarty tags start here
-//
-
-                  // assign new style
-tagbody(A) ::= DOLLARID(B) eqoutattr(C). {
-    A = $this->compiler->compileTag('assign',array_merge(array(array('value'=>C[0]),array('var'=>'\''.substr(B,1).'\'')),C[1]));
-}
-
-tagbody(A) ::= varindexed(B) eqoutattr(C). {
-    A = $this->compiler->compileTag('assign',array_merge(array(array('value'=>C[0]),array('var'=>B['var'])),C[1]),array('smarty_internal_index'=>B['smarty_internal_index']));
-}
-
-eqoutattr(A) ::= EQUAL outattr(B). {
-       A = B;
-}
-
-outattr(A) ::= output(B) attributes(C). {
-    A = array(B,C);
-}
-
-output(A) ::= variable(B). {
-    A = B;
-}
-output(A) ::= value(B). {
-    A = B;
-}
-output(A) ::= expr(B). {
-    A = B;
-}
-
-                  // tag with optional Smarty2 style attributes
-tag(res)   ::= LDEL ID(i) attributes(a). {
-        if (defined(i)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant(i, $this->compiler);
-            }
-            res = $this->compiler->compileTag('private_print_expression',a,array('value'=>i));
-        } else {
-            res = $this->compiler->compileTag(i,a);
-        }
-}
-tag(res)   ::= LDEL ID(i). {
-        if (defined(i)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant(i, $this->compiler);
-            }
-            res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>i));
-        } else {
-            res = $this->compiler->compileTag(i,array());
-        }
-}
-
-
-                  // tag with modifier and optional Smarty2 style attributes
-tag(res)   ::= LDEL ID(i) modifierlist(l)attributes(a). {
-        if (defined(i)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant(i, $this->compiler);
-            }
-            res = $this->compiler->compileTag('private_print_expression',a,array('value'=>i, 'modifierlist'=>l));
-        } else {
-            res = $this->compiler->compileTag(i,a, array('modifierlist'=>l));
-        }
-}
-
-                  // registered object tag
-tag(res)   ::= LDEL ID(i) PTR ID(m) attributes(a). {
-    res = $this->compiler->compileTag(i,a,array('object_method'=>m));
-}
-
-                  // registered object tag with modifiers
-tag(res)   ::= LDEL ID(i) PTR ID(me) modifierlist(l) attributes(a). {
-    res = $this->compiler->compileTag(i,a,array('modifierlist'=>l, 'object_method'=>me));
-}
-
-                  // nocache tag
-tag(res)   ::= LDELMAKENOCACHE DOLLARID(i). {
-    res = $this->compiler->compileTag('make_nocache',array(array('var'=>'\''.substr(i,1).'\'')));
-}
-
-                  // {if}, {elseif} and {while} tag
-tag(res)   ::= LDELIF(i) expr(ie). {
-    $tag = trim(substr(i,$this->compiler->getLdelLength())); 
-    res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
-}
-
-tag(res)   ::= LDELIF(i) expr(ie) attributes(a). {
-    $tag = trim(substr(i,$this->compiler->getLdelLength()));
-    res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
-}
-
-tag(res)   ::= LDELIF(i) statement(ie). {
-    $tag = trim(substr(i,$this->compiler->getLdelLength()));
-    res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
-}
-
-tag(res)   ::= LDELIF(i) statement(ie)  attributes(a). {
-    $tag = trim(substr(i,$this->compiler->getLdelLength()));
-    res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
-}
-
-                  // {for} tag
-tag(res)   ::= LDELFOR statements(st) SEMICOLON expr(ie) SEMICOLON varindexed(v2) foraction(e2) attributes(a). {
-    res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('ifexp'=>ie),array('var'=>v2),array('step'=>e2))),1);
-}
-
-  foraction(res)   ::= EQUAL expr(e). {
-    res = '='.e;
-}
-
-  foraction(res)   ::= INCDEC(e). {
-    res = e;
-}
-
-tag(res)   ::= LDELFOR statement(st) TO expr(v) attributes(a). {
-    res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v))),0);
-}
-
-tag(res)   ::= LDELFOR statement(st) TO expr(v) STEP expr(v2) attributes(a). {
-    res = $this->compiler->compileTag('for',array_merge(a,array(array('start'=>st),array('to'=>v),array('step'=>v2))),0);
-}
-
-                  // {foreach} tag
-tag(res)   ::= LDELFOREACH SPACE expr(e) AS varvar(v0) attributes(a). {
-    res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0))));
-}
-
-tag(res)   ::= LDELFOREACH SPACE expr(e) AS varvar(v1) APTR varvar(v0) attributes(a). {
-    res = $this->compiler->compileTag('foreach',array_merge(a,array(array('from'=>e),array('item'=>v0),array('key'=>v1))));
-}
-tag(res)   ::= LDELFOREACH attributes(a). {
-    res = $this->compiler->compileTag('foreach',a);
-}
-
-                  // {setfilter}
-tag(res)   ::= LDELSETFILTER ID(m) modparameters(p). {
-    res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array(m),p))));
-}
-
-tag(res)   ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). {
-    res = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array(m),p)),l)));
-}
-
-                  
-                  // end of block tag  {/....}                  
-smartytag(res)::= CLOSETAG(t). {
-    $tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' /');
-    if ($tag === 'strip') {
-        $this->strip = false;
-        res = null;
-    } else {
-       res = $this->compiler->compileTag($tag.'close',array());
-    }
- }
-tag(res)   ::= LDELSLASH ID(i). {
-    res = $this->compiler->compileTag(i.'close',array());
-}
-
-tag(res)   ::= LDELSLASH ID(i) modifierlist(l). {
-    res = $this->compiler->compileTag(i.'close',array(),array('modifier_list'=>l));
-}
-
-                  // end of block object tag  {/....}                 
-tag(res)   ::= LDELSLASH ID(i) PTR ID(m). {
-    res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m));
-}
-
-tag(res)   ::= LDELSLASH ID(i) PTR ID(m) modifierlist(l). {
-    res = $this->compiler->compileTag(i.'close',array(),array('object_method'=>m, 'modifier_list'=>l));
-}
-
-//
-//Attributes of Smarty tags 
-//
-                  // list of attributes
-attributes(res)  ::= attributes(a1) attribute(a2). {
-    res = a1;
-    res[] = a2;
-}
-
-                  // single attribute
-attributes(res)  ::= attribute(a). {
-    res = array(a);
-}
-
-                  // no attributes
-attributes(res)  ::= . {
-    res = array();
-}
-                  
-                  // attribute
-attribute(res)   ::= SPACE ID(v) EQUAL ID(id). {
-    if (defined(id)) {
-        if ($this->security) {
-            $this->security->isTrustedConstant(id, $this->compiler);
-        }
-        res = array(v=>id);
-    } else {
-        res = array(v=>'\''.id.'\'');
-    }
-}
-
-attribute(res)   ::= ATTR(v) expr(e). {
-    res = array(trim(v," =\n\r\t")=>e);
-}
-
-attribute(res)   ::= ATTR(v) value(e). {
-    res = array(trim(v," =\n\r\t")=>e);
-}
-
-attribute(res)   ::= SPACE ID(v). {
-    res = '\''.v.'\'';
-}
-
-attribute(res)   ::= SPACE expr(e). {
-    res = e;
-}
-
-attribute(res)   ::= SPACE value(v). {
-    res = v;
-}
-
-attribute(res)   ::= SPACE INTEGER(i) EQUAL expr(e). {
-    res = array(i=>e);
-}
-
-                  
-
-//
-// statement
-//
-statements(res)   ::= statement(s). {
-    res = array(s);
-}
-
-statements(res)   ::= statements(s1) COMMA statement(s). {
-    s1[]=s;
-    res = s1;
-}
-
-statement(res)    ::= DOLLARID(i) EQUAL INTEGER(e). {
-    res = array('var' => '\''.substr(i,1).'\'', 'value'=>e);
-}
-statement(res)    ::= DOLLARID(i) EQUAL expr(e). {
-    res = array('var' => '\''.substr(i,1).'\'', 'value'=>e);
-}
-
-statement(res)    ::= varindexed(vi) EQUAL expr(e). {
-    res = array('var' => vi, 'value'=>e);
-}
-
-statement(res)    ::= OPENP statement(st) CLOSEP. {
-    res = st;
-}
-
-
-//
-// expressions
-//
-
-                  // single value
-expr(res)        ::= value(v). {
-    res = v;
-}
-
-                 // ternary
-expr(res)        ::= ternary(v). {
-    res = v;
-}
-
-                 // resources/streams
-expr(res)        ::= DOLLARID(i) COLON ID(i2). {
-    res = '$_smarty_tpl->getStreamVariable(\''.substr(i,1).'://' . i2 . '\')';
-}
-
-                  // arithmetic expression
-expr(res)        ::= expr(e) MATH(m) value(v). {
-    res = e . trim(m) . v;
-}
-
-expr(res)        ::= expr(e) UNIMATH(m) value(v). {
-    res = e . trim(m) . v;
-}
-
-// if expression
-                    // special conditions
-expr(res)        ::= expr(e1) tlop(c) value(e2). {
-    res = c['pre']. e1.c['op'].e2 .')';
-}
-                    // simple expression
-expr(res)        ::= expr(e1) lop(c) expr(e2). {
-    res = e1.c.e2;
-}
-
-expr(res)        ::= expr(e1) scond(c). {
-    res = c . e1 . ')';
-}
-
-expr(res)        ::= expr(e1) ISIN array(a).  {
-    res = 'in_array('.e1.','.a.')';
-}
-
-expr(res)        ::= expr(e1) ISIN value(v).  {
-    res = 'in_array('.e1.',(array)'.v.')';
-}
-
-
-//
-// ternary
-//
-ternary(res)        ::= OPENP expr(v) CLOSEP  QMARK DOLLARID(e1) COLON  expr(e2). {
-    res = v.' ? '. $this->compiler->compileVariable('\''.substr(e1,1).'\'') . ' : '.e2;
-}
-
-ternary(res)        ::= OPENP expr(v) CLOSEP  QMARK  expr(e1) COLON  expr(e2). {
-    res = v.' ? '.e1.' : '.e2;
-}
-
-                 // value
-value(res)       ::= variable(v). {
-    res = v;
-}
-
-                  // +/- value
-value(res)        ::= UNIMATH(m) value(v). {
-    res = m.v;
-}
-
-                  // logical negation
-value(res)       ::= NOT value(v). {
-    res = '!'.v;
-}
-
-value(res)       ::= TYPECAST(t) value(v). {
-    res = t.v;
-}
-
-value(res)       ::= variable(v) INCDEC(o). {
-    res = v.o;
-}
-
-                 // numeric
-value(res)       ::= HEX(n). {
-    res = n;
-}
-
-value(res)       ::= INTEGER(n). {
-    res = n;
-}
-
-value(res)       ::= INTEGER(n1) DOT INTEGER(n2). {
-    res = n1.'.'.n2;
-}
-
-value(res)       ::= INTEGER(n1) DOT. {
-    res = n1.'.';
-}
-
-value(res)       ::= DOT INTEGER(n1). {
-    res = '.'.n1;
-}
-
-                 // ID, true, false, null
-value(res)       ::= ID(id). {
-    if (defined(id)) {
-        if ($this->security) {
-             $this->security->isTrustedConstant(id, $this->compiler);
-        }
-        res = id;
-    } else {
-        res = '\''.id.'\'';
-    }
-}
-
-                  // function call
-value(res)       ::= function(f). {
-    res = f;
-}
-
-                  // expression
-value(res)       ::= OPENP expr(e) CLOSEP. {
-    res = '('. e .')';
-}
-
-value(res)        ::= variable(v1) INSTANCEOF(i) ns1(v2). {
-      res = v1.i.v2;
-}
-value(res)        ::= variable(v1) INSTANCEOF(i) variable(v2). {
-      res = v1.i.v2;
-}
-
-                  // singele quoted string
-value(res)       ::= SINGLEQUOTESTRING(t). {
-    res = t;
-}
-
-                  // double quoted string
-value(res)       ::= doublequoted_with_quotes(s). {
-    res = s;
-}
-
-
-value(res)    ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
-    $prefixVar = $this->compiler->getNewPrefixVariable();
-    if (vi['var'] === '\'smarty\'') {
-        $this->compiler->appendPrefixCode("<?php {$prefixVar} = ". $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>');
-     } else {
-        $this->compiler->appendPrefixCode("<?php  {$prefixVar} = ". $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>');
-    }
-    res = $prefixVar .'::'.r[0].r[1];
-}
-
-                  // Smarty tag
-value(res)       ::= smartytag(st). {
-    $prefixVar = $this->compiler->getNewPrefixVariable();
-    $tmp = $this->compiler->appendCode('<?php ob_start();?>', st);
-    $this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php {$prefixVar} = ob_get_clean();?>"));
-    res = $prefixVar;
-}
-
-value(res)       ::= value(v) modifierlist(l). {
-    res = $this->compiler->compileTag('private_modifier',array(),array('value'=>v,'modifierlist'=>l));
-}
-                  // name space constant
-value(res)       ::= NAMESPACE(c). {
-    res = c;
-}
-
-                  // array
-value(res)       ::= arraydef(a). {
-    res = a;
-}
-                  // static class access
-value(res)       ::= ns1(c)DOUBLECOLON static_class_access(s). {
-    if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) {
-        if (isset($this->smarty->registered_classes[c])) {
-            res = $this->smarty->registered_classes[c].'::'.s[0].s[1];
-        } else {
-            res = c.'::'.s[0].s[1];
-        } 
-    } else {
-        $this->compiler->trigger_template_error ('static class \''.c.'\' is undefined or not allowed by security setting');
-    }
-}
-//
-// namespace stuff
-//
-
-ns1(res)           ::= ID(i). {
-    res = i;
-}
-
-ns1(res)           ::= NAMESPACE(i). {
-    res = i;
-    }
-
-
-
-
-//
-// variables 
-//
-                  // Smarty variable (optional array)
-variable(res)    ::= DOLLARID(i). {
-   res = $this->compiler->compileVariable('\''.substr(i,1).'\'');
-}
-variable(res)    ::= varindexed(vi). {
-    if (vi['var'] === '\'smarty\'') {
-        $smarty_var = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']);
-        res = $smarty_var;
-    } else {
-        // used for array reset,next,prev,end,current 
-        $this->last_variable = vi['var'];
-        $this->last_index = vi['smarty_internal_index'];
-        res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'];
-    }
-}
-
-                  // variable with property
-variable(res)    ::= varvar(v) AT ID(p). {
-    res = '$_smarty_tpl->tpl_vars['. v .']->'.p;
-}
-
-                  // object
-variable(res)    ::= object(o). {
-    res = o;
-}
-
-                  // config variable
-variable(res)    ::= HATCH ID(i) HATCH. {
-    res = $this->compiler->compileConfigVariable('\'' . i . '\'');
-}
-
-variable(res)    ::= HATCH ID(i) HATCH arrayindex(a). {
-    res = '(is_array($tmp = ' . $this->compiler->compileConfigVariable('\'' . i . '\'') . ') ? $tmp'.a.' :null)';
-}
-
-variable(res)    ::= HATCH variable(v) HATCH. {
-    res = $this->compiler->compileConfigVariable(v);
-}
-
-variable(res)    ::= HATCH variable(v) HATCH arrayindex(a). {
-    res = '(is_array($tmp = ' . $this->compiler->compileConfigVariable(v) . ') ? $tmp'.a.' : null)';
-}
-
-varindexed(res)  ::= DOLLARID(i) arrayindex(a). {
-    res = array('var'=>'\''.substr(i,1).'\'', 'smarty_internal_index'=>a);
-}
-varindexed(res)  ::= varvar(v) arrayindex(a). {
-    res = array('var'=>v, 'smarty_internal_index'=>a);
-}
-
-//
-// array index
-//
-                    // multiple array index
-arrayindex(res)  ::= arrayindex(a1) indexdef(a2). {
-    res = a1.a2;
-}
-
-                    // no array index
-arrayindex        ::= . {
-    return;
-}
-
-// single index definition
-                    // Smarty2 style index 
-indexdef(res)    ::= DOT DOLLARID(i).  {
-    res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
-}
-indexdef(res)    ::= DOT varvar(v).  {
-    res = '['.$this->compiler->compileVariable(v).']';
-}
-
-indexdef(res)    ::= DOT varvar(v) AT ID(p). {
-    res = '['.$this->compiler->compileVariable(v).'->'.p.']';
-}
-
-indexdef(res)   ::= DOT ID(i). {
-    res = '[\''. i .'\']';
-}
-
-indexdef(res)   ::= DOT INTEGER(n). {
-    res = '['. n .']';
-}
-
-
-indexdef(res)   ::= DOT LDEL expr(e) RDEL. {
-    res = '['. e .']';
-}
-
-                    // section tag index
-indexdef(res)   ::= OPENB ID(i)CLOSEB. {
-    res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\'index\']').']';
-}
-
-indexdef(res)   ::= OPENB ID(i) DOT ID(i2) CLOSEB. {
-    res = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.i.'\'][\''.i2.'\']').']';
-}
-indexdef(res)   ::= OPENB SINGLEQUOTESTRING(s) CLOSEB. {
-    res = '['.s.']';
-}
-indexdef(res)   ::= OPENB INTEGER(n) CLOSEB. {
-    res = '['.n.']';
-}
-indexdef(res)   ::= OPENB DOLLARID(i) CLOSEB. {
-    res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
-}
-indexdef(res)   ::= OPENB variable(v) CLOSEB. {
-    res = '['.v.']';
-}
-indexdef(res)   ::= OPENB value(v) CLOSEB. {
-    res = '['.v.']';
-}
-
-                    // PHP style index
-indexdef(res)   ::= OPENB expr(e) CLOSEB. {
-    res = '['. e .']';
-}
-
-                    // for assign append array
-indexdef(res)  ::= OPENB CLOSEB. {
-    res = '[]';
-}
-
-
-//
-// variable variable names
-//
-
-                    // singel identifier element
-varvar(res)      ::= DOLLARID(i). {
-    res = '\''.substr(i,1).'\'';
-}
-                    // single $
-varvar(res)      ::= DOLLAR. {
-    res = '\'\'';
-}
-
-                    // sequence of identifier elements
-varvar(res)      ::= varvar(v1) varvarele(v2). {
-    res = v1.'.'.v2;
-}
-
-                    // fix sections of element
-varvarele(res)   ::= ID(s). {
-    res = '\''.s.'\'';
-}
-varvarele(res)   ::= SIMPELOUTPUT(i). {
-    $var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
-    res = $this->compiler->compileVariable('\''.$var.'\'');
-}
-
-                    // variable sections of element
-varvarele(res)   ::= LDEL expr(e) RDEL. {
-    res = '('.e.')';
-}
-
-//
-// objects
-//
-object(res)    ::= varindexed(vi) objectchain(oc). {
-    if (vi['var'] === '\'smarty\'') {
-        res =  $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).oc;
-    } else {
-        res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].oc;
-    }
-}
-
-                    // single element
-objectchain(res) ::= objectelement(oe). {
-    res  = oe;
-}
-
-                    // chain of elements 
-objectchain(res) ::= objectchain(oc) objectelement(oe). {
-    res  = oc.oe;
-}
-
-                    // variable
-objectelement(res)::= PTR ID(i) arrayindex(a). {
-    if ($this->security && substr(i,0,1) === '_') {
-        $this->compiler->trigger_template_error (self::ERR1);
-    }
-    res = '->'.i.a;
-}
-
-objectelement(res)::= PTR varvar(v) arrayindex(a). {
-    if ($this->security) {
-        $this->compiler->trigger_template_error (self::ERR2);
-    }
-    res = '->{'.$this->compiler->compileVariable(v).a.'}';
-}
-
-objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). {
-    if ($this->security) {
-        $this->compiler->trigger_template_error (self::ERR2);
-    }
-    res = '->{'.e.a.'}';
-}
-
-objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). {
-    if ($this->security) {
-        $this->compiler->trigger_template_error (self::ERR2);
-    }
-    res = '->{\''.ii.'\'.'.e.a.'}';
-}
-
-                    // method
-objectelement(res)::= PTR method(f).  {
-    res = '->'.f;
-}
-
-
-//
-// function
-//
-function(res)     ::= ns1(f) OPENP params(p) CLOSEP. {
-    res = $this->compiler->compilePHPFunctionCall(f, p);
-}
-
-
-//
-// method
-//
-method(res)     ::= ID(f) OPENP params(p) CLOSEP. {
-    if ($this->security && substr(f,0,1) === '_') {
-        $this->compiler->trigger_template_error (self::ERR1);
-    }
-    res = f . '('. implode(',',p) .')';
-}
-
-method(res)     ::= DOLLARID(f) OPENP params(p) CLOSEP.  {
-    if ($this->security) {
-        $this->compiler->trigger_template_error (self::ERR2);
-    }
-    $prefixVar = $this->compiler->getNewPrefixVariable();
-    $this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
-    res = $prefixVar .'('. implode(',',p) .')';
-}
-
-// function/method parameter
-                    // multiple parameters
-params(res)       ::= params(p) COMMA expr(e). {
-    res = array_merge(p,array(e));
-}
-
-                    // single parameter
-params(res)       ::= expr(e). {
-    res = array(e);
-}
-
-                    // kein parameter
-params(res)       ::= . {
-    res = array();
-}
-
-//
-// modifier
-// 
-modifierlist(res) ::= modifierlist(l) modifier(m) modparameters(p). {
-    res = array_merge(l,array(array_merge(m,p)));
-}
-
-modifierlist(res) ::= modifier(m) modparameters(p). {
-    res = array(array_merge(m,p));
-}
- 
-modifier(res)    ::= VERT AT ID(m). {
-    res = array(m);
-}
-
-modifier(res)    ::= VERT ID(m). {
-    res =  array(m);
-}
-
-//
-// modifier parameter
-//
-                    // multiple parameter
-modparameters(res) ::= modparameters(mps) modparameter(mp). {
-    res = array_merge(mps,mp);
-}
-
-                    // no parameter
-modparameters(res)      ::= . {
-    res = array();
-}
-
-                    // parameter expression
-modparameter(res) ::= COLON value(mp). {
-    res = array(mp);
-}
-modparameter(res) ::= COLON UNIMATH(m) value(mp). {
-    res = array(trim(m).mp);
-}
-
-modparameter(res) ::= COLON array(mp). {
-    res = array(mp);
-}
-
-                  // static class methode call
-static_class_access(res)       ::= method(m). {
-    res = array(m, '', 'method');
-}
-
-                  // static class methode call with object chainig
-static_class_access(res)       ::= method(m) objectchain(oc). {
-    res = array(m, oc, 'method');
-}
-
-                  // static class constant
-static_class_access(res)       ::= ID(v). {
-    res = array(v, '');
-}
-
-                  // static class variables
-static_class_access(res)       ::=  DOLLARID(v) arrayindex(a). {
-    res = array(v, a, 'property');
-}
-
-                  // static class variables with object chain
-static_class_access(res)       ::= DOLLARID(v) arrayindex(a) objectchain(oc). {
-    res = array(v, a.oc, 'property');
-}
-
-
-// if conditions and operators
-lop(res)        ::= LOGOP(o). {
-    res = ' '. trim(o) . ' ';
-}
-
-lop(res)        ::= SLOGOP(o). {
-    static $lops = array(
-        'eq' => ' == ',
-        'ne' => ' != ',
-        'neq' => ' != ',
-        'gt' => ' > ',
-        'ge' => ' >= ',
-        'gte' => ' >= ',
-        'lt' =>  ' < ',
-        'le' =>  ' <= ',
-        'lte' => ' <= ',
-        'mod' =>  ' % ',
-        'and' => ' && ',
-        'or' => ' || ',
-        'xor' => ' xor ',
-         );
-    $op = strtolower(preg_replace('/\s*/', '', o));
-    res = $lops[$op];
-}
-tlop(res)        ::= TLOGOP(o). {
-     static $tlops = array(
-         'isdivby' => array('op' => ' % ', 'pre' => '!('),
-         'isnotdivby' => array('op' => ' % ', 'pre' => '('),
-         'isevenby' => array('op' => ' / ', 'pre' => '!(1 & '),
-         'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '),
-         'isoddby' => array('op' => ' / ', 'pre' => '(1 & '),
-         'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '),
-         );
-     $op = strtolower(preg_replace('/\s*/', '', o));
-     res = $tlops[$op];
- }
-
-scond(res)  ::= SINGLECOND(o). {
-        static $scond = array (
-            'iseven' => '!(1 & ',
-            'isnoteven' => '(1 & ',
-            'isodd' => '(1 & ',
-            'isnotodd' => '!(1 & ',
-        );
-   $op = strtolower(str_replace(' ', '', o));
-   res = $scond[$op];
-}
-
-//
-// ARRAY element assignment
-//
-arraydef(res)           ::=  OPENB arrayelements(a) CLOSEB.  {
-    res = 'array('.a.')';
-}
-arraydef(res)           ::=  ARRAYOPEN arrayelements(a) CLOSEP.  {
-    res = 'array('.a.')';
-}
-
-arrayelements(res)   ::=  arrayelement(a).  {
-    res = a;
-}
-
-arrayelements(res)   ::=  arrayelements(a1) COMMA arrayelement(a).  {
-    res = a1.','.a;
-}
-
-arrayelements        ::=  .  {
-    return;
-}
-
-arrayelement(res)    ::=  value(e1) APTR expr(e2). {
-    res = e1.'=>'.e2;
-}
-
-arrayelement(res)    ::=  ID(i) APTR expr(e2). { 
-    res = '\''.i.'\'=>'.e2;
-}
-
-arrayelement(res)    ::=  expr(e). {
-    res = e;
-}
-
-
-//
-// double quoted strings
-//
-doublequoted_with_quotes(res) ::= QUOTE QUOTE. {
-    res = '\'\'';
-}
-
-doublequoted_with_quotes(res) ::= QUOTE doublequoted(s) QUOTE. {
-    $this->compiler->leaveDoubleQuote();
-    res = s->to_smarty_php($this);
-}
-
-
-doublequoted(res)          ::= doublequoted(o1) doublequotedcontent(o2). {
-    o1->append_subtree($this, o2);
-    res = o1;
-}
-
-doublequoted(res)          ::= doublequotedcontent(o). {
-    res = new Smarty_Internal_ParseTree_Dq($this, o);
-}
-
-doublequotedcontent(res)           ::=  BACKTICK variable(v) BACKTICK. {
-    res = new Smarty_Internal_ParseTree_Code('(string)'.v);
-}
-
-doublequotedcontent(res)           ::=  BACKTICK expr(e) BACKTICK. {
-    res = new Smarty_Internal_ParseTree_Code('(string)('.e.')');
-}
-
-doublequotedcontent(res)           ::=  DOLLARID(i). {
-    res = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\''. substr(i,1) .'\']->value');
-}
-
-doublequotedcontent(res)           ::=  LDEL variable(v) RDEL. {
-    res = new Smarty_Internal_ParseTree_Code('(string)'.v);
-}
-
-doublequotedcontent(res)           ::=  LDEL expr(e) RDEL. {
-    res = new Smarty_Internal_ParseTree_Code('(string)('.e.')');
-}
-
-doublequotedcontent(res)     ::=  smartytag(st). {
-    res = new Smarty_Internal_ParseTree_Tag($this, st);
-}
-
-doublequotedcontent(res)           ::=  TEXT(o). {
-    res = new Smarty_Internal_ParseTree_DqContent(o);
-}
-
diff --git a/libraries/Smarty/libs/Autoloader.php b/libraries/Smarty/libs/Autoloader.php
deleted file mode 100644
index c09361b66..000000000
--- a/libraries/Smarty/libs/Autoloader.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-/**
- * Smarty Autoloader
- *
- * @package Smarty
- */
-
-/**
- * Smarty Autoloader
- *
- * @package Smarty
- * @author  Uwe Tews
- *             Usage:
- *                  require_once '...path/Autoloader.php';
- *                  Smarty_Autoloader::register();
- *             or
- *                  include '...path/bootstrap.php';
- *
- *                  $smarty = new Smarty();
- */
-class Smarty_Autoloader
-{
-    /**
-     * Filepath to Smarty root
-     *
-     * @var string
-     */
-    public static $SMARTY_DIR = null;
-
-    /**
-     * Filepath to Smarty internal plugins
-     *
-     * @var string
-     */
-    public static $SMARTY_SYSPLUGINS_DIR = null;
-
-    /**
-     * Array with Smarty core classes and their filename
-     *
-     * @var array
-     */
-    public static $rootClasses = array('smarty' => 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',);
-
-    /**
-     * Registers Smarty_Autoloader backward compatible to older installations.
-     *
-     * @param bool $prepend Whether to prepend the autoloader or not.
-     */
-    public static function registerBC($prepend = false)
-    {
-        /**
-         * register the class autoloader
-         */
-        if (!defined('SMARTY_SPL_AUTOLOAD')) {
-            define('SMARTY_SPL_AUTOLOAD', 0);
-        }
-        if (SMARTY_SPL_AUTOLOAD
-            && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
-        ) {
-            $registeredAutoLoadFunctions = spl_autoload_functions();
-            if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
-                spl_autoload_register();
-            }
-        } else {
-            self::register($prepend);
-        }
-    }
-
-    /**
-     * Registers Smarty_Autoloader as an SPL autoloader.
-     *
-     * @param bool $prepend Whether to prepend the autoloader or not.
-     */
-    public static function register($prepend = false)
-    {
-        self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
-        self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
-            self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
-        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
-            spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
-        } else {
-            spl_autoload_register(array(__CLASS__, 'autoload'));
-        }
-    }
-
-    /**
-     * Handles auto loading of classes.
-     *
-     * @param string $class A class name.
-     */
-    public static function autoload($class)
-    {
-        if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) {
-            return;
-        }
-        $_class = strtolower($class);
-        if (isset(self::$rootClasses[ $_class ])) {
-            $file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
-            if (is_file($file)) {
-                include $file;
-            }
-        } else {
-            $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
-            if (is_file($file)) {
-                include $file;
-            }
-        }
-        return;
-    }
-}
diff --git a/libraries/Smarty/libs/Smarty.class.php b/libraries/Smarty/libs/Smarty.class.php
deleted file mode 100644
index 375bab133..000000000
--- a/libraries/Smarty/libs/Smarty.class.php
+++ /dev/null
@@ -1,1424 +0,0 @@
-<?php
-/**
- * Project:     Smarty: the PHP compiling template engine
- * File:        Smarty.class.php
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3.0 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * For questions, help, comments, discussion, etc., please join the
- * Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
- *
- * @link      http://www.smarty.net/
- * @copyright 2018 New Digital Group, Inc.
- * @copyright 2018 Uwe Tews
- * @author    Monte Ohrt <monte at ohrt dot com>
- * @author    Uwe Tews   <uwe dot tews at gmail dot com>
- * @author    Rodney Rehm
- * @package   Smarty
- */
-/**
- * set SMARTY_DIR to absolute path to Smarty library files.
- * Sets SMARTY_DIR only if user application has not already defined it.
- */
-if (!defined('SMARTY_DIR')) {
-    /**
-     *
-     */
-    define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
-}
-/**
- * set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
- * Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.
- */
-if (!defined('SMARTY_SYSPLUGINS_DIR')) {
-    /**
-     *
-     */
-    define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR);
-}
-if (!defined('SMARTY_PLUGINS_DIR')) {
-    /**
-     *
-     */
-    define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DIRECTORY_SEPARATOR);
-}
-if (!defined('SMARTY_MBSTRING')) {
-    /**
-     *
-     */
-    define('SMARTY_MBSTRING', function_exists('mb_get_info'));
-}
-if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
-    // UTF-8 can only be done properly when mbstring is available!
-    /**
-     * @deprecated in favor of Smarty::$_CHARSET
-     */
-    define('SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1');
-}
-if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
-    /**
-     * @deprecated in favor of Smarty::$_DATE_FORMAT
-     */
-    define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
-}
-/**
- * Load Smarty_Autoloader
- */
-if (!class_exists('Smarty_Autoloader')) {
-    include dirname(__FILE__) . '/bootstrap.php';
-}
-/**
- * Load always needed external class files
- */
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
-require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php';
-
-/**
- * This is the main Smarty class
- *
- * @package Smarty
- *
- * The following methods will be dynamically loaded by the extension handler when they are called.
- * They are located in a corresponding Smarty_Internal_Method_xxxx class
- *
- * @method int clearAllCache(int $exp_time = null, string $type = null)
- * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null)
- * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, $max_errors = null)
- * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, $max_errors = null)
- * @method int clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
- */
-class Smarty extends Smarty_Internal_TemplateBase
-{
-    /**
-     * smarty version
-     */
-    const SMARTY_VERSION = '3.1.39';
-    /**
-     * define variable scopes
-     */
-    const SCOPE_LOCAL    = 1;
-    const SCOPE_PARENT   = 2;
-    const SCOPE_TPL_ROOT = 4;
-    const SCOPE_ROOT     = 8;
-    const SCOPE_SMARTY   = 16;
-    const SCOPE_GLOBAL   = 32;
-    /**
-     * define caching modes
-     */
-    const CACHING_OFF              = 0;
-    const CACHING_LIFETIME_CURRENT = 1;
-    const CACHING_LIFETIME_SAVED   = 2;
-    /**
-     * define constant for clearing cache files be saved expiration dates
-     */
-    const CLEAR_EXPIRED = -1;
-    /**
-     * define compile check modes
-     */
-    const COMPILECHECK_OFF       = 0;
-    const COMPILECHECK_ON        = 1;
-    const COMPILECHECK_CACHEMISS = 2;
-    /**
-     * define debug modes
-     */
-    const DEBUG_OFF        = 0;
-    const DEBUG_ON         = 1;
-    const DEBUG_INDIVIDUAL = 2;
-    /**
-     * modes for handling of "<?php ... ?>" tags in templates.
-     */
-    const PHP_PASSTHRU = 0; //-> print tags as plain text
-    const PHP_QUOTE    = 1; //-> escape tags as entities
-    const PHP_REMOVE   = 2; //-> escape tags as entities
-    const PHP_ALLOW    = 3; //-> escape tags as entities
-    /**
-     * filter types
-     */
-    const FILTER_POST     = 'post';
-    const FILTER_PRE      = 'pre';
-    const FILTER_OUTPUT   = 'output';
-    const FILTER_VARIABLE = 'variable';
-    /**
-     * plugin types
-     */
-    const PLUGIN_FUNCTION         = 'function';
-    const PLUGIN_BLOCK            = 'block';
-    const PLUGIN_COMPILER         = 'compiler';
-    const PLUGIN_MODIFIER         = 'modifier';
-    const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler';
-
-    /**
-     * assigned global tpl vars
-     */
-    public static $global_tpl_vars = array();
-
-    /**
-     * Flag denoting if Multibyte String functions are available
-     */
-    public static $_MBSTRING = SMARTY_MBSTRING;
-
-    /**
-     * The character set to adhere to (e.g. "UTF-8")
-     */
-    public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;
-
-    /**
-     * The date format to be used internally
-     * (accepts date() and strftime())
-     */
-    public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT;
-
-    /**
-     * Flag denoting if PCRE should run in UTF-8 mode
-     */
-    public static $_UTF8_MODIFIER = 'u';
-
-    /**
-     * Flag denoting if operating system is windows
-     */
-    public static $_IS_WINDOWS = false;
-
-    /**
-     * auto literal on delimiters with whitespace
-     *
-     * @var boolean
-     */
-    public $auto_literal = true;
-
-    /**
-     * display error on not assigned variables
-     *
-     * @var boolean
-     */
-    public $error_unassigned = false;
-
-    /**
-     * look up relative file path in include_path
-     *
-     * @var boolean
-     */
-    public $use_include_path = false;
-
-    /**
-     * flag if template_dir is normalized
-     *
-     * @var bool
-     */
-    public $_templateDirNormalized = false;
-
-    /**
-     * joined template directory string used in cache keys
-     *
-     * @var string
-     */
-    public $_joined_template_dir = null;
-
-    /**
-     * flag if config_dir is normalized
-     *
-     * @var bool
-     */
-    public $_configDirNormalized = false;
-
-    /**
-     * joined config directory string used in cache keys
-     *
-     * @var string
-     */
-    public $_joined_config_dir = null;
-
-    /**
-     * default template handler
-     *
-     * @var callable
-     */
-    public $default_template_handler_func = null;
-
-    /**
-     * default config handler
-     *
-     * @var callable
-     */
-    public $default_config_handler_func = null;
-
-    /**
-     * default plugin handler
-     *
-     * @var callable
-     */
-    public $default_plugin_handler_func = null;
-
-    /**
-     * flag if template_dir is normalized
-     *
-     * @var bool
-     */
-    public $_compileDirNormalized = false;
-
-    /**
-     * flag if plugins_dir is normalized
-     *
-     * @var bool
-     */
-    public $_pluginsDirNormalized = false;
-
-    /**
-     * flag if template_dir is normalized
-     *
-     * @var bool
-     */
-    public $_cacheDirNormalized = false;
-
-    /**
-     * force template compiling?
-     *
-     * @var boolean
-     */
-    public $force_compile = false;
-
-    /**
-     * use sub dirs for compiled/cached files?
-     *
-     * @var boolean
-     */
-    public $use_sub_dirs = false;
-
-    /**
-     * allow ambiguous resources (that are made unique by the resource handler)
-     *
-     * @var boolean
-     */
-    public $allow_ambiguous_resources = false;
-
-    /**
-     * merge compiled includes
-     *
-     * @var boolean
-     */
-    public $merge_compiled_includes = false;
-
-    /*
-    * flag for behaviour when extends: resource  and {extends} tag are used simultaneous
-    *   if false disable execution of {extends} in templates called by extends resource.
-    *   (behaviour as versions < 3.1.28)
-    *
-    * @var boolean
-    */
-    public $extends_recursion = true;
-
-    /**
-     * force cache file creation
-     *
-     * @var boolean
-     */
-    public $force_cache = false;
-
-    /**
-     * template left-delimiter
-     *
-     * @var string
-     */
-    public $left_delimiter = "{";
-
-    /**
-     * template right-delimiter
-     *
-     * @var string
-     */
-    public $right_delimiter = "}";
-
-    /**
-     * array of strings which shall be treated as literal by compiler
-     *
-     * @var array string
-     */
-    public $literals = array();
-
-    /**
-     * class name
-     * This should be instance of Smarty_Security.
-     *
-     * @var string
-     * @see Smarty_Security
-     */
-    public $security_class = 'Smarty_Security';
-
-    /**
-     * implementation of security class
-     *
-     * @var Smarty_Security
-     */
-    public $security_policy = null;
-
-    /**
-     * controls handling of PHP-blocks
-     *
-     * @var integer
-     */
-    public $php_handling = self::PHP_PASSTHRU;
-
-    /**
-     * controls if the php template file resource is allowed
-     *
-     * @var bool
-     */
-    public $allow_php_templates = false;
-
-    /**
-     * debug mode
-     * Setting this to true enables the debug-console.
-     *
-     * @var boolean
-     */
-    public $debugging = false;
-
-    /**
-     * This determines if debugging is enable-able from the browser.
-     * <ul>
-     *  <li>NONE => no debugging control allowed</li>
-     *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
-     * </ul>
-     *
-     * @var string
-     */
-    public $debugging_ctrl = 'NONE';
-
-    /**
-     * Name of debugging URL-param.
-     * Only used when $debugging_ctrl is set to 'URL'.
-     * The name of the URL-parameter that activates debugging.
-     *
-     * @var string
-     */
-    public $smarty_debug_id = 'SMARTY_DEBUG';
-
-    /**
-     * Path of debug template.
-     *
-     * @var string
-     */
-    public $debug_tpl = null;
-
-    /**
-     * When set, smarty uses this value as error_reporting-level.
-     *
-     * @var int
-     */
-    public $error_reporting = null;
-
-    /**
-     * Controls whether variables with the same name overwrite each other.
-     *
-     * @var boolean
-     */
-    public $config_overwrite = true;
-
-    /**
-     * Controls whether config values of on/true/yes and off/false/no get converted to boolean.
-     *
-     * @var boolean
-     */
-    public $config_booleanize = true;
-
-    /**
-     * Controls whether hidden config sections/vars are read from the file.
-     *
-     * @var boolean
-     */
-    public $config_read_hidden = false;
-
-    /**
-     * locking concurrent compiles
-     *
-     * @var boolean
-     */
-    public $compile_locking = true;
-
-    /**
-     * Controls whether cache resources should use locking mechanism
-     *
-     * @var boolean
-     */
-    public $cache_locking = false;
-
-    /**
-     * seconds to wait for acquiring a lock before ignoring the write lock
-     *
-     * @var float
-     */
-    public $locking_timeout = 10;
-
-    /**
-     * resource type used if none given
-     * Must be an valid key of $registered_resources.
-     *
-     * @var string
-     */
-    public $default_resource_type = 'file';
-
-    /**
-     * caching type
-     * Must be an element of $cache_resource_types.
-     *
-     * @var string
-     */
-    public $caching_type = 'file';
-
-    /**
-     * config type
-     *
-     * @var string
-     */
-    public $default_config_type = 'file';
-
-    /**
-     * check If-Modified-Since headers
-     *
-     * @var boolean
-     */
-    public $cache_modified_check = false;
-
-    /**
-     * registered plugins
-     *
-     * @var array
-     */
-    public $registered_plugins = array();
-
-    /**
-     * registered objects
-     *
-     * @var array
-     */
-    public $registered_objects = array();
-
-    /**
-     * registered classes
-     *
-     * @var array
-     */
-    public $registered_classes = array();
-
-    /**
-     * registered filters
-     *
-     * @var array
-     */
-    public $registered_filters = array();
-
-    /**
-     * registered resources
-     *
-     * @var array
-     */
-    public $registered_resources = array();
-
-    /**
-     * registered cache resources
-     *
-     * @var array
-     */
-    public $registered_cache_resources = array();
-
-    /**
-     * autoload filter
-     *
-     * @var array
-     */
-    public $autoload_filters = array();
-
-    /**
-     * default modifier
-     *
-     * @var array
-     */
-    public $default_modifiers = array();
-
-    /**
-     * autoescape variable output
-     *
-     * @var boolean
-     */
-    public $escape_html = false;
-
-    /**
-     * start time for execution time calculation
-     *
-     * @var int
-     */
-    public $start_time = 0;
-
-    /**
-     * required by the compiler for BC
-     *
-     * @var string
-     */
-    public $_current_file = null;
-
-    /**
-     * internal flag to enable parser debugging
-     *
-     * @var bool
-     */
-    public $_parserdebug = false;
-
-    /**
-     * This object type (Smarty = 1, template = 2, data = 4)
-     *
-     * @var int
-     */
-    public $_objType = 1;
-
-    /**
-     * Debug object
-     *
-     * @var Smarty_Internal_Debug
-     */
-    public $_debug = null;
-
-    /**
-     * template directory
-     *
-     * @var array
-     */
-    protected $template_dir = array('./templates/');
-
-    /**
-     * flags for normalized template directory entries
-     *
-     * @var array
-     */
-    protected $_processedTemplateDir = array();
-
-    /**
-     * config directory
-     *
-     * @var array
-     */
-    protected $config_dir = array('./configs/');
-
-    /**
-     * flags for normalized template directory entries
-     *
-     * @var array
-     */
-    protected $_processedConfigDir = array();
-
-    /**
-     * compile directory
-     *
-     * @var string
-     */
-    protected $compile_dir = './templates_c/';
-
-    /**
-     * plugins directory
-     *
-     * @var array
-     */
-    protected $plugins_dir = array();
-
-    /**
-     * cache directory
-     *
-     * @var string
-     */
-    protected $cache_dir = './cache/';
-
-    /**
-     * removed properties
-     *
-     * @var string[]
-     */
-    protected $obsoleteProperties = array(
-        'resource_caching', 'template_resource_caching', 'direct_access_security',
-        '_dir_perms', '_file_perms', 'plugin_search_order',
-        'inheritance_merge_compiled_includes', 'resource_cache_mode',
-    );
-
-    /**
-     * List of private properties which will call getter/setter on a direct access
-     *
-     * @var string[]
-     */
-    protected $accessMap = array(
-        'template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir',
-        'plugins_dir'  => 'PluginsDir', 'compile_dir' => 'CompileDir',
-        'cache_dir'    => 'CacheDir',
-    );
-
-    /**
-     * Initialize new Smarty object
-     */
-    public function __construct()
-    {
-        $this->_clearTemplateCache();
-        parent::__construct();
-        if (is_callable('mb_internal_encoding')) {
-            mb_internal_encoding(Smarty::$_CHARSET);
-        }
-        $this->start_time = microtime(true);
-        if (isset($_SERVER[ 'SCRIPT_NAME' ])) {
-            Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]);
-        }
-        // Check if we're running on windows
-        Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
-        // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8
-        if (Smarty::$_CHARSET !== 'UTF-8') {
-            Smarty::$_UTF8_MODIFIER = '';
-        }
-    }
-
-    /**
-     * Enable error handler to mute expected messages
-     *
-     * @return     boolean
-     * @deprecated
-     */
-    public static function muteExpectedErrors()
-    {
-        return Smarty_Internal_ErrorHandler::muteExpectedErrors();
-    }
-
-    /**
-     * Disable error handler muting expected messages
-     *
-     * @deprecated
-     */
-    public static function unmuteExpectedErrors()
-    {
-        restore_error_handler();
-    }
-
-    /**
-     * Check if a template resource exists
-     *
-     * @param string $resource_name template name
-     *
-     * @return bool status
-     * @throws \SmartyException
-     */
-    public function templateExists($resource_name)
-    {
-        // create source object
-        $source = Smarty_Template_Source::load(null, $this, $resource_name);
-        return $source->exists;
-    }
-
-    /**
-     * Loads security class and enables security
-     *
-     * @param string|Smarty_Security $security_class if a string is used, it must be class-name
-     *
-     * @return Smarty                 current Smarty instance for chaining
-     * @throws \SmartyException
-     */
-    public function enableSecurity($security_class = null)
-    {
-        Smarty_Security::enableSecurity($this, $security_class);
-        return $this;
-    }
-
-    /**
-     * Disable security
-     *
-     * @return Smarty current Smarty instance for chaining
-     */
-    public function disableSecurity()
-    {
-        $this->security_policy = null;
-        return $this;
-    }
-
-    /**
-     * Add template directory(s)
-     *
-     * @param string|array $template_dir directory(s) of template sources
-     * @param string       $key          of the array element to assign the template dir to
-     * @param bool         $isConfig     true for config_dir
-     *
-     * @return Smarty          current Smarty instance for chaining
-     */
-    public function addTemplateDir($template_dir, $key = null, $isConfig = false)
-    {
-        if ($isConfig) {
-            $processed = &$this->_processedConfigDir;
-            $dir = &$this->config_dir;
-            $this->_configDirNormalized = false;
-        } else {
-            $processed = &$this->_processedTemplateDir;
-            $dir = &$this->template_dir;
-            $this->_templateDirNormalized = false;
-        }
-        if (is_array($template_dir)) {
-            foreach ($template_dir as $k => $v) {
-                if (is_int($k)) {
-                    // indexes are not merged but appended
-                    $dir[] = $v;
-                } else {
-                    // string indexes are overridden
-                    $dir[ $k ] = $v;
-                    unset($processed[ $key ]);
-                }
-            }
-        } else {
-            if ($key !== null) {
-                // override directory at specified index
-                $dir[ $key ] = $template_dir;
-                unset($processed[ $key ]);
-            } else {
-                // append new directory
-                $dir[] = $template_dir;
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * Get template directories
-     *
-     * @param mixed $index    index of directory to get, null to get all
-     * @param bool  $isConfig true for config_dir
-     *
-     * @return array|string list of template directories, or directory of $index
-     */
-    public function getTemplateDir($index = null, $isConfig = false)
-    {
-        if ($isConfig) {
-            $dir = &$this->config_dir;
-        } else {
-            $dir = &$this->template_dir;
-        }
-        if ($isConfig ? !$this->_configDirNormalized : !$this->_templateDirNormalized) {
-            $this->_normalizeTemplateConfig($isConfig);
-        }
-        if ($index !== null) {
-            return isset($dir[ $index ]) ? $dir[ $index ] : null;
-        }
-        return $dir;
-    }
-
-    /**
-     * Set template directory
-     *
-     * @param string|array $template_dir directory(s) of template sources
-     * @param bool         $isConfig     true for config_dir
-     *
-     * @return \Smarty current Smarty instance for chaining
-     */
-    public function setTemplateDir($template_dir, $isConfig = false)
-    {
-        if ($isConfig) {
-            $this->config_dir = array();
-            $this->_processedConfigDir = array();
-        } else {
-            $this->template_dir = array();
-            $this->_processedTemplateDir = array();
-        }
-        $this->addTemplateDir($template_dir, null, $isConfig);
-        return $this;
-    }
-
-    /**
-     * Add config directory(s)
-     *
-     * @param string|array $config_dir directory(s) of config sources
-     * @param mixed        $key        key of the array element to assign the config dir to
-     *
-     * @return Smarty current Smarty instance for chaining
-     */
-    public function addConfigDir($config_dir, $key = null)
-    {
-        return $this->addTemplateDir($config_dir, $key, true);
-    }
-
-    /**
-     * Get config directory
-     *
-     * @param mixed $index index of directory to get, null to get all
-     *
-     * @return array configuration directory
-     */
-    public function getConfigDir($index = null)
-    {
-        return $this->getTemplateDir($index, true);
-    }
-
-    /**
-     * Set config directory
-     *
-     * @param $config_dir
-     *
-     * @return Smarty       current Smarty instance for chaining
-     */
-    public function setConfigDir($config_dir)
-    {
-        return $this->setTemplateDir($config_dir, true);
-    }
-
-    /**
-     * Adds directory of plugin files
-     *
-     * @param null|array|string $plugins_dir
-     *
-     * @return Smarty current Smarty instance for chaining
-     */
-    public function addPluginsDir($plugins_dir)
-    {
-        if (empty($this->plugins_dir)) {
-            $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
-        }
-        $this->plugins_dir = array_merge($this->plugins_dir, (array)$plugins_dir);
-        $this->_pluginsDirNormalized = false;
-        return $this;
-    }
-
-    /**
-     * Get plugin directories
-     *
-     * @return array list of plugin directories
-     */
-    public function getPluginsDir()
-    {
-        if (empty($this->plugins_dir)) {
-            $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
-            $this->_pluginsDirNormalized = false;
-        }
-        if (!$this->_pluginsDirNormalized) {
-            if (!is_array($this->plugins_dir)) {
-                $this->plugins_dir = (array)$this->plugins_dir;
-            }
-            foreach ($this->plugins_dir as $k => $v) {
-                $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, '/\\') . DIRECTORY_SEPARATOR, true);
-            }
-            $this->_cache[ 'plugin_files' ] = array();
-            $this->_pluginsDirNormalized = true;
-        }
-        return $this->plugins_dir;
-    }
-
-    /**
-     * Set plugins directory
-     *
-     * @param string|array $plugins_dir directory(s) of plugins
-     *
-     * @return Smarty       current Smarty instance for chaining
-     */
-    public function setPluginsDir($plugins_dir)
-    {
-        $this->plugins_dir = (array)$plugins_dir;
-        $this->_pluginsDirNormalized = false;
-        return $this;
-    }
-
-    /**
-     * Get compiled directory
-     *
-     * @return string path to compiled templates
-     */
-    public function getCompileDir()
-    {
-        if (!$this->_compileDirNormalized) {
-            $this->_normalizeDir('compile_dir', $this->compile_dir);
-            $this->_compileDirNormalized = true;
-        }
-        return $this->compile_dir;
-    }
-
-    /**
-     *
-     * @param  string $compile_dir directory to store compiled templates in
-     *
-     * @return Smarty current Smarty instance for chaining
-     */
-    public function setCompileDir($compile_dir)
-    {
-        $this->_normalizeDir('compile_dir', $compile_dir);
-        $this->_compileDirNormalized = true;
-        return $this;
-    }
-
-    /**
-     * Get cache directory
-     *
-     * @return string path of cache directory
-     */
-    public function getCacheDir()
-    {
-        if (!$this->_cacheDirNormalized) {
-            $this->_normalizeDir('cache_dir', $this->cache_dir);
-            $this->_cacheDirNormalized = true;
-        }
-        return $this->cache_dir;
-    }
-
-    /**
-     * Set cache directory
-     *
-     * @param string $cache_dir directory to store cached templates in
-     *
-     * @return Smarty current Smarty instance for chaining
-     */
-    public function setCacheDir($cache_dir)
-    {
-        $this->_normalizeDir('cache_dir', $cache_dir);
-        $this->_cacheDirNormalized = true;
-        return $this;
-    }
-
-    /**
-     * creates a template object
-     *
-     * @param string  $template   the resource handle of the template file
-     * @param mixed   $cache_id   cache id to be used with this template
-     * @param mixed   $compile_id compile id to be used with this template
-     * @param object  $parent     next higher level of Smarty variables
-     * @param boolean $do_clone   flag is Smarty object shall be cloned
-     *
-     * @return \Smarty_Internal_Template template object
-     * @throws \SmartyException
-     */
-    public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
-    {
-        if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
-            $parent = $cache_id;
-            $cache_id = null;
-        }
-        if ($parent !== null && is_array($parent)) {
-            $data = $parent;
-            $parent = null;
-        } else {
-            $data = null;
-        }
-        if (!$this->_templateDirNormalized) {
-            $this->_normalizeTemplateConfig(false);
-        }
-        $_templateId = $this->_getTemplateId($template, $cache_id, $compile_id);
-        $tpl = null;
-        if ($this->caching && isset(Smarty_Internal_Template::$isCacheTplObj[ $_templateId ])) {
-            $tpl = $do_clone ? clone Smarty_Internal_Template::$isCacheTplObj[ $_templateId ] :
-                Smarty_Internal_Template::$isCacheTplObj[ $_templateId ];
-            $tpl->inheritance = null;
-            $tpl->tpl_vars = $tpl->config_vars = array();
-        } elseif (!$do_clone && isset(Smarty_Internal_Template::$tplObjCache[ $_templateId ])) {
-            $tpl = clone Smarty_Internal_Template::$tplObjCache[ $_templateId ];
-            $tpl->inheritance = null;
-            $tpl->tpl_vars = $tpl->config_vars = array();
-        } else {
-            /* @var Smarty_Internal_Template $tpl */
-            $tpl = new $this->template_class($template, $this, null, $cache_id, $compile_id, null, null);
-            $tpl->templateId = $_templateId;
-        }
-        if ($do_clone) {
-            $tpl->smarty = clone $tpl->smarty;
-        }
-        $tpl->parent = $parent ? $parent : $this;
-        // fill data if present
-        if (!empty($data) && is_array($data)) {
-            // set up variable values
-            foreach ($data as $_key => $_val) {
-                $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val);
-            }
-        }
-        if ($this->debugging || $this->debugging_ctrl === 'URL') {
-            $tpl->smarty->_debug = new Smarty_Internal_Debug();
-            // check URL debugging control
-            if (!$this->debugging && $this->debugging_ctrl === 'URL') {
-                $tpl->smarty->_debug->debugUrl($tpl->smarty);
-            }
-        }
-        return $tpl;
-    }
-
-    /**
-     * Takes unknown classes and loads plugin files for them
-     * class name format: Smarty_PluginType_PluginName
-     * plugin filename format: plugintype.pluginname.php
-     *
-     * @param string $plugin_name class plugin name to load
-     * @param bool   $check       check if already loaded
-     *
-     * @return string |boolean filepath of loaded file or false
-     * @throws \SmartyException
-     */
-    public function loadPlugin($plugin_name, $check = true)
-    {
-        return $this->ext->loadPlugin->loadPlugin($this, $plugin_name, $check);
-    }
-
-    /**
-     * Get unique template id
-     *
-     * @param string                    $template_name
-     * @param null|mixed                $cache_id
-     * @param null|mixed                $compile_id
-     * @param null                      $caching
-     * @param \Smarty_Internal_Template $template
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function _getTemplateId(
-        $template_name,
-        $cache_id = null,
-        $compile_id = null,
-        $caching = null,
-        Smarty_Internal_Template $template = null
-    ) {
-        $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
-            $template_name;
-        $cache_id = $cache_id === null ? $this->cache_id : $cache_id;
-        $compile_id = $compile_id === null ? $this->compile_id : $compile_id;
-        $caching = (int)($caching === null ? $this->caching : $caching);
-        if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) {
-            $_templateId =
-                Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) .
-                "#{$cache_id}#{$compile_id}#{$caching}";
-        } else {
-            $_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}";
-        }
-        if (isset($_templateId[ 150 ])) {
-            $_templateId = sha1($_templateId);
-        }
-        return $_templateId;
-    }
-
-    /**
-     * Normalize path
-     *  - remove /./ and /../
-     *  - make it absolute if required
-     *
-     * @param string $path     file path
-     * @param bool   $realpath if true - convert to absolute
-     *                         false - convert to relative
-     *                         null - keep as it is but
-     *                         remove /./ /../
-     *
-     * @return string
-     */
-    public function _realpath($path, $realpath = null)
-    {
-        $nds = array('/' => '\\', '\\' => '/');
-        preg_match(
-            '%^(?<root>(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
-            $path,
-            $parts
-        );
-        $path = $parts[ 'path' ];
-        if ($parts[ 'root' ] === '\\') {
-            $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
-        } else {
-            if ($realpath !== null && !$parts[ 'root' ]) {
-                $path = getcwd() . DIRECTORY_SEPARATOR . $path;
-            }
-        }
-        // normalize DIRECTORY_SEPARATOR
-        $path = str_replace($nds[ DIRECTORY_SEPARATOR ], DIRECTORY_SEPARATOR, $path);
-        $parts[ 'root' ] = str_replace($nds[ DIRECTORY_SEPARATOR ], DIRECTORY_SEPARATOR, $parts[ 'root' ]);
-        do {
-            $path = preg_replace(
-                array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'),
-                DIRECTORY_SEPARATOR,
-                $path,
-                -1,
-                $count
-            );
-        } while ($count > 0);
-        return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path);
-    }
-
-    /**
-     * Empty template objects cache
-     */
-    public function _clearTemplateCache()
-    {
-        Smarty_Internal_Template::$isCacheTplObj = array();
-        Smarty_Internal_Template::$tplObjCache = array();
-    }
-
-    /**
-     * @param boolean $use_sub_dirs
-     */
-    public function setUseSubDirs($use_sub_dirs)
-    {
-        $this->use_sub_dirs = $use_sub_dirs;
-    }
-
-    /**
-     * @param int $error_reporting
-     */
-    public function setErrorReporting($error_reporting)
-    {
-        $this->error_reporting = $error_reporting;
-    }
-
-    /**
-     * @param boolean $escape_html
-     */
-    public function setEscapeHtml($escape_html)
-    {
-        $this->escape_html = $escape_html;
-    }
-
-    /**
-     * Return auto_literal flag
-     *
-     * @return boolean
-     */
-    public function getAutoLiteral()
-    {
-        return $this->auto_literal;
-    }
-
-    /**
-     * Set auto_literal flag
-     *
-     * @param boolean $auto_literal
-     */
-    public function setAutoLiteral($auto_literal = true)
-    {
-        $this->auto_literal = $auto_literal;
-    }
-
-    /**
-     * @param boolean $force_compile
-     */
-    public function setForceCompile($force_compile)
-    {
-        $this->force_compile = $force_compile;
-    }
-
-    /**
-     * @param boolean $merge_compiled_includes
-     */
-    public function setMergeCompiledIncludes($merge_compiled_includes)
-    {
-        $this->merge_compiled_includes = $merge_compiled_includes;
-    }
-
-    /**
-     * Get left delimiter
-     *
-     * @return string
-     */
-    public function getLeftDelimiter()
-    {
-        return $this->left_delimiter;
-    }
-
-    /**
-     * Set left delimiter
-     *
-     * @param string $left_delimiter
-     */
-    public function setLeftDelimiter($left_delimiter)
-    {
-        $this->left_delimiter = $left_delimiter;
-    }
-
-    /**
-     * Get right delimiter
-     *
-     * @return string $right_delimiter
-     */
-    public function getRightDelimiter()
-    {
-        return $this->right_delimiter;
-    }
-
-    /**
-     * Set right delimiter
-     *
-     * @param string
-     */
-    public function setRightDelimiter($right_delimiter)
-    {
-        $this->right_delimiter = $right_delimiter;
-    }
-
-    /**
-     * @param boolean $debugging
-     */
-    public function setDebugging($debugging)
-    {
-        $this->debugging = $debugging;
-    }
-
-    /**
-     * @param boolean $config_overwrite
-     */
-    public function setConfigOverwrite($config_overwrite)
-    {
-        $this->config_overwrite = $config_overwrite;
-    }
-
-    /**
-     * @param boolean $config_booleanize
-     */
-    public function setConfigBooleanize($config_booleanize)
-    {
-        $this->config_booleanize = $config_booleanize;
-    }
-
-    /**
-     * @param boolean $config_read_hidden
-     */
-    public function setConfigReadHidden($config_read_hidden)
-    {
-        $this->config_read_hidden = $config_read_hidden;
-    }
-
-    /**
-     * @param boolean $compile_locking
-     */
-    public function setCompileLocking($compile_locking)
-    {
-        $this->compile_locking = $compile_locking;
-    }
-
-    /**
-     * @param string $default_resource_type
-     */
-    public function setDefaultResourceType($default_resource_type)
-    {
-        $this->default_resource_type = $default_resource_type;
-    }
-
-    /**
-     * @param string $caching_type
-     */
-    public function setCachingType($caching_type)
-    {
-        $this->caching_type = $caching_type;
-    }
-
-    /**
-     * Test install
-     *
-     * @param null $errors
-     */
-    public function testInstall(&$errors = null)
-    {
-        Smarty_Internal_TestInstall::testInstall($this, $errors);
-    }
-
-    /**
-     * Get Smarty object
-     *
-     * @return Smarty
-     */
-    public function _getSmartyObj()
-    {
-        return $this;
-    }
-
-    /**
-     * <<magic>> Generic getter.
-     * Calls the appropriate getter function.
-     * Issues an E_USER_NOTICE if no valid getter is found.
-     *
-     * @param string $name property name
-     *
-     * @return mixed
-     */
-    public function __get($name)
-    {
-        if (isset($this->accessMap[ $name ])) {
-            $method = 'get' . $this->accessMap[ $name ];
-            return $this->{$method}();
-        } elseif (isset($this->_cache[ $name ])) {
-            return $this->_cache[ $name ];
-        } elseif (in_array($name, $this->obsoleteProperties)) {
-            return null;
-        } else {
-            trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
-        }
-        return null;
-    }
-
-    /**
-     * <<magic>> Generic setter.
-     * Calls the appropriate setter function.
-     * Issues an E_USER_NOTICE if no valid setter is found.
-     *
-     * @param string $name  property name
-     * @param mixed  $value parameter passed to setter
-     *
-     */
-    public function __set($name, $value)
-    {
-        if (isset($this->accessMap[ $name ])) {
-            $method = 'set' . $this->accessMap[ $name ];
-            $this->{$method}($value);
-        } elseif (in_array($name, $this->obsoleteProperties)) {
-            return;
-        } elseif (is_object($value) && method_exists($value, $name)) {
-            $this->$name = $value;
-        } else {
-            trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
-        }
-    }
-
-    /**
-     * Normalize and set directory string
-     *
-     * @param string $dirName cache_dir or compile_dir
-     * @param string $dir     filepath of folder
-     */
-    private function _normalizeDir($dirName, $dir)
-    {
-        $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DIRECTORY_SEPARATOR, true);
-        if (class_exists('Smarty_Internal_ErrorHandler', false)) {
-            if (!isset(Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ])) {
-                Smarty_Internal_ErrorHandler::$mutedDirectories[ $this->{$dirName} ] = null;
-            }
-        }
-    }
-
-    /**
-     * Normalize template_dir or config_dir
-     *
-     * @param bool $isConfig true for config_dir
-     */
-    private function _normalizeTemplateConfig($isConfig)
-    {
-        if ($isConfig) {
-            $processed = &$this->_processedConfigDir;
-            $dir = &$this->config_dir;
-        } else {
-            $processed = &$this->_processedTemplateDir;
-            $dir = &$this->template_dir;
-        }
-        if (!is_array($dir)) {
-            $dir = (array)$dir;
-        }
-        foreach ($dir as $k => $v) {
-            if (!isset($processed[ $k ])) {
-                $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DIRECTORY_SEPARATOR, true);
-                $processed[ $k ] = true;
-            }
-        }
-        $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true;
-        $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) :
-            $this->_joined_template_dir = join('#', $this->template_dir);
-    }
-}
diff --git a/libraries/Smarty/libs/SmartyBC.class.php b/libraries/Smarty/libs/SmartyBC.class.php
deleted file mode 100644
index 0550e46dc..000000000
--- a/libraries/Smarty/libs/SmartyBC.class.php
+++ /dev/null
@@ -1,477 +0,0 @@
-<?php
-/**
- * Project:     Smarty: the PHP compiling template engine
- * File:        SmartyBC.class.php
- * SVN:         $Id: $
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3.0 of the License, or (at your option) any later version.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * For questions, help, comments, discussion, etc., please join the
- * Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
- *
- * @link      http://www.smarty.net/
- * @copyright 2008 New Digital Group, Inc.
- * @author    Monte Ohrt <monte at ohrt dot com>
- * @author    Uwe Tews
- * @author    Rodney Rehm
- * @package   Smarty
- */
-/**
- * @ignore
- */
-require_once dirname(__FILE__) . '/Smarty.class.php';
-
-/**
- * Smarty Backward Compatibility Wrapper Class
- *
- * @package Smarty
- */
-class SmartyBC extends Smarty
-{
-    /**
-     * Smarty 2 BC
-     *
-     * @var string
-     */
-    public $_version = self::SMARTY_VERSION;
-
-    /**
-     * This is an array of directories where trusted php scripts reside.
-     *
-     * @var array
-     */
-    public $trusted_dir = array();
-
-    /**
-     * Initialize new SmartyBC object
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * wrapper for assign_by_ref
-     *
-     * @param string $tpl_var the template variable name
-     * @param mixed  &$value  the referenced value to assign
-     */
-    public function assign_by_ref($tpl_var, &$value)
-    {
-        $this->assignByRef($tpl_var, $value);
-    }
-
-    /**
-     * wrapper for append_by_ref
-     *
-     * @param string  $tpl_var the template variable name
-     * @param mixed   &$value  the referenced value to append
-     * @param boolean $merge   flag if array elements shall be merged
-     */
-    public function append_by_ref($tpl_var, &$value, $merge = false)
-    {
-        $this->appendByRef($tpl_var, $value, $merge);
-    }
-
-    /**
-     * clear the given assigned template variable.
-     *
-     * @param string $tpl_var the template variable to clear
-     */
-    public function clear_assign($tpl_var)
-    {
-        $this->clearAssign($tpl_var);
-    }
-
-    /**
-     * Registers custom function to be used in templates
-     *
-     * @param string $function      the name of the template function
-     * @param string $function_impl the name of the PHP function to register
-     * @param bool   $cacheable
-     * @param mixed  $cache_attrs
-     *
-     * @throws \SmartyException
-     */
-    public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
-    {
-        $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
-    }
-
-    /**
-     * Unregister custom function
-     *
-     * @param string $function name of template function
-     */
-    public function unregister_function($function)
-    {
-        $this->unregisterPlugin('function', $function);
-    }
-
-    /**
-     * Registers object to be used in templates
-     *
-     * @param string  $object        name of template object
-     * @param object  $object_impl   the referenced PHP object to register
-     * @param array   $allowed       list of allowed methods (empty = all)
-     * @param boolean $smarty_args   smarty argument format, else traditional
-     * @param array   $block_methods list of methods that are block format
-     *
-     * @throws   SmartyException
-     * @internal param array $block_functs list of methods that are block format
-     */
-    public function register_object(
-        $object,
-        $object_impl,
-        $allowed = array(),
-        $smarty_args = true,
-        $block_methods = array()
-    ) {
-        settype($allowed, 'array');
-        settype($smarty_args, 'boolean');
-        $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
-    }
-
-    /**
-     * Unregister object
-     *
-     * @param string $object name of template object
-     */
-    public function unregister_object($object)
-    {
-        $this->unregisterObject($object);
-    }
-
-    /**
-     * Registers block function to be used in templates
-     *
-     * @param string $block      name of template block
-     * @param string $block_impl PHP function to register
-     * @param bool   $cacheable
-     * @param mixed  $cache_attrs
-     *
-     * @throws \SmartyException
-     */
-    public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
-    {
-        $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
-    }
-
-    /**
-     * Unregister block function
-     *
-     * @param string $block name of template function
-     */
-    public function unregister_block($block)
-    {
-        $this->unregisterPlugin('block', $block);
-    }
-
-    /**
-     * Registers compiler function
-     *
-     * @param string $function      name of template function
-     * @param string $function_impl name of PHP function to register
-     * @param bool   $cacheable
-     *
-     * @throws \SmartyException
-     */
-    public function register_compiler_function($function, $function_impl, $cacheable = true)
-    {
-        $this->registerPlugin('compiler', $function, $function_impl, $cacheable);
-    }
-
-    /**
-     * Unregister compiler function
-     *
-     * @param string $function name of template function
-     */
-    public function unregister_compiler_function($function)
-    {
-        $this->unregisterPlugin('compiler', $function);
-    }
-
-    /**
-     * Registers modifier to be used in templates
-     *
-     * @param string $modifier      name of template modifier
-     * @param string $modifier_impl name of PHP function to register
-     *
-     * @throws \SmartyException
-     */
-    public function register_modifier($modifier, $modifier_impl)
-    {
-        $this->registerPlugin('modifier', $modifier, $modifier_impl);
-    }
-
-    /**
-     * Unregister modifier
-     *
-     * @param string $modifier name of template modifier
-     */
-    public function unregister_modifier($modifier)
-    {
-        $this->unregisterPlugin('modifier', $modifier);
-    }
-
-    /**
-     * Registers a resource to fetch a template
-     *
-     * @param string $type      name of resource
-     * @param array  $functions array of functions to handle resource
-     */
-    public function register_resource($type, $functions)
-    {
-        $this->registerResource($type, $functions);
-    }
-
-    /**
-     * Unregister a resource
-     *
-     * @param string $type name of resource
-     */
-    public function unregister_resource($type)
-    {
-        $this->unregisterResource($type);
-    }
-
-    /**
-     * Registers a prefilter function to apply
-     * to a template before compiling
-     *
-     * @param callable $function
-     *
-     * @throws \SmartyException
-     */
-    public function register_prefilter($function)
-    {
-        $this->registerFilter('pre', $function);
-    }
-
-    /**
-     * Unregister a prefilter function
-     *
-     * @param callable $function
-     */
-    public function unregister_prefilter($function)
-    {
-        $this->unregisterFilter('pre', $function);
-    }
-
-    /**
-     * Registers a postfilter function to apply
-     * to a compiled template after compilation
-     *
-     * @param callable $function
-     *
-     * @throws \SmartyException
-     */
-    public function register_postfilter($function)
-    {
-        $this->registerFilter('post', $function);
-    }
-
-    /**
-     * Unregister a postfilter function
-     *
-     * @param callable $function
-     */
-    public function unregister_postfilter($function)
-    {
-        $this->unregisterFilter('post', $function);
-    }
-
-    /**
-     * Registers an output filter function to apply
-     * to a template output
-     *
-     * @param callable $function
-     *
-     * @throws \SmartyException
-     */
-    public function register_outputfilter($function)
-    {
-        $this->registerFilter('output', $function);
-    }
-
-    /**
-     * Unregister an outputfilter function
-     *
-     * @param callable $function
-     */
-    public function unregister_outputfilter($function)
-    {
-        $this->unregisterFilter('output', $function);
-    }
-
-    /**
-     * load a filter of specified type and name
-     *
-     * @param string $type filter type
-     * @param string $name filter name
-     *
-     * @throws \SmartyException
-     */
-    public function load_filter($type, $name)
-    {
-        $this->loadFilter($type, $name);
-    }
-
-    /**
-     * clear cached content for the given template and cache id
-     *
-     * @param string $tpl_file   name of template file
-     * @param string $cache_id   name of cache_id
-     * @param string $compile_id name of compile_id
-     * @param string $exp_time   expiration time
-     *
-     * @return boolean
-     */
-    public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
-    {
-        return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
-    }
-
-    /**
-     * clear the entire contents of cache (all templates)
-     *
-     * @param string $exp_time expire time
-     *
-     * @return boolean
-     */
-    public function clear_all_cache($exp_time = null)
-    {
-        return $this->clearCache(null, null, null, $exp_time);
-    }
-
-    /**
-     * test to see if valid cache exists for this template
-     *
-     * @param string $tpl_file name of template file
-     * @param string $cache_id
-     * @param string $compile_id
-     *
-     * @return bool
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
-    {
-        return $this->isCached($tpl_file, $cache_id, $compile_id);
-    }
-
-    /**
-     * clear all the assigned template variables.
-     */
-    public function clear_all_assign()
-    {
-        $this->clearAllAssign();
-    }
-
-    /**
-     * clears compiled version of specified template resource,
-     * or all compiled template files if one is not specified.
-     * This function is for advanced use only, not normally needed.
-     *
-     * @param string $tpl_file
-     * @param string $compile_id
-     * @param string $exp_time
-     *
-     * @return boolean results of {@link smarty_core_rm_auto()}
-     */
-    public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
-    {
-        return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
-    }
-
-    /**
-     * Checks whether requested template exists.
-     *
-     * @param string $tpl_file
-     *
-     * @return bool
-     * @throws \SmartyException
-     */
-    public function template_exists($tpl_file)
-    {
-        return $this->templateExists($tpl_file);
-    }
-
-    /**
-     * Returns an array containing template variables
-     *
-     * @param string $name
-     *
-     * @return array
-     */
-    public function get_template_vars($name = null)
-    {
-        return $this->getTemplateVars($name);
-    }
-
-    /**
-     * Returns an array containing config variables
-     *
-     * @param string $name
-     *
-     * @return array
-     */
-    public function get_config_vars($name = null)
-    {
-        return $this->getConfigVars($name);
-    }
-
-    /**
-     * load configuration values
-     *
-     * @param string $file
-     * @param string $section
-     * @param string $scope
-     */
-    public function config_load($file, $section = null, $scope = 'global')
-    {
-        $this->ConfigLoad($file, $section, $scope);
-    }
-
-    /**
-     * return a reference to a registered object
-     *
-     * @param string $name
-     *
-     * @return object
-     */
-    public function get_registered_object($name)
-    {
-        return $this->getRegisteredObject($name);
-    }
-
-    /**
-     * clear configuration values
-     *
-     * @param string $var
-     */
-    public function clear_config($var = null)
-    {
-        $this->clearConfig($var);
-    }
-
-    /**
-     * trigger Smarty error
-     *
-     * @param string  $error_msg
-     * @param integer $error_type
-     */
-    public function trigger_error($error_msg, $error_type = E_USER_WARNING)
-    {
-        trigger_error("Smarty error: $error_msg", $error_type);
-    }
-}
diff --git a/libraries/Smarty/libs/bootstrap.php b/libraries/Smarty/libs/bootstrap.php
deleted file mode 100644
index 2c830468e..000000000
--- a/libraries/Smarty/libs/bootstrap.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * This file is part of the Smarty package.
- *
- * (c) Sebastian Bergmann <sebastian@phpunit.de>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-/**
- * Load and register Smarty Autoloader
- */
-if (!class_exists('Smarty_Autoloader')) {
-    include dirname(__FILE__) . '/Autoloader.php';
-}
-Smarty_Autoloader::register(true);
diff --git a/libraries/Smarty/libs/debug.tpl b/libraries/Smarty/libs/debug.tpl
deleted file mode 100644
index edc7bef98..000000000
--- a/libraries/Smarty/libs/debug.tpl
+++ /dev/null
@@ -1,160 +0,0 @@
-{capture name='_smarty_debug' assign=debug_output}
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-    <head>
-        <title>Smarty Debug Console</title>
-        <style type="text/css">
-            {literal}
-            body, h1, h2, h3, td, th, p {
-                font-family: sans-serif;
-                font-weight: normal;
-                font-size: 0.9em;
-                margin: 1px;
-                padding: 0;
-            }
-
-            h1 {
-                margin: 0;
-                text-align: left;
-                padding: 2px;
-                background-color: #f0c040;
-                color: black;
-                font-weight: bold;
-                font-size: 1.2em;
-            }
-
-            h2 {
-                background-color: #9B410E;
-                color: white;
-                text-align: left;
-                font-weight: bold;
-                padding: 2px;
-                border-top: 1px solid black;
-            }
-            h3 {
-                text-align: left;
-                font-weight: bold;
-                color: black;
-                font-size: 0.7em;
-                padding: 2px;
-            }
-
-            body {
-                background: black;
-            }
-
-            p, table, div {
-                background: #f0ead8;
-            }
-
-            p {
-                margin: 0;
-                font-style: italic;
-                text-align: center;
-            }
-
-            table {
-                width: 100%;
-            }
-
-            th, td {
-                font-family: monospace;
-                vertical-align: top;
-                text-align: left;
-            }
-
-            td {
-                color: green;
-            }
-
-            .odd {
-                background-color: #eeeeee;
-            }
-
-            .even {
-                background-color: #fafafa;
-            }
-
-            .exectime {
-                font-size: 0.8em;
-                font-style: italic;
-            }
-
-            #bold div {
-                color: black;
-                font-weight: bold;
-            }
-            #blue h3 {
-                color: blue;
-            }
-            #normal div {
-                color: black;
-                font-weight: normal;
-            }
-            #table_assigned_vars th {
-                color: blue;
-                font-weight: bold;
-            }
-
-            #table_config_vars th {
-                color: maroon;
-            }
-
-            {/literal}
-        </style>
-    </head>
-    <body>
-
-    <h1>Smarty {Smarty::SMARTY_VERSION} Debug Console
-        -  {if isset($template_name)}{$template_name|debug_print_var nofilter} {/if}{if !empty($template_data)}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
-
-    {if !empty($template_data)}
-        <h2>included templates &amp; config files (load time in seconds)</h2>
-        <div>
-            {foreach $template_data as $template}
-                <font color=brown>{$template.name}</font>
-                <br />&nbsp;&nbsp;<span class="exectime">
-                (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
-                 </span>
-                <br />
-            {/foreach}
-        </div>
-    {/if}
-
-    <h2>assigned template variables</h2>
-
-    <table id="table_assigned_vars">
-        {foreach $assigned_vars as $vars}
-            <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
-                <td><h3><font color=blue>${$vars@key}</font></h3>
-                    {if isset($vars['nocache'])}<b>Nocache</b><br />{/if}
-                    {if isset($vars['scope'])}<b>Origin:</b> {$vars['scope']|debug_print_var nofilter}{/if}
-                </td>
-                <td><h3>Value</h3>{$vars['value']|debug_print_var:10:80 nofilter}</td>
-                <td>{if isset($vars['attributes'])}<h3>Attributes</h3>{$vars['attributes']|debug_print_var nofilter} {/if}</td>
-         {/foreach}
-    </table>
-
-    <h2>assigned config file variables</h2>
-
-    <table id="table_config_vars">
-        {foreach $config_vars as $vars}
-            <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
-                <td><h3><font color=blue>#{$vars@key}#</font></h3>
-                    {if isset($vars['scope'])}<b>Origin:</b> {$vars['scope']|debug_print_var nofilter}{/if}
-                </td>
-                <td>{$vars['value']|debug_print_var:10:80 nofilter}</td>
-            </tr>
-        {/foreach}
-
-    </table>
-    </body>
-    </html>
-{/capture}
-<script type="text/javascript">
-    {$id = '__Smarty__'}
-    {if $display_mode}{$id = "$offset$template_name"|md5}{/if}
-    _smarty_console = window.open("", "console{$id}", "width=1024,height=600,left={$offset},top={$offset},resizable,scrollbars=yes");
-    _smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
-    _smarty_console.document.close();
-</script>
diff --git a/libraries/Smarty/libs/plugins/block.textformat.php b/libraries/Smarty/libs/plugins/block.textformat.php
deleted file mode 100644
index 5e494637e..000000000
--- a/libraries/Smarty/libs/plugins/block.textformat.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/**
- * Smarty plugin to format text blocks
- *
- * @package    Smarty
- * @subpackage PluginsBlock
- */
-/**
- * Smarty {textformat}{/textformat} block plugin
- * Type:     block function
- * Name:     textformat
- * Purpose:  format text a certain way with preset styles
- *           or custom wrap/indent settings
- * Params:
- *
- * - style         - string (email)
- * - indent        - integer (0)
- * - wrap          - integer (80)
- * - wrap_char     - string ("\n")
- * - indent_char   - string (" ")
- * - wrap_boundary - boolean (true)
- *
- * @link   http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
- *         (Smarty online manual)
- *
- * @param array                    $params   parameters
- * @param string                   $content  contents of the block
- * @param Smarty_Internal_Template $template template object
- * @param boolean                  &$repeat  repeat flag
- *
- * @return string content re-formatted
- * @author Monte Ohrt <monte at ohrt dot com>
- * @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/libraries/Smarty/libs/plugins/function.counter.php b/libraries/Smarty/libs/plugins/function.counter.php
deleted file mode 100644
index a4129e77c..000000000
--- a/libraries/Smarty/libs/plugins/function.counter.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {counter} function plugin
- * Type:     function
- * Name:     counter
- * Purpose:  print out a counter value
- *
- * @author Monte Ohrt <monte at ohrt dot com>
- * @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/libraries/Smarty/libs/plugins/function.cycle.php b/libraries/Smarty/libs/plugins/function.cycle.php
deleted file mode 100644
index 07ffcc5e2..000000000
--- a/libraries/Smarty/libs/plugins/function.cycle.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {cycle} function plugin
- * Type:     function
- * Name:     cycle
- * Date:     May 3, 2002
- * Purpose:  cycle through given values
- * Params:
- *
- * - name      - name of cycle (optional)
- * - values    - comma separated list of values to cycle, or an array of values to cycle
- *               (this can be left out for subsequent calls)
- * - reset     - boolean - resets given var to true
- * - print     - boolean - print var or not. default is true
- * - advance   - boolean - whether or not to advance the cycle
- * - delimiter - the value delimiter, default is ","
- * - assign    - boolean, assigns to template var instead of printed.
- *
- * Examples:
- *
- * {cycle values="#eeeeee,#d0d0d0d"}
- * {cycle name=row values="one,two,three" reset=true}
- * {cycle name=row}
- *
- * @link    http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
- *           (Smarty online manual)
- * @author  Monte Ohrt <monte at ohrt dot com>
- * @author  credit to Mark Priatel <mpriatel@rogers.com>
- * @author  credit to Gerard <gerard@interfold.com>
- * @author  credit to Jason Sweat <jsweat_php@yahoo.com>
- * @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/libraries/Smarty/libs/plugins/function.fetch.php b/libraries/Smarty/libs/plugins/function.fetch.php
deleted file mode 100644
index 768761b23..000000000
--- a/libraries/Smarty/libs/plugins/function.fetch.php
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {fetch} plugin
- * Type:     function
- * Name:     fetch
- * Purpose:  fetch file, web or ftp data and display results
- *
- * @link   http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
- *         (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @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/libraries/Smarty/libs/plugins/function.html_checkboxes.php b/libraries/Smarty/libs/plugins/function.html_checkboxes.php
deleted file mode 100644
index 302358edd..000000000
--- a/libraries/Smarty/libs/plugins/function.html_checkboxes.php
+++ /dev/null
@@ -1,286 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_checkboxes} function plugin
- * File:       function.html_checkboxes.php
- * Type:       function
- * Name:       html_checkboxes
- * Date:       24.Feb.2003
- * Purpose:    Prints out a list of checkbox input types
- * Examples:
- *
- * {html_checkboxes values=$ids output=$names}
- * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
- * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
- *
- * Params:
- *
- * - name       (optional) - string default "checkbox"
- * - values     (required) - array
- * - options    (optional) - associative array
- * - checked    (optional) - array default not set
- * - separator  (optional) - ie <br> or &nbsp;
- * - 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 <christopher.kvarme@flashjab.com>
- * @author  credits to Monte Ohrt <monte at ohrt dot com>
- * @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 .= '<label for="' . $_id . '">';
-        } else {
-            $_output .= '<label>';
-        }
-    }
-    $name = smarty_function_escape_special_chars($name);
-    $value = smarty_function_escape_special_chars($value);
-    if ($escape) {
-        $output = smarty_function_escape_special_chars($output);
-    }
-    $_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
-    if ($labels && $label_ids) {
-        $_output .= ' id="' . $_id . '"';
-    }
-    if (is_array($selected)) {
-        if (isset($selected[ $value ])) {
-            $_output .= ' checked="checked"';
-        }
-    } elseif ($value === $selected) {
-        $_output .= ' checked="checked"';
-    }
-    $_output .= $extra . ' />' . $output;
-    if ($labels) {
-        $_output .= '</label>';
-    }
-    $_output .= $separator;
-    return $_output;
-}
diff --git a/libraries/Smarty/libs/plugins/function.html_image.php b/libraries/Smarty/libs/plugins/function.html_image.php
deleted file mode 100644
index ad468e4f1..000000000
--- a/libraries/Smarty/libs/plugins/function.html_image.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_image} function plugin
- * Type:     function
- * Name:     html_image
- * Date:     Feb 24, 2003
- * Purpose:  format HTML tags for the image
- * Examples: {html_image file="/images/masthead.gif"}
- * Output:   <img src="/images/masthead.gif" width=400 height=23>
- * Params:
- *
- * - file        - (required) - file (and path) of image
- * - height      - (optional) - image height (default actual height)
- * - width       - (optional) - image width (default actual width)
- * - basedir     - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
- * - path_prefix - prefix for path output (optional, default empty)
- *
- * @link    http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
- *          (Smarty online manual)
- * @author  Monte Ohrt <monte at ohrt dot com>
- * @author  credits to Duda <duda@big.hu>
- * @version 1.0
- *
- * @param array                    $params   parameters
- * @param Smarty_Internal_Template $template template object
- *
- * @throws SmartyException
- * @return string
- * @uses    smarty_function_escape_special_chars()
- */
-function smarty_function_html_image($params, Smarty_Internal_Template $template)
-{
-    $template->_checkPlugins(
-        array(
-            array(
-                'function' => 'smarty_function_escape_special_chars',
-                'file'     => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
-            )
-        )
-    );
-    $alt = '';
-    $file = '';
-    $height = '';
-    $width = '';
-    $extra = '';
-    $prefix = '';
-    $suffix = '';
-    $path_prefix = '';
-    $basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : '';
-    foreach ($params as $_key => $_val) {
-        switch ($_key) {
-            case 'file':
-            case 'height':
-            case 'width':
-            case 'dpi':
-            case 'path_prefix':
-            case 'basedir':
-                $$_key = $_val;
-                break;
-            case 'alt':
-                if (!is_array($_val)) {
-                    $$_key = smarty_function_escape_special_chars($_val);
-                } else {
-                    throw new SmartyException(
-                        "html_image: extra attribute '{$_key}' cannot be an array",
-                        E_USER_NOTICE
-                    );
-                }
-                break;
-            case 'link':
-            case 'href':
-                $prefix = '<a href="' . $_val . '">';
-                $suffix = '</a>';
-                break;
-            default:
-                if (!is_array($_val)) {
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
-                } else {
-                    throw new SmartyException(
-                        "html_image: extra attribute '{$_key}' cannot be an array",
-                        E_USER_NOTICE
-                    );
-                }
-                break;
-        }
-    }
-    if (empty($file)) {
-        trigger_error('html_image: missing \'file\' parameter', E_USER_NOTICE);
-        return;
-    }
-    if ($file[ 0 ] === '/') {
-        $_image_path = $basedir . $file;
-    } else {
-        $_image_path = $file;
-    }
-    // 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($_image_path)) {
-                return;
-            }
-        }
-    }
-    if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) {
-        // FIXME: (rodneyrehm) getimagesize() loads the complete file off a remote resource, use custom [jpg,png,gif]header reader!
-        if (!$_image_data = @getimagesize($_image_path)) {
-            if (!file_exists($_image_path)) {
-                trigger_error("html_image: unable to find '{$_image_path}'", E_USER_NOTICE);
-                return;
-            } elseif (!is_readable($_image_path)) {
-                trigger_error("html_image: unable to read '{$_image_path}'", E_USER_NOTICE);
-                return;
-            } else {
-                trigger_error("html_image: '{$_image_path}' is not a valid image file", E_USER_NOTICE);
-                return;
-            }
-        }
-        if (!isset($params[ 'width' ])) {
-            $width = $_image_data[ 0 ];
-        }
-        if (!isset($params[ 'height' ])) {
-            $height = $_image_data[ 1 ];
-        }
-    }
-    if (isset($params[ 'dpi' ])) {
-        if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) {
-            // FIXME: (rodneyrehm) wrong dpi assumption
-            // don't know who thought this up… even if it was true in 1998, it's definitely wrong in 2011.
-            $dpi_default = 72;
-        } else {
-            $dpi_default = 96;
-        }
-        $_resize = $dpi_default / $params[ 'dpi' ];
-        $width = round($width * $_resize);
-        $height = round($height * $_resize);
-    }
-    return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' .
-           $height . '"' . $extra . ' />' . $suffix;
-}
diff --git a/libraries/Smarty/libs/plugins/function.html_options.php b/libraries/Smarty/libs/plugins/function.html_options.php
deleted file mode 100644
index 6907e8ee1..000000000
--- a/libraries/Smarty/libs/plugins/function.html_options.php
+++ /dev/null
@@ -1,230 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_options} function plugin
- * Type:     function
- * Name:     html_options
- * Purpose:  Prints the list of <option> tags generated from
- *           the passed parameters
- * Params:
- *
- * - name       (optional) - string default "select"
- * - values     (required) - if no options supplied) - array
- * - options    (required) - if no values supplied) - associative array
- * - selected   (optional) - string default not set
- * - output     (required) - if not options supplied) - array
- * - id         (optional) - string default not set
- * - class      (optional) - string default not set
- *
- * @link   http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
- *           (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
- *
- * @param array                     $params parameters
- *
- * @param \Smarty_Internal_Template $template
- *
- * @return string
- * @uses   smarty_function_escape_special_chars()
- * @throws \SmartyException
- */
-function smarty_function_html_options($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 = null;
-    $values = null;
-    $options = null;
-    $selected = null;
-    $output = null;
-    $id = null;
-    $class = null;
-    $extra = '';
-    foreach ($params as $_key => $_val) {
-        switch ($_key) {
-            case 'name':
-            case 'class':
-            case 'id':
-                $$_key = (string)$_val;
-                break;
-            case 'options':
-                $options = (array)$_val;
-                break;
-            case 'values':
-            case 'output':
-                $$_key = array_values((array)$_val);
-                break;
-            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_options: 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_options: 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 '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_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
-                }
-                break;
-        }
-    }
-    if (!isset($options) && !isset($values)) {
-        /* raise error here? */
-        return '';
-    }
-    $_html_result = '';
-    $_idx = 0;
-    if (isset($options)) {
-        foreach ($options as $_key => $_val) {
-            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
-        }
-    } else {
-        foreach ($values as $_i => $_key) {
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
-            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
-        }
-    }
-    if (!empty($name)) {
-        $_html_class = !empty($class) ? ' class="' . $class . '"' : '';
-        $_html_id = !empty($id) ? ' id="' . $id . '"' : '';
-        $_html_result =
-            '<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result .
-            '</select>' . "\n";
-    }
-    return $_html_result;
-}
-
-/**
- * @param $key
- * @param $value
- * @param $selected
- * @param $id
- * @param $class
- * @param $idx
- *
- * @return string
- */
-function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
-{
-    if (!is_array($value)) {
-        $_key = smarty_function_escape_special_chars($key);
-        $_html_result = '<option value="' . $_key . '"';
-        if (is_array($selected)) {
-            if (isset($selected[ $_key ])) {
-                $_html_result .= ' selected="selected"';
-            }
-        } elseif ($_key === $selected) {
-            $_html_result .= ' selected="selected"';
-        }
-        $_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
-        $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
-        if (is_object($value)) {
-            if (method_exists($value, '__toString')) {
-                $value = smarty_function_escape_special_chars((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 = smarty_function_escape_special_chars((string)$value);
-        }
-        $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
-        $idx++;
-    } else {
-        $_idx = 0;
-        $_html_result =
-            smarty_function_html_options_optgroup(
-                $key,
-                $value,
-                $selected,
-                !empty($id) ? ($id . '-' . $idx) : null,
-                $class,
-                $_idx
-            );
-        $idx++;
-    }
-    return $_html_result;
-}
-
-/**
- * @param $key
- * @param $values
- * @param $selected
- * @param $id
- * @param $class
- * @param $idx
- *
- * @return string
- */
-function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
-{
-    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
-    foreach ($values as $key => $value) {
-        $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
-    }
-    $optgroup_html .= "</optgroup>\n";
-    return $optgroup_html;
-}
diff --git a/libraries/Smarty/libs/plugins/function.html_radios.php b/libraries/Smarty/libs/plugins/function.html_radios.php
deleted file mode 100644
index 5e834587c..000000000
--- a/libraries/Smarty/libs/plugins/function.html_radios.php
+++ /dev/null
@@ -1,266 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_radios} function plugin
- * File:       function.html_radios.php
- * Type:       function
- * Name:       html_radios
- * Date:       24.Feb.2003
- * Purpose:    Prints out a list of radio input types
- * Params:
- *
- * - name       (optional) - string default "radio"
- * - values     (required) - array
- * - options    (required) - associative array
- * - checked    (optional) - array default not set
- * - separator  (optional) - ie <br> or &nbsp;
- * - output     (optional) - the output next to each radio button
- * - assign     (optional) - assign the output as an array to this variable
- * - escape     (optional) - escape the content (not value), defaults to true
- *
- * Examples:
- *
- * {html_radios values=$ids output=$names}
- * {html_radios values=$ids name='box' separator='<br>' output=$names}
- * {html_radios values=$ids checked=$checked separator='<br>' output=$names}
- *
- * @link    http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
- *          (Smarty online manual)
- * @author  Christopher Kvarme <christopher.kvarme@flashjab.com>
- * @author  credits to Monte Ohrt <monte at ohrt dot com>
- * @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_radios($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 = 'radio';
-    $values = null;
-    $options = null;
-    $selected = null;
-    $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 'checked':
-            case 'selected':
-                if (is_array($_val)) {
-                    trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
-                } elseif (is_object($_val)) {
-                    if (method_exists($_val, '__toString')) {
-                        $selected = smarty_function_escape_special_chars((string)$_val->__toString());
-                    } else {
-                        trigger_error(
-                            'html_radios: selected attribute is an object of class \'' . get_class($_val) .
-                            '\' without __toString() method',
-                            E_USER_NOTICE
-                        );
-                    }
-                } else {
-                    $selected = (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 'radios':
-                trigger_error(
-                    'html_radios: the use of the "radios" 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_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
-                }
-                break;
-        }
-    }
-    if (!isset($options) && !isset($values)) {
-        /* raise error here? */
-        return '';
-    }
-    $_html_result = array();
-    if (isset($options)) {
-        foreach ($options as $_key => $_val) {
-            $_html_result[] =
-                smarty_function_html_radios_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_radios_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 $escape
- *
- * @return string
- */
-function smarty_function_html_radios_output(
-    $name,
-    $value,
-    $output,
-    $selected,
-    $extra,
-    $separator,
-    $labels,
-    $label_ids,
-    $escape
-) {
-    $_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 .= '<label for="' . $_id . '">';
-        } else {
-            $_output .= '<label>';
-        }
-    }
-    $name = smarty_function_escape_special_chars($name);
-    $value = smarty_function_escape_special_chars($value);
-    if ($escape) {
-        $output = smarty_function_escape_special_chars($output);
-    }
-    $_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
-    if ($labels && $label_ids) {
-        $_output .= ' id="' . $_id . '"';
-    }
-    if ($value === $selected) {
-        $_output .= ' checked="checked"';
-    }
-    $_output .= $extra . ' />' . $output;
-    if ($labels) {
-        $_output .= '</label>';
-    }
-    $_output .= $separator;
-    return $_output;
-}
diff --git a/libraries/Smarty/libs/plugins/function.html_select_date.php b/libraries/Smarty/libs/plugins/function.html_select_date.php
deleted file mode 100644
index 86403e3dc..000000000
--- a/libraries/Smarty/libs/plugins/function.html_select_date.php
+++ /dev/null
@@ -1,388 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_select_date} plugin
- * Type:     function
- * Name:     html_select_date
- * Purpose:  Prints the dropdowns for date selection.
- * ChangeLog:
- *
- *            - 1.0 initial release
- *            - 1.1 added support for +/- N syntax for begin
- *              and end year values. (Monte)
- *            - 1.2 added support for yyyy-mm-dd syntax for
- *              time value. (Jan Rosier)
- *            - 1.3 added support for choosing format for
- *              month values (Gary Loescher)
- *            - 1.3.1 added support for choosing format for
- *              day values (Marcus Bointon)
- *            - 1.3.2 support negative timestamps, force year
- *              dropdown to include given date unless explicitly set (Monte)
- *            - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
- *              of 0000-00-00 dates (cybot, boots)
- *            - 2.0 complete rewrite for performance,
- *              added attributes month_names, *_id
- *
- * @link    http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
- *           (Smarty online manual)
- * @version 2.0
- * @author  Andrei Zmievski
- * @author  Monte Ohrt <monte at ohrt dot com>
- * @author  Rodney Rehm
- *
- * @param array                     $params parameters
- *
- * @param \Smarty_Internal_Template $template
- *
- * @return string
- * @throws \SmartyException
- */
-function smarty_function_html_select_date($params, Smarty_Internal_Template $template)
-{
-    $template->_checkPlugins(
-        array(
-            array(
-                'function' => 'smarty_function_escape_special_chars',
-                'file'     => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
-            )
-        )
-    );
-    // generate timestamps used for month names only
-    static $_month_timestamps = null;
-    static $_current_year = null;
-    if ($_month_timestamps === null) {
-        $_current_year = date('Y');
-        $_month_timestamps = array();
-        for ($i = 1; $i <= 12; $i++) {
-            $_month_timestamps[ $i ] = mktime(0, 0, 0, $i, 1, 2000);
-        }
-    }
-    /* Default values. */
-    $prefix = 'Date_';
-    $start_year = null;
-    $end_year = null;
-    $display_days = true;
-    $display_months = true;
-    $display_years = true;
-    $month_format = '%B';
-    /* Write months as numbers by default  GL */
-    $month_value_format = '%m';
-    $day_format = '%02d';
-    /* Write day values using this format MB */
-    $day_value_format = '%d';
-    $year_as_text = false;
-    /* Display years in reverse order? Ie. 2000,1999,.... */
-    $reverse_years = false;
-    /* Should the select boxes be part of an array when returned from PHP?
-       e.g. setting it to "birthday", would create "birthday[Day]",
-       "birthday[Month]" & "birthday[Year]". Can be combined with prefix */
-    $field_array = null;
-    /* <select size>'s of the different <select> tags.
-       If not set, uses default dropdown. */
-    $day_size = null;
-    $month_size = null;
-    $year_size = null;
-    /* Unparsed attributes common to *ALL* the <select>/<input> tags.
-       An example might be in the template: all_extra ='class ="foo"'. */
-    $all_extra = null;
-    /* Separate attributes for the tags. */
-    $day_extra = null;
-    $month_extra = null;
-    $year_extra = null;
-    /* Order in which to display the fields.
-       "D" -> day, "M" -> month, "Y" -> year. */
-    $field_order = 'MDY';
-    /* String printed between the different fields. */
-    $field_separator = "\n";
-    $option_separator = "\n";
-    $time = null;
-    // $all_empty = null;
-    // $day_empty = null;
-    // $month_empty = null;
-    // $year_empty = null;
-    $extra_attrs = '';
-    $all_id = null;
-    $day_id = null;
-    $month_id = null;
-    $year_id = null;
-    foreach ($params as $_key => $_value) {
-        switch ($_key) {
-            case 'time':
-                if (!is_array($_value) && $_value !== null) {
-                    $template->_checkPlugins(
-                        array(
-                            array(
-                                'function' => 'smarty_make_timestamp',
-                                'file'     => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'
-                            )
-                        )
-                    );
-                    $time = smarty_make_timestamp($_value);
-                }
-                break;
-            case 'month_names':
-                if (is_array($_value) && count($_value) === 12) {
-                    $$_key = $_value;
-                } else {
-                    trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE);
-                }
-                break;
-            case 'prefix':
-            case 'field_array':
-            case 'start_year':
-            case 'end_year':
-            case 'day_format':
-            case 'day_value_format':
-            case 'month_format':
-            case 'month_value_format':
-            case 'day_size':
-            case 'month_size':
-            case 'year_size':
-            case 'all_extra':
-            case 'day_extra':
-            case 'month_extra':
-            case 'year_extra':
-            case 'field_order':
-            case 'field_separator':
-            case 'option_separator':
-            case 'all_empty':
-            case 'month_empty':
-            case 'day_empty':
-            case 'year_empty':
-            case 'all_id':
-            case 'month_id':
-            case 'day_id':
-            case 'year_id':
-                $$_key = (string)$_value;
-                break;
-            case 'display_days':
-            case 'display_months':
-            case 'display_years':
-            case 'year_as_text':
-            case 'reverse_years':
-                $$_key = (bool)$_value;
-                break;
-            default:
-                if (!is_array($_value)) {
-                    $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
-                } else {
-                    trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
-                }
-                break;
-        }
-    }
-    // Note: date() is faster than strftime()
-    // Note: explode(date()) is faster than date() date() date()
-    if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
-        if (isset($params[ 'time' ][ $prefix . 'Year' ])) {
-            // $_REQUEST[$field_array] given
-            foreach (array(
-                'Y' => 'Year',
-                'm' => 'Month',
-                'd' => 'Day'
-            ) as $_elementKey => $_elementName) {
-                $_variableName = '_' . strtolower($_elementName);
-                $$_variableName =
-                    isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
-                        date($_elementKey);
-            }
-        } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) {
-            // $_REQUEST given
-            foreach (array(
-                'Y' => 'Year',
-                'm' => 'Month',
-                'd' => 'Day'
-            ) as $_elementKey => $_elementName) {
-                $_variableName = '_' . strtolower($_elementName);
-                $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
-                    $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
-            }
-        } else {
-            // no date found, use NOW
-            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
-        }
-    } elseif ($time === null) {
-        if (array_key_exists('time', $params)) {
-            $_year = $_month = $_day = $time = null;
-        } else {
-            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
-        }
-    } else {
-        list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d', $time));
-    }
-    // make syntax "+N" or "-N" work with $start_year and $end_year
-    // Note preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match) is slower than trim+substr
-    foreach (array(
-        'start',
-        'end'
-    ) as $key) {
-        $key .= '_year';
-        $t = $$key;
-        if ($t === null) {
-            $$key = (int)$_current_year;
-        } elseif ($t[ 0 ] === '+') {
-            $$key = (int)($_current_year + (int)trim(substr($t, 1)));
-        } elseif ($t[ 0 ] === '-') {
-            $$key = (int)($_current_year - (int)trim(substr($t, 1)));
-        } else {
-            $$key = (int)$$key;
-        }
-    }
-    // flip for ascending or descending
-    if (($start_year > $end_year && !$reverse_years) || ($start_year < $end_year && $reverse_years)) {
-        $t = $end_year;
-        $end_year = $start_year;
-        $start_year = $t;
-    }
-    // generate year <select> or <input>
-    if ($display_years) {
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($year_extra) {
-            $_extra .= ' ' . $year_extra;
-        }
-        if ($year_as_text) {
-            $_html_years =
-                '<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra .
-                $extra_attrs . ' />';
-        } else {
-            $_html_years = '<select name="' . $_name . '"';
-            if ($year_id !== null || $all_id !== null) {
-                $_html_years .= ' id="' . smarty_function_escape_special_chars(
-                        $year_id !== null ?
-                            ($year_id ? $year_id : $_name) :
-                            ($all_id ? ($all_id . $_name) :
-                                $_name)
-                    ) . '"';
-            }
-            if ($year_size) {
-                $_html_years .= ' size="' . $year_size . '"';
-            }
-            $_html_years .= $_extra . $extra_attrs . '>' . $option_separator;
-            if (isset($year_empty) || isset($all_empty)) {
-                $_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' .
-                                $option_separator;
-            }
-            $op = $start_year > $end_year ? -1 : 1;
-            for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
-                $_html_years .= '<option value="' . $i . '"' . ($_year == $i ? ' selected="selected"' : '') . '>' . $i .
-                                '</option>' . $option_separator;
-            }
-            $_html_years .= '</select>';
-        }
-    }
-    // generate month <select> or <input>
-    if ($display_months) {
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($month_extra) {
-            $_extra .= ' ' . $month_extra;
-        }
-        $_html_months = '<select name="' . $_name . '"';
-        if ($month_id !== null || $all_id !== null) {
-            $_html_months .= ' id="' . smarty_function_escape_special_chars(
-                    $month_id !== null ?
-                        ($month_id ? $month_id : $_name) :
-                        ($all_id ? ($all_id . $_name) :
-                            $_name)
-                ) . '"';
-        }
-        if ($month_size) {
-            $_html_months .= ' size="' . $month_size . '"';
-        }
-        $_html_months .= $_extra . $extra_attrs . '>' . $option_separator;
-        if (isset($month_empty) || isset($all_empty)) {
-            $_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' .
-                             $option_separator;
-        }
-        for ($i = 1; $i <= 12; $i++) {
-            $_val = sprintf('%02d', $i);
-            $_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[ $i ]) :
-                ($month_format === '%m' ? $_val : strftime($month_format, $_month_timestamps[ $i ]));
-            $_value = $month_value_format === '%m' ? $_val : strftime($month_value_format, $_month_timestamps[ $i ]);
-            $_html_months .= '<option value="' . $_value . '"' . ($_val == $_month ? ' selected="selected"' : '') .
-                             '>' . $_text . '</option>' . $option_separator;
-        }
-        $_html_months .= '</select>';
-    }
-    // generate day <select> or <input>
-    if ($display_days) {
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($day_extra) {
-            $_extra .= ' ' . $day_extra;
-        }
-        $_html_days = '<select name="' . $_name . '"';
-        if ($day_id !== null || $all_id !== null) {
-            $_html_days .= ' id="' .
-                           smarty_function_escape_special_chars(
-                               $day_id !== null ? ($day_id ? $day_id : $_name) :
-                                   ($all_id ? ($all_id . $_name) : $_name)
-                           ) . '"';
-        }
-        if ($day_size) {
-            $_html_days .= ' size="' . $day_size . '"';
-        }
-        $_html_days .= $_extra . $extra_attrs . '>' . $option_separator;
-        if (isset($day_empty) || isset($all_empty)) {
-            $_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' .
-                           $option_separator;
-        }
-        for ($i = 1; $i <= 31; $i++) {
-            $_val = sprintf('%02d', $i);
-            $_text = $day_format === '%02d' ? $_val : sprintf($day_format, $i);
-            $_value = $day_value_format === '%02d' ? $_val : sprintf($day_value_format, $i);
-            $_html_days .= '<option value="' . $_value . '"' . ($_val == $_day ? ' selected="selected"' : '') . '>' .
-                           $_text . '</option>' . $option_separator;
-        }
-        $_html_days .= '</select>';
-    }
-    // order the fields for output
-    $_html = '';
-    for ($i = 0; $i <= 2; $i++) {
-        switch ($field_order[ $i ]) {
-            case 'Y':
-            case 'y':
-                if (isset($_html_years)) {
-                    if ($_html) {
-                        $_html .= $field_separator;
-                    }
-                    $_html .= $_html_years;
-                }
-                break;
-            case 'm':
-            case 'M':
-                if (isset($_html_months)) {
-                    if ($_html) {
-                        $_html .= $field_separator;
-                    }
-                    $_html .= $_html_months;
-                }
-                break;
-            case 'd':
-            case 'D':
-                if (isset($_html_days)) {
-                    if ($_html) {
-                        $_html .= $field_separator;
-                    }
-                    $_html .= $_html_days;
-                }
-                break;
-        }
-    }
-    return $_html;
-}
diff --git a/libraries/Smarty/libs/plugins/function.html_select_time.php b/libraries/Smarty/libs/plugins/function.html_select_time.php
deleted file mode 100644
index cb047bc0a..000000000
--- a/libraries/Smarty/libs/plugins/function.html_select_time.php
+++ /dev/null
@@ -1,354 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_select_time} function plugin
- * Type:     function
- * Name:     html_select_time
- * Purpose:  Prints the dropdowns for time selection
- *
- * @link   http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
- *           (Smarty online manual)
- * @author Roberto Berto <roberto@berto.net>
- * @author Monte Ohrt <monte AT ohrt DOT com>
- *
- * @param array                     $params parameters
- *
- * @param \Smarty_Internal_Template $template
- *
- * @return string
- * @uses   smarty_make_timestamp()
- * @throws \SmartyException
- */
-function smarty_function_html_select_time($params, Smarty_Internal_Template $template)
-{
-    $template->_checkPlugins(
-        array(
-            array(
-                'function' => 'smarty_function_escape_special_chars',
-                'file'     => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
-            )
-        )
-    );
-    $prefix = 'Time_';
-    $field_array = null;
-    $field_separator = "\n";
-    $option_separator = "\n";
-    $time = null;
-    $display_hours = true;
-    $display_minutes = true;
-    $display_seconds = true;
-    $display_meridian = true;
-    $hour_format = '%02d';
-    $hour_value_format = '%02d';
-    $minute_format = '%02d';
-    $minute_value_format = '%02d';
-    $second_format = '%02d';
-    $second_value_format = '%02d';
-    $hour_size = null;
-    $minute_size = null;
-    $second_size = null;
-    $meridian_size = null;
-    $all_empty = null;
-    $hour_empty = null;
-    $minute_empty = null;
-    $second_empty = null;
-    $meridian_empty = null;
-    $all_id = null;
-    $hour_id = null;
-    $minute_id = null;
-    $second_id = null;
-    $meridian_id = null;
-    $use_24_hours = true;
-    $minute_interval = 1;
-    $second_interval = 1;
-    $extra_attrs = '';
-    $all_extra = null;
-    $hour_extra = null;
-    $minute_extra = null;
-    $second_extra = null;
-    $meridian_extra = null;
-    foreach ($params as $_key => $_value) {
-        switch ($_key) {
-            case 'time':
-                if (!is_array($_value) && $_value !== null) {
-                    $template->_checkPlugins(
-                        array(
-                            array(
-                                'function' => 'smarty_make_timestamp',
-                                'file'     => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'
-                            )
-                        )
-                    );
-                    $time = smarty_make_timestamp($_value);
-                }
-                break;
-            case 'prefix':
-            case 'field_array':
-            case 'field_separator':
-            case 'option_separator':
-            case 'all_extra':
-            case 'hour_extra':
-            case 'minute_extra':
-            case 'second_extra':
-            case 'meridian_extra':
-            case 'all_empty':
-            case 'hour_empty':
-            case 'minute_empty':
-            case 'second_empty':
-            case 'meridian_empty':
-            case 'all_id':
-            case 'hour_id':
-            case 'minute_id':
-            case 'second_id':
-            case 'meridian_id':
-            case 'hour_format':
-            case 'hour_value_format':
-            case 'minute_format':
-            case 'minute_value_format':
-            case 'second_format':
-            case 'second_value_format':
-                $$_key = (string)$_value;
-                break;
-            case 'display_hours':
-            case 'display_minutes':
-            case 'display_seconds':
-            case 'display_meridian':
-            case 'use_24_hours':
-                $$_key = (bool)$_value;
-                break;
-            case 'minute_interval':
-            case 'second_interval':
-            case 'hour_size':
-            case 'minute_size':
-            case 'second_size':
-            case 'meridian_size':
-                $$_key = (int)$_value;
-                break;
-            default:
-                if (!is_array($_value)) {
-                    $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
-                } else {
-                    trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
-                }
-                break;
-        }
-    }
-    if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
-        if (isset($params[ 'time' ][ $prefix . 'Hour' ])) {
-            // $_REQUEST[$field_array] given
-            foreach (array(
-                'H' => 'Hour',
-                'i' => 'Minute',
-                's' => 'Second'
-            ) as $_elementKey => $_elementName) {
-                $_variableName = '_' . strtolower($_elementName);
-                $$_variableName =
-                    isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
-                        date($_elementKey);
-            }
-            $_meridian =
-                isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
-                    '';
-            $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
-            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
-        } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) {
-            // $_REQUEST given
-            foreach (array(
-                'H' => 'Hour',
-                'i' => 'Minute',
-                's' => 'Second'
-            ) as $_elementKey => $_elementName) {
-                $_variableName = '_' . strtolower($_elementName);
-                $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
-                    $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
-            }
-            $_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
-                (' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
-            $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
-            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
-        } else {
-            // no date found, use NOW
-            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
-        }
-    } elseif ($time === null) {
-        if (array_key_exists('time', $params)) {
-            $_hour = $_minute = $_second = $time = null;
-        } else {
-            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
-        }
-    } else {
-        list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
-    }
-    // generate hour <select>
-    if ($display_hours) {
-        $_html_hours = '';
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($hour_extra) {
-            $_extra .= ' ' . $hour_extra;
-        }
-        $_html_hours = '<select name="' . $_name . '"';
-        if ($hour_id !== null || $all_id !== null) {
-            $_html_hours .= ' id="' .
-                            smarty_function_escape_special_chars(
-                                $hour_id !== null ? ($hour_id ? $hour_id : $_name) :
-                                    ($all_id ? ($all_id . $_name) : $_name)
-                            ) . '"';
-        }
-        if ($hour_size) {
-            $_html_hours .= ' size="' . $hour_size . '"';
-        }
-        $_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
-        if (isset($hour_empty) || isset($all_empty)) {
-            $_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
-                            $option_separator;
-        }
-        $start = $use_24_hours ? 0 : 1;
-        $end = $use_24_hours ? 23 : 12;
-        for ($i = $start; $i <= $end; $i++) {
-            $_val = sprintf('%02d', $i);
-            $_text = $hour_format === '%02d' ? $_val : sprintf($hour_format, $i);
-            $_value = $hour_value_format === '%02d' ? $_val : sprintf($hour_value_format, $i);
-            if (!$use_24_hours) {
-                $_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12);
-            }
-            $selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
-            $_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' .
-                            $_text . '</option>' . $option_separator;
-        }
-        $_html_hours .= '</select>';
-    }
-    // generate minute <select>
-    if ($display_minutes) {
-        $_html_minutes = '';
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($minute_extra) {
-            $_extra .= ' ' . $minute_extra;
-        }
-        $_html_minutes = '<select name="' . $_name . '"';
-        if ($minute_id !== null || $all_id !== null) {
-            $_html_minutes .= ' id="' . smarty_function_escape_special_chars(
-                    $minute_id !== null ?
-                        ($minute_id ? $minute_id : $_name) :
-                        ($all_id ? ($all_id . $_name) :
-                            $_name)
-                ) . '"';
-        }
-        if ($minute_size) {
-            $_html_minutes .= ' size="' . $minute_size . '"';
-        }
-        $_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
-        if (isset($minute_empty) || isset($all_empty)) {
-            $_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
-                              $option_separator;
-        }
-        $selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
-        for ($i = 0; $i <= 59; $i += $minute_interval) {
-            $_val = sprintf('%02d', $i);
-            $_text = $minute_format === '%02d' ? $_val : sprintf($minute_format, $i);
-            $_value = $minute_value_format === '%02d' ? $_val : sprintf($minute_value_format, $i);
-            $_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
-                              '>' . $_text . '</option>' . $option_separator;
-        }
-        $_html_minutes .= '</select>';
-    }
-    // generate second <select>
-    if ($display_seconds) {
-        $_html_seconds = '';
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($second_extra) {
-            $_extra .= ' ' . $second_extra;
-        }
-        $_html_seconds = '<select name="' . $_name . '"';
-        if ($second_id !== null || $all_id !== null) {
-            $_html_seconds .= ' id="' . smarty_function_escape_special_chars(
-                    $second_id !== null ?
-                        ($second_id ? $second_id : $_name) :
-                        ($all_id ? ($all_id . $_name) :
-                            $_name)
-                ) . '"';
-        }
-        if ($second_size) {
-            $_html_seconds .= ' size="' . $second_size . '"';
-        }
-        $_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
-        if (isset($second_empty) || isset($all_empty)) {
-            $_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
-                              $option_separator;
-        }
-        $selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
-        for ($i = 0; $i <= 59; $i += $second_interval) {
-            $_val = sprintf('%02d', $i);
-            $_text = $second_format === '%02d' ? $_val : sprintf($second_format, $i);
-            $_value = $second_value_format === '%02d' ? $_val : sprintf($second_value_format, $i);
-            $_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
-                              '>' . $_text . '</option>' . $option_separator;
-        }
-        $_html_seconds .= '</select>';
-    }
-    // generate meridian <select>
-    if ($display_meridian && !$use_24_hours) {
-        $_html_meridian = '';
-        $_extra = '';
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian');
-        if ($all_extra) {
-            $_extra .= ' ' . $all_extra;
-        }
-        if ($meridian_extra) {
-            $_extra .= ' ' . $meridian_extra;
-        }
-        $_html_meridian = '<select name="' . $_name . '"';
-        if ($meridian_id !== null || $all_id !== null) {
-            $_html_meridian .= ' id="' . smarty_function_escape_special_chars(
-                    $meridian_id !== null ?
-                        ($meridian_id ? $meridian_id :
-                            $_name) :
-                        ($all_id ? ($all_id . $_name) :
-                            $_name)
-                ) . '"';
-        }
-        if ($meridian_size) {
-            $_html_meridian .= ' size="' . $meridian_size . '"';
-        }
-        $_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
-        if (isset($meridian_empty) || isset($all_empty)) {
-            $_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
-                               '</option>' . $option_separator;
-        }
-        $_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
-                           '>AM</option>' . $option_separator . '<option value="pm"' .
-                           ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator .
-                           '</select>';
-    }
-    $_html = '';
-    foreach (array(
-        '_html_hours',
-        '_html_minutes',
-        '_html_seconds',
-        '_html_meridian'
-    ) as $k) {
-        if (isset($$k)) {
-            if ($_html) {
-                $_html .= $field_separator;
-            }
-            $_html .= $$k;
-        }
-    }
-    return $_html;
-}
diff --git a/libraries/Smarty/libs/plugins/function.html_table.php b/libraries/Smarty/libs/plugins/function.html_table.php
deleted file mode 100644
index ae61e83dc..000000000
--- a/libraries/Smarty/libs/plugins/function.html_table.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {html_table} function plugin
- * Type:     function
- * Name:     html_table
- * Date:     Feb 17, 2003
- * Purpose:  make an html table from an array of data
- * Params:
- *
- * - loop       - array to loop through
- * - cols       - number of columns, comma separated list of column names
- *                or array of column names
- * - rows       - number of rows
- * - table_attr - table attributes
- * - th_attr    - table heading attributes (arrays are cycled)
- * - tr_attr    - table row attributes (arrays are cycled)
- * - td_attr    - table cell attributes (arrays are cycled)
- * - trailpad   - value to pad trailing cells with
- * - caption    - text for caption element
- * - vdir       - vertical direction (default: "down", means top-to-bottom)
- * - hdir       - horizontal direction (default: "right", means left-to-right)
- * - inner      - inner loop (default "cols": print $loop line by line,
- *                $loop will be printed column by column otherwise)
- *
- * Examples:
- *
- * {table loop=$data}
- * {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
- * {table loop=$data cols="first,second,third" tr_attr=$colors}
- *
- * @author  Monte Ohrt <monte at ohrt dot com>
- * @author  credit to Messju Mohr <messju at lammfellpuschen dot de>
- * @author  credit to boots <boots dot smarty at yahoo dot com>
- * @version 1.1
- * @link    http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
- *           (Smarty online manual)
- *
- * @param array $params parameters
- *
- * @return string
- */
-function smarty_function_html_table($params)
-{
-    $table_attr = 'border="1"';
-    $tr_attr = '';
-    $th_attr = '';
-    $td_attr = '';
-    $cols = $cols_count = 3;
-    $rows = 3;
-    $trailpad = '&nbsp;';
-    $vdir = 'down';
-    $hdir = 'right';
-    $inner = 'cols';
-    $caption = '';
-    $loop = null;
-    if (!isset($params[ 'loop' ])) {
-        trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
-        return;
-    }
-    foreach ($params as $_key => $_value) {
-        switch ($_key) {
-            case 'loop':
-                $$_key = (array)$_value;
-                break;
-            case 'cols':
-                if (is_array($_value) && !empty($_value)) {
-                    $cols = $_value;
-                    $cols_count = count($_value);
-                } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
-                    $cols = explode(',', $_value);
-                    $cols_count = count($cols);
-                } elseif (!empty($_value)) {
-                    $cols_count = (int)$_value;
-                } else {
-                    $cols_count = $cols;
-                }
-                break;
-            case 'rows':
-                $$_key = (int)$_value;
-                break;
-            case 'table_attr':
-            case 'trailpad':
-            case 'hdir':
-            case 'vdir':
-            case 'inner':
-            case 'caption':
-                $$_key = (string)$_value;
-                break;
-            case 'tr_attr':
-            case 'td_attr':
-            case 'th_attr':
-                $$_key = $_value;
-                break;
-        }
-    }
-    $loop_count = count($loop);
-    if (empty($params[ 'rows' ])) {
-        /* no rows specified */
-        $rows = ceil($loop_count / $cols_count);
-    } elseif (empty($params[ 'cols' ])) {
-        if (!empty($params[ 'rows' ])) {
-            /* no cols specified, but rows */
-            $cols_count = ceil($loop_count / $rows);
-        }
-    }
-    $output = "<table $table_attr>\n";
-    if (!empty($caption)) {
-        $output .= '<caption>' . $caption . "</caption>\n";
-    }
-    if (is_array($cols)) {
-        $cols = ($hdir === 'right') ? $cols : array_reverse($cols);
-        $output .= "<thead><tr>\n";
-        for ($r = 0; $r < $cols_count; $r++) {
-            $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
-            $output .= $cols[ $r ];
-            $output .= "</th>\n";
-        }
-        $output .= "</tr></thead>\n";
-    }
-    $output .= "<tbody>\n";
-    for ($r = 0; $r < $rows; $r++) {
-        $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
-        $rx = ($vdir === 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
-        for ($c = 0; $c < $cols_count; $c++) {
-            $x = ($hdir === 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
-            if ($inner !== 'cols') {
-                /* shuffle x to loop over rows*/
-                $x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
-            }
-            if ($x < $loop_count) {
-                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n";
-            } else {
-                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
-            }
-        }
-        $output .= "</tr>\n";
-    }
-    $output .= "</tbody>\n";
-    $output .= "</table>\n";
-    return $output;
-}
-
-/**
- * @param $name
- * @param $var
- * @param $no
- *
- * @return string
- */
-function smarty_function_html_table_cycle($name, $var, $no)
-{
-    if (!is_array($var)) {
-        $ret = $var;
-    } else {
-        $ret = $var[ $no % count($var) ];
-    }
-    return ($ret) ? ' ' . $ret : '';
-}
diff --git a/libraries/Smarty/libs/plugins/function.mailto.php b/libraries/Smarty/libs/plugins/function.mailto.php
deleted file mode 100644
index 27351df82..000000000
--- a/libraries/Smarty/libs/plugins/function.mailto.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {mailto} function plugin
- * Type:     function
- * Name:     mailto
- * Date:     May 21, 2002
- * Purpose:  automate mailto address link creation, and optionally encode them.
- * Params:
- *
- * - address    - (required) - e-mail address
- * - text       - (optional) - text to display, default is address
- * - encode     - (optional) - can be one of:
- *                             * none : no encoding (default)
- *                             * javascript : encode with javascript
- *                             * javascript_charcode : encode with javascript charcode
- *                             * hex : encode with hexadecimal (no javascript)
- * - cc         - (optional) - address(es) to carbon copy
- * - bcc        - (optional) - address(es) to blind carbon copy
- * - subject    - (optional) - e-mail subject
- * - newsgroups - (optional) - newsgroup(s) to post to
- * - followupto - (optional) - address(es) to follow up to
- * - extra      - (optional) - extra tags for the href link
- *
- * Examples:
- *
- * {mailto address="me@domain.com"}
- * {mailto address="me@domain.com" encode="javascript"}
- * {mailto address="me@domain.com" encode="hex"}
- * {mailto address="me@domain.com" subject="Hello to you!"}
- * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
- * {mailto address="me@domain.com" extra='class="mailto"'}
- *
- * @link    http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
- *           (Smarty online manual)
- * @version 1.2
- * @author  Monte Ohrt <monte at ohrt dot com>
- * @author  credits to Jason Sweat (added cc, bcc and subject functionality)
- *
- * @param array $params parameters
- *
- * @return string
- */
-function smarty_function_mailto($params)
-{
-    static $_allowed_encoding =
-        array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
-    $extra = '';
-    if (empty($params[ 'address' ])) {
-        trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
-        return;
-    } else {
-        $address = $params[ 'address' ];
-    }
-    $text = $address;
-    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
-    // so, don't encode it.
-    $search = array('%40', '%2C');
-    $replace = array('@', ',');
-    $mail_parms = array();
-    foreach ($params as $var => $value) {
-        switch ($var) {
-            case 'cc':
-            case 'bcc':
-            case 'followupto':
-                if (!empty($value)) {
-                    $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
-                }
-                break;
-            case 'subject':
-            case 'newsgroups':
-                $mail_parms[] = $var . '=' . rawurlencode($value);
-                break;
-            case 'extra':
-            case 'text':
-                $$var = $value;
-            // no break
-            default:
-        }
-    }
-    if ($mail_parms) {
-        $address .= '?' . join('&', $mail_parms);
-    }
-    $encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
-    if (!isset($_allowed_encoding[ $encode ])) {
-        trigger_error(
-            "mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
-            E_USER_WARNING
-        );
-        return;
-    }
-    // FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed!
-    if ($encode === 'javascript') {
-        $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
-        $js_encode = '';
-        for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
-            $js_encode .= '%' . bin2hex($string[ $x ]);
-        }
-        return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>';
-    } elseif ($encode === 'javascript_charcode') {
-        $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
-        for ($x = 0, $y = strlen($string); $x < $y; $x++) {
-            $ord[] = ord($string[ $x ]);
-        }
-        $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" .
-                implode(',', $ord) . "))" . "}\n" . "</script>\n";
-        return $_ret;
-    } elseif ($encode === 'hex') {
-        preg_match('!^(.*)(\?.*)$!', $address, $match);
-        if (!empty($match[ 2 ])) {
-            trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
-            return;
-        }
-        $address_encode = '';
-        for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {
-            if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) {
-                $address_encode .= '%' . bin2hex($address[ $x ]);
-            } else {
-                $address_encode .= $address[ $x ];
-            }
-        }
-        $text_encode = '';
-        for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {
-            $text_encode .= '&#x' . bin2hex($text[ $x ]) . ';';
-        }
-        $mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
-        return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
-    } else {
-        // no encoding
-        return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/function.math.php b/libraries/Smarty/libs/plugins/function.math.php
deleted file mode 100644
index 7348d9649..000000000
--- a/libraries/Smarty/libs/plugins/function.math.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * Smarty plugin
- * This plugin is only for Smarty2 BC
- *
- * @package    Smarty
- * @subpackage PluginsFunction
- */
-/**
- * Smarty {math} function plugin
- * Type:     function
- * Name:     math
- * Purpose:  handle math computations in template
- *
- * @link   http://www.smarty.net/manual/en/language.function.math.php {math}
- *           (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param array                    $params   parameters
- * @param Smarty_Internal_Template $template template object
- *
- * @return string|null
- */
-function smarty_function_math($params, $template)
-{
-    static $_allowed_funcs =
-        array(
-            'int'   => true,
-            'abs'   => true,
-            'ceil'  => true,
-            'cos'   => true,
-            'exp'   => true,
-            'floor' => true,
-            'log'   => true,
-            'log10' => true,
-            'max'   => true,
-            'min'   => true,
-            'pi'    => true,
-            'pow'   => true,
-            'rand'  => true,
-            'round' => true,
-            'sin'   => true,
-            'sqrt'  => true,
-            'srand' => true,
-            'tan'   => true
-        );
-    // be sure equation parameter is present
-    if (empty($params[ 'equation' ])) {
-        trigger_error("math: missing equation parameter", E_USER_WARNING);
-        return;
-    }
-    $equation = $params[ 'equation' ];
-    // make sure parenthesis are balanced
-    if (substr_count($equation, '(') !== substr_count($equation, ')')) {
-        trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
-        return;
-    }
-    // disallow backticks
-    if (strpos($equation, '`') !== false) {
-        trigger_error("math: backtick character not allowed in equation", E_USER_WARNING);
-        return;
-    }
-    // also disallow dollar signs
-    if (strpos($equation, '$') !== false) {
-        trigger_error("math: dollar signs not allowed in equation", E_USER_WARNING);
-        return;
-    }
-    foreach ($params as $key => $val) {
-        if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
-            // make sure value is not empty
-            if (strlen($val) === 0) {
-                trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING);
-                return;
-            }
-            if (!is_numeric($val)) {
-                trigger_error("math: parameter '{$key}' is not numeric", E_USER_WARNING);
-                return;
-            }
-        }
-    }
-    // match all vars in equation, make sure all are passed
-    preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
-    foreach ($match[ 1 ] as $curr_var) {
-        if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
-            trigger_error(
-                "math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'",
-                E_USER_WARNING
-            );
-            return;
-        }
-    }
-    foreach ($params as $key => $val) {
-        if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
-            $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
-        }
-    }
-    $smarty_math_result = null;
-    eval("\$smarty_math_result = " . $equation . ";");
-    if (empty($params[ 'format' ])) {
-        if (empty($params[ 'assign' ])) {
-            return $smarty_math_result;
-        } else {
-            $template->assign($params[ 'assign' ], $smarty_math_result);
-        }
-    } else {
-        if (empty($params[ 'assign' ])) {
-            printf($params[ 'format' ], $smarty_math_result);
-        } else {
-            $template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.capitalize.php b/libraries/Smarty/libs/plugins/modifier.capitalize.php
deleted file mode 100644
index c5fc400a6..000000000
--- a/libraries/Smarty/libs/plugins/modifier.capitalize.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty capitalize modifier plugin
- * Type:     modifier
- * Name:     capitalize
- * Purpose:  capitalize words in the string
- * {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
- *
- * @param string  $string    string to capitalize
- * @param boolean $uc_digits also capitalize "x123" to "X123"
- * @param boolean $lc_rest   capitalize first letters, lowercase all following letters "aAa" to "Aaa"
- *
- * @return string capitalized string
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Rodney Rehm
- */
-function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
-{
-    if (Smarty::$_MBSTRING) {
-        if ($lc_rest) {
-            // uppercase (including hyphenated words)
-            $upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
-        } else {
-            // uppercase word breaks
-            $upper_string = preg_replace_callback(
-                "!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
-                'smarty_mod_cap_mbconvert_cb',
-                $string
-            );
-        }
-        // check uc_digits case
-        if (!$uc_digits) {
-            if (preg_match_all(
-                "!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER,
-                $string,
-                $matches,
-                PREG_OFFSET_CAPTURE
-            )
-            ) {
-                foreach ($matches[ 1 ] as $match) {
-                    $upper_string =
-                        substr_replace(
-                            $upper_string,
-                            mb_strtolower($match[ 0 ], Smarty::$_CHARSET),
-                            $match[ 1 ],
-                            strlen($match[ 0 ])
-                        );
-                }
-            }
-        }
-        $upper_string =
-            preg_replace_callback(
-                "!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER,
-                'smarty_mod_cap_mbconvert2_cb',
-                $upper_string
-            );
-        return $upper_string;
-    }
-    // lowercase first
-    if ($lc_rest) {
-        $string = strtolower($string);
-    }
-    // uppercase (including hyphenated words)
-    $upper_string =
-        preg_replace_callback(
-            "!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
-            'smarty_mod_cap_ucfirst_cb',
-            $string
-        );
-    // check uc_digits case
-    if (!$uc_digits) {
-        if (preg_match_all(
-            "!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER,
-            $string,
-            $matches,
-            PREG_OFFSET_CAPTURE
-        )
-        ) {
-            foreach ($matches[ 1 ] as $match) {
-                $upper_string =
-                    substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
-            }
-        }
-    }
-    $upper_string = preg_replace_callback(
-        "!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER,
-        'smarty_mod_cap_ucfirst2_cb',
-        $upper_string
-    );
-    return $upper_string;
-}
-
-/**
- *
- * Bug: create_function() use exhausts memory when used in long loops
- * Fix: use declared functions for callbacks instead of using create_function()
- * Note: This can be fixed using anonymous functions instead, but that requires PHP >= 5.3
- *
- * @author Kyle Renfrow
- */
-/**
- * @param $matches
- *
- * @return string
- */
-function smarty_mod_cap_mbconvert_cb($matches)
-{
-    return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
-}
-
-/**
- * @param $matches
- *
- * @return string
- */
-function smarty_mod_cap_mbconvert2_cb($matches)
-{
-    return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
-}
-
-/**
- * @param $matches
- *
- * @return string
- */
-function smarty_mod_cap_ucfirst_cb($matches)
-{
-    return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
-}
-
-/**
- * @param $matches
- *
- * @return string
- */
-function smarty_mod_cap_ucfirst2_cb($matches)
-{
-    return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.date_format.php b/libraries/Smarty/libs/plugins/modifier.date_format.php
deleted file mode 100644
index c8e88c5c9..000000000
--- a/libraries/Smarty/libs/plugins/modifier.date_format.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty date_format modifier plugin
- * Type:     modifier
- * Name:     date_format
- * Purpose:  format datestamps via strftime
- * Input:
- *          - string: input date string
- *          - format: strftime format for output
- *          - default_date: default date if $string is empty
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param string $string       input date string
- * @param string $format       strftime format for output
- * @param string $default_date default date if $string is empty
- * @param string $formatter    either 'strftime' or 'auto'
- *
- * @return string |void
- * @uses   smarty_make_timestamp()
- */
-function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto')
-{
-    if ($format === null) {
-        $format = Smarty::$_DATE_FORMAT;
-    }
-    /**
-     * require_once the {@link shared.make_timestamp.php} plugin
-     */
-    static $is_loaded = false;
-    if (!$is_loaded) {
-        if (!is_callable('smarty_make_timestamp')) {
-            include_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php';
-        }
-        $is_loaded = true;
-    }
-    if (!empty($string) && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') {
-        $timestamp = smarty_make_timestamp($string);
-    } elseif (!empty($default_date)) {
-        $timestamp = smarty_make_timestamp($default_date);
-    } else {
-        return;
-    }
-    if ($formatter === 'strftime' || ($formatter === 'auto' && strpos($format, '%') !== false)) {
-        if (Smarty::$_IS_WINDOWS) {
-            $_win_from = array(
-                '%D',
-                '%h',
-                '%n',
-                '%r',
-                '%R',
-                '%t',
-                '%T'
-            );
-            $_win_to = array(
-                '%m/%d/%y',
-                '%b',
-                "\n",
-                '%I:%M:%S %p',
-                '%H:%M',
-                "\t",
-                '%H:%M:%S'
-            );
-            if (strpos($format, '%e') !== false) {
-                $_win_from[] = '%e';
-                $_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
-            }
-            if (strpos($format, '%l') !== false) {
-                $_win_from[] = '%l';
-                $_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
-            }
-            $format = str_replace($_win_from, $_win_to, $format);
-        }
-        return strftime($format, $timestamp);
-    } else {
-        return date($format, $timestamp);
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.debug_print_var.php b/libraries/Smarty/libs/plugins/modifier.debug_print_var.php
deleted file mode 100644
index 78397d017..000000000
--- a/libraries/Smarty/libs/plugins/modifier.debug_print_var.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage Debug
- */
-/**
- * Smarty debug_print_var modifier plugin
- * Type:     modifier
- * Name:     debug_print_var
- * Purpose:  formats variable contents for display in the console
- *
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param array|object $var     variable to be formatted
- * @param int          $max     maximum recursion depth if $var is an array or object
- * @param int          $length  maximum string length if $var is a string
- * @param int          $depth   actual recursion depth
- * @param array        $objects processed objects in actual depth to prevent recursive object processing
- *
- * @return string
- */
-function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
-{
-    $_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
-    switch (gettype($var)) {
-        case 'array':
-            $results = '<b>Array (' . count($var) . ')</b>';
-            if ($depth === $max) {
-                break;
-            }
-            foreach ($var as $curr_key => $curr_val) {
-                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
-                            '</b> =&gt; ' .
-                            smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
-                $depth--;
-            }
-            break;
-        case 'object':
-            $object_vars = get_object_vars($var);
-            $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
-            if (in_array($var, $objects)) {
-                $results .= ' called recursive';
-                break;
-            }
-            if ($depth === $max) {
-                break;
-            }
-            $objects[] = $var;
-            foreach ($object_vars as $curr_key => $curr_val) {
-                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
-                            '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
-                $depth--;
-            }
-            break;
-        case 'boolean':
-        case 'NULL':
-        case 'resource':
-            if (true === $var) {
-                $results = 'true';
-            } elseif (false === $var) {
-                $results = 'false';
-            } elseif (null === $var) {
-                $results = 'null';
-            } else {
-                $results = htmlspecialchars((string)$var);
-            }
-            $results = '<i>' . $results . '</i>';
-            break;
-        case 'integer':
-        case 'float':
-            $results = htmlspecialchars((string)$var);
-            break;
-        case 'string':
-            $results = strtr($var, $_replace);
-            if (Smarty::$_MBSTRING) {
-                if (mb_strlen($var, Smarty::$_CHARSET) > $length) {
-                    $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
-                }
-            } else {
-                if (isset($var[ $length ])) {
-                    $results = substr($var, 0, $length - 3) . '...';
-                }
-            }
-            $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
-            break;
-        case 'unknown type':
-        default:
-            $results = strtr((string)$var, $_replace);
-            if (Smarty::$_MBSTRING) {
-                if (mb_strlen($results, Smarty::$_CHARSET) > $length) {
-                    $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...';
-                }
-            } else {
-                if (strlen($results) > $length) {
-                    $results = substr($results, 0, $length - 3) . '...';
-                }
-            }
-            $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
-    }
-    return $results;
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.escape.php b/libraries/Smarty/libs/plugins/modifier.escape.php
deleted file mode 100644
index 150901c7c..000000000
--- a/libraries/Smarty/libs/plugins/modifier.escape.php
+++ /dev/null
@@ -1,255 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty escape modifier plugin
- * Type:     modifier
- * Name:     escape
- * Purpose:  escape string for output
- *
- * @link   http://www.smarty.net/docs/en/language.modifier.escape
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param string  $string        input string
- * @param string  $esc_type      escape type
- * @param string  $char_set      character set, used for htmlspecialchars() or htmlentities()
- * @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
- *
- * @return string escaped input string
- */
-function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
-{
-    static $_double_encode = null;
-    static $is_loaded_1 = false;
-    static $is_loaded_2 = false;
-    if ($_double_encode === null) {
-        $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
-    }
-    if (!$char_set) {
-        $char_set = Smarty::$_CHARSET;
-    }
-    switch ($esc_type) {
-        case 'html':
-            if ($_double_encode) {
-                // php >=5.3.2 - go native
-                return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
-            } else {
-                if ($double_encode) {
-                    // php <5.2.3 - only handle double encoding
-                    return htmlspecialchars($string, ENT_QUOTES, $char_set);
-                } else {
-                    // php <5.2.3 - prevent double encoding
-                    $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
-                    $string = htmlspecialchars($string, ENT_QUOTES, $char_set);
-                    $string = str_replace(
-                        array(
-                            '%%%SMARTY_START%%%',
-                            '%%%SMARTY_END%%%'
-                        ),
-                        array(
-                            '&',
-                            ';'
-                        ),
-                        $string
-                    );
-                    return $string;
-                }
-            }
-        // no break
-        case 'htmlall':
-            if (Smarty::$_MBSTRING) {
-                // mb_convert_encoding ignores htmlspecialchars()
-                if ($_double_encode) {
-                    // php >=5.3.2 - go native
-                    $string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
-                } else {
-                    if ($double_encode) {
-                        // php <5.2.3 - only handle double encoding
-                        $string = htmlspecialchars($string, ENT_QUOTES, $char_set);
-                    } else {
-                        // php <5.2.3 - prevent double encoding
-                        $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
-                        $string = htmlspecialchars($string, ENT_QUOTES, $char_set);
-                        $string =
-                            str_replace(
-                                array(
-                                    '%%%SMARTY_START%%%',
-                                    '%%%SMARTY_END%%%'
-                                ),
-                                array(
-                                    '&',
-                                    ';'
-                                ),
-                                $string
-                            );
-                        return $string;
-                    }
-                }
-                // htmlentities() won't convert everything, so use mb_convert_encoding
-                return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);
-            }
-            // no MBString fallback
-            if ($_double_encode) {
-                return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
-            } else {
-                if ($double_encode) {
-                    return htmlentities($string, ENT_QUOTES, $char_set);
-                } else {
-                    $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
-                    $string = htmlentities($string, ENT_QUOTES, $char_set);
-                    $string = str_replace(
-                        array(
-                            '%%%SMARTY_START%%%',
-                            '%%%SMARTY_END%%%'
-                        ),
-                        array(
-                            '&',
-                            ';'
-                        ),
-                        $string
-                    );
-                    return $string;
-                }
-            }
-        // no break
-        case 'url':
-            return rawurlencode($string);
-        case 'urlpathinfo':
-            return str_replace('%2F', '/', rawurlencode($string));
-        case 'quotes':
-            // escape unescaped single quotes
-            return preg_replace("%(?<!\\\\)'%", "\\'", $string);
-        case 'hex':
-            // escape every byte into hex
-            // Note that the UTF-8 encoded character ä will be represented as %c3%a4
-            $return = '';
-            $_length = strlen($string);
-            for ($x = 0; $x < $_length; $x++) {
-                $return .= '%' . bin2hex($string[ $x ]);
-            }
-            return $return;
-        case 'hexentity':
-            $return = '';
-            if (Smarty::$_MBSTRING) {
-                if (!$is_loaded_1) {
-                    if (!is_callable('smarty_mb_to_unicode')) {
-                        include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
-                    }
-                    $is_loaded_1 = true;
-                }
-                $return = '';
-                foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
-                    $return .= '&#x' . strtoupper(dechex($unicode)) . ';';
-                }
-                return $return;
-            }
-            // no MBString fallback
-            $_length = strlen($string);
-            for ($x = 0; $x < $_length; $x++) {
-                $return .= '&#x' . bin2hex($string[ $x ]) . ';';
-            }
-            return $return;
-        case 'decentity':
-            $return = '';
-            if (Smarty::$_MBSTRING) {
-                if (!$is_loaded_1) {
-                    if (!is_callable('smarty_mb_to_unicode')) {
-                        include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
-                    }
-                    $is_loaded_1 = true;
-                }
-                $return = '';
-                foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
-                    $return .= '&#' . $unicode . ';';
-                }
-                return $return;
-            }
-            // no MBString fallback
-            $_length = strlen($string);
-            for ($x = 0; $x < $_length; $x++) {
-                $return .= '&#' . ord($string[ $x ]) . ';';
-            }
-            return $return;
-        case 'javascript':
-            // escape quotes and backslashes, newlines, etc.
-            return strtr(
-                $string,
-                array(
-                    '\\' => '\\\\',
-                    "'"  => "\\'",
-                    '"'  => '\\"',
-                    "\r" => '\\r',
-                    "\n" => '\\n',
-                    '</' => '<\/'
-                )
-            );
-        case 'mail':
-            if (Smarty::$_MBSTRING) {
-                if (!$is_loaded_2) {
-                    if (!is_callable('smarty_mb_str_replace')) {
-                        include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
-                    }
-                    $is_loaded_2 = true;
-                }
-                return smarty_mb_str_replace(
-                    array(
-                        '@',
-                        '.'
-                    ),
-                    array(
-                        ' [AT] ',
-                        ' [DOT] '
-                    ),
-                    $string
-                );
-            }
-            // no MBString fallback
-            return str_replace(
-                array(
-                    '@',
-                    '.'
-                ),
-                array(
-                    ' [AT] ',
-                    ' [DOT] '
-                ),
-                $string
-            );
-        case 'nonstd':
-            // escape non-standard chars, such as ms document quotes
-            $return = '';
-            if (Smarty::$_MBSTRING) {
-                if (!$is_loaded_1) {
-                    if (!is_callable('smarty_mb_to_unicode')) {
-                        include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
-                    }
-                    $is_loaded_1 = true;
-                }
-                foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
-                    if ($unicode >= 126) {
-                        $return .= '&#' . $unicode . ';';
-                    } else {
-                        $return .= chr($unicode);
-                    }
-                }
-                return $return;
-            }
-            $_length = strlen($string);
-            for ($_i = 0; $_i < $_length; $_i++) {
-                $_ord = ord(substr($string, $_i, 1));
-                // non-standard char, escape it
-                if ($_ord >= 126) {
-                    $return .= '&#' . $_ord . ';';
-                } else {
-                    $return .= substr($string, $_i, 1);
-                }
-            }
-            return $return;
-        default:
-            return $string;
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.mb_wordwrap.php b/libraries/Smarty/libs/plugins/modifier.mb_wordwrap.php
deleted file mode 100644
index 1cd625b64..000000000
--- a/libraries/Smarty/libs/plugins/modifier.mb_wordwrap.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty wordwrap modifier plugin
- * Type:     modifier
- * Name:     mb_wordwrap
- * Purpose:  Wrap a string to a given number of characters
- *
- * @link   http://php.net/manual/en/function.wordwrap.php for similarity
- *
- * @param string  $str   the string to wrap
- * @param int     $width the width of the output
- * @param string  $break the character used to break the line
- * @param boolean $cut   ignored parameter, just for the sake of
- *
- * @return string  wrapped string
- * @author Rodney Rehm
- */
-function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false)
-{
-    // break words into tokens using white space as a delimiter
-    $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
-    $length = 0;
-    $t = '';
-    $_previous = false;
-    $_space = false;
-    foreach ($tokens as $_token) {
-        $token_length = mb_strlen($_token, Smarty::$_CHARSET);
-        $_tokens = array($_token);
-        if ($token_length > $width) {
-            if ($cut) {
-                $_tokens = preg_split(
-                    '!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER,
-                    $_token,
-                    -1,
-                    PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE
-                );
-            }
-        }
-        foreach ($_tokens as $token) {
-            $_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token);
-            $token_length = mb_strlen($token, Smarty::$_CHARSET);
-            $length += $token_length;
-            if ($length > $width) {
-                // remove space before inserted break
-                if ($_previous) {
-                    $t = mb_substr($t, 0, -1, Smarty::$_CHARSET);
-                }
-                if (!$_space) {
-                    // add the break before the token
-                    if (!empty($t)) {
-                        $t .= $break;
-                    }
-                    $length = $token_length;
-                }
-            } elseif ($token === "\n") {
-                // hard break must reset counters
-                $length = 0;
-            }
-            $_previous = $_space;
-            // add the token
-            $t .= $token;
-        }
-    }
-    return $t;
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.regex_replace.php b/libraries/Smarty/libs/plugins/modifier.regex_replace.php
deleted file mode 100644
index 7eb550695..000000000
--- a/libraries/Smarty/libs/plugins/modifier.regex_replace.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty regex_replace modifier plugin
- * Type:     modifier
- * Name:     regex_replace
- * Purpose:  regular expression search/replace
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.regex.replace.php
- *          regex_replace (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param string       $string  input string
- * @param string|array $search  regular expression(s) to search for
- * @param string|array $replace string(s) that should be replaced
- * @param int          $limit   the maximum number of replacements
- *
- * @return string
- */
-function smarty_modifier_regex_replace($string, $search, $replace, $limit = -1)
-{
-    if (is_array($search)) {
-        foreach ($search as $idx => $s) {
-            $search[ $idx ] = _smarty_regex_replace_check($s);
-        }
-    } else {
-        $search = _smarty_regex_replace_check($search);
-    }
-    return preg_replace($search, $replace, $string, $limit);
-}
-
-/**
- * @param  string $search string(s) that should be replaced
- *
- * @return string
- * @ignore
- */
-function _smarty_regex_replace_check($search)
-{
-    // null-byte injection detection
-    // anything behind the first null-byte is ignored
-    if (($pos = strpos($search, "\0")) !== false) {
-        $search = substr($search, 0, $pos);
-    }
-    // remove eval-modifier from $search
-    if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[ 1 ], 'e') !== false)) {
-        $search = substr($search, 0, -strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]);
-    }
-    return $search;
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.replace.php b/libraries/Smarty/libs/plugins/modifier.replace.php
deleted file mode 100644
index a98f5a4a6..000000000
--- a/libraries/Smarty/libs/plugins/modifier.replace.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty replace modifier plugin
- * Type:     modifier
- * Name:     replace
- * Purpose:  simple search/replace
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- *
- * @param string $string  input string
- * @param string $search  text to search for
- * @param string $replace replacement text
- *
- * @return string
- */
-function smarty_modifier_replace($string, $search, $replace)
-{
-    static $is_loaded = false;
-    if (Smarty::$_MBSTRING) {
-        if (!$is_loaded) {
-            if (!is_callable('smarty_mb_str_replace')) {
-                include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
-            }
-            $is_loaded = true;
-        }
-        return smarty_mb_str_replace($search, $replace, $string);
-    }
-    return str_replace($search, $replace, $string);
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.spacify.php b/libraries/Smarty/libs/plugins/modifier.spacify.php
deleted file mode 100644
index 98efd4b30..000000000
--- a/libraries/Smarty/libs/plugins/modifier.spacify.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty spacify modifier plugin
- * Type:     modifier
- * Name:     spacify
- * Purpose:  add spaces between characters in a string
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param string $string       input string
- * @param string $spacify_char string to insert between characters.
- *
- * @return string
- */
-function smarty_modifier_spacify($string, $spacify_char = ' ')
-{
-    // well… what about charsets besides latin and UTF-8?
-    return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY));
-}
diff --git a/libraries/Smarty/libs/plugins/modifier.truncate.php b/libraries/Smarty/libs/plugins/modifier.truncate.php
deleted file mode 100644
index bb881bf6e..000000000
--- a/libraries/Smarty/libs/plugins/modifier.truncate.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifier
- */
-/**
- * Smarty truncate modifier plugin
- * Type:     modifier
- * Name:     truncate
- * Purpose:  Truncate a string to a certain length if necessary,
- *               optionally splitting in the middle of a word, and
- *               appending the $etc string or inserting $etc into the middle.
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param string  $string      input string
- * @param integer $length      length of truncated text
- * @param string  $etc         end string
- * @param boolean $break_words truncate at word boundary
- * @param boolean $middle      truncate in the middle of text
- *
- * @return string truncated string
- */
-function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
-{
-    if ($length === 0) {
-        return '';
-    }
-    if (Smarty::$_MBSTRING) {
-        if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
-            $length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
-            if (!$break_words && !$middle) {
-                $string = preg_replace(
-                    '/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER,
-                    '',
-                    mb_substr($string, 0, $length + 1, Smarty::$_CHARSET)
-                );
-            }
-            if (!$middle) {
-                return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
-            }
-            return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc .
-                   mb_substr($string, -$length / 2, $length, Smarty::$_CHARSET);
-        }
-        return $string;
-    }
-    // no MBString fallback
-    if (isset($string[ $length ])) {
-        $length -= min($length, strlen($etc));
-        if (!$break_words && !$middle) {
-            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
-        }
-        if (!$middle) {
-            return substr($string, 0, $length) . $etc;
-        }
-        return substr($string, 0, $length / 2) . $etc . substr($string, -$length / 2);
-    }
-    return $string;
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.cat.php b/libraries/Smarty/libs/plugins/modifiercompiler.cat.php
deleted file mode 100644
index 21d0e6624..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.cat.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty cat modifier plugin
- * Type:     modifier
- * Name:     cat
- * Date:     Feb 24, 2003
- * Purpose:  catenate a value to a variable
- * Input:    string to catenate
- * Example:  {$var|cat:"foo"}
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.cat.php cat
- *           (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_cat($params)
-{
-    return '(' . implode(').(', $params) . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.count_characters.php b/libraries/Smarty/libs/plugins/modifiercompiler.count_characters.php
deleted file mode 100644
index 6c44278af..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.count_characters.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty count_characters modifier plugin
- * Type:     modifier
- * Name:     count_characters
- * Purpose:  count the number of characters in a text
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online
- *         manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_characters($params)
-{
-    if (!isset($params[ 1 ]) || $params[ 1 ] !== 'true') {
-        return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
-    }
-    if (Smarty::$_MBSTRING) {
-        return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
-    }
-    // no MBString fallback
-    return 'strlen(' . $params[ 0 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.count_paragraphs.php b/libraries/Smarty/libs/plugins/modifiercompiler.count_paragraphs.php
deleted file mode 100644
index e214a56f0..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.count_paragraphs.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty count_paragraphs modifier plugin
- * Type:     modifier
- * Name:     count_paragraphs
- * Purpose:  count the number of paragraphs in a text
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
- *          count_paragraphs (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_paragraphs($params)
-{
-    // count \r or \n characters
-    return '(preg_match_all(\'#[\r\n]+#\', ' . $params[ 0 ] . ', $tmp)+1)';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.count_sentences.php b/libraries/Smarty/libs/plugins/modifiercompiler.count_sentences.php
deleted file mode 100644
index 027745635..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.count_sentences.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty count_sentences modifier plugin
- * Type:     modifier
- * Name:     count_sentences
- * Purpose:  count the number of sentences in a text
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
- *          count_sentences (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_sentences($params)
-{
-    // find periods, question marks, exclamation marks with a word before but not after.
-    return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[ 0 ] . ', $tmp)';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.count_words.php b/libraries/Smarty/libs/plugins/modifiercompiler.count_words.php
deleted file mode 100644
index 6d889da5c..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.count_words.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty count_words modifier plugin
- * Type:     modifier
- * Name:     count_words
- * Purpose:  count the number of words in a text
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_count_words($params)
-{
-    if (Smarty::$_MBSTRING) {
-        // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
-        // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
-        return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
-               $params[ 0 ] . ', $tmp)';
-    }
-    // no MBString fallback
-    return 'str_word_count(' . $params[ 0 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.default.php b/libraries/Smarty/libs/plugins/modifiercompiler.default.php
deleted file mode 100644
index ae886c4b2..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.default.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty default modifier plugin
- * Type:     modifier
- * Name:     default
- * Purpose:  designate default value for empty variables
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_default($params)
-{
-    $output = $params[ 0 ];
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = "''";
-    }
-    array_shift($params);
-    foreach ($params as $param) {
-        $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
-    }
-    return $output;
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.escape.php b/libraries/Smarty/libs/plugins/modifiercompiler.escape.php
deleted file mode 100644
index e0763adce..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.escape.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty escape modifier plugin
- * Type:     modifier
- * Name:     escape
- * Purpose:  escape string for output
- *
- * @link   http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
- * @author Rodney Rehm
- *
- * @param array                                $params parameters
- * @param Smarty_Internal_TemplateCompilerBase $compiler
- *
- * @return string with compiled code
- * @throws \SmartyException
- */
-function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompilerBase $compiler)
-{
-    static $_double_encode = null;
-    static $is_loaded = false;
-    $compiler->template->_checkPlugins(
-        array(
-            array(
-                'function' => 'smarty_literal_compiler_param',
-                'file'     => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'
-            )
-        )
-    );
-    if ($_double_encode === null) {
-        $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
-    }
-    try {
-        $esc_type = smarty_literal_compiler_param($params, 1, 'html');
-        $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);
-        $double_encode = smarty_literal_compiler_param($params, 3, true);
-        if (!$char_set) {
-            $char_set = Smarty::$_CHARSET;
-        }
-        switch ($esc_type) {
-            case 'html':
-                if ($_double_encode) {
-                    return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
-                           var_export($double_encode, true) . ')';
-                } elseif ($double_encode) {
-                    return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')';
-                } else {
-                    // fall back to modifier.escape.php
-                }
-            // no break
-            case 'htmlall':
-                if (Smarty::$_MBSTRING) {
-                    if ($_double_encode) {
-                        // php >=5.2.3 - go native
-                        return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' .
-                               var_export($char_set, true) . ', ' . var_export($double_encode, true) .
-                               '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
-                    } elseif ($double_encode) {
-                        // php <5.2.3 - only handle double encoding
-                        return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' .
-                               var_export($char_set, true) . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
-                    } else {
-                        // fall back to modifier.escape.php
-                    }
-                }
-                // no MBString fallback
-                if ($_double_encode) {
-                    // php >=5.2.3 - go native
-                    return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
-                           var_export($double_encode, true) . ')';
-                } elseif ($double_encode) {
-                    // php <5.2.3 - only handle double encoding
-                    return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')';
-                } else {
-                    // fall back to modifier.escape.php
-                }
-            // no break
-            case 'url':
-                return 'rawurlencode(' . $params[ 0 ] . ')';
-            case 'urlpathinfo':
-                return 'str_replace("%2F", "/", rawurlencode(' . $params[ 0 ] . '))';
-            case 'quotes':
-                // escape unescaped single quotes
-                return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[ 0 ] . ')';
-            case 'javascript':
-                // escape quotes and backslashes, newlines, etc.
-                return 'strtr(' .
-                       $params[ 0 ] .
-                       ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
-        }
-    } catch (SmartyException $e) {
-        // pass through to regular plugin fallback
-    }
-    // could not optimize |escape call, so fallback to regular plugin
-    if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
-        $compiler->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'file' ] =
-            SMARTY_PLUGINS_DIR . 'modifier.escape.php';
-        $compiler->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'function' ] =
-            'smarty_modifier_escape';
-    } else {
-        $compiler->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'file' ] =
-            SMARTY_PLUGINS_DIR . 'modifier.escape.php';
-        $compiler->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'function' ] =
-            'smarty_modifier_escape';
-    }
-    return 'smarty_modifier_escape(' . join(', ', $params) . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.from_charset.php b/libraries/Smarty/libs/plugins/modifiercompiler.from_charset.php
deleted file mode 100644
index acce7784b..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.from_charset.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty from_charset modifier plugin
- * Type:     modifier
- * Name:     from_charset
- * Purpose:  convert character encoding from $charset to internal encoding
- *
- * @author Rodney Rehm
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_from_charset($params)
-{
-    if (!Smarty::$_MBSTRING) {
-        // FIXME: (rodneyrehm) shouldn't this throw an error?
-        return $params[ 0 ];
-    }
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = '"ISO-8859-1"';
-    }
-    return 'mb_convert_encoding(' . $params[ 0 ] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[ 1 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.indent.php b/libraries/Smarty/libs/plugins/modifiercompiler.indent.php
deleted file mode 100644
index 2088ad6a8..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.indent.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty indent modifier plugin
- * Type:     modifier
- * Name:     indent
- * Purpose:  indent lines of text
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_indent($params)
-{
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = 4;
-    }
-    if (!isset($params[ 2 ])) {
-        $params[ 2 ] = "' '";
-    }
-    return 'preg_replace(\'!^!m\',str_repeat(' . $params[ 2 ] . ',' . $params[ 1 ] . '),' . $params[ 0 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.lower.php b/libraries/Smarty/libs/plugins/modifiercompiler.lower.php
deleted file mode 100644
index 0d899a002..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.lower.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty lower modifier plugin
- * Type:     modifier
- * Name:     lower
- * Purpose:  convert string to lowercase
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_lower($params)
-{
-    if (Smarty::$_MBSTRING) {
-        return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
-    }
-    // no MBString fallback
-    return 'strtolower(' . $params[ 0 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.noprint.php b/libraries/Smarty/libs/plugins/modifiercompiler.noprint.php
deleted file mode 100644
index 1275190e0..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.noprint.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty noprint modifier plugin
- * Type:     modifier
- * Name:     noprint
- * Purpose:  return an empty string
- *
- * @author Uwe Tews
- * @return string with compiled code
- */
-function smarty_modifiercompiler_noprint()
-{
-    return "''";
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.string_format.php b/libraries/Smarty/libs/plugins/modifiercompiler.string_format.php
deleted file mode 100644
index 663094311..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.string_format.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty string_format modifier plugin
- * Type:     modifier
- * Name:     string_format
- * Purpose:  format strings via sprintf
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_string_format($params)
-{
-    return 'sprintf(' . $params[ 1 ] . ',' . $params[ 0 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.strip.php b/libraries/Smarty/libs/plugins/modifiercompiler.strip.php
deleted file mode 100644
index 04ea332c5..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.strip.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty strip modifier plugin
- * Type:     modifier
- * Name:     strip
- * Purpose:  Replace all repeated spaces, newlines, tabs
- *              with a single space or supplied replacement string.
- * Example:  {$var|strip} {$var|strip:"&nbsp;"}
- * Date:     September 25th, 2002
- *
- * @link   http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_strip($params)
-{
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = "' '";
-    }
-    return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.strip_tags.php b/libraries/Smarty/libs/plugins/modifiercompiler.strip_tags.php
deleted file mode 100644
index 1bca1a28e..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.strip_tags.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty strip_tags modifier plugin
- * Type:     modifier
- * Name:     strip_tags
- * Purpose:  strip html tags from text
- *
- * @link   http://www.smarty.net/docs/en/language.modifier.strip.tags.tpl strip_tags (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_strip_tags($params)
-{
-    if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') === 'true') {
-        return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
-    } else {
-        return 'strip_tags(' . $params[ 0 ] . ')';
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.to_charset.php b/libraries/Smarty/libs/plugins/modifiercompiler.to_charset.php
deleted file mode 100644
index d652eab1b..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.to_charset.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty to_charset modifier plugin
- * Type:     modifier
- * Name:     to_charset
- * Purpose:  convert character encoding from internal encoding to $charset
- *
- * @author Rodney Rehm
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_to_charset($params)
-{
-    if (!Smarty::$_MBSTRING) {
-        // FIXME: (rodneyrehm) shouldn't this throw an error?
-        return $params[ 0 ];
-    }
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = '"ISO-8859-1"';
-    }
-    return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 1 ] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.unescape.php b/libraries/Smarty/libs/plugins/modifiercompiler.unescape.php
deleted file mode 100644
index 05beb81f5..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.unescape.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty unescape modifier plugin
- * Type:     modifier
- * Name:     unescape
- * Purpose:  unescape html entities
- *
- * @author Rodney Rehm
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_unescape($params)
-{
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = 'html';
-    }
-    if (!isset($params[ 2 ])) {
-        $params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
-    } else {
-        $params[ 2 ] = "'{$params[ 2 ]}'";
-    }
-    switch (trim($params[ 1 ], '"\'')) {
-        case 'entity':
-        case 'htmlall':
-            if (Smarty::$_MBSTRING) {
-                return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
-            }
-            return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
-        case 'html':
-            return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
-        case 'url':
-            return 'rawurldecode(' . $params[ 0 ] . ')';
-        default:
-            return $params[ 0 ];
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.upper.php b/libraries/Smarty/libs/plugins/modifiercompiler.upper.php
deleted file mode 100644
index ea4e95b7a..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.upper.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty upper modifier plugin
- * Type:     modifier
- * Name:     lower
- * Purpose:  convert string to uppercase
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array $params parameters
- *
- * @return string with compiled code
- */
-function smarty_modifiercompiler_upper($params)
-{
-    if (Smarty::$_MBSTRING) {
-        return 'mb_strtoupper(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
-    }
-    // no MBString fallback
-    return 'strtoupper(' . $params[ 0 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/modifiercompiler.wordwrap.php b/libraries/Smarty/libs/plugins/modifiercompiler.wordwrap.php
deleted file mode 100644
index 8565f140e..000000000
--- a/libraries/Smarty/libs/plugins/modifiercompiler.wordwrap.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsModifierCompiler
- */
-/**
- * Smarty wordwrap modifier plugin
- * Type:     modifier
- * Name:     wordwrap
- * Purpose:  wrap a string of text at a given length
- *
- * @link   http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
- * @author Uwe Tews
- *
- * @param array                                 $params parameters
- * @param \Smarty_Internal_TemplateCompilerBase $compiler
- *
- * @return string with compiled code
- * @throws \SmartyException
- */
-function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompilerBase $compiler)
-{
-    if (!isset($params[ 1 ])) {
-        $params[ 1 ] = 80;
-    }
-    if (!isset($params[ 2 ])) {
-        $params[ 2 ] = '"\n"';
-    }
-    if (!isset($params[ 3 ])) {
-        $params[ 3 ] = 'false';
-    }
-    $function = 'wordwrap';
-    if (Smarty::$_MBSTRING) {
-        $function = $compiler->getPlugin('mb_wordwrap', 'modifier');
-    }
-    return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')';
-}
diff --git a/libraries/Smarty/libs/plugins/outputfilter.trimwhitespace.php b/libraries/Smarty/libs/plugins/outputfilter.trimwhitespace.php
deleted file mode 100644
index 7e4503a1c..000000000
--- a/libraries/Smarty/libs/plugins/outputfilter.trimwhitespace.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFilter
- */
-/**
- * Smarty trimwhitespace outputfilter plugin
- * Trim unnecessary whitespace from HTML markup.
- *
- * @author Rodney Rehm
- *
- * @param string $source input string
- *
- * @return string filtered output
- * @todo   substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
- */
-function smarty_outputfilter_trimwhitespace($source)
-{
-    $store = array();
-    $_store = 0;
-    $_offset = 0;
-    // Unify Line-Breaks to \n
-    $source = preg_replace('/\015\012|\015|\012/', "\n", $source);
-    // capture Internet Explorer and KnockoutJS Conditional Comments
-    if (preg_match_all(
-        '#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is',
-        $source,
-        $matches,
-        PREG_OFFSET_CAPTURE | PREG_SET_ORDER
-    )
-    ) {
-        foreach ($matches as $match) {
-            $store[] = $match[ 0 ][ 0 ];
-            $_length = strlen($match[ 0 ][ 0 ]);
-            $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
-            $source = substr_replace($source, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
-            $_offset += $_length - strlen($replace);
-            $_store++;
-        }
-    }
-    // Strip all HTML-Comments
-    // yes, even the ones in <script> - see http://stackoverflow.com/a/808850/515124
-    $source = preg_replace('#<!--.*?-->#ms', '', $source);
-    // capture html elements not to be messed with
-    $_offset = 0;
-    if (preg_match_all(
-        '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
-        $source,
-        $matches,
-        PREG_OFFSET_CAPTURE | PREG_SET_ORDER
-    )
-    ) {
-        foreach ($matches as $match) {
-            $store[] = $match[ 0 ][ 0 ];
-            $_length = strlen($match[ 0 ][ 0 ]);
-            $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
-            $source = substr_replace($source, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
-            $_offset += $_length - strlen($replace);
-            $_store++;
-        }
-    }
-    $expressions = array(// replace multiple spaces between tags by a single space
-                         // can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
-                         '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s'                                    => '\1 \2',
-                         // remove spaces between attributes (but not in attribute values!)
-                         '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
-                         // note: for some very weird reason trim() seems to remove spaces inside attributes.
-                         // maybe a \0 byte or something is interfering?
-                         '#^\s+<#Ss'                                                               => '<',
-                         '#>\s+$#Ss'                                                               => '>',
-    );
-    $source = preg_replace(array_keys($expressions), array_values($expressions), $source);
-    // note: for some very weird reason trim() seems to remove spaces inside attributes.
-    // maybe a \0 byte or something is interfering?
-    // $source = trim( $source );
-    $_offset = 0;
-    if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
-        foreach ($matches as $match) {
-            $_length = strlen($match[ 0 ][ 0 ]);
-            $replace = $store[ $match[ 1 ][ 0 ] ];
-            $source = substr_replace($source, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);
-            $_offset += strlen($replace) - $_length;
-            $_store++;
-        }
-    }
-    return $source;
-}
diff --git a/libraries/Smarty/libs/plugins/shared.escape_special_chars.php b/libraries/Smarty/libs/plugins/shared.escape_special_chars.php
deleted file mode 100644
index 6b18d3eec..000000000
--- a/libraries/Smarty/libs/plugins/shared.escape_special_chars.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Smarty shared plugin
- *
- * @package    Smarty
- * @subpackage PluginsShared
- */
-/**
- * escape_special_chars common function
- * Function: smarty_function_escape_special_chars
- * Purpose:  used by other smarty functions to escape
- *           special chars except for already escaped ones
- *
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param string $string text that should by escaped
- *
- * @return string
- */
-function smarty_function_escape_special_chars($string)
-{
-    if (!is_array($string)) {
-        if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
-            $string = htmlspecialchars($string, ENT_COMPAT, Smarty::$_CHARSET, false);
-        } else {
-            $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
-            $string = htmlspecialchars($string);
-            $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
-        }
-    }
-    return $string;
-}
diff --git a/libraries/Smarty/libs/plugins/shared.literal_compiler_param.php b/libraries/Smarty/libs/plugins/shared.literal_compiler_param.php
deleted file mode 100644
index 65caf03c8..000000000
--- a/libraries/Smarty/libs/plugins/shared.literal_compiler_param.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsShared
- */
-/**
- * evaluate compiler parameter
- *
- * @param array   $params  parameter array as given to the compiler function
- * @param integer $index   array index of the parameter to convert
- * @param mixed   $default value to be returned if the parameter is not present
- *
- * @return mixed evaluated value of parameter or $default
- * @throws SmartyException if parameter is not a literal (but an expression, variable, …)
- * @author Rodney Rehm
- */
-function smarty_literal_compiler_param($params, $index, $default = null)
-{
-    // not set, go default
-    if (!isset($params[ $index ])) {
-        return $default;
-    }
-    // test if param is a literal
-    if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) {
-        throw new SmartyException(
-            '$param[' . $index .
-            '] is not a literal and is thus not evaluatable at compile time'
-        );
-    }
-    $t = null;
-    eval("\$t = " . $params[ $index ] . ";");
-    return $t;
-}
diff --git a/libraries/Smarty/libs/plugins/shared.make_timestamp.php b/libraries/Smarty/libs/plugins/shared.make_timestamp.php
deleted file mode 100644
index 9626dc68e..000000000
--- a/libraries/Smarty/libs/plugins/shared.make_timestamp.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Smarty shared plugin
- *
- * @package    Smarty
- * @subpackage PluginsShared
- */
-/**
- * Function: smarty_make_timestamp
- * Purpose:  used by other smarty functions to make a timestamp from a string.
- *
- * @author Monte Ohrt <monte at ohrt dot com>
- *
- * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime()
- *
- * @return int
- */
-function smarty_make_timestamp($string)
-{
-    if (empty($string)) {
-        // use "now":
-        return time();
-    } elseif ($string instanceof DateTime
-              || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
-    ) {
-        return (int)$string->format('U'); // PHP 5.2 BC
-    } elseif (strlen($string) === 14 && ctype_digit($string)) {
-        // it is mysql timestamp format of YYYYMMDDHHMMSS?
-        return mktime(
-            substr($string, 8, 2),
-            substr($string, 10, 2),
-            substr($string, 12, 2),
-            substr($string, 4, 2),
-            substr($string, 6, 2),
-            substr($string, 0, 4)
-        );
-    } elseif (is_numeric($string)) {
-        // it is a numeric string, we handle it as timestamp
-        return (int)$string;
-    } else {
-        // strtotime should handle it
-        $time = strtotime($string);
-        if ($time === -1 || $time === false) {
-            // strtotime() was not able to parse $string, use "now":
-            return time();
-        }
-        return $time;
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/shared.mb_str_replace.php b/libraries/Smarty/libs/plugins/shared.mb_str_replace.php
deleted file mode 100644
index 206cf9ea6..000000000
--- a/libraries/Smarty/libs/plugins/shared.mb_str_replace.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Smarty shared plugin
- *
- * @package    Smarty
- * @subpackage PluginsShared
- */
-if (!function_exists('smarty_mb_str_replace')) {
-    /**
-     * Multibyte string replace
-     *
-     * @param string|string[] $search  the string to be searched
-     * @param string|string[] $replace the replacement string
-     * @param string          $subject the source string
-     * @param int             &$count  number of matches found
-     *
-     * @return string replaced string
-     * @author Rodney Rehm
-     */
-    function smarty_mb_str_replace($search, $replace, $subject, &$count = 0)
-    {
-        if (!is_array($search) && is_array($replace)) {
-            return false;
-        }
-        if (is_array($subject)) {
-            // call mb_replace for each single string in $subject
-            foreach ($subject as &$string) {
-                $string = smarty_mb_str_replace($search, $replace, $string, $c);
-                $count += $c;
-            }
-        } elseif (is_array($search)) {
-            if (!is_array($replace)) {
-                foreach ($search as &$string) {
-                    $subject = smarty_mb_str_replace($string, $replace, $subject, $c);
-                    $count += $c;
-                }
-            } else {
-                $n = max(count($search), count($replace));
-                while ($n--) {
-                    $subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c);
-                    $count += $c;
-                    next($search);
-                    next($replace);
-                }
-            }
-        } else {
-            $parts = mb_split(preg_quote($search), $subject);
-            $count = count($parts) - 1;
-            $subject = implode($replace, $parts);
-        }
-        return $subject;
-    }
-}
diff --git a/libraries/Smarty/libs/plugins/shared.mb_unicode.php b/libraries/Smarty/libs/plugins/shared.mb_unicode.php
deleted file mode 100644
index 7d1206506..000000000
--- a/libraries/Smarty/libs/plugins/shared.mb_unicode.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Smarty shared plugin
- *
- * @package    Smarty
- * @subpackage PluginsShared
- */
-/**
- * convert characters to their decimal unicode equivalents
- *
- * @link   http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration
- *
- * @param string $string   characters to calculate unicode of
- * @param string $encoding encoding of $string, if null mb_internal_encoding() is used
- *
- * @return array sequence of unicodes
- * @author Rodney Rehm
- */
-function smarty_mb_to_unicode($string, $encoding = null)
-{
-    if ($encoding) {
-        $expanded = mb_convert_encoding($string, 'UTF-32BE', $encoding);
-    } else {
-        $expanded = mb_convert_encoding($string, 'UTF-32BE');
-    }
-    return unpack('N*', $expanded);
-}
-
-/**
- * convert unicodes to the character of given encoding
- *
- * @link   http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration
- *
- * @param integer|array $unicode  single unicode or list of unicodes to convert
- * @param string        $encoding encoding of returned string, if null mb_internal_encoding() is used
- *
- * @return string unicode as character sequence in given $encoding
- * @author Rodney Rehm
- */
-function smarty_mb_from_unicode($unicode, $encoding = null)
-{
-    $t = '';
-    if (!$encoding) {
-        $encoding = mb_internal_encoding();
-    }
-    foreach ((array)$unicode as $utf32be) {
-        $character = pack('N*', $utf32be);
-        $t .= mb_convert_encoding($character, $encoding, 'UTF-32BE');
-    }
-    return $t;
-}
diff --git a/libraries/Smarty/libs/plugins/variablefilter.htmlspecialchars.php b/libraries/Smarty/libs/plugins/variablefilter.htmlspecialchars.php
deleted file mode 100644
index 3c85295db..000000000
--- a/libraries/Smarty/libs/plugins/variablefilter.htmlspecialchars.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage PluginsFilter
- */
-/**
- * Smarty htmlspecialchars variablefilter plugin
- *
- * @param string                    $source input string
- * @param \Smarty_Internal_Template $template
- *
- * @return string filtered output
- */
-function smarty_variablefilter_htmlspecialchars($source, Smarty_Internal_Template $template)
-{
-    return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_cacheresource.php b/libraries/Smarty/libs/sysplugins/smarty_cacheresource.php
deleted file mode 100644
index 91e9f3924..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_cacheresource.php
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin
- *
- * @package    Smarty
- * @subpackage Cacher
- */
-
-/**
- * Cache Handler API
- *
- * @package    Smarty
- * @subpackage Cacher
- * @author     Rodney Rehm
- */
-abstract class Smarty_CacheResource
-{
-    /**
-     * resource types provided by the core
-     *
-     * @var array
-     */
-    protected static $sysplugins = array('file' => 'smarty_internal_cacheresource_file.php',);
-
-    /**
-     * populate Cached Object with meta data from Resource
-     *
-     * @param \Smarty_Template_Cached  $cached    cached object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    abstract public function populate(\Smarty_Template_Cached $cached, Smarty_Internal_Template $_template);
-
-    /**
-     * populate Cached Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Cached $cached
-     *
-     * @return void
-     */
-    abstract public function populateTimestamp(Smarty_Template_Cached $cached);
-
-    /**
-     * Read the cached template and process header
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param Smarty_Template_Cached   $cached    cached object
-     * @param boolean                  $update    flag if called because cache update
-     *
-     * @return boolean true or false if the cached content does not exist
-     */
-    abstract public function process(
-        Smarty_Internal_Template $_template,
-        Smarty_Template_Cached $cached = null,
-        $update = false
-    );
-
-    /**
-     * Write the rendered template output to cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $content   content to cache
-     *
-     * @return boolean success
-     */
-    abstract public function writeCachedContent(Smarty_Internal_Template $_template, $content);
-
-    /**
-     * Read cached template from cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string  content
-     */
-    abstract public function readCachedContent(Smarty_Internal_Template $_template);
-
-    /**
-     * Return cached content
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return null|string
-     */
-    public function getCachedContent(Smarty_Internal_Template $_template)
-    {
-        if ($_template->cached->handler->process($_template)) {
-            ob_start();
-            $unifunc = $_template->cached->unifunc;
-            $unifunc($_template);
-            return ob_get_clean();
-        }
-        return null;
-    }
-
-    /**
-     * Empty cache
-     *
-     * @param Smarty  $smarty   Smarty object
-     * @param integer $exp_time expiration time (number of seconds, not timestamp)
-     *
-     * @return integer number of cache files deleted
-     */
-    abstract public function clearAll(Smarty $smarty, $exp_time = null);
-
-    /**
-     * Empty cache for a specific template
-     *
-     * @param Smarty  $smarty        Smarty object
-     * @param string  $resource_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time (number of seconds, not timestamp)
-     *
-     * @return integer number of cache files deleted
-     */
-    abstract public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);
-
-    /**
-     * @param Smarty                 $smarty
-     * @param Smarty_Template_Cached $cached
-     *
-     * @return bool|null
-     */
-    public function locked(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        // theoretically locking_timeout should be checked against time_limit (max_execution_time)
-        $start = microtime(true);
-        $hadLock = null;
-        while ($this->hasLock($smarty, $cached)) {
-            $hadLock = true;
-            if (microtime(true) - $start > $smarty->locking_timeout) {
-                // abort waiting for lock release
-                return false;
-            }
-            sleep(1);
-        }
-        return $hadLock;
-    }
-
-    /**
-     * Check is cache is locked for this template
-     *
-     * @param Smarty                 $smarty
-     * @param Smarty_Template_Cached $cached
-     *
-     * @return bool
-     */
-    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        // check if lock exists
-        return false;
-    }
-
-    /**
-     * Lock cache for this template
-     *
-     * @param Smarty                 $smarty
-     * @param Smarty_Template_Cached $cached
-     *
-     * @return bool
-     */
-    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        // create lock
-        return true;
-    }
-
-    /**
-     * Unlock cache for this template
-     *
-     * @param Smarty                 $smarty
-     * @param Smarty_Template_Cached $cached
-     *
-     * @return bool
-     */
-    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        // release lock
-        return true;
-    }
-
-    /**
-     * Load Cache Resource Handler
-     *
-     * @param Smarty $smarty Smarty object
-     * @param string $type   name of the cache resource
-     *
-     * @throws SmartyException
-     * @return Smarty_CacheResource Cache Resource Handler
-     */
-    public static function load(Smarty $smarty, $type = null)
-    {
-        if (!isset($type)) {
-            $type = $smarty->caching_type;
-        }
-        // try smarty's cache
-        if (isset($smarty->_cache[ 'cacheresource_handlers' ][ $type ])) {
-            return $smarty->_cache[ 'cacheresource_handlers' ][ $type ];
-        }
-        // try registered resource
-        if (isset($smarty->registered_cache_resources[ $type ])) {
-            // do not cache these instances as they may vary from instance to instance
-            return $smarty->_cache[ 'cacheresource_handlers' ][ $type ] = $smarty->registered_cache_resources[ $type ];
-        }
-        // try sysplugins dir
-        if (isset(self::$sysplugins[ $type ])) {
-            $cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
-            return $smarty->_cache[ 'cacheresource_handlers' ][ $type ] = new $cache_resource_class();
-        }
-        // try plugins dir
-        $cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);
-        if ($smarty->loadPlugin($cache_resource_class)) {
-            return $smarty->_cache[ 'cacheresource_handlers' ][ $type ] = new $cache_resource_class();
-        }
-        // give up
-        throw new SmartyException("Unable to load cache resource '{$type}'");
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_cacheresource_custom.php b/libraries/Smarty/libs/sysplugins/smarty_cacheresource_custom.php
deleted file mode 100644
index 68ad11289..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_cacheresource_custom.php
+++ /dev/null
@@ -1,297 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin
- *
- * @package    Smarty
- * @subpackage Cacher
- */
-
-/**
- * Cache Handler API
- *
- * @package    Smarty
- * @subpackage Cacher
- * @author     Rodney Rehm
- */
-abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
-{
-    /**
-     * fetch cached content and its modification time from data source
-     *
-     * @param string  $id         unique cache content identifier
-     * @param string  $name       template name
-     * @param string  $cache_id   cache id
-     * @param string  $compile_id compile id
-     * @param string  $content    cached content
-     * @param integer $mtime      cache modification timestamp (epoch)
-     *
-     * @return void
-     */
-    abstract protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);
-
-    /**
-     * Fetch cached content's modification timestamp from data source
-     * {@internal implementing this method is optional.
-     *  Only implement it if modification times can be accessed faster than loading the complete cached content.}}
-     *
-     * @param string $id         unique cache content identifier
-     * @param string $name       template name
-     * @param string $cache_id   cache id
-     * @param string $compile_id compile id
-     *
-     * @return integer|boolean timestamp (epoch) the template was modified, or false if not found
-     */
-    protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
-    {
-        return false;
-    }
-
-    /**
-     * Save content to cache
-     *
-     * @param string       $id         unique cache content identifier
-     * @param string       $name       template name
-     * @param string       $cache_id   cache id
-     * @param string       $compile_id compile id
-     * @param integer|null $exp_time   seconds till expiration or null
-     * @param string       $content    content to cache
-     *
-     * @return boolean      success
-     */
-    abstract protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content);
-
-    /**
-     * Delete content from cache
-     *
-     * @param string|null  $name       template name
-     * @param string|null  $cache_id   cache id
-     * @param string|null  $compile_id compile id
-     * @param integer|null $exp_time   seconds till expiration time in seconds or null
-     *
-     * @return integer      number of deleted caches
-     */
-    abstract protected function delete($name, $cache_id, $compile_id, $exp_time);
-
-    /**
-     * populate Cached Object with meta data from Resource
-     *
-     * @param Smarty_Template_Cached   $cached    cached object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
-    {
-        $_cache_id = isset($cached->cache_id) ? preg_replace('![^\w\|]+!', '_', $cached->cache_id) : null;
-        $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w]+!', '_', $cached->compile_id) : null;
-        $path = $cached->source->uid . $_cache_id . $_compile_id;
-        $cached->filepath = sha1($path);
-        if ($_template->smarty->cache_locking) {
-            $cached->lock_id = sha1('lock.' . $path);
-        }
-        $this->populateTimestamp($cached);
-    }
-
-    /**
-     * populate Cached Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Cached $cached
-     *
-     * @return void
-     */
-    public function populateTimestamp(Smarty_Template_Cached $cached)
-    {
-        $mtime =
-            $this->fetchTimestamp($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id);
-        if ($mtime !== null) {
-            $cached->timestamp = $mtime;
-            $cached->exists = !!$cached->timestamp;
-            return;
-        }
-        $timestamp = null;
-        $this->fetch(
-            $cached->filepath,
-            $cached->source->name,
-            $cached->cache_id,
-            $cached->compile_id,
-            $cached->content,
-            $timestamp
-        );
-        $cached->timestamp = isset($timestamp) ? $timestamp : false;
-        $cached->exists = !!$cached->timestamp;
-    }
-
-    /**
-     * Read the cached template and process the header
-     *
-     * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
-     * @param Smarty_Template_Cached    $cached      cached object
-     * @param boolean                   $update      flag if called because cache update
-     *
-     * @return boolean                 true or false if the cached content does not exist
-     */
-    public function process(
-        Smarty_Internal_Template $_smarty_tpl,
-        Smarty_Template_Cached $cached = null,
-        $update = false
-    ) {
-        if (!$cached) {
-            $cached = $_smarty_tpl->cached;
-        }
-        $content = $cached->content ? $cached->content : null;
-        $timestamp = $cached->timestamp ? $cached->timestamp : null;
-        if ($content === null || !$timestamp) {
-            $this->fetch(
-                $_smarty_tpl->cached->filepath,
-                $_smarty_tpl->source->name,
-                $_smarty_tpl->cache_id,
-                $_smarty_tpl->compile_id,
-                $content,
-                $timestamp
-            );
-        }
-        if (isset($content)) {
-            eval('?>' . $content);
-            $cached->content = null;
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Write the rendered template output to cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $content   content to cache
-     *
-     * @return boolean                  success
-     */
-    public function writeCachedContent(Smarty_Internal_Template $_template, $content)
-    {
-        return $this->save(
-            $_template->cached->filepath,
-            $_template->source->name,
-            $_template->cache_id,
-            $_template->compile_id,
-            $_template->cache_lifetime,
-            $content
-        );
-    }
-
-    /**
-     * Read cached template from cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string|boolean  content
-     */
-    public function readCachedContent(Smarty_Internal_Template $_template)
-    {
-        $content = $_template->cached->content ? $_template->cached->content : null;
-        $timestamp = null;
-        if ($content === null) {
-            $timestamp = null;
-            $this->fetch(
-                $_template->cached->filepath,
-                $_template->source->name,
-                $_template->cache_id,
-                $_template->compile_id,
-                $content,
-                $timestamp
-            );
-        }
-        if (isset($content)) {
-            return $content;
-        }
-        return false;
-    }
-
-    /**
-     * Empty cache
-     *
-     * @param Smarty  $smarty   Smarty object
-     * @param integer $exp_time expiration time (number of seconds, not timestamp)
-     *
-     * @return integer number of cache files deleted
-     */
-    public function clearAll(Smarty $smarty, $exp_time = null)
-    {
-        return $this->delete(null, null, null, $exp_time);
-    }
-
-    /**
-     * Empty cache for a specific template
-     *
-     * @param Smarty  $smarty        Smarty object
-     * @param string  $resource_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time (number of seconds, not timestamp)
-     *
-     * @return int number of cache files deleted
-     * @throws \SmartyException
-     */
-    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
-    {
-        $cache_name = null;
-        if (isset($resource_name)) {
-            $source = Smarty_Template_Source::load(null, $smarty, $resource_name);
-            if ($source->exists) {
-                $cache_name = $source->name;
-            } else {
-                return 0;
-            }
-        }
-        return $this->delete($cache_name, $cache_id, $compile_id, $exp_time);
-    }
-
-    /**
-     * Check is cache is locked for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return boolean               true or false if cache is locked
-     */
-    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $id = $cached->lock_id;
-        $name = $cached->source->name . '.lock';
-        $mtime = $this->fetchTimestamp($id, $name, $cached->cache_id, $cached->compile_id);
-        if ($mtime === null) {
-            $this->fetch($id, $name, $cached->cache_id, $cached->compile_id, $content, $mtime);
-        }
-        return $mtime && ($t = time()) - $mtime < $smarty->locking_timeout;
-    }
-
-    /**
-     * Lock cache for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return bool|void
-     */
-    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $cached->is_locked = true;
-        $id = $cached->lock_id;
-        $name = $cached->source->name . '.lock';
-        $this->save($id, $name, $cached->cache_id, $cached->compile_id, $smarty->locking_timeout, '');
-    }
-
-    /**
-     * Unlock cache for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return bool|void
-     */
-    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $cached->is_locked = false;
-        $name = $cached->source->name . '.lock';
-        $this->delete($name, $cached->cache_id, $cached->compile_id, null);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php b/libraries/Smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php
deleted file mode 100644
index 59bf1d4a8..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php
+++ /dev/null
@@ -1,538 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin
- *
- * @package    Smarty
- * @subpackage Cacher
- */
-
-/**
- * Smarty Cache Handler Base for Key/Value Storage Implementations
- * This class implements the functionality required to use simple key/value stores
- * for hierarchical cache groups. key/value stores like memcache or APC do not support
- * wildcards in keys, therefore a cache group cannot be cleared like "a|*" - which
- * is no problem to filesystem and RDBMS implementations.
- * This implementation is based on the concept of invalidation. While one specific cache
- * can be identified and cleared, any range of caches cannot be identified. For this reason
- * each level of the cache group hierarchy can have its own value in the store. These values
- * are nothing but microtimes, telling us when a particular cache group was cleared for the
- * last time. These keys are evaluated for every cache read to determine if the cache has
- * been invalidated since it was created and should hence be treated as inexistent.
- * Although deep hierarchies are possible, they are not recommended. Try to keep your
- * cache groups as shallow as possible. Anything up 3-5 parents should be ok. So
- * »a|b|c« is a good depth where »a|b|c|d|e|f|g|h|i|j|k« isn't. Try to join correlating
- * cache groups: if your cache groups look somewhat like »a|b|$page|$items|$whatever«
- * consider using »a|b|c|$page-$items-$whatever« instead.
- *
- * @package    Smarty
- * @subpackage Cacher
- * @author     Rodney Rehm
- */
-abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
-{
-    /**
-     * cache for contents
-     *
-     * @var array
-     */
-    protected $contents = array();
-
-    /**
-     * cache for timestamps
-     *
-     * @var array
-     */
-    protected $timestamps = array();
-
-    /**
-     * populate Cached Object with meta data from Resource
-     *
-     * @param Smarty_Template_Cached   $cached    cached object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
-    {
-        $cached->filepath = $_template->source->uid . '#' . $this->sanitize($cached->source->resource) . '#' .
-                            $this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id);
-        $this->populateTimestamp($cached);
-    }
-
-    /**
-     * populate Cached Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return void
-     */
-    public function populateTimestamp(Smarty_Template_Cached $cached)
-    {
-        if (!$this->fetch(
-            $cached->filepath,
-            $cached->source->name,
-            $cached->cache_id,
-            $cached->compile_id,
-            $content,
-            $timestamp,
-            $cached->source->uid
-        )
-        ) {
-            return;
-        }
-        $cached->content = $content;
-        $cached->timestamp = (int)$timestamp;
-        $cached->exists = !!$cached->timestamp;
-    }
-
-    /**
-     * Read the cached template and process the header
-     *
-     * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
-     * @param Smarty_Template_Cached    $cached      cached object
-     * @param boolean                   $update      flag if called because cache update
-     *
-     * @return boolean                 true or false if the cached content does not exist
-     */
-    public function process(
-        Smarty_Internal_Template $_smarty_tpl,
-        Smarty_Template_Cached $cached = null,
-        $update = false
-    ) {
-        if (!$cached) {
-            $cached = $_smarty_tpl->cached;
-        }
-        $content = $cached->content ? $cached->content : null;
-        $timestamp = $cached->timestamp ? $cached->timestamp : null;
-        if ($content === null || !$timestamp) {
-            if (!$this->fetch(
-                $_smarty_tpl->cached->filepath,
-                $_smarty_tpl->source->name,
-                $_smarty_tpl->cache_id,
-                $_smarty_tpl->compile_id,
-                $content,
-                $timestamp,
-                $_smarty_tpl->source->uid
-            )
-            ) {
-                return false;
-            }
-        }
-        if (isset($content)) {
-            eval('?>' . $content);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Write the rendered template output to cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $content   content to cache
-     *
-     * @return boolean                  success
-     */
-    public function writeCachedContent(Smarty_Internal_Template $_template, $content)
-    {
-        $this->addMetaTimestamp($content);
-        return $this->write(array($_template->cached->filepath => $content), $_template->cache_lifetime);
-    }
-
-    /**
-     * Read cached template from cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string|false  content
-     */
-    public function readCachedContent(Smarty_Internal_Template $_template)
-    {
-        $content = $_template->cached->content ? $_template->cached->content : null;
-        $timestamp = null;
-        if ($content === null) {
-            if (!$this->fetch(
-                $_template->cached->filepath,
-                $_template->source->name,
-                $_template->cache_id,
-                $_template->compile_id,
-                $content,
-                $timestamp,
-                $_template->source->uid
-            )
-            ) {
-                return false;
-            }
-        }
-        if (isset($content)) {
-            return $content;
-        }
-        return false;
-    }
-
-    /**
-     * Empty cache
-     * {@internal the $exp_time argument is ignored altogether }}
-     *
-     * @param Smarty  $smarty   Smarty object
-     * @param integer $exp_time expiration time [being ignored]
-     *
-     * @return integer number of cache files deleted [always -1]
-     * @uses   purge() to clear the whole store
-     * @uses   invalidate() to mark everything outdated if purge() is inapplicable
-     */
-    public function clearAll(Smarty $smarty, $exp_time = null)
-    {
-        if (!$this->purge()) {
-            $this->invalidate(null);
-        }
-        return -1;
-    }
-
-    /**
-     * Empty cache for a specific template
-     * {@internal the $exp_time argument is ignored altogether}}
-     *
-     * @param Smarty  $smarty        Smarty object
-     * @param string  $resource_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time [being ignored]
-     *
-     * @return int number of cache files deleted [always -1]
-     * @throws \SmartyException
-     * @uses   buildCachedFilepath() to generate the CacheID
-     * @uses   invalidate() to mark CacheIDs parent chain as outdated
-     * @uses   delete() to remove CacheID from cache
-     */
-    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
-    {
-        $uid = $this->getTemplateUid($smarty, $resource_name);
-        $cid = $uid . '#' . $this->sanitize($resource_name) . '#' . $this->sanitize($cache_id) . '#' .
-               $this->sanitize($compile_id);
-        $this->delete(array($cid));
-        $this->invalidate($cid, $resource_name, $cache_id, $compile_id, $uid);
-        return -1;
-    }
-
-    /**
-     * Get template's unique ID
-     *
-     * @param Smarty $smarty        Smarty object
-     * @param string $resource_name template name
-     *
-     * @return string filepath of cache file
-     * @throws \SmartyException
-     */
-    protected function getTemplateUid(Smarty $smarty, $resource_name)
-    {
-        if (isset($resource_name)) {
-            $source = Smarty_Template_Source::load(null, $smarty, $resource_name);
-            if ($source->exists) {
-                return $source->uid;
-            }
-        }
-        return '';
-    }
-
-    /**
-     * Sanitize CacheID components
-     *
-     * @param string $string CacheID component to sanitize
-     *
-     * @return string sanitized CacheID component
-     */
-    protected function sanitize($string)
-    {
-        $string = trim($string, '|');
-        if (!$string) {
-            return '';
-        }
-        return preg_replace('#[^\w\|]+#S', '_', $string);
-    }
-
-    /**
-     * Fetch and prepare a cache object.
-     *
-     * @param string  $cid           CacheID to fetch
-     * @param string  $resource_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param string  $content       cached content
-     * @param integer &$timestamp    cached timestamp (epoch)
-     * @param string  $resource_uid  resource's uid
-     *
-     * @return boolean success
-     */
-    protected function fetch(
-        $cid,
-        $resource_name = null,
-        $cache_id = null,
-        $compile_id = null,
-        &$content = null,
-        &$timestamp = null,
-        $resource_uid = null
-    ) {
-        $t = $this->read(array($cid));
-        $content = !empty($t[ $cid ]) ? $t[ $cid ] : null;
-        $timestamp = null;
-        if ($content && ($timestamp = $this->getMetaTimestamp($content))) {
-            $invalidated =
-                $this->getLatestInvalidationTimestamp($cid, $resource_name, $cache_id, $compile_id, $resource_uid);
-            if ($invalidated > $timestamp) {
-                $timestamp = null;
-                $content = null;
-            }
-        }
-        return !!$content;
-    }
-
-    /**
-     * Add current microtime to the beginning of $cache_content
-     * {@internal the header uses 8 Bytes, the first 4 Bytes are the seconds, the second 4 Bytes are the microseconds}}
-     *
-     * @param string &$content the content to be cached
-     */
-    protected function addMetaTimestamp(&$content)
-    {
-        $mt = explode(' ', microtime());
-        $ts = pack('NN', $mt[ 1 ], (int)($mt[ 0 ] * 100000000));
-        $content = $ts . $content;
-    }
-
-    /**
-     * Extract the timestamp the $content was cached
-     *
-     * @param string &$content the cached content
-     *
-     * @return float  the microtime the content was cached
-     */
-    protected function getMetaTimestamp(&$content)
-    {
-        extract(unpack('N1s/N1m/a*content', $content));
-        /**
-         * @var  int $s
-         * @var  int $m
-         */
-        return $s + ($m / 100000000);
-    }
-
-    /**
-     * Invalidate CacheID
-     *
-     * @param string $cid           CacheID
-     * @param string $resource_name template name
-     * @param string $cache_id      cache id
-     * @param string $compile_id    compile id
-     * @param string $resource_uid  source's uid
-     *
-     * @return void
-     */
-    protected function invalidate(
-        $cid = null,
-        $resource_name = null,
-        $cache_id = null,
-        $compile_id = null,
-        $resource_uid = null
-    ) {
-        $now = microtime(true);
-        $key = null;
-        // invalidate everything
-        if (!$resource_name && !$cache_id && !$compile_id) {
-            $key = 'IVK#ALL';
-        } // invalidate all caches by template
-        else {
-            if ($resource_name && !$cache_id && !$compile_id) {
-                $key = 'IVK#TEMPLATE#' . $resource_uid . '#' . $this->sanitize($resource_name);
-            } // invalidate all caches by cache group
-            else {
-                if (!$resource_name && $cache_id && !$compile_id) {
-                    $key = 'IVK#CACHE#' . $this->sanitize($cache_id);
-                } // invalidate all caches by compile id
-                else {
-                    if (!$resource_name && !$cache_id && $compile_id) {
-                        $key = 'IVK#COMPILE#' . $this->sanitize($compile_id);
-                    } // invalidate by combination
-                    else {
-                        $key = 'IVK#CID#' . $cid;
-                    }
-                }
-            }
-        }
-        $this->write(array($key => $now));
-    }
-
-    /**
-     * Determine the latest timestamp known to the invalidation chain
-     *
-     * @param string $cid           CacheID to determine latest invalidation timestamp of
-     * @param string $resource_name template name
-     * @param string $cache_id      cache id
-     * @param string $compile_id    compile id
-     * @param string $resource_uid  source's filepath
-     *
-     * @return float  the microtime the CacheID was invalidated
-     */
-    protected function getLatestInvalidationTimestamp(
-        $cid,
-        $resource_name = null,
-        $cache_id = null,
-        $compile_id = null,
-        $resource_uid = null
-    ) {
-        // abort if there is no CacheID
-        if (false && !$cid) {
-            return 0;
-        }
-        // abort if there are no InvalidationKeys to check
-        if (!($_cid = $this->listInvalidationKeys($cid, $resource_name, $cache_id, $compile_id, $resource_uid))) {
-            return 0;
-        }
-        // there are no InValidationKeys
-        if (!($values = $this->read($_cid))) {
-            return 0;
-        }
-        // make sure we're dealing with floats
-        $values = array_map('floatval', $values);
-        return max($values);
-    }
-
-    /**
-     * Translate a CacheID into the list of applicable InvalidationKeys.
-     * Splits 'some|chain|into|an|array' into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... )
-     *
-     * @param string $cid           CacheID to translate
-     * @param string $resource_name template name
-     * @param string $cache_id      cache id
-     * @param string $compile_id    compile id
-     * @param string $resource_uid  source's filepath
-     *
-     * @return array  list of InvalidationKeys
-     * @uses   $invalidationKeyPrefix to prepend to each InvalidationKey
-     */
-    protected function listInvalidationKeys(
-        $cid,
-        $resource_name = null,
-        $cache_id = null,
-        $compile_id = null,
-        $resource_uid = null
-    ) {
-        $t = array('IVK#ALL');
-        $_name = $_compile = '#';
-        if ($resource_name) {
-            $_name .= $resource_uid . '#' . $this->sanitize($resource_name);
-            $t[] = 'IVK#TEMPLATE' . $_name;
-        }
-        if ($compile_id) {
-            $_compile .= $this->sanitize($compile_id);
-            $t[] = 'IVK#COMPILE' . $_compile;
-        }
-        $_name .= '#';
-        $cid = trim($cache_id, '|');
-        if (!$cid) {
-            return $t;
-        }
-        $i = 0;
-        while (true) {
-            // determine next delimiter position
-            $i = strpos($cid, '|', $i);
-            // add complete CacheID if there are no more delimiters
-            if ($i === false) {
-                $t[] = 'IVK#CACHE#' . $cid;
-                $t[] = 'IVK#CID' . $_name . $cid . $_compile;
-                $t[] = 'IVK#CID' . $_name . $_compile;
-                break;
-            }
-            $part = substr($cid, 0, $i);
-            // add slice to list
-            $t[] = 'IVK#CACHE#' . $part;
-            $t[] = 'IVK#CID' . $_name . $part . $_compile;
-            // skip past delimiter position
-            $i++;
-        }
-        return $t;
-    }
-
-    /**
-     * Check is cache is locked for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return boolean               true or false if cache is locked
-     */
-    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $key = 'LOCK#' . $cached->filepath;
-        $data = $this->read(array($key));
-        return $data && time() - $data[ $key ] < $smarty->locking_timeout;
-    }
-
-    /**
-     * Lock cache for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return bool|void
-     */
-    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $cached->is_locked = true;
-        $key = 'LOCK#' . $cached->filepath;
-        $this->write(array($key => time()), $smarty->locking_timeout);
-    }
-
-    /**
-     * Unlock cache for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return bool|void
-     */
-    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $cached->is_locked = false;
-        $key = 'LOCK#' . $cached->filepath;
-        $this->delete(array($key));
-    }
-
-    /**
-     * Read values for a set of keys from cache
-     *
-     * @param array $keys list of keys to fetch
-     *
-     * @return array list of values with the given keys used as indexes
-     */
-    abstract protected function read(array $keys);
-
-    /**
-     * Save values for a set of keys to cache
-     *
-     * @param array $keys   list of values to save
-     * @param int   $expire expiration time
-     *
-     * @return boolean true on success, false on failure
-     */
-    abstract protected function write(array $keys, $expire = null);
-
-    /**
-     * Remove values from cache
-     *
-     * @param array $keys list of keys to delete
-     *
-     * @return boolean true on success, false on failure
-     */
-    abstract protected function delete(array $keys);
-
-    /**
-     * Remove *all* values from cache
-     *
-     * @return boolean true on success, false on failure
-     */
-    protected function purge()
-    {
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_data.php b/libraries/Smarty/libs/sysplugins/smarty_data.php
deleted file mode 100644
index 2545ed3a8..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_data.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * Smarty Plugin Data
- * This file contains the data object
- *
- * @package    Smarty
- * @subpackage Template
- * @author     Uwe Tews
- */
-
-/**
- * class for the Smarty data object
- * The Smarty data object will hold Smarty variables in the current scope
- *
- * @package    Smarty
- * @subpackage Template
- */
-class Smarty_Data extends Smarty_Internal_Data
-{
-    /**
-     * Counter
-     *
-     * @var int
-     */
-    public static $count = 0;
-
-    /**
-     * Data block name
-     *
-     * @var string
-     */
-    public $dataObjectName = '';
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * create Smarty data object
-     *
-     * @param Smarty|array                    $_parent parent template
-     * @param Smarty|Smarty_Internal_Template $smarty  global smarty instance
-     * @param string                          $name    optional data block name
-     *
-     * @throws SmartyException
-     */
-    public function __construct($_parent = null, $smarty = null, $name = null)
-    {
-        parent::__construct();
-        self::$count++;
-        $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count);
-        $this->smarty = $smarty;
-        if (is_object($_parent)) {
-            // when object set up back pointer
-            $this->parent = $_parent;
-        } elseif (is_array($_parent)) {
-            // set up variable values
-            foreach ($_parent as $_key => $_val) {
-                $this->tpl_vars[ $_key ] = new Smarty_Variable($_val);
-            }
-        } elseif ($_parent !== null) {
-            throw new SmartyException('Wrong type for template variables');
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_block.php b/libraries/Smarty/libs/sysplugins/smarty_internal_block.php
deleted file mode 100644
index 9956d642b..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_block.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-
-/**
- * Smarty {block} tag class
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Block
-{
-    /**
-     * Block name
-     *
-     * @var string
-     */
-    public $name = '';
-
-    /**
-     * Hide attribute
-     *
-     * @var bool
-     */
-    public $hide = false;
-
-    /**
-     * Append attribute
-     *
-     * @var bool
-     */
-    public $append = false;
-
-    /**
-     * prepend attribute
-     *
-     * @var bool
-     */
-    public $prepend = false;
-
-    /**
-     * Block calls $smarty.block.child
-     *
-     * @var bool
-     */
-    public $callsChild = false;
-
-    /**
-     * Inheritance child block
-     *
-     * @var Smarty_Internal_Block|null
-     */
-    public $child = null;
-
-    /**
-     * Inheritance calling parent block
-     *
-     * @var Smarty_Internal_Block|null
-     */
-    public $parent = null;
-
-    /**
-     * Inheritance Template index
-     *
-     * @var int
-     */
-    public $tplIndex = 0;
-
-    /**
-     * Smarty_Internal_Block constructor.
-     * - if outer level {block} of child template ($state === 1) save it as child root block
-     * - otherwise process inheritance and render
-     *
-     * @param string   $name     block name
-     * @param int|null $tplIndex index of outer level {block} if nested
-     */
-    public function __construct($name, $tplIndex)
-    {
-        $this->name = $name;
-        $this->tplIndex = $tplIndex;
-    }
-
-    /**
-     * Compiled block code overloaded by {block} class
-     *
-     * @param \Smarty_Internal_Template $tpl
-     */
-    public function callBlock(Smarty_Internal_Template $tpl)
-    {
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_cacheresource_file.php b/libraries/Smarty/libs/sysplugins/smarty_internal_cacheresource_file.php
deleted file mode 100644
index 61618449d..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_cacheresource_file.php
+++ /dev/null
@@ -1,239 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin CacheResource File
- *
- * @package    Smarty
- * @subpackage Cacher
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * This class does contain all necessary methods for the HTML cache on file system
- * Implements the file system as resource for the HTML cache Version ussing nocache inserts.
- *
- * @package    Smarty
- * @subpackage Cacher
- */
-class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
-{
-    /**
-     * populate Cached Object with meta data from Resource
-     *
-     * @param Smarty_Template_Cached   $cached    cached object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
-    {
-        $source = &$_template->source;
-        $smarty = &$_template->smarty;
-        $_compile_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
-        $_filepath = sha1($source->uid . $smarty->_joined_template_dir);
-        $cached->filepath = $smarty->getCacheDir();
-        if (isset($_template->cache_id)) {
-            $cached->filepath .= preg_replace(
-                                     array(
-                                         '![^\w|]+!',
-                                         '![|]+!'
-                                     ),
-                                     array(
-                                         '_',
-                                         $_compile_dir_sep
-                                     ),
-                                     $_template->cache_id
-                                 ) . $_compile_dir_sep;
-        }
-        if (isset($_template->compile_id)) {
-            $cached->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . $_compile_dir_sep;
-        }
-        // if use_sub_dirs, break file into directories
-        if ($smarty->use_sub_dirs) {
-            $cached->filepath .= $_filepath[ 0 ] . $_filepath[ 1 ] . DIRECTORY_SEPARATOR . $_filepath[ 2 ] .
-                                 $_filepath[ 3 ] .
-                                 DIRECTORY_SEPARATOR .
-                                 $_filepath[ 4 ] . $_filepath[ 5 ] . DIRECTORY_SEPARATOR;
-        }
-        $cached->filepath .= $_filepath;
-        $basename = $source->handler->getBasename($source);
-        if (!empty($basename)) {
-            $cached->filepath .= '.' . $basename;
-        }
-        if ($smarty->cache_locking) {
-            $cached->lock_id = $cached->filepath . '.lock';
-        }
-        $cached->filepath .= '.php';
-        $cached->timestamp = $cached->exists = is_file($cached->filepath);
-        if ($cached->exists) {
-            $cached->timestamp = filemtime($cached->filepath);
-        }
-    }
-
-    /**
-     * populate Cached Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return void
-     */
-    public function populateTimestamp(Smarty_Template_Cached $cached)
-    {
-        $cached->timestamp = $cached->exists = is_file($cached->filepath);
-        if ($cached->exists) {
-            $cached->timestamp = filemtime($cached->filepath);
-        }
-    }
-
-    /**
-     * Read the cached template and process its header
-     *
-     * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
-     * @param Smarty_Template_Cached    $cached      cached object
-     * @param bool                      $update      flag if called because cache update
-     *
-     * @return boolean true or false if the cached content does not exist
-     */
-    public function process(
-        Smarty_Internal_Template $_smarty_tpl,
-        Smarty_Template_Cached $cached = null,
-        $update = false
-    ) {
-        $_smarty_tpl->cached->valid = false;
-        if ($update && defined('HHVM_VERSION')) {
-            eval('?>' . file_get_contents($_smarty_tpl->cached->filepath));
-            return true;
-        } else {
-            return @include $_smarty_tpl->cached->filepath;
-        }
-    }
-
-    /**
-     * Write the rendered template output to cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $content   content to cache
-     *
-     * @return bool success
-     * @throws \SmartyException
-     */
-    public function writeCachedContent(Smarty_Internal_Template $_template, $content)
-    {
-        if ($_template->smarty->ext->_writeFile->writeFile(
-                $_template->cached->filepath,
-                $content,
-                $_template->smarty
-            ) === true
-        ) {
-            if (function_exists('opcache_invalidate')
-                && (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1
-            ) {
-                opcache_invalidate($_template->cached->filepath, true);
-            } elseif (function_exists('apc_compile_file')) {
-                apc_compile_file($_template->cached->filepath);
-            }
-            $cached = $_template->cached;
-            $cached->timestamp = $cached->exists = is_file($cached->filepath);
-            if ($cached->exists) {
-                $cached->timestamp = filemtime($cached->filepath);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Read cached template from cache
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string  content
-     */
-    public function readCachedContent(Smarty_Internal_Template $_template)
-    {
-        if (is_file($_template->cached->filepath)) {
-            return file_get_contents($_template->cached->filepath);
-        }
-        return false;
-    }
-
-    /**
-     * Empty cache
-     *
-     * @param Smarty  $smarty
-     * @param integer $exp_time expiration time (number of seconds, not timestamp)
-     *
-     * @return integer number of cache files deleted
-     */
-    public function clearAll(Smarty $smarty, $exp_time = null)
-    {
-        return $smarty->ext->_cacheResourceFile->clear($smarty, null, null, null, $exp_time);
-    }
-
-    /**
-     * Empty cache for a specific template
-     *
-     * @param Smarty  $smarty
-     * @param string  $resource_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time (number of seconds, not timestamp)
-     *
-     * @return integer number of cache files deleted
-     */
-    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
-    {
-        return $smarty->ext->_cacheResourceFile->clear($smarty, $resource_name, $cache_id, $compile_id, $exp_time);
-    }
-
-    /**
-     * Check is cache is locked for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return boolean true or false if cache is locked
-     */
-    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
-            clearstatcache(true, $cached->lock_id);
-        } else {
-            clearstatcache();
-        }
-        if (is_file($cached->lock_id)) {
-            $t = filemtime($cached->lock_id);
-            return $t && (time() - $t < $smarty->locking_timeout);
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * Lock cache for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return bool|void
-     */
-    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $cached->is_locked = true;
-        touch($cached->lock_id);
-    }
-
-    /**
-     * Unlock cache for this template
-     *
-     * @param Smarty                 $smarty Smarty object
-     * @param Smarty_Template_Cached $cached cached object
-     *
-     * @return bool|void
-     */
-    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
-    {
-        $cached->is_locked = false;
-        @unlink($cached->lock_id);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_append.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_append.php
deleted file mode 100644
index 1a9befbf6..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_append.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Append
- * Compiles the {append} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Append Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign
-{
-    /**
-     * Compiles code for the {append} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // the following must be assigned at runtime because it will be overwritten in parent class
-        $this->required_attributes = array('var', 'value');
-        $this->shorttag_order = array('var', 'value');
-        $this->optional_attributes = array('scope', 'index');
-        $this->mapCache = array();
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        // map to compile assign attributes
-        if (isset($_attr[ 'index' ])) {
-            $_params[ 'smarty_internal_index' ] = '[' . $_attr[ 'index' ] . ']';
-            unset($_attr[ 'index' ]);
-        } else {
-            $_params[ 'smarty_internal_index' ] = '[]';
-        }
-        $_new_attr = array();
-        foreach ($_attr as $key => $value) {
-            $_new_attr[] = array($key => $value);
-        }
-        // call compile assign
-        return parent::compile($_new_attr, $compiler, $_params);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_assign.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_assign.php
deleted file mode 100644
index 1f0ab9b7d..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_assign.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Assign
- * Compiles the {assign} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Assign Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $option_flags = array('nocache', 'noscope');
-
-    /**
-     * Valid scope names
-     *
-     * @var array
-     */
-    public $valid_scopes = array(
-        'local'    => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
-        'root'     => Smarty::SCOPE_ROOT, 'global' => Smarty::SCOPE_GLOBAL,
-        'tpl_root' => Smarty::SCOPE_TPL_ROOT, 'smarty' => Smarty::SCOPE_SMARTY
-    );
-
-    /**
-     * Compiles code for the {assign} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
-        $this->required_attributes = array('var', 'value');
-        $this->shorttag_order = array('var', 'value');
-        $this->optional_attributes = array('scope');
-        $this->mapCache = array();
-        $_nocache = false;
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        // nocache ?
-        if ($_var = $compiler->getId($_attr[ 'var' ])) {
-            $_var = "'{$_var}'";
-        } else {
-            $_var = $_attr[ 'var' ];
-        }
-        if ($compiler->tag_nocache || $compiler->nocache) {
-            $_nocache = true;
-            // create nocache var to make it know for further compiling
-            $compiler->setNocacheInVariable($_attr[ 'var' ]);
-        }
-        // scope setup
-        if ($_attr[ 'noscope' ]) {
-            $_scope = -1;
-        } else {
-            $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
-        }
-        // optional parameter
-        $_params = '';
-        if ($_nocache || $_scope) {
-            $_params .= ' ,' . var_export($_nocache, true);
-        }
-        if ($_scope) {
-            $_params .= ' ,' . $_scope;
-        }
-        if (isset($parameter[ 'smarty_internal_index' ])) {
-            $output =
-                "<?php \$_tmp_array = isset(\$_smarty_tpl->tpl_vars[{$_var}]) ? \$_smarty_tpl->tpl_vars[{$_var}]->value : array();\n";
-            $output .= "if (!(is_array(\$_tmp_array) || \$_tmp_array instanceof ArrayAccess)) {\n";
-            $output .= "settype(\$_tmp_array, 'array');\n";
-            $output .= "}\n";
-            $output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n";
-            $output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});?>";
-        } else {
-            $output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});?>";
-        }
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block.php
deleted file mode 100644
index 8ff15d8e5..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block.php
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-/**
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty Internal Plugin Compile Block Class
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inheritance
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $option_flags = array('hide', 'nocache');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('assign');
-
-    /**
-     * Compiles code for the {block} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
-            $compiler->_cache[ 'blockNesting' ] = 0;
-        }
-        if ($compiler->_cache[ 'blockNesting' ] === 0) {
-            // make sure that inheritance gets initialized in template code
-            $this->registerInit($compiler);
-            $this->option_flags = array('hide', 'nocache', 'append', 'prepend');
-        } else {
-            $this->option_flags = array('hide', 'nocache');
-        }
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        ++$compiler->_cache[ 'blockNesting' ];
-        $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(mt_rand(), true));
-        $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ];
-        $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className;
-        $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array();
-        $compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className;
-        $this->openTag(
-            $compiler,
-            'block',
-            array(
-                $_attr, $compiler->nocache, $compiler->parser->current_buffer,
-                $compiler->template->compiled->has_nocache_code,
-                $compiler->template->caching
-            )
-        );
-        $compiler->saveRequiredPlugins(true);
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
-        $compiler->template->compiled->has_nocache_code = false;
-        $compiler->suppressNocacheProcessing = true;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile BlockClose Class
- */
-class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance
-{
-    /**
-     * Compiles code for the {/block} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return bool true
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block'));
-        // init block parameter
-        $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ];
-        unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]);
-        $_name = $_attr[ 'name' ];
-        $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
-        unset($_attr[ 'assign' ], $_attr[ 'name' ]);
-        foreach ($_attr as $name => $stat) {
-            if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) {
-                $_block[ $name ] = 'true';
-            }
-        }
-        $_className = $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ];
-        // get compiled block code
-        $_functionCode = $compiler->parser->current_buffer;
-        // setup buffer for template function code
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
-        $output = "<?php\n";
-        $output .= "/* {block {$_name}} */\n";
-        $output .= "class {$_className} extends Smarty_Internal_Block\n";
-        $output .= "{\n";
-        foreach ($_block as $property => $value) {
-            $output .= "public \${$property} = " . var_export($value, true) . ";\n";
-        }
-        $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n";
-        $output .= $compiler->compileRequiredPlugins();
-        $compiler->restoreRequiredPlugins();
-        if ($compiler->template->compiled->has_nocache_code) {
-            $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n";
-        }
-        if (isset($_assign)) {
-            $output .= "ob_start();\n";
-        }
-        $output .= "?>\n";
-        $compiler->parser->current_buffer->append_subtree(
-            $compiler->parser,
-            new Smarty_Internal_ParseTree_Tag(
-                $compiler->parser,
-                $output
-            )
-        );
-        $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
-        $output = "<?php\n";
-        if (isset($_assign)) {
-            $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
-        }
-        $output .= "}\n";
-        $output .= "}\n";
-        $output .= "/* {/block {$_name}} */\n\n";
-        $output .= "?>\n";
-        $compiler->parser->current_buffer->append_subtree(
-            $compiler->parser,
-            new Smarty_Internal_ParseTree_Tag(
-                $compiler->parser,
-                $output
-            )
-        );
-        $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
-        // restore old status
-        $compiler->template->compiled->has_nocache_code = $_has_nocache_code;
-        $compiler->tag_nocache = $compiler->nocache;
-        $compiler->nocache = $_nocache;
-        $compiler->parser->current_buffer = $_buffer;
-        $output = "<?php \n";
-        if ($compiler->_cache[ 'blockNesting' ] === 1) {
-            $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n";
-        } else {
-            $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";
-        }
-        $output .= "?>\n";
-        --$compiler->_cache[ 'blockNesting' ];
-        if ($compiler->_cache[ 'blockNesting' ] === 0) {
-            unset($compiler->_cache[ 'blockNesting' ]);
-        }
-        $compiler->has_code = true;
-        $compiler->suppressNocacheProcessing = true;
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_child.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_child.php
deleted file mode 100644
index 588d18628..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_child.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/**
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty Internal Plugin Compile Block Child Class
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_Compile_Child
-{
-    /**
-     * Tag name
-     *
-     * @var string
-     */
-    public $tag = 'block_child';
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_parent.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_parent.php
deleted file mode 100644
index 97f11ca43..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_block_parent.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty Internal Plugin Compile Block Parent Class
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Child
-{
-    /**
-     * Tag name
-     *
-     * @var string
-     */
-    public $tag = 'block_parent';
-
-    /**
-     * Block type
-     *
-     * @var string
-     */
-    public $blockType = 'Parent';
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_break.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_break.php
deleted file mode 100644
index 1ee8d75d7..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_break.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Break
- * Compiles the {break} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Break Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('levels');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('levels');
-
-    /**
-     * Tag name may be overloaded by Smarty_Internal_Compile_Continue
-     *
-     * @var string
-     */
-    public $tag = 'break';
-
-    /**
-     * Compiles code for the {break} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        list($levels, $foreachLevels) = $this->checkLevels($args, $compiler);
-        $output = "<?php ";
-        if ($foreachLevels > 0 && $this->tag === 'continue') {
-            $foreachLevels--;
-        }
-        if ($foreachLevels > 0) {
-            /* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
-            $foreachCompiler = $compiler->getTagCompiler('foreach');
-            $output .= $foreachCompiler->compileRestore($foreachLevels);
-        }
-        $output .= "{$this->tag} {$levels};?>";
-        return $output;
-    }
-
-    /**
-     * check attributes and return array of break and foreach levels
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return array
-     * @throws \SmartyCompilerException
-     */
-    public function checkLevels($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        if ($_attr[ 'nocache' ] === true) {
-            $compiler->trigger_template_error('nocache option not allowed', null, true);
-        }
-        if (isset($_attr[ 'levels' ])) {
-            if (!is_numeric($_attr[ 'levels' ])) {
-                $compiler->trigger_template_error('level attribute must be a numeric constant', null, true);
-            }
-            $levels = $_attr[ 'levels' ];
-        } else {
-            $levels = 1;
-        }
-        $level_count = $levels;
-        $stack_count = count($compiler->_tag_stack) - 1;
-        $foreachLevels = 0;
-        $lastTag = '';
-        while ($level_count > 0 && $stack_count >= 0) {
-            if (isset($_is_loopy[ $compiler->_tag_stack[ $stack_count ][ 0 ] ])) {
-                $lastTag = $compiler->_tag_stack[ $stack_count ][ 0 ];
-                if ($level_count === 0) {
-                    break;
-                }
-                $level_count--;
-                if ($compiler->_tag_stack[ $stack_count ][ 0 ] === 'foreach') {
-                    $foreachLevels++;
-                }
-            }
-            $stack_count--;
-        }
-        if ($level_count !== 0) {
-            $compiler->trigger_template_error("cannot {$this->tag} {$levels} level(s)", null, true);
-        }
-        if ($lastTag === 'foreach' && $this->tag === 'break' && $foreachLevels > 0) {
-            $foreachLevels--;
-        }
-        return array($levels, $foreachLevels);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_call.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_call.php
deleted file mode 100644
index 445cabc60..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_call.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Function_Call
- * Compiles the calls of user defined tags defined by {function}
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Function_Call Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Compiles the calls of user defined tags defined by {function}
-     *
-     * @param array  $args     array with attributes from parser
-     * @param object $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        // save possible attributes
-        if (isset($_attr[ 'assign' ])) {
-            // output will be stored in a smarty variable instead of being displayed
-            $_assign = $_attr[ 'assign' ];
-        }
-        //$_name = trim($_attr['name'], "''");
-        $_name = $_attr[ 'name' ];
-        unset($_attr[ 'name' ], $_attr[ 'assign' ], $_attr[ 'nocache' ]);
-        // set flag (compiled code of {function} must be included in cache file
-        if (!$compiler->template->caching || $compiler->nocache || $compiler->tag_nocache) {
-            $_nocache = 'true';
-        } else {
-            $_nocache = 'false';
-        }
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        $_params = 'array(' . implode(',', $_paramsArray) . ')';
-        //$compiler->suppressNocacheProcessing = true;
-        // was there an assign attribute
-        if (isset($_assign)) {
-            $_output =
-                "<?php ob_start();\n\$_smarty_tpl->smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n";
-        } else {
-            $_output =
-                "<?php \$_smarty_tpl->smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});?>\n";
-        }
-        return $_output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_capture.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_capture.php
deleted file mode 100644
index a4ffbc9ea..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_capture.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Capture
- * Compiles the {capture} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Capture Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('name', 'assign', 'append');
-
-    /**
-     * Compiles code for the {$smarty.capture.xxx}
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     */
-    public static function compileSpecialVariable(
-        $args,
-        Smarty_Internal_TemplateCompilerBase $compiler,
-        $parameter = null
-    ) {
-        return '$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl' .
-               (isset($parameter[ 1 ]) ? ", {$parameter[ 1 ]})" : ')');
-    }
-
-    /**
-     * Compiles code for the {capture} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     * @param null                                  $parameter
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args, $parameter, 'capture');
-        $buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'";
-        $assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null';
-        $append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null';
-        $compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache);
-        // maybe nocache because of nocache variables
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        $_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);?>";
-        return $_output;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Captureclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/capture} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     * @param null                                  $parameter
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args, $parameter, '/capture');
-        // must endblock be nocache?
-        if ($compiler->nocache) {
-            $compiler->tag_nocache = true;
-        }
-        list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]);
-        return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);?>";
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_child.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_child.php
deleted file mode 100644
index f728c18bf..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_child.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty Internal Plugin Compile Child Class
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('assign');
-
-    /**
-     * Tag name
-     *
-     * @var string
-     */
-    public $tag = 'child';
-
-    /**
-     * Block type
-     *
-     * @var string
-     */
-    public $blockType = 'Child';
-
-    /**
-     * Compiles code for the {child} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $tag = isset($parameter[ 0 ]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'";
-        if (!isset($compiler->_cache[ 'blockNesting' ])) {
-            $compiler->trigger_template_error(
-                "{$tag} used outside {block} tags ",
-                $compiler->parser->lex->taglineno
-            );
-        }
-        $compiler->has_code = true;
-        $compiler->suppressNocacheProcessing = true;
-        if ($this->blockType === 'Child') {
-            $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
-        }
-        $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
-        $output = "<?php \n";
-        if (isset($_assign)) {
-            $output .= "ob_start();\n";
-        }
-        $output .= '$_smarty_tpl->inheritance->call' . $this->blockType . '($_smarty_tpl, $this' .
-                   ($this->blockType === 'Child' ? '' : ", {$tag}") . ");\n";
-        if (isset($_assign)) {
-            $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
-        }
-        $output .= "?>\n";
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_config_load.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_config_load.php
deleted file mode 100644
index 8fe64ee10..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_config_load.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Config Load
- * Compiles the {config load} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Config Load Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('file');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('file', 'section');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('section', 'scope');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $option_flags = array('nocache', 'noscope');
-
-    /**
-     * Valid scope names
-     *
-     * @var array
-     */
-    public $valid_scopes = array(
-        'local'  => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
-        'root'   => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT,
-        'smarty' => Smarty::SCOPE_SMARTY, 'global' => Smarty::SCOPE_SMARTY
-    );
-
-    /**
-     * Compiles code for the {config_load} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        if ($_attr[ 'nocache' ] === true) {
-            $compiler->trigger_template_error('nocache option not allowed', null, true);
-        }
-        // save possible attributes
-        $conf_file = $_attr[ 'file' ];
-        if (isset($_attr[ 'section' ])) {
-            $section = $_attr[ 'section' ];
-        } else {
-            $section = 'null';
-        }
-        // scope setup
-        if ($_attr[ 'noscope' ]) {
-            $_scope = -1;
-        } else {
-            $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
-        }
-        // create config object
-        $_output =
-            "<?php\n\$_smarty_tpl->smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n";
-        return $_output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_continue.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_continue.php
deleted file mode 100644
index e545728ee..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_continue.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Continue
- * Compiles the {continue} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Continue Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Continue extends Smarty_Internal_Compile_Break
-{
-    /**
-     * Tag name
-     *
-     * @var string
-     */
-    public $tag = 'continue';
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_debug.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_debug.php
deleted file mode 100644
index 799416689..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_debug.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Debug
- * Compiles the {debug} tag.
- * It opens a window the the Smarty Debugging Console.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Debug Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {debug} tag
-     *
-     * @param array  $args     array with attributes from parser
-     * @param object $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        // compile always as nocache
-        $compiler->tag_nocache = true;
-        // display debug template
-        $_output =
-            "<?php \$_smarty_debug = new Smarty_Internal_Debug;\n \$_smarty_debug->display_debug(\$_smarty_tpl);\n";
-        $_output .= "unset(\$_smarty_debug);\n?>";
-        return $_output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_eval.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_eval.php
deleted file mode 100644
index 8e0174e3e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_eval.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Eval
- * Compiles the {eval} tag.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Eval Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('var');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('assign');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('var', 'assign');
-
-    /**
-     * Compiles code for the {eval} tag
-     *
-     * @param array  $args     array with attributes from parser
-     * @param object $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        if (isset($_attr[ 'assign' ])) {
-            // output will be stored in a smarty variable instead of being displayed
-            $_assign = $_attr[ 'assign' ];
-        }
-        // create template object
-        $_output =
-            "\$_template = new {$compiler->smarty->template_class}('eval:'.{$_attr[ 'var' ]}, \$_smarty_tpl->smarty, \$_smarty_tpl);";
-        //was there an assign attribute?
-        if (isset($_assign)) {
-            $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());";
-        } else {
-            $_output .= 'echo $_template->fetch();';
-        }
-        return "<?php $_output ?>";
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_extends.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_extends.php
deleted file mode 100644
index d72d2b76f..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_extends.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile extend
- * Compiles the {extends} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile extend Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inheritance
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('file');
-
-    /**
-     * Array of names of optional attribute required by tag
-     * use array('_any') if there is no restriction of attributes names
-     *
-     * @var array
-     */
-    public $optional_attributes = array('extends_resource');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('file');
-
-    /**
-     * Compiles code for the {extends} tag extends: resource
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        if ($_attr[ 'nocache' ] === true) {
-            $compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->line - 1);
-        }
-        if (strpos($_attr[ 'file' ], '$_tmp') !== false) {
-            $compiler->trigger_template_error('illegal value for file attribute', $compiler->parser->lex->line - 1);
-        }
-        // add code to initialize inheritance
-        $this->registerInit($compiler, true);
-        $file = trim($_attr[ 'file' ], '\'"');
-        if (strlen($file) > 8 && substr($file, 0, 8) === 'extends:') {
-            // generate code for each template
-            $files = array_reverse(explode('|', substr($file, 8)));
-            $i = 0;
-            foreach ($files as $file) {
-                if ($file[ 0 ] === '"') {
-                    $file = trim($file, '".');
-                } else {
-                    $file = "'{$file}'";
-                }
-                $i++;
-                if ($i === count($files) && isset($_attr[ 'extends_resource' ])) {
-                    $this->compileEndChild($compiler);
-                }
-                $this->compileInclude($compiler, $file);
-            }
-            if (!isset($_attr[ 'extends_resource' ])) {
-                $this->compileEndChild($compiler);
-            }
-        } else {
-            $this->compileEndChild($compiler, $_attr[ 'file' ]);
-        }
-        $compiler->has_code = false;
-        return '';
-    }
-
-    /**
-     * Add code for inheritance endChild() method to end of template
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param null|string                           $template optional inheritance parent template
-     *
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    private function compileEndChild(Smarty_Internal_TemplateCompilerBase $compiler, $template = null)
-    {
-        $inlineUids = '';
-        if (isset($template) && $compiler->smarty->merge_compiled_includes) {
-            $code = $compiler->compileTag('include', array($template, array('scope' => 'parent')));
-            if (preg_match('/([,][\s]*[\'][a-z0-9]+[\'][,][\s]*[\']content.*[\'])[)]/', $code, $match)) {
-                $inlineUids = $match[ 1 ];
-            }
-        }
-        $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag(
-            $compiler->parser,
-            '<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' .
-            (isset($template) ?
-                ", {$template}{$inlineUids}" :
-                '') . ");\n?>"
-        );
-    }
-
-    /**
-     * Add code for including subtemplate to end of template
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param string                                $template subtemplate name
-     *
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template)
-    {
-        $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag(
-            $compiler->parser,
-            $compiler->compileTag(
-                'include',
-                array(
-                    $template,
-                    array('scope' => 'parent')
-                )
-            )
-        );
-    }
-
-    /**
-     * Create source code for {extends} from source components array
-     *
-     * @param \Smarty_Internal_Template $template
-     *
-     * @return string
-     */
-    public static function extendsSourceArrayCode(Smarty_Internal_Template $template)
-    {
-        $resources = array();
-        foreach ($template->source->components as $source) {
-            $resources[] = $source->resource;
-        }
-        return $template->smarty->left_delimiter . 'extends file=\'extends:' . join('|', $resources) .
-               '\' extends_resource=true' . $template->smarty->right_delimiter;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_for.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_for.php
deleted file mode 100644
index 3f113e56d..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_for.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile For
- * Compiles the {for} {forelse} {/for} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile For Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {for} tag
-     * Smarty 3 does implement two different syntax's:
-     * - {for $var in $array}
-     * For looping over arrays or iterators
-     * - {for $x=0; $x<$y; $x++}
-     * For general loops
-     * The parser is generating different sets of attribute by which this compiler can
-     * determine which syntax is used.
-     *
-     * @param array  $args      array with attributes from parser
-     * @param object $compiler  compiler object
-     * @param array  $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     */
-    public function compile($args, $compiler, $parameter)
-    {
-        $compiler->loopNesting++;
-        if ($parameter === 0) {
-            $this->required_attributes = array('start', 'to');
-            $this->optional_attributes = array('max', 'step');
-        } else {
-            $this->required_attributes = array('start', 'ifexp', 'var', 'step');
-            $this->optional_attributes = array();
-        }
-        $this->mapCache = array();
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $output = "<?php\n";
-        if ($parameter === 1) {
-            foreach ($_attr[ 'start' ] as $_statement) {
-                if (is_array($_statement[ 'var' ])) {
-                    $var = $_statement[ 'var' ][ 'var' ];
-                    $index = $_statement[ 'var' ][ 'smarty_internal_index' ];
-                } else {
-                    $var = $_statement[ 'var' ];
-                    $index = '';
-                }
-                $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);\n";
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->value{$index} = {$_statement['value']};\n";
-            }
-            if (is_array($_attr[ 'var' ])) {
-                $var = $_attr[ 'var' ][ 'var' ];
-                $index = $_attr[ 'var' ][ 'smarty_internal_index' ];
-            } else {
-                $var = $_attr[ 'var' ];
-                $index = '';
-            }
-            $output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n";
-        } else {
-            $_statement = $_attr[ 'start' ];
-            if (is_array($_statement[ 'var' ])) {
-                $var = $_statement[ 'var' ][ 'var' ];
-                $index = $_statement[ 'var' ][ 'smarty_internal_index' ];
-            } else {
-                $var = $_statement[ 'var' ];
-                $index = '';
-            }
-            $output .= "\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable(null, \$_smarty_tpl->isRenderingCache);";
-            if (isset($_attr[ 'step' ])) {
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->step = $_attr[step];";
-            } else {
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->step = 1;";
-            }
-            if (isset($_attr[ 'max' ])) {
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step)),$_attr[max]);\n";
-            } else {
-                $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step));\n";
-            }
-            $output .= "if (\$_smarty_tpl->tpl_vars[$var]->total > 0) {\n";
-            $output .= "for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n";
-            $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration === 1;";
-            $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration === \$_smarty_tpl->tpl_vars[$var]->total;";
-        }
-        $output .= '?>';
-        $this->openTag($compiler, 'for', array('for', $compiler->nocache));
-        // maybe nocache because of nocache variables
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        // return compiled code
-        return $output;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Forelse Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {forelse} tag
-     *
-     * @param array  $args      array with attributes from parser
-     * @param object $compiler  compiler object
-     * @param array  $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     */
-    public function compile($args, $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        list($openTag, $nocache) = $this->closeTag($compiler, array('for'));
-        $this->openTag($compiler, 'forelse', array('forelse', $nocache));
-        return "<?php }} else { ?>";
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Forclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/for} tag
-     *
-     * @param array  $args      array with attributes from parser
-     * @param object $compiler  compiler object
-     * @param array  $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     */
-    public function compile($args, $compiler, $parameter)
-    {
-        $compiler->loopNesting--;
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        // must endblock be nocache?
-        if ($compiler->nocache) {
-            $compiler->tag_nocache = true;
-        }
-        list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse'));
-        $output = "<?php }\n";
-        if ($openTag !== 'forelse') {
-            $output .= "}\n";
-        }
-        $output .= "?>";
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_foreach.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_foreach.php
deleted file mode 100644
index a68da5409..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_foreach.php
+++ /dev/null
@@ -1,343 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Foreach
- * Compiles the {foreach} {foreachelse} {/foreach} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Foreach Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_ForeachSection
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('from', 'item');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('name', 'key', 'properties');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('from', 'item', 'key', 'name');
-
-    /**
-     * counter
-     *
-     * @var int
-     */
-    public $counter = 0;
-
-    /**
-     * Name of this tag
-     *
-     * @var string
-     */
-    public $tagName = 'foreach';
-
-    /**
-     * Valid properties of $smarty.foreach.name.xxx variable
-     *
-     * @var array
-     */
-    public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total');
-
-    /**
-     * Valid properties of $item@xxx variable
-     *
-     * @var array
-     */
-    public $itemProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'key');
-
-    /**
-     * Flag if tag had name attribute
-     *
-     * @var bool
-     */
-    public $isNamed = false;
-
-    /**
-     * Compiles code for the {foreach} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $compiler->loopNesting++;
-        // init
-        $this->isNamed = false;
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $from = $_attr[ 'from' ];
-        $item = $compiler->getId($_attr[ 'item' ]);
-        if ($item === false) {
-            $item = $compiler->getVariableName($_attr[ 'item' ]);
-        }
-        $key = $name = null;
-        $attributes = array('item' => $item);
-        if (isset($_attr[ 'key' ])) {
-            $key = $compiler->getId($_attr[ 'key' ]);
-            if ($key === false) {
-                $key = $compiler->getVariableName($_attr[ 'key' ]);
-            }
-            $attributes[ 'key' ] = $key;
-        }
-        if (isset($_attr[ 'name' ])) {
-            $this->isNamed = true;
-            $name = $attributes[ 'name' ] = $compiler->getId($_attr[ 'name' ]);
-        }
-        foreach ($attributes as $a => $v) {
-            if ($v === false) {
-                $compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true);
-            }
-        }
-        $fromName = $compiler->getVariableName($_attr[ 'from' ]);
-        if ($fromName) {
-            foreach (array('item', 'key') as $a) {
-                if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) {
-                    $compiler->trigger_template_error(
-                        "'{$a}' and 'from' may not have same variable name '{$fromName}'",
-                        null,
-                        true
-                    );
-                }
-            }
-        }
-        $itemVar = "\$_smarty_tpl->tpl_vars['{$item}']";
-        $local = '$__foreach_' . $attributes[ 'item' ] . '_' . $this->counter++ . '_';
-        // search for used tag attributes
-        $itemAttr = array();
-        $namedAttr = array();
-        $this->scanForProperties($attributes, $compiler);
-        if (!empty($this->matchResults[ 'item' ])) {
-            $itemAttr = $this->matchResults[ 'item' ];
-        }
-        if (!empty($this->matchResults[ 'named' ])) {
-            $namedAttr = $this->matchResults[ 'named' ];
-        }
-        if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) {
-            foreach ($match[ 1 ] as $prop) {
-                if (in_array($prop, $this->itemProperties)) {
-                    $itemAttr[ $prop ] = true;
-                } else {
-                    $compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
-                }
-            }
-            if ($this->isNamed) {
-                foreach ($match[ 1 ] as $prop) {
-                    if (in_array($prop, $this->nameProperties)) {
-                        $nameAttr[ $prop ] = true;
-                    } else {
-                        $compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
-                    }
-                }
-            }
-        }
-        if (isset($itemAttr[ 'first' ])) {
-            $itemAttr[ 'index' ] = true;
-        }
-        if (isset($namedAttr[ 'first' ])) {
-            $namedAttr[ 'index' ] = true;
-        }
-        if (isset($namedAttr[ 'last' ])) {
-            $namedAttr[ 'iteration' ] = true;
-            $namedAttr[ 'total' ] = true;
-        }
-        if (isset($itemAttr[ 'last' ])) {
-            $itemAttr[ 'iteration' ] = true;
-            $itemAttr[ 'total' ] = true;
-        }
-        if (isset($namedAttr[ 'show' ])) {
-            $namedAttr[ 'total' ] = true;
-        }
-        if (isset($itemAttr[ 'show' ])) {
-            $itemAttr[ 'total' ] = true;
-        }
-        $keyTerm = '';
-        if (isset($attributes[ 'key' ])) {
-            $keyTerm = "\$_smarty_tpl->tpl_vars['{$key}']->value => ";
-        }
-        if (isset($itemAttr[ 'key' ])) {
-            $keyTerm = "{$itemVar}->key => ";
-        }
-        if ($this->isNamed) {
-            $foreachVar = "\$_smarty_tpl->tpl_vars['__smarty_foreach_{$attributes['name']}']";
-        }
-        $needTotal = isset($itemAttr[ 'total' ]);
-        // Register tag
-        $this->openTag(
-            $compiler,
-            'foreach',
-            array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2)
-        );
-        // maybe nocache because of nocache variables
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        // generate output code
-        $output = "<?php\n";
-        $output .= "\$_from = \$_smarty_tpl->smarty->ext->_foreach->init(\$_smarty_tpl, $from, " .
-                   var_export($item, true);
-        if ($name || $needTotal || $key) {
-            $output .= ', ' . var_export($needTotal, true);
-        }
-        if ($name || $key) {
-            $output .= ', ' . var_export($key, true);
-        }
-        if ($name) {
-            $output .= ', ' . var_export($name, true) . ', ' . var_export($namedAttr, true);
-        }
-        $output .= ");\n";
-        if (isset($itemAttr[ 'show' ])) {
-            $output .= "{$itemVar}->show = ({$itemVar}->total > 0);\n";
-        }
-        if (isset($itemAttr[ 'iteration' ])) {
-            $output .= "{$itemVar}->iteration = 0;\n";
-        }
-        if (isset($itemAttr[ 'index' ])) {
-            $output .= "{$itemVar}->index = -1;\n";
-        }
-	    $output .= "{$itemVar}->do_else = true;\n";
-        $output .= "if (\$_from !== null) foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n";
-	    $output .= "{$itemVar}->do_else = false;\n";
-        if (isset($attributes[ 'key' ]) && isset($itemAttr[ 'key' ])) {
-            $output .= "\$_smarty_tpl->tpl_vars['{$key}']->value = {$itemVar}->key;\n";
-        }
-        if (isset($itemAttr[ 'iteration' ])) {
-            $output .= "{$itemVar}->iteration++;\n";
-        }
-        if (isset($itemAttr[ 'index' ])) {
-            $output .= "{$itemVar}->index++;\n";
-        }
-        if (isset($itemAttr[ 'first' ])) {
-            $output .= "{$itemVar}->first = !{$itemVar}->index;\n";
-        }
-        if (isset($itemAttr[ 'last' ])) {
-            $output .= "{$itemVar}->last = {$itemVar}->iteration === {$itemVar}->total;\n";
-        }
-        if (isset($foreachVar)) {
-            if (isset($namedAttr[ 'iteration' ])) {
-                $output .= "{$foreachVar}->value['iteration']++;\n";
-            }
-            if (isset($namedAttr[ 'index' ])) {
-                $output .= "{$foreachVar}->value['index']++;\n";
-            }
-            if (isset($namedAttr[ 'first' ])) {
-                $output .= "{$foreachVar}->value['first'] = !{$foreachVar}->value['index'];\n";
-            }
-            if (isset($namedAttr[ 'last' ])) {
-                $output .= "{$foreachVar}->value['last'] = {$foreachVar}->value['iteration'] === {$foreachVar}->value['total'];\n";
-            }
-        }
-        if (!empty($itemAttr)) {
-            $output .= "{$local}saved = {$itemVar};\n";
-        }
-        $output .= '?>';
-        return $output;
-    }
-
-    /**
-     * Compiles code for to restore saved template variables
-     *
-     * @param int $levels number of levels to restore
-     *
-     * @return string compiled code
-     */
-    public function compileRestore($levels)
-    {
-        return "\$_smarty_tpl->smarty->ext->_foreach->restore(\$_smarty_tpl, {$levels});";
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Foreachelse Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {foreachelse} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        list($openTag, $nocache, $local, $itemVar, $restore) = $this->closeTag($compiler, array('foreach'));
-        $this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache, $local, $itemVar, 0));
-        $output = "<?php\n";
-        if ($restore === 2) {
-            $output .= "{$itemVar} = {$local}saved;\n";
-        }
-        $output .= "}\nif ({$itemVar}->do_else) {\n?>";
-        return $output;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Foreachclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/foreach} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $compiler->loopNesting--;
-        // must endblock be nocache?
-        if ($compiler->nocache) {
-            $compiler->tag_nocache = true;
-        }
-        list(
-            $openTag, $compiler->nocache, $local, $itemVar, $restore
-            ) = $this->closeTag($compiler, array('foreach', 'foreachelse'));
-        $output = "<?php\n";
-        if ($restore === 2) {
-            $output .= "{$itemVar} = {$local}saved;\n";
-        }
-        $output .= "}\n";
-        /* @var Smarty_Internal_Compile_Foreach $foreachCompiler */
-        $foreachCompiler = $compiler->getTagCompiler('foreach');
-        $output .= $foreachCompiler->compileRestore(1);
-        $output .= "?>";
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_function.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_function.php
deleted file mode 100644
index d0f2b0f4a..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_function.php
+++ /dev/null
@@ -1,236 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Function
- * Compiles the {function} {/function} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Function Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Compiles code for the {function} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return bool true
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        if ($_attr[ 'nocache' ] === true) {
-            $compiler->trigger_template_error('nocache option not allowed', null, true);
-        }
-        unset($_attr[ 'nocache' ]);
-        $_name = trim($_attr[ 'name' ], '\'"');
-
-        if (!preg_match('/^[a-zA-Z0-9_\x80-\xff]+$/', $_name)) {
-	        $compiler->trigger_template_error("Function name contains invalid characters: {$_name}", null, true);
-        }
-
-        $compiler->parent_compiler->tpl_function[ $_name ] = array();
-        $save = array(
-            $_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code,
-            $compiler->template->caching
-        );
-        $this->openTag($compiler, 'function', $save);
-        // Init temporary context
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
-        $compiler->template->compiled->has_nocache_code = false;
-        $compiler->saveRequiredPlugins(true);
-        return true;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Functionclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiler object
-     *
-     * @var object
-     */
-    private $compiler = null;
-
-    /**
-     * Compiles code for the {/function} tag
-     *
-     * @param array                                        $args     array with attributes from parser
-     * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return bool true
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->compiler = $compiler;
-        $saved_data = $this->closeTag($compiler, array('function'));
-        $_attr = $saved_data[ 0 ];
-        $_name = trim($_attr[ 'name' ], '\'"');
-        $compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] =
-            $compiler->parent_compiler->template->compiled->filepath;
-        $compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid;
-        $_parameter = $_attr;
-        unset($_parameter[ 'name' ]);
-        // default parameter
-        $_paramsArray = array();
-        foreach ($_parameter as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        if (!empty($_paramsArray)) {
-            $_params = 'array(' . implode(',', $_paramsArray) . ')';
-            $_paramsCode = "\$params = array_merge($_params, \$params);\n";
-        } else {
-            $_paramsCode = '';
-        }
-        $_functionCode = $compiler->parser->current_buffer;
-        // setup buffer for template function code
-        $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
-        $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}";
-        $_funcNameCaching = $_funcName . '_nocache';
-        if ($compiler->template->compiled->has_nocache_code) {
-            $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching;
-            $output = "<?php\n";
-            $output .= "/* {$_funcNameCaching} */\n";
-            $output .= "if (!function_exists('{$_funcNameCaching}')) {\n";
-            $output .= "function {$_funcNameCaching} (Smarty_Internal_Template \$_smarty_tpl,\$params) {\n";
-            $output .= "ob_start();\n";
-            $output .= $compiler->compileRequiredPlugins();
-            $output .= "\$_smarty_tpl->compiled->has_nocache_code = true;\n";
-            $output .= $_paramsCode;
-            $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n";
-            $output .= "\$params = var_export(\$params, true);\n";
-            $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
-            $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>";
-            $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";?>";
-            $compiler->parser->current_buffer->append_subtree(
-                $compiler->parser,
-                new Smarty_Internal_ParseTree_Tag(
-                    $compiler->parser,
-                    $output
-                )
-            );
-            $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
-            $output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
-            $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n";
-            $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>";
-            $output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n";
-            $output .= "}\n}\n";
-            $output .= "/*/ {$_funcName}_nocache */\n\n";
-            $output .= "?>\n";
-            $compiler->parser->current_buffer->append_subtree(
-                $compiler->parser,
-                new Smarty_Internal_ParseTree_Tag(
-                    $compiler->parser,
-                    $output
-                )
-            );
-            $_functionCode = new Smarty_Internal_ParseTree_Tag(
-                $compiler->parser,
-                preg_replace_callback(
-                    "/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",
-                    array($this, 'removeNocache'),
-                    $_functionCode->to_smarty_php($compiler->parser)
-                )
-            );
-        }
-        $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName;
-        $output = "<?php\n";
-        $output .= "/* {$_funcName} */\n";
-        $output .= "if (!function_exists('{$_funcName}')) {\n";
-        $output .= "function {$_funcName}(Smarty_Internal_Template \$_smarty_tpl,\$params) {\n";
-        $output .= $_paramsCode;
-        $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n";
-        $output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ],
-            $compiler->required_plugins[ 'nocache' ]));
-        $output .= "?>\n";
-        $compiler->parser->current_buffer->append_subtree(
-            $compiler->parser,
-            new Smarty_Internal_ParseTree_Tag(
-                $compiler->parser,
-                $output
-            )
-        );
-        $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
-        $output = "<?php\n}}\n";
-        $output .= "/*/ {$_funcName} */\n\n";
-        $output .= "?>\n";
-        $compiler->parser->current_buffer->append_subtree(
-            $compiler->parser,
-            new Smarty_Internal_ParseTree_Tag(
-                $compiler->parser,
-                $output
-            )
-        );
-        $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
-        // restore old buffer
-        $compiler->parser->current_buffer = $saved_data[ 1 ];
-        // restore old status
-        $compiler->restoreRequiredPlugins();
-        $compiler->template->compiled->has_nocache_code = $saved_data[ 2 ];
-        $compiler->template->caching = $saved_data[ 3 ];
-        return true;
-    }
-
-    /**
-     * Remove nocache code
-     *
-     * @param $match
-     *
-     * @return string
-     */
-    public function removeNocache($match)
-    {
-        $code =
-            preg_replace(
-                "/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",
-                '',
-                $match[ 0 ]
-            );
-        $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code);
-        return $code;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_if.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_if.php
deleted file mode 100644
index df3dc3fad..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_if.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile If
- * Compiles the {if} {else} {elseif} {/if} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile If Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {if} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $this->openTag($compiler, 'if', array(1, $compiler->nocache));
-        // must whole block be nocache ?
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        if (!isset($parameter[ 'if condition' ])) {
-            $compiler->trigger_template_error('missing if condition', null, true);
-        }
-        if (is_array($parameter[ 'if condition' ])) {
-            if (is_array($parameter[ 'if condition' ][ 'var' ])) {
-                $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
-            } else {
-                $var = $parameter[ 'if condition' ][ 'var' ];
-            }
-            if ($compiler->nocache) {
-                // create nocache var to make it know for further compiling
-                $compiler->setNocacheInVariable($var);
-            }
-            $prefixVar = $compiler->getNewPrefixVariable();
-            $_output = "<?php {$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]};?>\n";
-            $assignAttr = array();
-            $assignAttr[][ 'value' ] = $prefixVar;
-            $assignCompiler = new Smarty_Internal_Compile_Assign();
-            if (is_array($parameter[ 'if condition' ][ 'var' ])) {
-                $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
-                $_output .= $assignCompiler->compile(
-                    $assignAttr,
-                    $compiler,
-                    array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
-                );
-            } else {
-                $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
-                $_output .= $assignCompiler->compile($assignAttr, $compiler, array());
-            }
-            $_output .= "<?php if ({$prefixVar}) {?>";
-            return $_output;
-        } else {
-            return "<?php if ({$parameter['if condition']}) {?>";
-        }
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Else Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {else} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
-        $this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache));
-        return '<?php } else { ?>';
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile ElseIf Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {elseif} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
-        if (!isset($parameter[ 'if condition' ])) {
-            $compiler->trigger_template_error('missing elseif condition', null, true);
-        }
-        $assignCode = '';
-        $var = '';
-        if (is_array($parameter[ 'if condition' ])) {
-            $condition_by_assign = true;
-            if (is_array($parameter[ 'if condition' ][ 'var' ])) {
-                $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
-            } else {
-                $var = $parameter[ 'if condition' ][ 'var' ];
-            }
-            if ($compiler->nocache) {
-                // create nocache var to make it know for further compiling
-                $compiler->setNocacheInVariable($var);
-            }
-            $prefixVar = $compiler->getNewPrefixVariable();
-            $assignCode = "<?php {$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]};?>\n";
-            $assignCompiler = new Smarty_Internal_Compile_Assign();
-            $assignAttr = array();
-            $assignAttr[][ 'value' ] = $prefixVar;
-            if (is_array($parameter[ 'if condition' ][ 'var' ])) {
-                $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
-                $assignCode .= $assignCompiler->compile(
-                    $assignAttr,
-                    $compiler,
-                    array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
-                );
-            } else {
-                $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
-                $assignCode .= $assignCompiler->compile($assignAttr, $compiler, array());
-            }
-        } else {
-            $condition_by_assign = false;
-        }
-        $prefixCode = $compiler->getPrefixCode();
-        if (empty($prefixCode)) {
-            if ($condition_by_assign) {
-                $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
-                $_output = $compiler->appendCode("<?php } else {\n?>", $assignCode);
-                return $compiler->appendCode($_output, "<?php if ({$prefixVar}) {?>");
-            } else {
-                $this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache));
-                return "<?php } elseif ({$parameter['if condition']}) {?>";
-            }
-        } else {
-            $_output = $compiler->appendCode("<?php } else {\n?>", $prefixCode);
-            $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
-            if ($condition_by_assign) {
-                $_output = $compiler->appendCode($_output, $assignCode);
-                return $compiler->appendCode($_output, "<?php if ({$prefixVar}) {?>");
-            } else {
-                return $compiler->appendCode($_output, "<?php if ({$parameter['if condition']}) {?>");
-            }
-        }
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Ifclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/if} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // must endblock be nocache?
-        if ($compiler->nocache) {
-            $compiler->tag_nocache = true;
-        }
-        list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif'));
-        $tmp = '';
-        for ($i = 0; $i < $nesting; $i++) {
-            $tmp .= '}';
-        }
-        return "<?php {$tmp}?>";
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_include.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_include.php
deleted file mode 100644
index 716c91d49..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_include.php
+++ /dev/null
@@ -1,347 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Include
- * Compiles the {include} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Include Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
-{
-    /**
-     * caching mode to create nocache code but no cache file
-     */
-    const CACHING_NOCACHE_CODE = 9999;
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('file');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('file');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $option_flags = array('nocache', 'inline', 'caching');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Valid scope names
-     *
-     * @var array
-     */
-    public $valid_scopes = array(
-        'parent' => Smarty::SCOPE_PARENT, 'root' => Smarty::SCOPE_ROOT,
-        'global' => Smarty::SCOPE_GLOBAL, 'tpl_root' => Smarty::SCOPE_TPL_ROOT,
-        'smarty' => Smarty::SCOPE_SMARTY
-    );
-
-    /**
-     * Compiles code for the {include} tag
-     *
-     * @param array                                  $args     array with attributes from parser
-     * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object
-     *
-     * @return string
-     * @throws \Exception
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler)
-    {
-        $uid = $t_hash = null;
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $fullResourceName = $source_resource = $_attr[ 'file' ];
-        $variable_template = false;
-        $cache_tpl = false;
-        // parse resource_name
-        if (preg_match('/^([\'"])(([A-Za-z0-9_\-]{2,})[:])?(([^$()]+)|(.+))\1$/', $source_resource, $match)) {
-            $type = !empty($match[ 3 ]) ? $match[ 3 ] : $compiler->template->smarty->default_resource_type;
-            $name = !empty($match[ 5 ]) ? $match[ 5 ] : $match[ 6 ];
-            $handler = Smarty_Resource::load($compiler->smarty, $type);
-            if ($handler->recompiled || $handler->uncompiled) {
-                $variable_template = true;
-            }
-            if (!$variable_template) {
-                if ($type !== 'string') {
-                    $fullResourceName = "{$type}:{$name}";
-                    $compiled = $compiler->parent_compiler->template->compiled;
-                    if (isset($compiled->includes[ $fullResourceName ])) {
-                        $compiled->includes[ $fullResourceName ]++;
-                        $cache_tpl = true;
-                    } else {
-                        if ("{$compiler->template->source->type}:{$compiler->template->source->name}" ==
-                            $fullResourceName
-                        ) {
-                            // recursive call of current template
-                            $compiled->includes[ $fullResourceName ] = 2;
-                            $cache_tpl = true;
-                        } else {
-                            $compiled->includes[ $fullResourceName ] = 1;
-                        }
-                    }
-                    $fullResourceName = $match[ 1 ] . $fullResourceName . $match[ 1 ];
-                }
-            }
-            if (empty($match[ 5 ])) {
-                $variable_template = true;
-            }
-        } else {
-            $variable_template = true;
-        }
-        // scope setup
-        $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
-        // set flag to cache subtemplate object when called within loop or template name is variable.
-        if ($cache_tpl || $variable_template || $compiler->loopNesting > 0) {
-            $_cache_tpl = 'true';
-        } else {
-            $_cache_tpl = 'false';
-        }
-        // assume caching is off
-        $_caching = Smarty::CACHING_OFF;
-        $call_nocache = $compiler->tag_nocache || $compiler->nocache;
-        // caching was on and {include} is not in nocache mode
-        if ($compiler->template->caching && !$compiler->nocache && !$compiler->tag_nocache) {
-            $_caching = self::CACHING_NOCACHE_CODE;
-        }
-        // flag if included template code should be merged into caller
-        $merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || $_attr[ 'inline' ] === true) &&
-                                   !$compiler->template->source->handler->recompiled;
-        if ($merge_compiled_includes) {
-            // variable template name ?
-            if ($variable_template) {
-                $merge_compiled_includes = false;
-            }
-            // variable compile_id?
-            if (isset($_attr[ 'compile_id' ]) && $compiler->isVariable($_attr[ 'compile_id' ])) {
-                $merge_compiled_includes = false;
-            }
-        }
-        /*
-        * if the {include} tag provides individual parameter for caching or compile_id
-        * the subtemplate must not be included into the common cache file and is treated like
-        * a call in nocache mode.
-        *
-        */
-        if ($_attr[ 'nocache' ] !== true && $_attr[ 'caching' ]) {
-            $_caching = $_new_caching = (int)$_attr[ 'caching' ];
-            $call_nocache = true;
-        } else {
-            $_new_caching = Smarty::CACHING_LIFETIME_CURRENT;
-        }
-        if (isset($_attr[ 'cache_lifetime' ])) {
-            $_cache_lifetime = $_attr[ 'cache_lifetime' ];
-            $call_nocache = true;
-            $_caching = $_new_caching;
-        } else {
-            $_cache_lifetime = '$_smarty_tpl->cache_lifetime';
-        }
-        if (isset($_attr[ 'cache_id' ])) {
-            $_cache_id = $_attr[ 'cache_id' ];
-            $call_nocache = true;
-            $_caching = $_new_caching;
-        } else {
-            $_cache_id = '$_smarty_tpl->cache_id';
-        }
-        if (isset($_attr[ 'compile_id' ])) {
-            $_compile_id = $_attr[ 'compile_id' ];
-        } else {
-            $_compile_id = '$_smarty_tpl->compile_id';
-        }
-        // if subtemplate will be called in nocache mode do not merge
-        if ($compiler->template->caching && $call_nocache) {
-            $merge_compiled_includes = false;
-        }
-        // assign attribute
-        if (isset($_attr[ 'assign' ])) {
-            // output will be stored in a smarty variable instead of being displayed
-            if ($_assign = $compiler->getId($_attr[ 'assign' ])) {
-                $_assign = "'{$_assign}'";
-                if ($compiler->tag_nocache || $compiler->nocache || $call_nocache) {
-                    // create nocache var to make it know for further compiling
-                    $compiler->setNocacheInVariable($_attr[ 'assign' ]);
-                }
-            } else {
-                $_assign = $_attr[ 'assign' ];
-            }
-        }
-        $has_compiled_template = false;
-        if ($merge_compiled_includes) {
-            $c_id = isset($_attr[ 'compile_id' ]) ? $_attr[ 'compile_id' ] : $compiler->template->compile_id;
-            // we must observe different compile_id and caching
-            $t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching'));
-            $compiler->smarty->allow_ambiguous_resources = true;
-            /* @var Smarty_Internal_Template $tpl */
-            $tpl = new $compiler->smarty->template_class(
-                trim($fullResourceName, '"\''),
-                $compiler->smarty,
-                $compiler->template,
-                $compiler->template->cache_id,
-                $c_id,
-                $_caching
-            );
-            $uid = $tpl->source->type . $tpl->source->uid;
-            if (!isset($compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ])) {
-                $has_compiled_template = $this->compileInlineTemplate($compiler, $tpl, $t_hash);
-            } else {
-                $has_compiled_template = true;
-            }
-            unset($tpl);
-        }
-        // delete {include} standard attributes
-        unset($_attr[ 'file' ], $_attr[ 'assign' ], $_attr[ 'cache_id' ], $_attr[ 'compile_id' ], $_attr[ 'cache_lifetime' ], $_attr[ 'nocache' ], $_attr[ 'caching' ], $_attr[ 'scope' ], $_attr[ 'inline' ]);
-        // remaining attributes must be assigned as smarty variable
-        $_vars = 'array()';
-        if (!empty($_attr)) {
-            $_pairs = array();
-            // create variables
-            foreach ($_attr as $key => $value) {
-                $_pairs[] = "'$key'=>$value";
-            }
-            $_vars = 'array(' . join(',', $_pairs) . ')';
-        }
-        $update_compile_id = $compiler->template->caching && !$compiler->tag_nocache && !$compiler->nocache &&
-                             $_compile_id !== '$_smarty_tpl->compile_id';
-        if ($has_compiled_template && !$call_nocache) {
-            $_output = "<?php\n";
-            if ($update_compile_id) {
-                $_output .= $compiler->makeNocacheCode("\$_compile_id_save[] = \$_smarty_tpl->compile_id;\n\$_smarty_tpl->compile_id = {$_compile_id};\n");
-            }
-            if (!empty($_attr) && $_caching === 9999 && $compiler->template->caching) {
-                $_vars_nc = "foreach ($_vars as \$ik => \$iv) {\n";
-                $_vars_nc .= "\$_smarty_tpl->tpl_vars[\$ik] =  new Smarty_Variable(\$iv);\n";
-                $_vars_nc .= "}\n";
-                $_output .= substr($compiler->processNocacheCode('<?php ' . $_vars_nc . "?>\n", true), 6, -3);
-            }
-            if (isset($_assign)) {
-                $_output .= "ob_start();\n";
-            }
-            $_output .= "\$_smarty_tpl->_subTemplateRender({$fullResourceName}, {$_cache_id}, {$_compile_id}, {$_caching}, {$_cache_lifetime}, {$_vars}, {$_scope}, {$_cache_tpl}, '{$compiler->parent_compiler->mergedSubTemplatesData[$uid][$t_hash]['uid']}', '{$compiler->parent_compiler->mergedSubTemplatesData[$uid][$t_hash]['func']}');\n";
-            if (isset($_assign)) {
-                $_output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
-            }
-            if ($update_compile_id) {
-                $_output .= $compiler->makeNocacheCode("\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n");
-            }
-            $_output .= "?>";
-            return $_output;
-        }
-        if ($call_nocache) {
-            $compiler->tag_nocache = true;
-        }
-        $_output = "<?php ";
-        if ($update_compile_id) {
-            $_output .= "\$_compile_id_save[] = \$_smarty_tpl->compile_id;\n\$_smarty_tpl->compile_id = {$_compile_id};\n";
-        }
-        // was there an assign attribute
-        if (isset($_assign)) {
-            $_output .= "ob_start();\n";
-        }
-        $_output .= "\$_smarty_tpl->_subTemplateRender({$fullResourceName}, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_scope, {$_cache_tpl});\n";
-        if (isset($_assign)) {
-            $_output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n";
-        }
-        if ($update_compile_id) {
-            $_output .= "\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n";
-        }
-        $_output .= "?>";
-        return $_output;
-    }
-
-    /**
-     * Compile inline sub template
-     *
-     * @param \Smarty_Internal_SmartyTemplateCompiler $compiler
-     * @param \Smarty_Internal_Template               $tpl
-     * @param string                                  $t_hash
-     *
-     * @return bool
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function compileInlineTemplate(
-        Smarty_Internal_SmartyTemplateCompiler $compiler,
-        Smarty_Internal_Template $tpl,
-        $t_hash
-    ) {
-        $uid = $tpl->source->type . $tpl->source->uid;
-        if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) {
-            $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'uid' ] = $tpl->source->uid;
-            if (isset($compiler->template->inheritance)) {
-                $tpl->inheritance = clone $compiler->template->inheritance;
-            }
-            $tpl->compiled = new Smarty_Template_Compiled();
-            $tpl->compiled->nocache_hash = $compiler->parent_compiler->template->compiled->nocache_hash;
-            $tpl->loadCompiler();
-            // save unique function name
-            $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'func' ] =
-            $tpl->compiled->unifunc = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
-            // make sure whole chain gets compiled
-            $tpl->mustCompile = true;
-            $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'nocache_hash' ] =
-                $tpl->compiled->nocache_hash;
-            if ($tpl->source->type === 'file') {
-                $sourceInfo = $tpl->source->filepath;
-            } else {
-                $basename = $tpl->source->handler->getBasename($tpl->source);
-                $sourceInfo = $tpl->source->type . ':' .
-                              ($basename ? $basename : $tpl->source->name);
-            }
-            // get compiled code
-            $compiled_code = "<?php\n\n";
-            $compiled_code .= "/* Start inline template \"{$sourceInfo}\" =============================*/\n";
-            $compiled_code .= "function {$tpl->compiled->unifunc} (Smarty_Internal_Template \$_smarty_tpl) {\n";
-            $compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler);
-            $compiled_code .= "<?php\n";
-            $compiled_code .= "}\n?>\n";
-            $compiled_code .= $tpl->compiler->postFilter($tpl->compiler->blockOrFunctionCode);
-            $compiled_code .= "<?php\n\n";
-            $compiled_code .= "/* End inline template \"{$sourceInfo}\" =============================*/\n";
-            $compiled_code .= '?>';
-            unset($tpl->compiler);
-            if ($tpl->compiled->has_nocache_code) {
-                // replace nocache_hash
-                $compiled_code =
-                    str_replace(
-                        "{$tpl->compiled->nocache_hash}",
-                        $compiler->template->compiled->nocache_hash,
-                        $compiled_code
-                    );
-                $compiler->template->compiled->has_nocache_code = true;
-            }
-            $compiler->parent_compiler->mergedSubTemplatesCode[ $tpl->compiled->unifunc ] = $compiled_code;
-            return true;
-        } else {
-            return false;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php
deleted file mode 100644
index 1b0fdaad3..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_include_php.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Include PHP
- * Compiles the {include_php} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Insert Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('file');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('file');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('once', 'assign');
-
-    /**
-     * Compiles code for the {include_php} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        if (!($compiler->smarty instanceof SmartyBC)) {
-            throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable");
-        }
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        /**
-         *
-         *
-         * @var Smarty_Internal_Template $_smarty_tpl
-         * used in evaluated code
-         */
-        $_smarty_tpl = $compiler->template;
-        $_filepath = false;
-        $_file = null;
-        eval('$_file = @' . $_attr[ 'file' ] . ';');
-        if (!isset($compiler->smarty->security_policy) && file_exists($_file)) {
-            $_filepath = $compiler->smarty->_realpath($_file, true);
-        } else {
-            if (isset($compiler->smarty->security_policy)) {
-                $_dir = $compiler->smarty->security_policy->trusted_dir;
-            } else {
-                $_dir = $compiler->smarty->trusted_dir;
-            }
-            if (!empty($_dir)) {
-                foreach ((array)$_dir as $_script_dir) {
-                    $_path = $compiler->smarty->_realpath($_script_dir . DIRECTORY_SEPARATOR . $_file, true);
-                    if (file_exists($_path)) {
-                        $_filepath = $_path;
-                        break;
-                    }
-                }
-            }
-        }
-        if ($_filepath === false) {
-            $compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", null, true);
-        }
-        if (isset($compiler->smarty->security_policy)) {
-            $compiler->smarty->security_policy->isTrustedPHPDir($_filepath);
-        }
-        if (isset($_attr[ 'assign' ])) {
-            // output will be stored in a smarty variable instead of being displayed
-            $_assign = $_attr[ 'assign' ];
-        }
-        $_once = '_once';
-        if (isset($_attr[ 'once' ])) {
-            if ($_attr[ 'once' ] === 'false') {
-                $_once = '';
-            }
-        }
-        if (isset($_assign)) {
-            return "<?php ob_start();\ninclude{$_once} ('{$_filepath}');\n\$_smarty_tpl->assign({$_assign},ob_get_clean());\n?>";
-        } else {
-            return "<?php include{$_once} ('{$_filepath}');?>\n";
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_insert.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
deleted file mode 100644
index 4bdc3952e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Insert
- * Compiles the {insert} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Insert Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('name');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Compiles code for the {insert} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache);
-        if (!$nocacheParam) {
-            // do not compile as nocache code
-            $compiler->suppressNocacheProcessing = true;
-        }
-        $compiler->tag_nocache = true;
-        $_smarty_tpl = $compiler->template;
-        $_name = null;
-        $_script = null;
-        $_output = '<?php ';
-        // save possible attributes
-        eval('$_name = @' . $_attr[ 'name' ] . ';');
-        if (isset($_attr[ 'assign' ])) {
-            // output will be stored in a smarty variable instead of being displayed
-            $_assign = $_attr[ 'assign' ];
-            // create variable to make sure that the compiler knows about its nocache status
-            $var = trim($_attr[ 'assign' ], '\'');
-            if (isset($compiler->template->tpl_vars[ $var ])) {
-                $compiler->template->tpl_vars[ $var ]->nocache = true;
-            } else {
-                $compiler->template->tpl_vars[ $var ] = new Smarty_Variable(null, true);
-            }
-        }
-        if (isset($_attr[ 'script' ])) {
-            // script which must be included
-            $_function = "smarty_insert_{$_name}";
-            $_smarty_tpl = $compiler->template;
-            $_filepath = false;
-            eval('$_script = @' . $_attr[ 'script' ] . ';');
-            if (!isset($compiler->smarty->security_policy) && file_exists($_script)) {
-                $_filepath = $_script;
-            } else {
-                if (isset($compiler->smarty->security_policy)) {
-                    $_dir = $compiler->smarty->security_policy->trusted_dir;
-                } else {
-                    $_dir = $compiler->smarty instanceof SmartyBC ? $compiler->smarty->trusted_dir : null;
-                }
-                if (!empty($_dir)) {
-                    foreach ((array)$_dir as $_script_dir) {
-                        $_script_dir = rtrim($_script_dir, '/\\') . DIRECTORY_SEPARATOR;
-                        if (file_exists($_script_dir . $_script)) {
-                            $_filepath = $_script_dir . $_script;
-                            break;
-                        }
-                    }
-                }
-            }
-            if ($_filepath === false) {
-                $compiler->trigger_template_error("{insert} missing script file '{$_script}'", null, true);
-            }
-            // code for script file loading
-            $_output .= "require_once '{$_filepath}' ;";
-            include_once $_filepath;
-            if (!is_callable($_function)) {
-                $compiler->trigger_template_error(
-                    " {insert} function '{$_function}' is not callable in script file '{$_script}'",
-                    null,
-                    true
-                );
-            }
-        } else {
-            $_filepath = 'null';
-            $_function = "insert_{$_name}";
-            // function in PHP script ?
-            if (!is_callable($_function)) {
-                // try plugin
-                if (!$_function = $compiler->getPlugin($_name, 'insert')) {
-                    $compiler->trigger_template_error(
-                        "{insert} no function or plugin found for '{$_name}'",
-                        null,
-                        true
-                    );
-                }
-            }
-        }
-        // delete {insert} standard attributes
-        unset($_attr[ 'name' ], $_attr[ 'assign' ], $_attr[ 'script' ], $_attr[ 'nocache' ]);
-        // convert attributes into parameter array string
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            $_paramsArray[] = "'$_key' => $_value";
-        }
-        $_params = 'array(' . implode(", ", $_paramsArray) . ')';
-        // call insert
-        if (isset($_assign)) {
-            if ($_smarty_tpl->caching && !$nocacheParam) {
-                $_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}',{$_assign});?>";
-            } else {
-                $_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>";
-            }
-        } else {
-            if ($_smarty_tpl->caching && !$nocacheParam) {
-                $_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>";
-            } else {
-                $_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
-            }
-        }
-        $compiler->template->compiled->has_nocache_code = true;
-        return $_output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_ldelim.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_ldelim.php
deleted file mode 100644
index 5493d4ecc..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_ldelim.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Ldelim
- * Compiles the {ldelim} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Ldelim Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {ldelim} tag
-     * This tag does output the left delimiter
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $_attr = $this->getAttributes($compiler, $args);
-        if ($_attr[ 'nocache' ] === true) {
-            $compiler->trigger_template_error('nocache option not allowed', null, true);
-        }
-        return $compiler->smarty->left_delimiter;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php
deleted file mode 100644
index 8a34ccd0a..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Make_Nocache
- * Compiles the {make_nocache} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Make_Nocache Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Make_Nocache extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $option_flags = array();
-
-    /**
-     * Array of names of required attribute required by tag
-     *
-     * @var array
-     */
-    public $required_attributes = array('var');
-
-    /**
-     * Shorttag attribute order defined by its names
-     *
-     * @var array
-     */
-    public $shorttag_order = array('var');
-
-    /**
-     * Compiles code for the {make_nocache} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        if ($compiler->template->caching) {
-            $output = "<?php \$_smarty_tpl->smarty->ext->_make_nocache->save(\$_smarty_tpl, {$_attr[ 'var' ]});\n?>\n";
-            $compiler->template->compiled->has_nocache_code = true;
-            $compiler->suppressNocacheProcessing = true;
-            return $output;
-        } else {
-            return true;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_nocache.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_nocache.php
deleted file mode 100644
index 12f64ed2e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_nocache.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Nocache
- * Compiles the {nocache} {/nocache} tags.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Nocache Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
-{
-    /**
-     * Array of names of valid option flags
-     *
-     * @var array
-     */
-    public $option_flags = array();
-
-    /**
-     * Compiles code for the {nocache} tag
-     * This tag does not generate compiled output. It only sets a compiler flag.
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return bool
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $_attr = $this->getAttributes($compiler, $args);
-        $this->openTag($compiler, 'nocache', array($compiler->nocache));
-        // enter nocache mode
-        $compiler->nocache = true;
-        // this tag does not return compiled code
-        $compiler->has_code = false;
-        return true;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Nocacheclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/nocache} tag
-     * This tag does not generate compiled output. It only sets a compiler flag.
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return bool
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $_attr = $this->getAttributes($compiler, $args);
-        // leave nocache mode
-        list($compiler->nocache) = $this->closeTag($compiler, array('nocache'));
-        // this tag does not return compiled code
-        $compiler->has_code = false;
-        return true;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_parent.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_parent.php
deleted file mode 100644
index ff23edf73..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_parent.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty Internal Plugin Compile Parent Class
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Compile_Parent extends Smarty_Internal_Compile_Child
-{
-    /**
-     * Tag name
-     *
-     * @var string
-     */
-    public $tag = 'parent';
-
-    /**
-     * Block type
-     *
-     * @var string
-     */
-    public $blockType = 'Parent';
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php
deleted file mode 100644
index 199a296c8..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Block Plugin
- * Compiles code for the execution of block plugin
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Block Plugin Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * nesting level
-     *
-     * @var int
-     */
-    public $nesting = 0;
-
-    /**
-     * Compiles code for the execution of block plugin
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     * @param string                                $tag       name of block plugin
-     * @param string                                $function  PHP function name
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function = null)
-    {
-        if (!isset($tag[ 5 ]) || substr($tag, -5) !== 'close') {
-            // opening tag of block plugin
-            // check and get attributes
-            $_attr = $this->getAttributes($compiler, $args);
-            $this->nesting++;
-            unset($_attr[ 'nocache' ]);
-            list($callback, $_paramsArray, $callable) = $this->setup($compiler, $_attr, $tag, $function);
-            $_params = 'array(' . implode(',', $_paramsArray) . ')';
-            // compile code
-            $output = "<?php ";
-            if (is_array($callback)) {
-                $output .= "\$_block_plugin{$this->nesting} = isset({$callback[0]}) ? {$callback[0]} : null;\n";
-                $callback = "\$_block_plugin{$this->nesting}{$callback[1]}";
-            }
-            if (isset($callable)) {
-                $output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n";
-            }
-            $output .= "\$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('{$tag}', {$_params});\n";
-            $output .= "\$_block_repeat=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat);\nwhile (\$_block_repeat) {\nob_start();?>";
-            $this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback));
-            // maybe nocache because of nocache variables or nocache plugin
-            $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        } else {
-            // must endblock be nocache?
-            if ($compiler->nocache) {
-                $compiler->tag_nocache = true;
-            }
-            // closing tag of block plugin, restore nocache
-            list($_params, $compiler->nocache, $callback) = $this->closeTag($compiler, substr($tag, 0, -5));
-            // compile code
-            if (!isset($parameter[ 'modifier_list' ])) {
-                $mod_pre = $mod_post = $mod_content = '';
-                $mod_content2 = 'ob_get_clean()';
-            } else {
-                $mod_content2 = "\$_block_content{$this->nesting}";
-                $mod_content = "\$_block_content{$this->nesting} = ob_get_clean();\n";
-                $mod_pre = "ob_start();\n";
-                $mod_post = 'echo ' . $compiler->compileTag(
-                        'private_modifier',
-                        array(),
-                        array(
-                            'modifierlist' => $parameter[ 'modifier_list' ],
-                            'value'        => 'ob_get_clean()'
-                        )
-                    ) . ";\n";
-            }
-            $output =
-                "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n";
-            $output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>';
-        }
-        return $output;
-    }
-
-    /**
-     * Setup callback and parameter array
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param array                                 $_attr attributes
-     * @param string                                $tag
-     * @param string                                $function
-     *
-     * @return array
-     */
-    public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $function)
-    {
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        return array($function, $_paramsArray, null);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
deleted file mode 100644
index d3aab24bb..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile ForeachSection
- * Shared methods for {foreach} {section} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile ForeachSection Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_CompileBase
-{
-    /**
-     * Name of this tag
-     *
-     * @var string
-     */
-    public $tagName = '';
-
-    /**
-     * Valid properties of $smarty.xxx variable
-     *
-     * @var array
-     */
-    public $nameProperties = array();
-
-    /**
-     * {section} tag has no item properties
-     *
-     * @var array
-     */
-    public $itemProperties = null;
-
-    /**
-     * {section} tag has always name attribute
-     *
-     * @var bool
-     */
-    public $isNamed = true;
-
-    /**
-     * @var array
-     */
-    public $matchResults = array();
-
-    /**
-     * Preg search pattern
-     *
-     * @var string
-     */
-    private $propertyPreg = '';
-
-    /**
-     * Offsets in preg match result
-     *
-     * @var array
-     */
-    private $resultOffsets = array();
-
-    /**
-     * Start offset
-     *
-     * @var int
-     */
-    private $startOffset = 0;
-
-    /**
-     * Scan sources for used tag attributes
-     *
-     * @param array                                 $attributes
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     *
-     * @throws \SmartyException
-     */
-    public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->propertyPreg = '~(';
-        $this->startOffset = 1;
-        $this->resultOffsets = array();
-        $this->matchResults = array('named' => array(), 'item' => array());
-        if (isset($attributes[ 'name' ])) {
-            $this->buildPropertyPreg(true, $attributes);
-        }
-        if (isset($this->itemProperties)) {
-            if ($this->isNamed) {
-                $this->propertyPreg .= '|';
-            }
-            $this->buildPropertyPreg(false, $attributes);
-        }
-        $this->propertyPreg .= ')\W~i';
-        // Template source
-        $this->matchTemplateSource($compiler);
-        // Parent template source
-        $this->matchParentTemplateSource($compiler);
-        // {block} source
-        $this->matchBlockSource($compiler);
-    }
-
-    /**
-     * Build property preg string
-     *
-     * @param bool  $named
-     * @param array $attributes
-     */
-    public function buildPropertyPreg($named, $attributes)
-    {
-        if ($named) {
-            $this->resultOffsets[ 'named' ] = $this->startOffset = $this->startOffset + 3;
-            $this->propertyPreg .= "(([\$]smarty[.]{$this->tagName}[.]" .
-                                   ($this->tagName === 'section' ? "|[\[]\s*" : '') .
-                                   "){$attributes['name']}[.](";
-            $properties = $this->nameProperties;
-        } else {
-            $this->resultOffsets[ 'item' ] = $this->startOffset = $this->startOffset + 2;
-            $this->propertyPreg .= "([\$]{$attributes['item']}[@](";
-            $properties = $this->itemProperties;
-        }
-        $propName = reset($properties);
-        while ($propName) {
-            $this->propertyPreg .= "{$propName}";
-            $propName = next($properties);
-            if ($propName) {
-                $this->propertyPreg .= '|';
-            }
-        }
-        $this->propertyPreg .= '))';
-    }
-
-    /**
-     * Find matches in source string
-     *
-     * @param string $source
-     */
-    public function matchProperty($source)
-    {
-        preg_match_all($this->propertyPreg, $source, $match);
-        foreach ($this->resultOffsets as $key => $offset) {
-            foreach ($match[ $offset ] as $m) {
-                if (!empty($m)) {
-                    $this->matchResults[ $key ][ strtolower($m) ] = true;
-                }
-            }
-        }
-    }
-
-    /**
-     * Find matches in template source
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     */
-    public function matchTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->matchProperty($compiler->parser->lex->data);
-    }
-
-    /**
-     * Find matches in all parent template source
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     *
-     * @throws \SmartyException
-     */
-    public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // search parent compiler template source
-        $nextCompiler = $compiler;
-        while ($nextCompiler !== $nextCompiler->parent_compiler) {
-            $nextCompiler = $nextCompiler->parent_compiler;
-            if ($compiler !== $nextCompiler) {
-                // get template source
-                $_content = $nextCompiler->template->source->getContent();
-                if ($_content !== '') {
-                    // run pre filter if required
-                    if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
-                         isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
-                    ) {
-                        $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter(
-                            'pre',
-                            $_content,
-                            $nextCompiler->template
-                        );
-                    }
-                    $this->matchProperty($_content);
-                }
-            }
-        }
-    }
-
-    /**
-     * Find matches in {block} tag source
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     */
-    public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-    }
-
-    /**
-     * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        $tag = strtolower(trim($parameter[ 0 ], '"\''));
-        $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false;
-        if (!$name) {
-            $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
-        }
-        $property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false;
-        if (!$property || !in_array($property, $this->nameProperties)) {
-            $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
-        }
-        $tagVar = "'__smarty_{$tag}_{$name}'";
-        return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)";
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php
deleted file mode 100644
index 055823423..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Function Plugin
- * Compiles code for the execution of function plugin
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Function Plugin Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array();
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Compiles code for the execution of function plugin
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     * @param string                                $tag       name of function plugin
-     * @param string                                $function  PHP function name
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        unset($_attr[ 'nocache' ]);
-        // convert attributes into parameter array string
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        $_params = 'array(' . implode(',', $_paramsArray) . ')';
-        // compile code
-        $output = "{$function}({$_params},\$_smarty_tpl)";
-        if (!empty($parameter[ 'modifierlist' ])) {
-            $output = $compiler->compileTag(
-                'private_modifier',
-                array(),
-                array(
-                    'modifierlist' => $parameter[ 'modifierlist' ],
-                    'value'        => $output
-                )
-            );
-        }
-        $output = "<?php echo {$output};?>\n";
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
deleted file mode 100644
index 72773fff8..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Modifier
- * Compiles code for modifier execution
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Modifier Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for modifier execution
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $output = $parameter[ 'value' ];
-        // loop over list of modifiers
-        foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
-            /* @var string $modifier */
-            $modifier = $single_modifier[ 0 ];
-            $single_modifier[ 0 ] = $output;
-            $params = implode(',', $single_modifier);
-            // check if we know already the type of modifier
-            if (isset($compiler->known_modifier_type[ $modifier ])) {
-                $modifier_types = array($compiler->known_modifier_type[ $modifier ]);
-            } else {
-                $modifier_types = array(1, 2, 3, 4, 5, 6);
-            }
-            foreach ($modifier_types as $type) {
-                switch ($type) {
-                    case 1:
-                        // registered modifier
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
-                            if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) {
-                                $output =
-                                    sprintf(
-                                        'call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))',
-                                        Smarty::PLUGIN_MODIFIER,
-                                        var_export($modifier, true),
-                                        $params
-                                    );
-                                $compiler->known_modifier_type[ $modifier ] = $type;
-                                break 2;
-                            }
-                        }
-                        break;
-                    case 2:
-                        // registered modifier compiler
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
-                            $output =
-                                call_user_func(
-                                    $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
-                                    $single_modifier,
-                                    $compiler->smarty
-                                );
-                            $compiler->known_modifier_type[ $modifier ] = $type;
-                            break 2;
-                        }
-                        break;
-                    case 3:
-                        // modifiercompiler plugin
-                        if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
-                            // check if modifier allowed
-                            if (!is_object($compiler->smarty->security_policy)
-                                || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
-                            ) {
-                                $plugin = 'smarty_modifiercompiler_' . $modifier;
-                                $output = $plugin($single_modifier, $compiler);
-                            }
-                            $compiler->known_modifier_type[ $modifier ] = $type;
-                            break 2;
-                        }
-                        break;
-                    case 4:
-                        // modifier plugin
-                        if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
-                            // check if modifier allowed
-                            if (!is_object($compiler->smarty->security_policy)
-                                || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
-                            ) {
-                                $output = "{$function}({$params})";
-                            }
-                            $compiler->known_modifier_type[ $modifier ] = $type;
-                            break 2;
-                        }
-                        break;
-                    case 5:
-                        // PHP function
-                        if (is_callable($modifier)) {
-                            // check if modifier allowed
-                            if (!is_object($compiler->smarty->security_policy)
-                                || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
-                            ) {
-                                $output = "{$modifier}({$params})";
-                            }
-                            $compiler->known_modifier_type[ $modifier ] = $type;
-                            break 2;
-                        }
-                        break;
-                    case 6:
-                        // default plugin handler
-                        if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])
-                            || (is_callable($compiler->smarty->default_plugin_handler_func)
-                                && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
-                        ) {
-                            $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
-                            // check if modifier allowed
-                            if (!is_object($compiler->smarty->security_policy)
-                                || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
-                            ) {
-                                if (!is_array($function)) {
-                                    $output = "{$function}({$params})";
-                                } else {
-                                    if (is_object($function[ 0 ])) {
-                                        $output = $function[ 0 ] . '->' . $function[ 1 ] . '(' . $params . ')';
-                                    } else {
-                                        $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
-                                    }
-                                }
-                            }
-                            if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
-                                ||
-                                isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
-                            ) {
-                                // was a plugin
-                                $compiler->known_modifier_type[ $modifier ] = 4;
-                            } else {
-                                $compiler->known_modifier_type[ $modifier ] = $type;
-                            }
-                            break 2;
-                        }
-                }
-            }
-            if (!isset($compiler->known_modifier_type[ $modifier ])) {
-                $compiler->trigger_template_error("unknown modifier '{$modifier}'", null, true);
-            }
-        }
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php
deleted file mode 100644
index baac51b28..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Object Block Function
- * Compiles code for registered objects as block function
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Object Block Function Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_Compile_Private_Block_Plugin
-{
-    /**
-     * Setup callback and parameter array
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param array                                 $_attr attributes
-     * @param string                                $tag
-     * @param string                                $method
-     *
-     * @return array
-     */
-    public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $method)
-    {
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        $callback = array("\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]", "->{$method}");
-        return array($callback, $_paramsArray, "array(\$_block_plugin{$this->nesting}, '{$method}')");
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php
deleted file mode 100644
index 2a763c6e3..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Object Function
- * Compiles code for registered objects as function
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Object Function Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Compiles code for the execution of function plugin
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     * @param string                                $tag       name of function
-     * @param string                                $method    name of method to call
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        unset($_attr[ 'nocache' ]);
-        $_assign = null;
-        if (isset($_attr[ 'assign' ])) {
-            $_assign = $_attr[ 'assign' ];
-            unset($_attr[ 'assign' ]);
-        }
-        // method or property ?
-        if (is_callable(array($compiler->smarty->registered_objects[ $tag ][ 0 ], $method))) {
-            // convert attributes into parameter array string
-            if ($compiler->smarty->registered_objects[ $tag ][ 2 ]) {
-                $_paramsArray = array();
-                foreach ($_attr as $_key => $_value) {
-                    if (is_int($_key)) {
-                        $_paramsArray[] = "$_key=>$_value";
-                    } else {
-                        $_paramsArray[] = "'$_key'=>$_value";
-                    }
-                }
-                $_params = 'array(' . implode(',', $_paramsArray) . ')';
-                $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)";
-            } else {
-                $_params = implode(',', $_attr);
-                $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
-            }
-        } else {
-            // object property
-            $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
-        }
-        if (!empty($parameter[ 'modifierlist' ])) {
-            $output = $compiler->compileTag(
-                'private_modifier',
-                array(),
-                array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)
-            );
-        }
-        if (empty($_assign)) {
-            return "<?php echo {$output};?>\n";
-        } else {
-            return "<?php \$_smarty_tpl->assign({$_assign},{$output});?>\n";
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_php.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_php.php
deleted file mode 100644
index ff48c6fbc..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_php.php
+++ /dev/null
@@ -1,253 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile PHP Expression
- * Compiles any tag which will output an expression or variable
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile PHP Expression Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('code', 'type');
-
-    /**
-     * Compiles code for generating output from any expression
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $compiler->has_code = false;
-        if ($_attr[ 'type' ] === 'xml') {
-            $compiler->tag_nocache = true;
-            $output = addcslashes($_attr[ 'code' ], "'\\");
-            $compiler->parser->current_buffer->append_subtree(
-                $compiler->parser,
-                new Smarty_Internal_ParseTree_Tag(
-                    $compiler->parser,
-                    $compiler->processNocacheCode(
-                        "<?php echo '{$output}';?>\n",
-                        true
-                    )
-                )
-            );
-            return '';
-        }
-        if ($_attr[ 'type' ] !== 'tag') {
-            if ($compiler->php_handling === Smarty::PHP_REMOVE) {
-                return '';
-            } elseif ($compiler->php_handling === Smarty::PHP_QUOTE) {
-                $output =
-                    preg_replace_callback(
-                        '#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i',
-                        array($this, 'quote'),
-                        $_attr[ 'code' ]
-                    );
-                $compiler->parser->current_buffer->append_subtree(
-                    $compiler->parser,
-                    new Smarty_Internal_ParseTree_Text($output)
-                );
-                return '';
-            } elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') {
-                $compiler->tag_nocache = true;
-                $output = addcslashes($_attr[ 'code' ], "'\\");
-                $compiler->parser->current_buffer->append_subtree(
-                    $compiler->parser,
-                    new Smarty_Internal_ParseTree_Tag(
-                        $compiler->parser,
-                        $compiler->processNocacheCode(
-                            "<?php echo '{$output}';?>\n",
-                            true
-                        )
-                    )
-                );
-                return '';
-            } elseif ($compiler->php_handling === Smarty::PHP_ALLOW) {
-                if (!($compiler->smarty instanceof SmartyBC)) {
-                    $compiler->trigger_template_error(
-                        '$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it',
-                        null,
-                        true
-                    );
-                }
-                $compiler->has_code = true;
-                return $_attr[ 'code' ];
-            } else {
-                $compiler->trigger_template_error('Illegal $smarty->php_handling value', null, true);
-            }
-        } else {
-            $compiler->has_code = true;
-            if (!($compiler->smarty instanceof SmartyBC)) {
-                $compiler->trigger_template_error(
-                    '{php}{/php} tags not allowed. Use SmartyBC to enable them',
-                    null,
-                    true
-                );
-            }
-            $ldel = preg_quote($compiler->smarty->left_delimiter, '#');
-            $rdel = preg_quote($compiler->smarty->right_delimiter, '#');
-            preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr[ 'code' ], $match);
-            if (!empty($match[ 2 ])) {
-                if ('nocache' === trim($match[ 2 ])) {
-                    $compiler->tag_nocache = true;
-                } else {
-                    $compiler->trigger_template_error("illegal value of option flag '{$match[2]}'", null, true);
-                }
-            }
-            return preg_replace(
-                array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"),
-                array('<?php ', '?>'),
-                $_attr[ 'code' ]
-            );
-        }
-    }
-
-    /**
-     * Lexer code for PHP tags
-     *
-     * This code has been moved from lexer here fo easier debugging and maintenance
-     *
-     * @param Smarty_Internal_Templatelexer $lex
-     *
-     * @throws \SmartyCompilerException
-     */
-    public function parsePhp(Smarty_Internal_Templatelexer $lex)
-    {
-        $lex->token = Smarty_Internal_Templateparser::TP_PHP;
-        $close = 0;
-        $lex->taglineno = $lex->line;
-        $closeTag = '?>';
-        if (strpos($lex->value, '<?xml') === 0) {
-            $lex->is_xml = true;
-            $lex->phpType = 'xml';
-            return;
-        } elseif (strpos($lex->value, '<?') === 0) {
-            $lex->phpType = 'php';
-        } elseif (strpos($lex->value, '<%') === 0) {
-            $lex->phpType = 'asp';
-            $closeTag = '%>';
-        } elseif (strpos($lex->value, '%>') === 0) {
-            $lex->phpType = 'unmatched';
-        } elseif (strpos($lex->value, '?>') === 0) {
-            if ($lex->is_xml) {
-                $lex->is_xml = false;
-                $lex->phpType = 'xml';
-                return;
-            }
-            $lex->phpType = 'unmatched';
-        } elseif (strpos($lex->value, '<s') === 0) {
-            $lex->phpType = 'script';
-            $closeTag = '</script>';
-        } elseif (strpos($lex->value, $lex->smarty->left_delimiter) === 0) {
-            if ($lex->isAutoLiteral()) {
-                $lex->token = Smarty_Internal_Templateparser::TP_TEXT;
-                return;
-            }
-            $closeTag = "{$lex->smarty->left_delimiter}/php{$lex->smarty->right_delimiter}";
-            if ($lex->value === $closeTag) {
-                $lex->compiler->trigger_template_error("unexpected closing tag '{$closeTag}'");
-            }
-            $lex->phpType = 'tag';
-        }
-        if ($lex->phpType === 'unmatched') {
-            return;
-        }
-        if (($lex->phpType === 'php' || $lex->phpType === 'asp')
-            &&
-            ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU ||
-             $lex->compiler->php_handling === Smarty::PHP_QUOTE)
-        ) {
-            return;
-        }
-        $start = $lex->counter + strlen($lex->value);
-        $body = true;
-        if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) {
-            $close = $match[ 0 ][ 1 ];
-        } else {
-            $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'");
-        }
-        while ($body) {
-            if (preg_match(
-                '~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~',
-                $lex->data,
-                $match,
-                PREG_OFFSET_CAPTURE,
-                $start
-            )
-            ) {
-                $value = $match[ 0 ][ 0 ];
-                $from = $pos = $match[ 0 ][ 1 ];
-                if ($pos > $close) {
-                    $body = false;
-                } else {
-                    $start = $pos + strlen($value);
-                    $phpCommentStart = $value === '/*';
-                    if ($phpCommentStart) {
-                        $phpCommentEnd = preg_match('~([*][/])~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start);
-                        if ($phpCommentEnd) {
-                            $pos2 = $match[ 0 ][ 1 ];
-                            $start = $pos2 + strlen($match[ 0 ][ 0 ]);
-                        }
-                    }
-                    while ($close > $pos && $close < $start) {
-                        if (preg_match(
-                            '~' . preg_quote($closeTag, '~') . '~i',
-                            $lex->data,
-                            $match,
-                            PREG_OFFSET_CAPTURE,
-                            $from
-                        )
-                        ) {
-                            $close = $match[ 0 ][ 1 ];
-                            $from = $close + strlen($match[ 0 ][ 0 ]);
-                        } else {
-                            $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'");
-                        }
-                    }
-                    if ($phpCommentStart && (!$phpCommentEnd || $pos2 > $close)) {
-                        $lex->taglineno = $lex->line + substr_count(substr($lex->data, $lex->counter, $start), "\n");
-                        $lex->compiler->trigger_template_error("missing PHP comment closing tag '*/'");
-                    }
-                }
-            } else {
-                $body = false;
-            }
-        }
-        $lex->value = substr($lex->data, $lex->counter, $close + strlen($closeTag) - $lex->counter);
-    }
-
-    /*
-     * Call back function for $php_handling = PHP_QUOTE
-     *
-     */
-    /**
-     * @param $match
-     *
-     * @return string
-     */
-    private function quote($match)
-    {
-        return htmlspecialchars($match[ 0 ], ENT_QUOTES);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php
deleted file mode 100644
index 23cae8aef..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Print Expression
- * Compiles any tag which will output an expression or variable
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Print Expression Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('assign');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $option_flags = array('nocache', 'nofilter');
-
-    /**
-     * Compiles code for generating output from any expression
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $output = $parameter[ 'value' ];
-        // tag modifier
-        if (!empty($parameter[ 'modifierlist' ])) {
-            $output = $compiler->compileTag(
-                'private_modifier',
-                array(),
-                array(
-                    'modifierlist' => $parameter[ 'modifierlist' ],
-                    'value'        => $output
-                )
-            );
-        }
-        if (isset($_attr[ 'assign' ])) {
-            // assign output to variable
-            return "<?php \$_smarty_tpl->assign({$_attr['assign']},{$output});?>";
-        } else {
-            // display value
-            if (!$_attr[ 'nofilter' ]) {
-                // default modifier
-                if (!empty($compiler->smarty->default_modifiers)) {
-                    if (empty($compiler->default_modifier_list)) {
-                        $modifierlist = array();
-                        foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
-                            preg_match_all(
-                                '/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
-                                $single_default_modifier,
-                                $mod_array
-                            );
-                            for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i++) {
-                                if ($mod_array[ 0 ][ $i ] !== ':') {
-                                    $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
-                                }
-                            }
-                        }
-                        $compiler->default_modifier_list = $modifierlist;
-                    }
-                    $output = $compiler->compileTag(
-                        'private_modifier',
-                        array(),
-                        array(
-                            'modifierlist' => $compiler->default_modifier_list,
-                            'value'        => $output
-                        )
-                    );
-                }
-                // autoescape html
-                if ($compiler->template->smarty->escape_html) {
-                    $output = "htmlspecialchars({$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
-                }
-                // loop over registered filters
-                if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) {
-                    foreach ($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ] as $key =>
-                        $function) {
-                        if (!is_array($function)) {
-                            $output = "{$function}({$output},\$_smarty_tpl)";
-                        } elseif (is_object($function[ 0 ])) {
-                            $output =
-                                "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
-                        } else {
-                            $output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
-                        }
-                    }
-                }
-                // auto loaded filters
-                if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) {
-                    foreach ((array)$compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name) {
-                        $result = $this->compile_variable_filter($compiler, $name, $output);
-                        if ($result !== false) {
-                            $output = $result;
-                        } else {
-                            // not found, throw exception
-                            throw new SmartyException("Unable to load variable filter '{$name}'");
-                        }
-                    }
-                }
-                foreach ($compiler->variable_filters as $filter) {
-                    if (count($filter) === 1
-                        && ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false
-                    ) {
-                        $output = $result;
-                    } else {
-                        $output = $compiler->compileTag(
-                            'private_modifier',
-                            array(),
-                            array('modifierlist' => array($filter), 'value' => $output)
-                        );
-                    }
-                }
-            }
-            $output = "<?php echo {$output};?>\n";
-        }
-        return $output;
-    }
-
-    /**
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     * @param string                                $name     name of variable filter
-     * @param string                                $output   embedded output
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    private function compile_variable_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output)
-    {
-        $function = $compiler->getPlugin($name, 'variablefilter');
-        if ($function) {
-            return "{$function}({$output},\$_smarty_tpl)";
-        } else {
-            // not found
-            return false;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php
deleted file mode 100644
index 0f818d1b3..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Registered Block
- * Compiles code for the execution of a registered block function
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Registered Block Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_Compile_Private_Block_Plugin
-{
-    /**
-     * Setup callback, parameter array and nocache mode
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param array                                 $_attr attributes
-     * @param string                                $tag
-     * @param null                                  $function
-     *
-     * @return array
-     */
-    public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $function)
-    {
-        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
-            $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
-            $callback = $tag_info[ 0 ];
-            if (is_array($callback)) {
-                if (is_object($callback[ 0 ])) {
-                    $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
-                    $callback =
-                        array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
-                } else {
-                    $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
-                    $callback =
-                        array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
-                }
-            } else {
-                $callable = "\$_block_plugin{$this->nesting}";
-                $callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
-            }
-        } else {
-            $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
-            $callback = $tag_info[ 0 ];
-            if (is_array($callback)) {
-                $callable = "array('{$callback[0]}', '{$callback[1]}')";
-                $callback = "{$callback[1]}::{$callback[1]}";
-            } else {
-                $callable = null;
-            }
-        }
-        $compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
-                $_value = str_replace('\'', "^#^", $_value);
-                $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        return array($callback, $_paramsArray, $callable);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php
deleted file mode 100644
index 2591107d2..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Registered Function
- * Compiles code for the execution of a registered function
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Registered Function Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('_any');
-
-    /**
-     * Compiles code for the execution of a registered function
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     * @param string                                $tag       name of function
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        unset($_attr[ 'nocache' ]);
-        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) {
-            $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
-            $is_registered = true;
-        } else {
-            $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
-            $is_registered = false;
-        }
-        // not cacheable?
-        $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ];
-        // convert attributes into parameter array string
-        $_paramsArray = array();
-        foreach ($_attr as $_key => $_value) {
-            if (is_int($_key)) {
-                $_paramsArray[] = "$_key=>$_value";
-            } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
-                $_value = str_replace('\'', "^#^", $_value);
-                $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
-            } else {
-                $_paramsArray[] = "'$_key'=>$_value";
-            }
-        }
-        $_params = 'array(' . implode(',', $_paramsArray) . ')';
-        // compile code
-        if ($is_registered) {
-            $output =
-                "call_user_func_array( \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0], array( {$_params},\$_smarty_tpl ) )";
-        } else {
-            $function = $tag_info[ 0 ];
-            if (!is_array($function)) {
-                $output = "{$function}({$_params},\$_smarty_tpl)";
-            } else {
-                $output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)";
-            }
-        }
-        if (!empty($parameter[ 'modifierlist' ])) {
-            $output = $compiler->compileTag(
-                'private_modifier',
-                array(),
-                array(
-                    'modifierlist' => $parameter[ 'modifierlist' ],
-                    'value'        => $output
-                )
-            );
-        }
-        $output = "<?php echo {$output};?>\n";
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php
deleted file mode 100644
index d53ef51ff..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Special Smarty Variable
- * Compiles the special $smarty variables
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile special Smarty Variable Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the special $smarty variables
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     * @param                                       $parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        $_index = preg_split("/\]\[/", substr($parameter, 1, strlen($parameter) - 2));
-        $variable = strtolower($compiler->getId($_index[ 0 ]));
-        if ($variable === false) {
-            $compiler->trigger_template_error("special \$Smarty variable name index can not be variable", null, true);
-        }
-        if (!isset($compiler->smarty->security_policy)
-            || $compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler)
-        ) {
-            switch ($variable) {
-                case 'foreach':
-                case 'section':
-                    if (!isset(Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ])) {
-                        $class = 'Smarty_Internal_Compile_' . ucfirst($variable);
-                        Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ] = new $class;
-                    }
-                    return Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ]->compileSpecialVariable(
-                        array(),
-                        $compiler,
-                        $_index
-                    );
-                case 'capture':
-                    if (class_exists('Smarty_Internal_Compile_Capture')) {
-                        return Smarty_Internal_Compile_Capture::compileSpecialVariable(array(), $compiler, $_index);
-                    }
-                    return '';
-                case 'now':
-                    return 'time()';
-                case 'cookies':
-                    if (isset($compiler->smarty->security_policy)
-                        && !$compiler->smarty->security_policy->allow_super_globals
-                    ) {
-                        $compiler->trigger_template_error("(secure mode) super globals not permitted");
-                        break;
-                    }
-                    $compiled_ref = '$_COOKIE';
-                    break;
-                case 'get':
-                case 'post':
-                case 'env':
-                case 'server':
-                case 'session':
-                case 'request':
-                    if (isset($compiler->smarty->security_policy)
-                        && !$compiler->smarty->security_policy->allow_super_globals
-                    ) {
-                        $compiler->trigger_template_error("(secure mode) super globals not permitted");
-                        break;
-                    }
-                    $compiled_ref = '$_' . strtoupper($variable);
-                    break;
-                case 'template':
-                    return 'basename($_smarty_tpl->source->filepath)';
-                case 'template_object':
-                    if (isset($compiler->smarty->security_policy)) {
-                        $compiler->trigger_template_error("(secure mode) template_object not permitted");
-                        break;
-                    }
-                    return '$_smarty_tpl';
-                case 'current_dir':
-                    return 'dirname($_smarty_tpl->source->filepath)';
-                case 'version':
-                    return "Smarty::SMARTY_VERSION";
-                case 'const':
-                    if (isset($compiler->smarty->security_policy)
-                        && !$compiler->smarty->security_policy->allow_constants
-                    ) {
-                        $compiler->trigger_template_error("(secure mode) constants not permitted");
-                        break;
-                    }
-                    if (strpos($_index[ 1 ], '$') === false && strpos($_index[ 1 ], '\'') === false) {
-                        return "(defined('{$_index[1]}') ? constant('{$_index[1]}') : null)";
-                    } else {
-                        return "(defined({$_index[1]}) ? constant({$_index[1]}) : null)";
-                    }
-                // no break
-                case 'config':
-                    if (isset($_index[ 2 ])) {
-                        return "(is_array(\$tmp = \$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])) ? \$tmp[$_index[2]] : null)";
-                    } else {
-                        return "\$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])";
-                    }
-                // no break
-                case 'ldelim':
-                    return "\$_smarty_tpl->smarty->left_delimiter";
-                case 'rdelim':
-                    return "\$_smarty_tpl->smarty->right_delimiter";
-                default:
-                    $compiler->trigger_template_error('$smarty.' . trim($_index[ 0 ], "'") . ' is not defined');
-                    break;
-            }
-            if (isset($_index[ 1 ])) {
-                array_shift($_index);
-                foreach ($_index as $_ind) {
-                    $compiled_ref = $compiled_ref . "[$_ind]";
-                }
-            }
-            return $compiled_ref;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_rdelim.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_rdelim.php
deleted file mode 100644
index 1cc340c18..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_rdelim.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Rdelim
- * Compiles the {rdelim} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Rdelim Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim
-{
-    /**
-     * Compiles code for the {rdelim} tag
-     * This tag does output the right delimiter.
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        parent::compile($args, $compiler);
-        return $compiler->smarty->right_delimiter;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_section.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_section.php
deleted file mode 100644
index 0dee20820..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_section.php
+++ /dev/null
@@ -1,462 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Section
- * Compiles the {section} {sectionelse} {/section} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Section Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_ForeachSection
-{
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $required_attributes = array('name', 'loop');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $shorttag_order = array('name', 'loop');
-
-    /**
-     * Attribute definition: Overwrites base class.
-     *
-     * @var array
-     * @see Smarty_Internal_CompileBase
-     */
-    public $optional_attributes = array('start', 'step', 'max', 'show', 'properties');
-
-    /**
-     * counter
-     *
-     * @var int
-     */
-    public $counter = 0;
-
-    /**
-     * Name of this tag
-     *
-     * @var string
-     */
-    public $tagName = 'section';
-
-    /**
-     * Valid properties of $smarty.section.name.xxx variable
-     *
-     * @var array
-     */
-    public $nameProperties = array(
-        'first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev',
-        'index_next', 'loop'
-    );
-
-    /**
-     * {section} tag has no item properties
-     *
-     * @var array
-     */
-    public $itemProperties = null;
-
-    /**
-     * {section} tag has always name attribute
-     *
-     * @var bool
-     */
-    public $isNamed = true;
-
-    /**
-     * Compiles code for the {section} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     * @throws \SmartyException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $compiler->loopNesting++;
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $attributes = array('name' => $compiler->getId($_attr[ 'name' ]));
-        unset($_attr[ 'name' ]);
-        foreach ($attributes as $a => $v) {
-            if ($v === false) {
-                $compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true);
-            }
-        }
-        $local = "\$__section_{$attributes['name']}_" . $this->counter++ . '_';
-        $sectionVar = "\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']";
-        $this->openTag($compiler, 'section', array('section', $compiler->nocache, $local, $sectionVar));
-        // maybe nocache because of nocache variables
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        $initLocal = array();
-        $initNamedProperty = array();
-        $initFor = array();
-        $incFor = array();
-        $cmpFor = array();
-        $propValue = array(
-            'index'     => "{$sectionVar}->value['index']", 'show' => 'true', 'step' => 1,
-            'iteration' => "{$local}iteration",
-        );
-        $propType = array('index' => 2, 'iteration' => 2, 'show' => 0, 'step' => 0,);
-        // search for used tag attributes
-        $this->scanForProperties($attributes, $compiler);
-        if (!empty($this->matchResults[ 'named' ])) {
-            $namedAttr = $this->matchResults[ 'named' ];
-        }
-        if (isset($_attr[ 'properties' ]) && preg_match_all("/['](.*?)[']/", $_attr[ 'properties' ], $match)) {
-            foreach ($match[ 1 ] as $prop) {
-                if (in_array($prop, $this->nameProperties)) {
-                    $namedAttr[ $prop ] = true;
-                } else {
-                    $compiler->trigger_template_error("Invalid property '{$prop}'", null, true);
-                }
-            }
-        }
-        $namedAttr[ 'index' ] = true;
-        $output = "<?php\n";
-        foreach ($_attr as $attr_name => $attr_value) {
-            switch ($attr_name) {
-                case 'loop':
-                    if (is_numeric($attr_value)) {
-                        $v = (int)$attr_value;
-                        $t = 0;
-                    } else {
-                        $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))";
-                        $t = 1;
-                    }
-                    if ($t === 1) {
-                        $initLocal[ 'loop' ] = $v;
-                        $v = "{$local}loop";
-                    }
-                    break;
-                case 'show':
-                    if (is_bool($attr_value)) {
-                        $v = $attr_value ? 'true' : 'false';
-                        $t = 0;
-                    } else {
-                        $v = "(bool) $attr_value";
-                        $t = 3;
-                    }
-                    break;
-                case 'step':
-                    if (is_numeric($attr_value)) {
-                        $v = (int)$attr_value;
-                        $v = ($v === 0) ? 1 : $v;
-                        $t = 0;
-                        break;
-                    }
-                    $initLocal[ 'step' ] = "((int)@$attr_value) === 0 ? 1 : (int)@$attr_value";
-                    $v = "{$local}step";
-                    $t = 2;
-                    break;
-                case 'max':
-                case 'start':
-                    if (is_numeric($attr_value)) {
-                        $v = (int)$attr_value;
-                        $t = 0;
-                        break;
-                    }
-                    $v = "(int)@$attr_value";
-                    $t = 3;
-                    break;
-            }
-            if ($t === 3 && $compiler->getId($attr_value)) {
-                $t = 1;
-            }
-            $propValue[ $attr_name ] = $v;
-            $propType[ $attr_name ] = $t;
-        }
-        if (isset($namedAttr[ 'step' ])) {
-            $initNamedProperty[ 'step' ] = $propValue[ 'step' ];
-        }
-        if (isset($namedAttr[ 'iteration' ])) {
-            $propValue[ 'iteration' ] = "{$sectionVar}->value['iteration']";
-        }
-        $incFor[ 'iteration' ] = "{$propValue['iteration']}++";
-        $initFor[ 'iteration' ] = "{$propValue['iteration']} = 1";
-        if ($propType[ 'step' ] === 0) {
-            if ($propValue[ 'step' ] === 1) {
-                $incFor[ 'index' ] = "{$sectionVar}->value['index']++";
-            } elseif ($propValue[ 'step' ] > 1) {
-                $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
-            } else {
-                $incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . -$propValue[ 'step' ];
-            }
-        } else {
-            $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}";
-        }
-        if (!isset($propValue[ 'max' ])) {
-            $propValue[ 'max' ] = $propValue[ 'loop' ];
-            $propType[ 'max' ] = $propType[ 'loop' ];
-        } elseif ($propType[ 'max' ] !== 0) {
-            $propValue[ 'max' ] = "{$propValue['max']} < 0 ? {$propValue['loop']} : {$propValue['max']}";
-            $propType[ 'max' ] = 1;
-        } else {
-            if ($propValue[ 'max' ] < 0) {
-                $propValue[ 'max' ] = $propValue[ 'loop' ];
-                $propType[ 'max' ] = $propType[ 'loop' ];
-            }
-        }
-        if (!isset($propValue[ 'start' ])) {
-            $start_code =
-                array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1');
-            if ($propType[ 'loop' ] === 0) {
-                $start_code[ 5 ] = '';
-                $start_code[ 4 ] = $propValue[ 'loop' ] - 1;
-            }
-            if ($propType[ 'step' ] === 0) {
-                if ($propValue[ 'step' ] > 0) {
-                    $start_code = array(1 => '0');
-                    $propType[ 'start' ] = 0;
-                } else {
-                    $start_code[ 1 ] = $start_code[ 2 ] = $start_code[ 3 ] = '';
-                    $propType[ 'start' ] = $propType[ 'loop' ];
-                }
-            } else {
-                $propType[ 'start' ] = 1;
-            }
-            $propValue[ 'start' ] = join('', $start_code);
-        } else {
-            $start_code =
-                array(
-                    1  => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0',
-                    5  => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')',
-                    11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ',
-                    15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ',
-                    18 => $propType[ 'loop' ] === 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1",
-                    19 => ')'
-                );
-            if ($propType[ 'step' ] === 0) {
-                $start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = '';
-                if ($propValue[ 'step' ] > 0) {
-                    $start_code[ 6 ] = $start_code[ 18 ] = '';
-                } else {
-                    $start_code[ 4 ] = $start_code[ 16 ] = '';
-                }
-            }
-            if ($propType[ 'start' ] === 0) {
-                if ($propType[ 'loop' ] === 0) {
-                    $start_code[ 8 ] = $propValue[ 'start' ] + $propValue[ 'loop' ];
-                }
-                $propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ];
-                $start_code[ 1 ] = '';
-                if ($propValue[ 'start' ] < 0) {
-                    for ($i = 11; $i <= 19; $i++) {
-                        $start_code[ $i ] = '';
-                    }
-                    if ($propType[ 'start' ] === 0) {
-                        $start_code = array(
-                            max(
-                                $propValue[ 'step' ] > 0 ? 0 : -1,
-                                $propValue[ 'start' ] + $propValue[ 'loop' ]
-                            )
-                        );
-                    }
-                } else {
-                    for ($i = 1; $i <= 11; $i++) {
-                        $start_code[ $i ] = '';
-                    }
-                    if ($propType[ 'start' ] === 0) {
-                        $start_code =
-                            array(
-                                min(
-                                    $propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
-                                    $propValue[ 'start' ]
-                                )
-                            );
-                    }
-                }
-            }
-            $propValue[ 'start' ] = join('', $start_code);
-        }
-        if ($propType[ 'start' ] !== 0) {
-            $initLocal[ 'start' ] = $propValue[ 'start' ];
-            $propValue[ 'start' ] = "{$local}start";
-        }
-        $initFor[ 'index' ] = "{$sectionVar}->value['index'] = {$propValue['start']}";
-        if (!isset($_attr[ 'start' ]) && !isset($_attr[ 'step' ]) && !isset($_attr[ 'max' ])) {
-            $propValue[ 'total' ] = $propValue[ 'loop' ];
-            $propType[ 'total' ] = $propType[ 'loop' ];
-        } else {
-            $propType[ 'total' ] =
-                $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
-            if ($propType[ 'total' ] === 0) {
-                $propValue[ 'total' ] =
-                    min(
-                        ceil(
-                            ($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
-                                (int)$propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])
-                        ),
-                        $propValue[ 'max' ]
-                    );
-            } else {
-                $total_code = array(
-                    1  => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
-                    5  => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
-                    9  => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(',
-                    14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",
-                );
-                if (!isset($propValue[ 'max' ])) {
-                    $total_code[ 1 ] = $total_code[ 17 ] = '';
-                }
-                if ($propType[ 'loop' ] + $propType[ 'start' ] === 0) {
-                    $total_code[ 5 ] = $propValue[ 'loop' ] - $propValue[ 'start' ];
-                    $total_code[ 6 ] = $total_code[ 7 ] = '';
-                }
-                if ($propType[ 'start' ] === 0) {
-                    $total_code[ 9 ] = (int)$propValue[ 'start' ] + 1;
-                    $total_code[ 10 ] = '';
-                }
-                if ($propType[ 'step' ] === 0) {
-                    $total_code[ 13 ] = $total_code[ 15 ] = '';
-                    if ($propValue[ 'step' ] === 1 || $propValue[ 'step' ] === -1) {
-                        $total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = '';
-                    } elseif ($propValue[ 'step' ] < 0) {
-                        $total_code[ 14 ] = -$propValue[ 'step' ];
-                    }
-                    $total_code[ 4 ] = '';
-                    if ($propValue[ 'step' ] > 0) {
-                        $total_code[ 8 ] = $total_code[ 9 ] = $total_code[ 10 ] = '';
-                    } else {
-                        $total_code[ 5 ] = $total_code[ 6 ] = $total_code[ 7 ] = $total_code[ 8 ] = '';
-                    }
-                }
-                $propValue[ 'total' ] = join('', $total_code);
-            }
-        }
-        if (isset($namedAttr[ 'loop' ])) {
-            $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['loop']}";
-        }
-        if (isset($namedAttr[ 'total' ])) {
-            $initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}";
-            if ($propType[ 'total' ] > 0) {
-                $propValue[ 'total' ] = "{$sectionVar}->value['total']";
-            }
-        } elseif ($propType[ 'total' ] > 0) {
-            $initLocal[ 'total' ] = $propValue[ 'total' ];
-            $propValue[ 'total' ] = "{$local}total";
-        }
-        $cmpFor[ 'iteration' ] = "{$propValue['iteration']} <= {$propValue['total']}";
-        foreach ($initLocal as $key => $code) {
-            $output .= "{$local}{$key} = {$code};\n";
-        }
-        $_vars = 'array(' . join(', ', $initNamedProperty) . ')';
-        $output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n";
-        $cond_code = "{$propValue['total']} !== 0";
-        if ($propType[ 'total' ] === 0) {
-            if ($propValue[ 'total' ] === 0) {
-                $cond_code = 'false';
-            } else {
-                $cond_code = 'true';
-            }
-        }
-        if ($propType[ 'show' ] > 0) {
-            $output .= "{$local}show = {$propValue['show']} ? {$cond_code} : false;\n";
-            $output .= "if ({$local}show) {\n";
-        } elseif ($propValue[ 'show' ] === 'true') {
-            $output .= "if ({$cond_code}) {\n";
-        } else {
-            $output .= "if (false) {\n";
-        }
-        $jinit = join(', ', $initFor);
-        $jcmp = join(', ', $cmpFor);
-        $jinc = join(', ', $incFor);
-        $output .= "for ({$jinit}; {$jcmp}; {$jinc}){\n";
-        if (isset($namedAttr[ 'rownum' ])) {
-            $output .= "{$sectionVar}->value['rownum'] = {$propValue['iteration']};\n";
-        }
-        if (isset($namedAttr[ 'index_prev' ])) {
-            $output .= "{$sectionVar}->value['index_prev'] = {$propValue['index']} - {$propValue['step']};\n";
-        }
-        if (isset($namedAttr[ 'index_next' ])) {
-            $output .= "{$sectionVar}->value['index_next'] = {$propValue['index']} + {$propValue['step']};\n";
-        }
-        if (isset($namedAttr[ 'first' ])) {
-            $output .= "{$sectionVar}->value['first'] = ({$propValue['iteration']} === 1);\n";
-        }
-        if (isset($namedAttr[ 'last' ])) {
-            $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} === {$propValue['total']});\n";
-        }
-        $output .= '?>';
-        return $output;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Sectionelse Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {sectionelse} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        list($openTag, $nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section'));
-        $this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache, $local, $sectionVar));
-        return "<?php }} else {\n ?>";
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Sectionclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/section} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $compiler->loopNesting--;
-        // must endblock be nocache?
-        if ($compiler->nocache) {
-            $compiler->tag_nocache = true;
-        }
-        list($openTag, $compiler->nocache, $local, $sectionVar) =
-            $this->closeTag($compiler, array('section', 'sectionelse'));
-        $output = "<?php\n";
-        if ($openTag === 'sectionelse') {
-            $output .= "}\n";
-        } else {
-            $output .= "}\n}\n";
-        }
-        $output .= '?>';
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_setfilter.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_setfilter.php
deleted file mode 100644
index 70e2e2f9f..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_setfilter.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Setfilter
- * Compiles code for setfilter tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Setfilter Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for setfilter tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        $compiler->variable_filter_stack[] = $compiler->variable_filters;
-        $compiler->variable_filters = $parameter[ 'modifier_list' ];
-        // this tag does not return compiled code
-        $compiler->has_code = false;
-        return true;
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Setfilterclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/setfilter} tag
-     * This tag does not generate compiled output. It resets variable filter.
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $_attr = $this->getAttributes($compiler, $args);
-        // reset variable filter to previous state
-        if (count($compiler->variable_filter_stack)) {
-            $compiler->variable_filters = array_pop($compiler->variable_filter_stack);
-        } else {
-            $compiler->variable_filters = array();
-        }
-        // this tag does not return compiled code
-        $compiler->has_code = false;
-        return true;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php
deleted file mode 100644
index d90262e60..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile Shared Inheritance
- * Shared methods for {extends} and {block} tags
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Shared Inheritance Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compile inheritance initialization code as prefix
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param bool|false                            $initChildSequence if true force child template
-     */
-    public static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
-    {
-        $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " .
-                                         var_export($initChildSequence, true) . ");\n?>\n";
-    }
-
-    /**
-     * Register post compile callback to compile inheritance initialization code
-     *
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     * @param bool|false                            $initChildSequence if true force child template
-     */
-    public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
-    {
-        if ($initChildSequence || !isset($compiler->_cache[ 'inheritanceInit' ])) {
-            $compiler->registerPostCompileCallback(
-                array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
-                array($initChildSequence),
-                'inheritanceInit',
-                $initChildSequence
-            );
-            $compiler->_cache[ 'inheritanceInit' ] = true;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_while.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compile_while.php
deleted file mode 100644
index 5aa3a7330..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compile_while.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Compile While
- * Compiles the {while} tag
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile While Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {while} tag
-     *
-     * @param array                                 $args      array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
-     * @param array                                 $parameter array with compilation parameter
-     *
-     * @return string compiled code
-     * @throws \SmartyCompilerException
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
-    {
-        $compiler->loopNesting++;
-        // check and get attributes
-        $_attr = $this->getAttributes($compiler, $args);
-        $this->openTag($compiler, 'while', $compiler->nocache);
-        if (!array_key_exists('if condition', $parameter)) {
-            $compiler->trigger_template_error('missing while condition', null, true);
-        }
-        // maybe nocache because of nocache variables
-        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
-        if (is_array($parameter[ 'if condition' ])) {
-            if ($compiler->nocache) {
-                // create nocache var to make it know for further compiling
-                if (is_array($parameter[ 'if condition' ][ 'var' ])) {
-                    $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
-                } else {
-                    $var = $parameter[ 'if condition' ][ 'var' ];
-                }
-                $compiler->setNocacheInVariable($var);
-            }
-            $prefixVar = $compiler->getNewPrefixVariable();
-            $assignCompiler = new Smarty_Internal_Compile_Assign();
-            $assignAttr = array();
-            $assignAttr[][ 'value' ] = $prefixVar;
-            if (is_array($parameter[ 'if condition' ][ 'var' ])) {
-                $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
-                $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";
-                $_output .= $assignCompiler->compile(
-                    $assignAttr,
-                    $compiler,
-                    array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
-                );
-            } else {
-                $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
-                $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";
-                $_output .= $assignCompiler->compile($assignAttr, $compiler, array());
-            }
-            return $_output;
-        } else {
-            return "<?php\n while ({$parameter['if condition']}) {?>";
-        }
-    }
-}
-
-/**
- * Smarty Internal Plugin Compile Whileclose Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase
-{
-    /**
-     * Compiles code for the {/while} tag
-     *
-     * @param array                                 $args     array with attributes from parser
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
-     *
-     * @return string compiled code
-     */
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $compiler->loopNesting--;
-        // must endblock be nocache?
-        if ($compiler->nocache) {
-            $compiler->tag_nocache = true;
-        }
-        $compiler->nocache = $this->closeTag($compiler, array('while'));
-        return "<?php }?>\n";
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_compilebase.php b/libraries/Smarty/libs/sysplugins/smarty_internal_compilebase.php
deleted file mode 100644
index 2a32e4373..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_compilebase.php
+++ /dev/null
@@ -1,203 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin CompileBase
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * This class does extend all internal compile plugins
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-abstract class Smarty_Internal_CompileBase
-{
-    /**
-     * Array of names of required attribute required by tag
-     *
-     * @var array
-     */
-    public $required_attributes = array();
-
-    /**
-     * Array of names of optional attribute required by tag
-     * use array('_any') if there is no restriction of attributes names
-     *
-     * @var array
-     */
-    public $optional_attributes = array();
-
-    /**
-     * Shorttag attribute order defined by its names
-     *
-     * @var array
-     */
-    public $shorttag_order = array();
-
-    /**
-     * Array of names of valid option flags
-     *
-     * @var array
-     */
-    public $option_flags = array('nocache');
-
-    /**
-     * Mapping array for boolean option value
-     *
-     * @var array
-     */
-    public $optionMap = array(1 => true, 0 => false, 'true' => true, 'false' => false);
-
-    /**
-     * Mapping array with attributes as key
-     *
-     * @var array
-     */
-    public $mapCache = array();
-
-    /**
-     * This function checks if the attributes passed are valid
-     * The attributes passed for the tag to compile are checked against the list of required and
-     * optional attributes. Required attributes must be present. Optional attributes are check against
-     * the corresponding list. The keyword '_any' specifies that any attribute will be accepted
-     * as valid
-     *
-     * @param object $compiler   compiler object
-     * @param array  $attributes attributes applied to the tag
-     *
-     * @return array  of mapped attributes for further processing
-     */
-    public function getAttributes($compiler, $attributes)
-    {
-        $_indexed_attr = array();
-        if (!isset($this->mapCache[ 'option' ])) {
-            $this->mapCache[ 'option' ] = array_fill_keys($this->option_flags, true);
-        }
-        foreach ($attributes as $key => $mixed) {
-            // shorthand ?
-            if (!is_array($mixed)) {
-                // option flag ?
-                if (isset($this->mapCache[ 'option' ][ trim($mixed, '\'"') ])) {
-                    $_indexed_attr[ trim($mixed, '\'"') ] = true;
-                    // shorthand attribute ?
-                } elseif (isset($this->shorttag_order[ $key ])) {
-                    $_indexed_attr[ $this->shorttag_order[ $key ] ] = $mixed;
-                } else {
-                    // too many shorthands
-                    $compiler->trigger_template_error('too many shorthand attributes', null, true);
-                }
-                // named attribute
-            } else {
-                foreach ($mixed as $k => $v) {
-                    // option flag?
-                    if (isset($this->mapCache[ 'option' ][ $k ])) {
-                        if (is_bool($v)) {
-                            $_indexed_attr[ $k ] = $v;
-                        } else {
-                            if (is_string($v)) {
-                                $v = trim($v, '\'" ');
-                            }
-                            if (isset($this->optionMap[ $v ])) {
-                                $_indexed_attr[ $k ] = $this->optionMap[ $v ];
-                            } else {
-                                $compiler->trigger_template_error(
-                                    "illegal value '" . var_export($v, true) .
-                                    "' for option flag '{$k}'",
-                                    null,
-                                    true
-                                );
-                            }
-                        }
-                        // must be named attribute
-                    } else {
-                        $_indexed_attr[ $k ] = $v;
-                    }
-                }
-            }
-        }
-        // check if all required attributes present
-        foreach ($this->required_attributes as $attr) {
-            if (!isset($_indexed_attr[ $attr ])) {
-                $compiler->trigger_template_error("missing '{$attr}' attribute", null, true);
-            }
-        }
-        // check for not allowed attributes
-        if ($this->optional_attributes !== array('_any')) {
-            if (!isset($this->mapCache[ 'all' ])) {
-                $this->mapCache[ 'all' ] =
-                    array_fill_keys(
-                        array_merge(
-                            $this->required_attributes,
-                            $this->optional_attributes,
-                            $this->option_flags
-                        ),
-                        true
-                    );
-            }
-            foreach ($_indexed_attr as $key => $dummy) {
-                if (!isset($this->mapCache[ 'all' ][ $key ]) && $key !== 0) {
-                    $compiler->trigger_template_error("unexpected '{$key}' attribute", null, true);
-                }
-            }
-        }
-        // default 'false' for all option flags not set
-        foreach ($this->option_flags as $flag) {
-            if (!isset($_indexed_attr[ $flag ])) {
-                $_indexed_attr[ $flag ] = false;
-            }
-        }
-        if (isset($_indexed_attr[ 'nocache' ]) && $_indexed_attr[ 'nocache' ]) {
-            $compiler->tag_nocache = true;
-        }
-        return $_indexed_attr;
-    }
-
-    /**
-     * Push opening tag name on stack
-     * Optionally additional data can be saved on stack
-     *
-     * @param object $compiler compiler object
-     * @param string $openTag  the opening tag's name
-     * @param mixed  $data     optional data saved
-     */
-    public function openTag($compiler, $openTag, $data = null)
-    {
-        array_push($compiler->_tag_stack, array($openTag, $data));
-    }
-
-    /**
-     * Pop closing tag
-     * Raise an error if this stack-top doesn't match with expected opening tags
-     *
-     * @param object       $compiler    compiler object
-     * @param array|string $expectedTag the expected opening tag names
-     *
-     * @return mixed        any type the opening tag's name or saved data
-     */
-    public function closeTag($compiler, $expectedTag)
-    {
-        if (count($compiler->_tag_stack) > 0) {
-            // get stacked info
-            list($_openTag, $_data) = array_pop($compiler->_tag_stack);
-            // open tag must match with the expected ones
-            if (in_array($_openTag, (array)$expectedTag)) {
-                if (is_null($_data)) {
-                    // return opening tag
-                    return $_openTag;
-                } else {
-                    // return restored data
-                    return $_data;
-                }
-            }
-            // wrong nesting of tags
-            $compiler->trigger_template_error("unclosed '{$compiler->smarty->left_delimiter}{$_openTag}{$compiler->smarty->right_delimiter}' tag");
-            return;
-        }
-        // wrong nesting of tags
-        $compiler->trigger_template_error('unexpected closing tag', null, true);
-        return;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_config_file_compiler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_config_file_compiler.php
deleted file mode 100644
index 90c5dcefa..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_config_file_compiler.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Config File Compiler
- * This is the config file compiler class. It calls the lexer and parser to
- * perform the compiling.
- *
- * @package    Smarty
- * @subpackage Config
- * @author     Uwe Tews
- */
-
-/**
- * Main config file compiler class
- *
- * @package    Smarty
- * @subpackage Config
- */
-class Smarty_Internal_Config_File_Compiler
-{
-    /**
-     * Lexer class name
-     *
-     * @var string
-     */
-    public $lexer_class;
-
-    /**
-     * Parser class name
-     *
-     * @var string
-     */
-    public $parser_class;
-
-    /**
-     * Lexer object
-     *
-     * @var object
-     */
-    public $lex;
-
-    /**
-     * Parser object
-     *
-     * @var object
-     */
-    public $parser;
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty object
-     */
-    public $smarty;
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty_Internal_Template object
-     */
-    public $template;
-
-    /**
-     * Compiled config data sections and variables
-     *
-     * @var array
-     */
-    public $config_data = array();
-
-    /**
-     * compiled config data must always be written
-     *
-     * @var bool
-     */
-    public $write_compiled_code = true;
-
-    /**
-     * Initialize compiler
-     *
-     * @param string $lexer_class  class name
-     * @param string $parser_class class name
-     * @param Smarty $smarty       global instance
-     */
-    public function __construct($lexer_class, $parser_class, Smarty $smarty)
-    {
-        $this->smarty = $smarty;
-        // get required plugins
-        $this->lexer_class = $lexer_class;
-        $this->parser_class = $parser_class;
-        $this->smarty = $smarty;
-        $this->config_data[ 'sections' ] = array();
-        $this->config_data[ 'vars' ] = array();
-    }
-
-    /**
-     * Method to compile Smarty config source.
-     *
-     * @param Smarty_Internal_Template $template
-     *
-     * @return bool true if compiling succeeded, false if it failed
-     * @throws \SmartyException
-     */
-    public function compileTemplate(Smarty_Internal_Template $template)
-    {
-        $this->template = $template;
-        $this->template->compiled->file_dependency[ $this->template->source->uid ] =
-            array(
-                $this->template->source->filepath,
-                $this->template->source->getTimeStamp(),
-                $this->template->source->type
-            );
-        if ($this->smarty->debugging) {
-            if (!isset($this->smarty->_debug)) {
-                $this->smarty->_debug = new Smarty_Internal_Debug();
-            }
-            $this->smarty->_debug->start_compile($this->template);
-        }
-        // init the lexer/parser to compile the config file
-        /* @var Smarty_Internal_ConfigFileLexer $this->lex */
-        $this->lex = new $this->lexer_class(
-            str_replace(
-                array(
-                    "\r\n",
-                    "\r"
-                ),
-                "\n",
-                $template->source->getContent()
-            ) . "\n",
-            $this
-        );
-        /* @var Smarty_Internal_ConfigFileParser $this->parser */
-        $this->parser = new $this->parser_class($this->lex, $this);
-        if (function_exists('mb_internal_encoding')
-            && function_exists('ini_get')
-            && ((int)ini_get('mbstring.func_overload')) & 2
-        ) {
-            $mbEncoding = mb_internal_encoding();
-            mb_internal_encoding('ASCII');
-        } else {
-            $mbEncoding = null;
-        }
-        if ($this->smarty->_parserdebug) {
-            $this->parser->PrintTrace();
-        }
-        // get tokens from lexer and parse them
-        while ($this->lex->yylex()) {
-            if ($this->smarty->_parserdebug) {
-                echo "<br>Parsing  {$this->parser->yyTokenName[$this->lex->token]} Token {$this->lex->value} Line {$this->lex->line} \n";
-            }
-            $this->parser->doParse($this->lex->token, $this->lex->value);
-        }
-        // finish parsing process
-        $this->parser->doParse(0, 0);
-        if ($mbEncoding) {
-            mb_internal_encoding($mbEncoding);
-        }
-        if ($this->smarty->debugging) {
-            $this->smarty->_debug->end_compile($this->template);
-        }
-        // template header code
-        $template_header =
-            "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
-            "\n";
-        $template_header .= "         compiled from '{$this->template->source->filepath}' */ ?>\n";
-        $code = '<?php $_smarty_tpl->smarty->ext->configLoad->_loadConfigVars($_smarty_tpl, ' .
-                var_export($this->config_data, true) . '); ?>';
-        return $template_header . $this->template->smarty->ext->_codeFrame->create($this->template, $code);
-    }
-
-    /**
-     * display compiler error messages without dying
-     * If parameter $args is empty it is a parser detected syntax error.
-     * In this case the parser is called to obtain information about expected tokens.
-     * If parameter $args contains a string this is used as error message
-     *
-     * @param string $args individual error message or null
-     *
-     * @throws SmartyCompilerException
-     */
-    public function trigger_config_file_error($args = null)
-    {
-        // get config source line which has error
-        $line = $this->lex->line;
-        if (isset($args)) {
-            // $line--;
-        }
-        $match = preg_split("/\n/", $this->lex->data);
-        $error_text =
-            "Syntax error in config file '{$this->template->source->filepath}' on line {$line} '{$match[$line - 1]}' ";
-        if (isset($args)) {
-            // individual error message
-            $error_text .= $args;
-        } else {
-            // expected token from parser
-            foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
-                $exp_token = $this->parser->yyTokenName[ $token ];
-                if (isset($this->lex->smarty_token_names[ $exp_token ])) {
-                    // token type from lexer
-                    $expect[] = '"' . $this->lex->smarty_token_names[ $exp_token ] . '"';
-                } else {
-                    // otherwise internal token name
-                    $expect[] = $this->parser->yyTokenName[ $token ];
-                }
-            }
-            // output parser error message
-            $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect);
-        }
-        throw new SmartyCompilerException($error_text);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_configfilelexer.php b/libraries/Smarty/libs/sysplugins/smarty_internal_configfilelexer.php
deleted file mode 100644
index afb3efcb0..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_configfilelexer.php
+++ /dev/null
@@ -1,739 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Configfilelexer
- *
- * This is the lexer to break the config file source into tokens
- *
- * @package    Smarty
- * @subpackage Config
- * @author     Uwe Tews
- */
-
-/**
- * Smarty_Internal_Configfilelexer
- *
- * This is the config file lexer.
- * It is generated from the smarty_internal_configfilelexer.plex file
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-class Smarty_Internal_Configfilelexer
-{
-    const START              = 1;
-    const VALUE              = 2;
-    const NAKED_STRING_VALUE = 3;
-    const COMMENT            = 4;
-    const SECTION            = 5;
-    const TRIPPLE            = 6;
-
-    /**
-     * Source
-     *
-     * @var string
-     */
-    public $data;
-
-    /**
-     * Source length
-     *
-     * @var int
-     */
-    public $dataLength = null;
-
-    /**
-     * byte counter
-     *
-     * @var int
-     */
-    public $counter;
-
-    /**
-     * token number
-     *
-     * @var int
-     */
-    public $token;
-
-    /**
-     * token value
-     *
-     * @var string
-     */
-    public $value;
-
-    /**
-     * current line
-     *
-     * @var int
-     */
-    public $line;
-
-    /**
-     * state number
-     *
-     * @var int
-     */
-    public $state = 1;
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * trace file
-     *
-     * @var resource
-     */
-    public $yyTraceFILE;
-
-    /**
-     * trace prompt
-     *
-     * @var string
-     */
-    public $yyTracePrompt;
-
-    /**
-     * state names
-     *
-     * @var array
-     */
-    public $state_name = array(
-        1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'
-    );
-
-    /**
-     * token names
-     *
-     * @var array
-     */
-    public $smarty_token_names = array(        // Text for parser error messages
-    );
-
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_Config_File_Compiler
-     */
-    private $compiler = null;
-
-    /**
-     * copy of config_booleanize
-     *
-     * @var bool
-     */
-    private $configBooleanize = false;
-
-    /**
-     * storage for assembled token patterns
-     *
-     * @var string
-     */
-    private $yy_global_pattern1 = null;
-
-    private $yy_global_pattern2 = null;
-
-    private $yy_global_pattern3 = null;
-
-    private $yy_global_pattern4 = null;
-
-    private $yy_global_pattern5 = null;
-
-    private $yy_global_pattern6 = null;
-
-    private $_yy_state          = 1;
-
-    private $_yy_stack          = array();
-
-    /**
-     * constructor
-     *
-     * @param   string                             $data template source
-     * @param Smarty_Internal_Config_File_Compiler $compiler
-     */
-    public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler)
-    {
-        $this->data = $data . "\n"; //now all lines are \n-terminated
-        $this->dataLength = strlen($data);
-        $this->counter = 0;
-        if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
-            $this->counter += strlen($match[ 0 ]);
-        }
-        $this->line = 1;
-        $this->compiler = $compiler;
-        $this->smarty = $compiler->smarty;
-        $this->configBooleanize = $this->smarty->config_booleanize;
-    }
-
-    public function replace($input)
-    {
-        return $input;
-    } // end function
-
-    public function PrintTrace()
-    {
-        $this->yyTraceFILE = fopen('php://output', 'w');
-        $this->yyTracePrompt = '<br>';
-    }
-
-    public function yylex()
-    {
-        return $this->{'yylex' . $this->_yy_state}();
-    }
-
-    public function yypushstate($state)
-    {
-        if ($this->yyTraceFILE) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%sState push %s\n",
-                $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
-            );
-        }
-        array_push($this->_yy_stack, $this->_yy_state);
-        $this->_yy_state = $state;
-        if ($this->yyTraceFILE) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%snew State %s\n",
-                $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
-            );
-        }
-    }
-
-    public function yypopstate()
-    {
-        if ($this->yyTraceFILE) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%sState pop %s\n",
-                $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
-            );
-        }
-        $this->_yy_state = array_pop($this->_yy_stack);
-        if ($this->yyTraceFILE) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%snew State %s\n",
-                $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
-            );
-        }
-    }
-
-    public function yybegin($state)
-    {
-        $this->_yy_state = $state;
-        if ($this->yyTraceFILE) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%sState set %s\n",
-                $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
-            );
-        }
-    }
-
-    public function yylex1()
-    {
-        if (!isset($this->yy_global_pattern1)) {
-            $this->yy_global_pattern1 =
-                $this->replace("/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr(
-                                            $this->data,
-                                            $this->counter,
-                                            5
-                                        ) . '... state START');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r1_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r1_1()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
-        $this->yypushstate(self::COMMENT);
-    }
-
-    public function yy_r1_2()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
-        $this->yypushstate(self::SECTION);
-    }
-
-    public function yy_r1_3()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
-    }
-
-    public function yy_r1_4()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
-        $this->yypushstate(self::VALUE);
-    } // end function
-
-    public function yy_r1_5()
-    {
-        return false;
-    }
-
-    public function yy_r1_6()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
-    }
-
-    public function yy_r1_7()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_ID;
-    }
-
-    public function yy_r1_8()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
-    }
-
-    public function yylex2()
-    {
-        if (!isset($this->yy_global_pattern2)) {
-            $this->yy_global_pattern2 =
-                $this->replace("/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr(
-                                            $this->data,
-                                            $this->counter,
-                                            5
-                                        ) . '... state VALUE');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r2_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r2_1()
-    {
-        return false;
-    }
-
-    public function yy_r2_2()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
-        $this->yypopstate();
-    }
-
-    public function yy_r2_3()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_INT;
-        $this->yypopstate();
-    }
-
-    public function yy_r2_4()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
-        $this->yypushstate(self::TRIPPLE);
-    }
-
-    public function yy_r2_5()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
-        $this->yypopstate();
-    }
-
-    public function yy_r2_6()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
-        $this->yypopstate();
-    } // end function
-
-    public function yy_r2_7()
-    {
-        if (!$this->configBooleanize ||
-            !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) {
-            $this->yypopstate();
-            $this->yypushstate(self::NAKED_STRING_VALUE);
-            return true; //reprocess in new state
-        } else {
-            $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
-            $this->yypopstate();
-        }
-    }
-
-    public function yy_r2_8()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-        $this->yypopstate();
-    }
-
-    public function yy_r2_9()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-        $this->value = '';
-        $this->yypopstate();
-    } // end function
-
-    public function yylex3()
-    {
-        if (!isset($this->yy_global_pattern3)) {
-            $this->yy_global_pattern3 = $this->replace("/\G([^\n]+?(?=[ \t\r]*\n))/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr(
-                                            $this->data,
-                                            $this->counter,
-                                            5
-                                        ) . '... state NAKED_STRING_VALUE');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r3_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r3_1()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-        $this->yypopstate();
-    }
-
-    public function yylex4()
-    {
-        if (!isset($this->yy_global_pattern4)) {
-            $this->yy_global_pattern4 = $this->replace("/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr(
-                                            $this->data,
-                                            $this->counter,
-                                            5
-                                        ) . '... state COMMENT');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r4_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r4_1()
-    {
-        return false;
-    }
-
-    public function yy_r4_2()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
-    } // end function
-
-    public function yy_r4_3()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
-        $this->yypopstate();
-    }
-
-    public function yylex5()
-    {
-        if (!isset($this->yy_global_pattern5)) {
-            $this->yy_global_pattern5 = $this->replace("/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr(
-                                            $this->data,
-                                            $this->counter,
-                                            5
-                                        ) . '... state SECTION');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r5_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r5_1()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
-    }
-
-    public function yy_r5_2()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
-        $this->yypopstate();
-    } // end function
-
-    public function yylex6()
-    {
-        if (!isset($this->yy_global_pattern6)) {
-            $this->yy_global_pattern6 = $this->replace("/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr(
-                                            $this->data,
-                                            $this->counter,
-                                            5
-                                        ) . '... state TRIPPLE');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r6_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r6_1()
-    {
-        $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
-        $this->yypopstate();
-        $this->yypushstate(self::START);
-    }
-
-    public function yy_r6_2()
-    {
-        $to = strlen($this->data);
-        preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
-        if (isset($match[ 0 ][ 1 ])) {
-            $to = $match[ 0 ][ 1 ];
-        } else {
-            $this->compiler->trigger_config_file_error('missing or misspelled literal closing tag');
-        }
-        $this->value = substr($this->data, $this->counter, $to - $this->counter);
-        $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_configfileparser.php b/libraries/Smarty/libs/sysplugins/smarty_internal_configfileparser.php
deleted file mode 100644
index 36fdb76ee..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_configfileparser.php
+++ /dev/null
@@ -1,1046 +0,0 @@
-<?php
-
-class TPC_yyStackEntry
-{
-    public $stateno;       /* The state-number */
-    public $major;         /* The major token value.  This is the code
-                     ** number for the token at this stack level */
-    public $minor; /* The user-supplied minor token value.  This
-                     ** is the value of the token  */
-}
-
-// line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
-
-/**
- * Smarty Internal Plugin Configfileparse
- *
- * This is the config file parser.
- * It is generated from the smarty_internal_configfileparser.y file
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-class Smarty_Internal_Configfileparser
-{
-    // line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
-    const TPC_OPENB                = 1;
-    const TPC_SECTION              = 2;
-    const TPC_CLOSEB               = 3;
-    const TPC_DOT                  = 4;
-    const TPC_ID                   = 5;
-    const TPC_EQUAL                = 6;
-    const TPC_FLOAT                = 7;
-    const TPC_INT                  = 8;
-    const TPC_BOOL                 = 9;
-    const TPC_SINGLE_QUOTED_STRING = 10;
-    const TPC_DOUBLE_QUOTED_STRING = 11;
-    const TPC_TRIPPLE_QUOTES       = 12;
-    const TPC_TRIPPLE_TEXT         = 13;
-    const TPC_TRIPPLE_QUOTES_END   = 14;
-    const TPC_NAKED_STRING         = 15;
-    const TPC_OTHER                = 16;
-    const TPC_NEWLINE              = 17;
-    const TPC_COMMENTSTART         = 18;
-    const YY_NO_ACTION             = 60;
-    const YY_ACCEPT_ACTION         = 59;
-    const YY_ERROR_ACTION          = 58;
-    const YY_SZ_ACTTAB             = 38;
-    const YY_SHIFT_USE_DFLT        = -8;
-    const YY_SHIFT_MAX             = 19;
-    const YY_REDUCE_USE_DFLT       = -17;
-    const YY_REDUCE_MAX            = 10;
-    const YYNOCODE                 = 29;
-    const YYSTACKDEPTH             = 100;
-    const YYNSTATE                 = 36;
-    const YYNRULE                  = 22;
-    const YYERRORSYMBOL            = 19;
-    const YYERRSYMDT               = 'yy0';
-    const YYFALLBACK               = 0;
-
-    public static $yy_action        = array(
-        32, 31, 30, 29, 35, 13, 19, 3, 24, 26,
-        59, 9, 14, 1, 16, 25, 11, 28, 25, 11,
-        17, 27, 34, 20, 18, 15, 23, 5, 6, 22,
-        10, 8, 4, 12, 2, 33, 7, 21,
-    );
-
-    public static $yy_lookahead     = array(
-        7, 8, 9, 10, 11, 12, 5, 23, 15, 16,
-        20, 21, 2, 23, 4, 17, 18, 14, 17, 18,
-        13, 14, 25, 26, 15, 2, 17, 3, 3, 17,
-        25, 25, 6, 1, 23, 27, 22, 24,
-    );
-
-    public static $yy_shift_ofst    = array(
-        -8, 1, 1, 1, -7, -2, -2, 32, -8, -8,
-        -8, 9, 10, 7, 25, 24, 23, 3, 12, 26,
-    );
-
-    public static $yy_reduce_ofst   = array(
-        -10, -3, -3, -3, 8, 6, 5, 13, 11, 14,
-        -16,
-    );
-
-    public static $yyExpectedTokens = array(
-        array(),
-        array(5, 17, 18,),
-        array(5, 17, 18,),
-        array(5, 17, 18,),
-        array(7, 8, 9, 10, 11, 12, 15, 16,),
-        array(17, 18,),
-        array(17, 18,),
-        array(1,),
-        array(),
-        array(),
-        array(),
-        array(15, 17,),
-        array(2, 4,),
-        array(13, 14,),
-        array(3,),
-        array(3,),
-        array(2,),
-        array(14,),
-        array(17,),
-        array(6,),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-    );
-
-    public static $yy_default       = array(
-        44, 37, 41, 40, 58, 58, 58, 36, 44, 39,
-        44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
-        43, 38, 57, 56, 53, 55, 54, 52, 51, 49,
-        48, 47, 46, 45, 42, 50,
-    );
-
-    public static $yyFallback       = array();
-
-    public static $yyRuleName       = array(
-        'start ::= global_vars sections',
-        'global_vars ::= var_list',
-        'sections ::= sections section',
-        'sections ::=',
-        'section ::= OPENB SECTION CLOSEB newline var_list',
-        'section ::= OPENB DOT SECTION CLOSEB newline var_list',
-        'var_list ::= var_list newline',
-        'var_list ::= var_list var',
-        'var_list ::=',
-        'var ::= ID EQUAL value',
-        'value ::= FLOAT',
-        'value ::= INT',
-        'value ::= BOOL',
-        'value ::= SINGLE_QUOTED_STRING',
-        'value ::= DOUBLE_QUOTED_STRING',
-        'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END',
-        'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END',
-        'value ::= NAKED_STRING',
-        'value ::= OTHER',
-        'newline ::= NEWLINE',
-        'newline ::= COMMENTSTART NEWLINE',
-        'newline ::= COMMENTSTART NAKED_STRING NEWLINE',
-    );
-
-    public static $yyRuleInfo       = array(
-        array(0 => 20, 1 => 2),
-        array(0 => 21, 1 => 1),
-        array(0 => 22, 1 => 2),
-        array(0 => 22, 1 => 0),
-        array(0 => 24, 1 => 5),
-        array(0 => 24, 1 => 6),
-        array(0 => 23, 1 => 2),
-        array(0 => 23, 1 => 2),
-        array(0 => 23, 1 => 0),
-        array(0 => 26, 1 => 3),
-        array(0 => 27, 1 => 1),
-        array(0 => 27, 1 => 1),
-        array(0 => 27, 1 => 1),
-        array(0 => 27, 1 => 1),
-        array(0 => 27, 1 => 1),
-        array(0 => 27, 1 => 3),
-        array(0 => 27, 1 => 2),
-        array(0 => 27, 1 => 1),
-        array(0 => 27, 1 => 1),
-        array(0 => 25, 1 => 1),
-        array(0 => 25, 1 => 2),
-        array(0 => 25, 1 => 3),
-    );
-
-    public static $yyReduceMap      = array(
-        0  => 0,
-        2  => 0,
-        3  => 0,
-        19 => 0,
-        20 => 0,
-        21 => 0,
-        1  => 1,
-        4  => 4,
-        5  => 5,
-        6  => 6,
-        7  => 7,
-        8  => 8,
-        9  => 9,
-        10 => 10,
-        11 => 11,
-        12 => 12,
-        13 => 13,
-        14 => 14,
-        15 => 15,
-        16 => 16,
-        17 => 17,
-        18 => 17,
-    );
-
-    /**
-     * helper map
-     *
-     * @var array
-     */
-    private static $escapes_single = array(
-        '\\' => '\\',
-        '\'' => '\''
-    );
-
-    /**
-     * result status
-     *
-     * @var bool
-     */
-    public $successful = true;
-
-    /**
-     * return value
-     *
-     * @var mixed
-     */
-    public $retvalue = 0;
-
-    /**
-     * @var
-     */
-    public $yymajor;
-
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_Config_File_Compiler
-     */
-    public $compiler = null;
-
-    /**
-     * smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty      = null;
-
-    public $yyTraceFILE;
-
-    public $yyTracePrompt;
-
-    public $yyidx;
-
-    public $yyerrcnt;
-
-    public $yystack     = array();
-
-    public $yyTokenName = array(
-        '$', 'OPENB', 'SECTION', 'CLOSEB',
-        'DOT', 'ID', 'EQUAL', 'FLOAT',
-        'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
-        'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING',
-        'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
-        'start', 'global_vars', 'sections', 'var_list',
-        'section', 'newline', 'var', 'value',
-    );
-
-    /**
-     * lexer object
-     *
-     * @var Smarty_Internal_Configfilelexer
-     */
-    private $lex;
-
-    /**
-     * internal error flag
-     *
-     * @var bool
-     */
-    private $internalError = false;
-
-    /**
-     * copy of config_overwrite property
-     *
-     * @var bool
-     */
-    private $configOverwrite = false;
-
-    /**
-     * copy of config_read_hidden property
-     *
-     * @var bool
-     */
-    private $configReadHidden = false;
-
-    private $_retvalue;
-
-    /**
-     * constructor
-     *
-     * @param Smarty_Internal_Configfilelexer      $lex
-     * @param Smarty_Internal_Config_File_Compiler $compiler
-     */
-    public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
-    {
-        $this->lex = $lex;
-        $this->smarty = $compiler->smarty;
-        $this->compiler = $compiler;
-        $this->configOverwrite = $this->smarty->config_overwrite;
-        $this->configReadHidden = $this->smarty->config_read_hidden;
-    }
-
-    public static function yy_destructor($yymajor, $yypminor)
-    {
-        switch ($yymajor) {
-            default:
-                break;   /* If no destructor action specified: do nothing */
-        }
-    }
-
-    /**
-     * parse single quoted string
-     *  remove outer quotes
-     *  unescape inner quotes
-     *
-     * @param string $qstr
-     *
-     * @return string
-     */
-    private static function parse_single_quoted_string($qstr)
-    {
-        $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
-        $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
-        $str = '';
-        foreach ($ss as $s) {
-            if (strlen($s) === 2 && $s[ 0 ] === '\\') {
-                if (isset(self::$escapes_single[ $s[ 1 ] ])) {
-                    $s = self::$escapes_single[ $s[ 1 ] ];
-                }
-            }
-            $str .= $s;
-        }
-        return $str;
-    }                    /* Index of top element in stack */
-    /**
-     * parse double quoted string
-     *
-     * @param string $qstr
-     *
-     * @return string
-     */
-    private static function parse_double_quoted_string($qstr)
-    {
-        $inner_str = substr($qstr, 1, strlen($qstr) - 2);
-        return stripcslashes($inner_str);
-    }                 /* Shifts left before out of the error */
-    /**
-     * parse triple quoted string
-     *
-     * @param string $qstr
-     *
-     * @return string
-     */
-    private static function parse_tripple_double_quoted_string($qstr)
-    {
-        return stripcslashes($qstr);
-    }  /* The parser's stack */
-    public function Trace($TraceFILE, $zTracePrompt)
-    {
-        if (!$TraceFILE) {
-            $zTracePrompt = 0;
-        } elseif (!$zTracePrompt) {
-            $TraceFILE = 0;
-        }
-        $this->yyTraceFILE = $TraceFILE;
-        $this->yyTracePrompt = $zTracePrompt;
-    }
-
-    public function PrintTrace()
-    {
-        $this->yyTraceFILE = fopen('php://output', 'w');
-        $this->yyTracePrompt = '<br>';
-    }
-
-    public function tokenName($tokenType)
-    {
-        if ($tokenType === 0) {
-            return 'End of Input';
-        }
-        if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
-            return $this->yyTokenName[ $tokenType ];
-        } else {
-            return 'Unknown';
-        }
-    }
-
-    public function yy_pop_parser_stack()
-    {
-        if (empty($this->yystack)) {
-            return;
-        }
-        $yytos = array_pop($this->yystack);
-        if ($this->yyTraceFILE && $this->yyidx >= 0) {
-            fwrite(
-                $this->yyTraceFILE,
-                $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] .
-                "\n"
-            );
-        }
-        $yymajor = $yytos->major;
-        self::yy_destructor($yymajor, $yytos->minor);
-        $this->yyidx--;
-        return $yymajor;
-    }
-
-    public function __destruct()
-    {
-        while ($this->yystack !== array()) {
-            $this->yy_pop_parser_stack();
-        }
-        if (is_resource($this->yyTraceFILE)) {
-            fclose($this->yyTraceFILE);
-        }
-    }
-
-    public function yy_get_expected_tokens($token)
-    {
-        static $res3 = array();
-        static $res4 = array();
-        $state = $this->yystack[ $this->yyidx ]->stateno;
-        $expected = self::$yyExpectedTokens[ $state ];
-        if (isset($res3[ $state ][ $token ])) {
-            if ($res3[ $state ][ $token ]) {
-                return $expected;
-            }
-        } else {
-            if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
-                return $expected;
-            }
-        }
-        $stack = $this->yystack;
-        $yyidx = $this->yyidx;
-        do {
-            $yyact = $this->yy_find_shift_action($token);
-            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
-                // reduce action
-                $done = 0;
-                do {
-                    if ($done++ === 100) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // too much recursion prevents proper detection
-                        // so give up
-                        return array_unique($expected);
-                    }
-                    $yyruleno = $yyact - self::YYNSTATE;
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
-                    $nextstate = $this->yy_find_reduce_action(
-                        $this->yystack[ $this->yyidx ]->stateno,
-                        self::$yyRuleInfo[ $yyruleno ][ 0 ]
-                    );
-                    if (isset(self::$yyExpectedTokens[ $nextstate ])) {
-                        $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
-                        if (isset($res4[ $nextstate ][ $token ])) {
-                            if ($res4[ $nextstate ][ $token ]) {
-                                $this->yyidx = $yyidx;
-                                $this->yystack = $stack;
-                                return array_unique($expected);
-                            }
-                        } else {
-                            if ($res4[ $nextstate ][ $token ] =
-                                in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) {
-                                $this->yyidx = $yyidx;
-                                $this->yystack = $stack;
-                                return array_unique($expected);
-                            }
-                        }
-                    }
-                    if ($nextstate < self::YYNSTATE) {
-                        // we need to shift a non-terminal
-                        $this->yyidx++;
-                        $x = new TPC_yyStackEntry;
-                        $x->stateno = $nextstate;
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
-                        $this->yystack[ $this->yyidx ] = $x;
-                        continue 2;
-                    } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // the last token was just ignored, we can't accept
-                        // by ignoring input, this is in essence ignoring a
-                        // syntax error!
-                        return array_unique($expected);
-                    } elseif ($nextstate === self::YY_NO_ACTION) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // input accepted, but not shifted (I guess)
-                        return $expected;
-                    } else {
-                        $yyact = $nextstate;
-                    }
-                } while (true);
-            }
-            break;
-        } while (true);
-        $this->yyidx = $yyidx;
-        $this->yystack = $stack;
-        return array_unique($expected);
-    }
-
-    public function yy_is_expected_token($token)
-    {
-        static $res = array();
-        static $res2 = array();
-        if ($token === 0) {
-            return true; // 0 is not part of this
-        }
-        $state = $this->yystack[ $this->yyidx ]->stateno;
-        if (isset($res[ $state ][ $token ])) {
-            if ($res[ $state ][ $token ]) {
-                return true;
-            }
-        } else {
-            if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
-                return true;
-            }
-        }
-        $stack = $this->yystack;
-        $yyidx = $this->yyidx;
-        do {
-            $yyact = $this->yy_find_shift_action($token);
-            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
-                // reduce action
-                $done = 0;
-                do {
-                    if ($done++ === 100) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // too much recursion prevents proper detection
-                        // so give up
-                        return true;
-                    }
-                    $yyruleno = $yyact - self::YYNSTATE;
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
-                    $nextstate = $this->yy_find_reduce_action(
-                        $this->yystack[ $this->yyidx ]->stateno,
-                        self::$yyRuleInfo[ $yyruleno ][ 0 ]
-                    );
-                    if (isset($res2[ $nextstate ][ $token ])) {
-                        if ($res2[ $nextstate ][ $token ]) {
-                            $this->yyidx = $yyidx;
-                            $this->yystack = $stack;
-                            return true;
-                        }
-                    } else {
-                        if ($res2[ $nextstate ][ $token ] =
-                            (isset(self::$yyExpectedTokens[ $nextstate ]) &&
-                             in_array($token, self::$yyExpectedTokens[ $nextstate ], true))) {
-                            $this->yyidx = $yyidx;
-                            $this->yystack = $stack;
-                            return true;
-                        }
-                    }
-                    if ($nextstate < self::YYNSTATE) {
-                        // we need to shift a non-terminal
-                        $this->yyidx++;
-                        $x = new TPC_yyStackEntry;
-                        $x->stateno = $nextstate;
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
-                        $this->yystack[ $this->yyidx ] = $x;
-                        continue 2;
-                    } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        if (!$token) {
-                            // end of input: this is valid
-                            return true;
-                        }
-                        // the last token was just ignored, we can't accept
-                        // by ignoring input, this is in essence ignoring a
-                        // syntax error!
-                        return false;
-                    } elseif ($nextstate === self::YY_NO_ACTION) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // input accepted, but not shifted (I guess)
-                        return true;
-                    } else {
-                        $yyact = $nextstate;
-                    }
-                } while (true);
-            }
-            break;
-        } while (true);
-        $this->yyidx = $yyidx;
-        $this->yystack = $stack;
-        return true;
-    }
-
-    public function yy_find_shift_action($iLookAhead)
-    {
-        $stateno = $this->yystack[ $this->yyidx ]->stateno;
-        /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
-        if (!isset(self::$yy_shift_ofst[ $stateno ])) {
-            // no shift actions
-            return self::$yy_default[ $stateno ];
-        }
-        $i = self::$yy_shift_ofst[ $stateno ];
-        if ($i === self::YY_SHIFT_USE_DFLT) {
-            return self::$yy_default[ $stateno ];
-        }
-        if ($iLookAhead === self::YYNOCODE) {
-            return self::YY_NO_ACTION;
-        }
-        $i += $iLookAhead;
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
-            self::$yy_lookahead[ $i ] != $iLookAhead) {
-            if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
-                && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) {
-                if ($this->yyTraceFILE) {
-                    fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' .
-                                               $this->yyTokenName[ $iLookAhead ] . ' => ' .
-                                               $this->yyTokenName[ $iFallback ] . "\n");
-                }
-                return $this->yy_find_shift_action($iFallback);
-            }
-            return self::$yy_default[ $stateno ];
-        } else {
-            return self::$yy_action[ $i ];
-        }
-    }
-
-    public function yy_find_reduce_action($stateno, $iLookAhead)
-    {
-        /* $stateno = $this->yystack[$this->yyidx]->stateno; */
-        if (!isset(self::$yy_reduce_ofst[ $stateno ])) {
-            return self::$yy_default[ $stateno ];
-        }
-        $i = self::$yy_reduce_ofst[ $stateno ];
-        if ($i === self::YY_REDUCE_USE_DFLT) {
-            return self::$yy_default[ $stateno ];
-        }
-        if ($iLookAhead === self::YYNOCODE) {
-            return self::YY_NO_ACTION;
-        }
-        $i += $iLookAhead;
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
-            self::$yy_lookahead[ $i ] != $iLookAhead) {
-            return self::$yy_default[ $stateno ];
-        } else {
-            return self::$yy_action[ $i ];
-        }
-    }
-
-    public function yy_shift($yyNewState, $yyMajor, $yypMinor)
-    {
-        $this->yyidx++;
-        if ($this->yyidx >= self::YYSTACKDEPTH) {
-            $this->yyidx--;
-            if ($this->yyTraceFILE) {
-                fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
-            }
-            while ($this->yyidx >= 0) {
-                $this->yy_pop_parser_stack();
-            }
-            // line 239 "../smarty/lexer/smarty_internal_configfileparser.y"
-            $this->internalError = true;
-            $this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
-            return;
-        }
-        $yytos = new TPC_yyStackEntry;
-        $yytos->stateno = $yyNewState;
-        $yytos->major = $yyMajor;
-        $yytos->minor = $yypMinor;
-        $this->yystack[] = $yytos;
-        if ($this->yyTraceFILE && $this->yyidx > 0) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%sShift %d\n",
-                $this->yyTracePrompt,
-                $yyNewState
-            );
-            fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
-            for ($i = 1; $i <= $this->yyidx; $i++) {
-                fprintf(
-                    $this->yyTraceFILE,
-                    " %s",
-                    $this->yyTokenName[ $this->yystack[ $i ]->major ]
-                );
-            }
-            fwrite($this->yyTraceFILE, "\n");
-        }
-    }
-
-    public function yy_r0()
-    {
-        $this->_retvalue = null;
-    }
-
-    public function yy_r1()
-    {
-        $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor);
-        $this->_retvalue = null;
-    }
-
-    public function yy_r4()
-    {
-        $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
-        $this->_retvalue = null;
-    }
-
-    // line 245 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r5()
-    {
-        if ($this->configReadHidden) {
-            $this->add_section_vars(
-                $this->yystack[ $this->yyidx + -3 ]->minor,
-                $this->yystack[ $this->yyidx + 0 ]->minor
-            );
-        }
-        $this->_retvalue = null;
-    }
-
-    // line 250 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r6()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
-    }
-
-    // line 264 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r7()
-    {
-        $this->_retvalue =
-            array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 269 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r8()
-    {
-        $this->_retvalue = array();
-    }
-
-    // line 277 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r9()
-    {
-        $this->_retvalue =
-            array(
-                'key'   => $this->yystack[ $this->yyidx + -2 ]->minor,
-                'value' => $this->yystack[ $this->yyidx + 0 ]->minor
-            );
-    }
-
-    // line 281 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r10()
-    {
-        $this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r11()
-    {
-        $this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 291 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r12()
-    {
-        $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 296 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r13()
-    {
-        $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 300 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r14()
-    {
-        $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 304 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r15()
-    {
-        $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor);
-    }
-
-    // line 308 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r16()
-    {
-        $this->_retvalue = '';
-    }
-
-    // line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_r17()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_reduce($yyruleno)
-    {
-        if ($this->yyTraceFILE && $yyruleno >= 0
-            && $yyruleno < count(self::$yyRuleName)) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%sReduce (%d) [%s].\n",
-                $this->yyTracePrompt,
-                $yyruleno,
-                self::$yyRuleName[ $yyruleno ]
-            );
-        }
-        $this->_retvalue = $yy_lefthand_side = null;
-        if (isset(self::$yyReduceMap[ $yyruleno ])) {
-            // call the action
-            $this->_retvalue = null;
-            $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}();
-            $yy_lefthand_side = $this->_retvalue;
-        }
-        $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ];
-        $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ];
-        $this->yyidx -= $yysize;
-        for ($i = $yysize; $i; $i--) {
-            // pop all of the right-hand side parameters
-            array_pop($this->yystack);
-        }
-        $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto);
-        if ($yyact < self::YYNSTATE) {
-            if (!$this->yyTraceFILE && $yysize) {
-                $this->yyidx++;
-                $x = new TPC_yyStackEntry;
-                $x->stateno = $yyact;
-                $x->major = $yygoto;
-                $x->minor = $yy_lefthand_side;
-                $this->yystack[ $this->yyidx ] = $x;
-            } else {
-                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
-            }
-        } elseif ($yyact === self::YYNSTATE + self::YYNRULE + 1) {
-            $this->yy_accept();
-        }
-    }
-
-    // line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_parse_failed()
-    {
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
-        }
-        while ($this->yyidx >= 0) {
-            $this->yy_pop_parser_stack();
-        }
-    }
-
-    // line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
-    public function yy_syntax_error($yymajor, $TOKEN)
-    {
-        // line 232 "../smarty/lexer/smarty_internal_configfileparser.y"
-        $this->internalError = true;
-        $this->yymajor = $yymajor;
-        $this->compiler->trigger_config_file_error();
-    }
-
-    public function yy_accept()
-    {
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
-        }
-        while ($this->yyidx >= 0) {
-            $this->yy_pop_parser_stack();
-        }
-        // line 225 "../smarty/lexer/smarty_internal_configfileparser.y"
-        $this->successful = !$this->internalError;
-        $this->internalError = false;
-        $this->retvalue = $this->_retvalue;
-    }
-
-    public function doParse($yymajor, $yytokenvalue)
-    {
-        $yyerrorhit = 0;   /* True if yymajor has invoked an error */
-        if ($this->yyidx === null || $this->yyidx < 0) {
-            $this->yyidx = 0;
-            $this->yyerrcnt = -1;
-            $x = new TPC_yyStackEntry;
-            $x->stateno = 0;
-            $x->major = 0;
-            $this->yystack = array();
-            $this->yystack[] = $x;
-        }
-        $yyendofinput = ($yymajor == 0);
-        if ($this->yyTraceFILE) {
-            fprintf(
-                $this->yyTraceFILE,
-                "%sInput %s\n",
-                $this->yyTracePrompt,
-                $this->yyTokenName[ $yymajor ]
-            );
-        }
-        do {
-            $yyact = $this->yy_find_shift_action($yymajor);
-            if ($yymajor < self::YYERRORSYMBOL &&
-                !$this->yy_is_expected_token($yymajor)) {
-                // force a syntax error
-                $yyact = self::YY_ERROR_ACTION;
-            }
-            if ($yyact < self::YYNSTATE) {
-                $this->yy_shift($yyact, $yymajor, $yytokenvalue);
-                $this->yyerrcnt--;
-                if ($yyendofinput && $this->yyidx >= 0) {
-                    $yymajor = 0;
-                } else {
-                    $yymajor = self::YYNOCODE;
-                }
-            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
-                $this->yy_reduce($yyact - self::YYNSTATE);
-            } elseif ($yyact === self::YY_ERROR_ACTION) {
-                if ($this->yyTraceFILE) {
-                    fprintf(
-                        $this->yyTraceFILE,
-                        "%sSyntax Error!\n",
-                        $this->yyTracePrompt
-                    );
-                }
-                if (self::YYERRORSYMBOL) {
-                    if ($this->yyerrcnt < 0) {
-                        $this->yy_syntax_error($yymajor, $yytokenvalue);
-                    }
-                    $yymx = $this->yystack[ $this->yyidx ]->major;
-                    if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) {
-                        if ($this->yyTraceFILE) {
-                            fprintf(
-                                $this->yyTraceFILE,
-                                "%sDiscard input token %s\n",
-                                $this->yyTracePrompt,
-                                $this->yyTokenName[ $yymajor ]
-                            );
-                        }
-                        $this->yy_destructor($yymajor, $yytokenvalue);
-                        $yymajor = self::YYNOCODE;
-                    } else {
-                        while ($this->yyidx >= 0 &&
-                               $yymx !== self::YYERRORSYMBOL &&
-                               ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
-                        ) {
-                            $this->yy_pop_parser_stack();
-                        }
-                        if ($this->yyidx < 0 || $yymajor == 0) {
-                            $this->yy_destructor($yymajor, $yytokenvalue);
-                            $this->yy_parse_failed();
-                            $yymajor = self::YYNOCODE;
-                        } elseif ($yymx !== self::YYERRORSYMBOL) {
-                            $u2 = 0;
-                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
-                        }
-                    }
-                    $this->yyerrcnt = 3;
-                    $yyerrorhit = 1;
-                } else {
-                    if ($this->yyerrcnt <= 0) {
-                        $this->yy_syntax_error($yymajor, $yytokenvalue);
-                    }
-                    $this->yyerrcnt = 3;
-                    $this->yy_destructor($yymajor, $yytokenvalue);
-                    if ($yyendofinput) {
-                        $this->yy_parse_failed();
-                    }
-                    $yymajor = self::YYNOCODE;
-                }
-            } else {
-                $this->yy_accept();
-                $yymajor = self::YYNOCODE;
-            }
-        } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0);
-    }
-
-    /**
-     * parse optional boolean keywords
-     *
-     * @param string $str
-     *
-     * @return bool
-     */
-    private function parse_bool($str)
-    {
-        $str = strtolower($str);
-        if (in_array($str, array('on', 'yes', 'true'))) {
-            $res = true;
-        } else {
-            $res = false;
-        }
-        return $res;
-    }
-
-    /**
-     * set a config variable in target array
-     *
-     * @param array $var
-     * @param array $target_array
-     */
-    private function set_var(array $var, array &$target_array)
-    {
-        $key = $var[ 'key' ];
-        $value = $var[ 'value' ];
-        if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) {
-            $target_array[ 'vars' ][ $key ] = $value;
-        } else {
-            settype($target_array[ 'vars' ][ $key ], 'array');
-            $target_array[ 'vars' ][ $key ][] = $value;
-        }
-    }
-
-    /**
-     * add config variable to global vars
-     *
-     * @param array $vars
-     */
-    private function add_global_vars(array $vars)
-    {
-        if (!isset($this->compiler->config_data[ 'vars' ])) {
-            $this->compiler->config_data[ 'vars' ] = array();
-        }
-        foreach ($vars as $var) {
-            $this->set_var($var, $this->compiler->config_data);
-        }
-    }
-
-    /**
-     * add config variable to section
-     *
-     * @param string $section_name
-     * @param array  $vars
-     */
-    private function add_section_vars($section_name, array $vars)
-    {
-        if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) {
-            $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = array();
-        }
-        foreach ($vars as $var) {
-            $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]);
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_data.php b/libraries/Smarty/libs/sysplugins/smarty_internal_data.php
deleted file mode 100644
index 98e3e57b3..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_data.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Data
- * This file contains the basic classes and methods for template and variable creation
- *
- * @package    Smarty
- * @subpackage Template
- * @author     Uwe Tews
- */
-
-/**
- * Base class with template and variable methods
- *
- * @package    Smarty
- * @subpackage Template
- *
- * @property int    $scope
- * @property Smarty $smarty
- * The following methods will be dynamically loaded by the extension handler when they are called.
- * They are located in a corresponding Smarty_Internal_Method_xxxx class
- *
- * @method mixed _getConfigVariable(string $varName, bool $errorEnable = true)
- * @method mixed getConfigVariable(string $varName, bool $errorEnable = true)
- * @method mixed getConfigVars(string $varName = null, bool $searchParents = true)
- * @method mixed getGlobal(string $varName = null)
- * @method mixed getStreamVariable(string $variable)
- * @method Smarty_Internal_Data clearAssign(mixed $tpl_var)
- * @method Smarty_Internal_Data clearAllAssign()
- * @method Smarty_Internal_Data clearConfig(string $varName = null)
- * @method Smarty_Internal_Data configLoad(string $config_file, mixed $sections = null, string $scope = 'local')
- */
-abstract class Smarty_Internal_Data
-{
-    /**
-     * This object type (Smarty = 1, template = 2, data = 4)
-     *
-     * @var int
-     */
-    public $_objType = 4;
-
-    /**
-     * name of class used for templates
-     *
-     * @var string
-     */
-    public $template_class = 'Smarty_Internal_Template';
-
-    /**
-     * template variables
-     *
-     * @var Smarty_Variable[]
-     */
-    public $tpl_vars = array();
-
-    /**
-     * parent template (if any)
-     *
-     * @var Smarty|Smarty_Internal_Template|Smarty_Data
-     */
-    public $parent = null;
-
-    /**
-     * configuration settings
-     *
-     * @var string[]
-     */
-    public $config_vars = array();
-
-    /**
-     * extension handler
-     *
-     * @var Smarty_Internal_Extension_Handler
-     */
-    public $ext = null;
-
-    /**
-     * Smarty_Internal_Data constructor.
-     *
-     * Install extension handler
-     */
-    public function __construct()
-    {
-        $this->ext = new Smarty_Internal_Extension_Handler();
-        $this->ext->objType = $this->_objType;
-    }
-
-    /**
-     * assigns a Smarty variable
-     *
-     * @param array|string $tpl_var the template variable name(s)
-     * @param mixed        $value   the value to assign
-     * @param boolean      $nocache if true any output of this variable will be not cached
-     *
-     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for
-     *                              chaining
-     */
-    public function assign($tpl_var, $value = null, $nocache = false)
-    {
-        if (is_array($tpl_var)) {
-            foreach ($tpl_var as $_key => $_val) {
-                $this->assign($_key, $_val, $nocache);
-            }
-        } else {
-            if ($tpl_var !== '') {
-                if ($this->_objType === 2) {
-                    /**
-                     *
-                     *
-                     * @var Smarty_Internal_Template $this
-                     */
-                    $this->_assignInScope($tpl_var, $value, $nocache);
-                } else {
-                    $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
-                }
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * appends values to template variables
-     *
-     * @api  Smarty::append()
-     * @link http://www.smarty.net/docs/en/api.append.tpl
-     *
-     * @param array|string $tpl_var the template variable name(s)
-     * @param mixed        $value   the value to append
-     * @param bool         $merge   flag if array elements shall be merged
-     * @param bool         $nocache if true any output of this variable will
-     *                              be not cached
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function append($tpl_var, $value = null, $merge = false, $nocache = false)
-    {
-        return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache);
-    }
-
-    /**
-     * assigns a global Smarty variable
-     *
-     * @param string  $varName the global variable name
-     * @param mixed   $value   the value to assign
-     * @param boolean $nocache if true any output of this variable will be not cached
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function assignGlobal($varName, $value = null, $nocache = false)
-    {
-        return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache);
-    }
-
-    /**
-     * appends values to template variables by reference
-     *
-     * @param string  $tpl_var the template variable name
-     * @param mixed   &$value  the referenced value to append
-     * @param boolean $merge   flag if array elements shall be merged
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function appendByRef($tpl_var, &$value, $merge = false)
-    {
-        return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge);
-    }
-
-    /**
-     * assigns values to template variables by reference
-     *
-     * @param string  $tpl_var the template variable name
-     * @param         $value
-     * @param boolean $nocache if true any output of this variable will be not cached
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function assignByRef($tpl_var, &$value, $nocache = false)
-    {
-        return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache);
-    }
-
-    /**
-     * Returns a single or all template variables
-     *
-     * @api  Smarty::getTemplateVars()
-     * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
-     *
-     * @param string                                                  $varName       variable name or null
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
-     * @param bool                                                    $searchParents include parent templates?
-     *
-     * @return mixed variable value or or array of variables
-     */
-    public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
-    {
-        return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents);
-    }
-
-    /**
-     * gets the object of a Smarty variable
-     *
-     * @param string               $variable      the name of the Smarty variable
-     * @param Smarty_Internal_Data $_ptr          optional pointer to data object
-     * @param boolean              $searchParents search also in parent data
-     * @param bool                 $error_enable
-     *
-     * @return     Smarty_Variable|Smarty_Undefined_Variable the object of the variable
-     * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
-     */
-    public function getVariable(
-        $variable = null,
-        Smarty_Internal_Data $_ptr = null,
-        $searchParents = true,
-        $error_enable = true
-    ) {
-        return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
-    }
-
-    /**
-     * Follow the parent chain an merge template and config variables
-     *
-     * @param \Smarty_Internal_Data|null $data
-     */
-    public function _mergeVars(Smarty_Internal_Data $data = null)
-    {
-        if (isset($data)) {
-            if (!empty($this->tpl_vars)) {
-                $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars);
-            }
-            if (!empty($this->config_vars)) {
-                $data->config_vars = array_merge($this->config_vars, $data->config_vars);
-            }
-        } else {
-            $data = $this;
-        }
-        if (isset($this->parent)) {
-            $this->parent->_mergeVars($data);
-        }
-    }
-
-    /**
-     * Return true if this instance is a Data obj
-     *
-     * @return bool
-     */
-    public function _isDataObj()
-    {
-        return $this->_objType === 4;
-    }
-
-    /**
-     * Return true if this instance is a template obj
-     *
-     * @return bool
-     */
-    public function _isTplObj()
-    {
-        return $this->_objType === 2;
-    }
-
-    /**
-     * Return true if this instance is a Smarty obj
-     *
-     * @return bool
-     */
-    public function _isSmartyObj()
-    {
-        return $this->_objType === 1;
-    }
-
-    /**
-     * Get Smarty object
-     *
-     * @return Smarty
-     */
-    public function _getSmartyObj()
-    {
-        return $this->smarty;
-    }
-
-    /**
-     * Handle unknown class methods
-     *
-     * @param string $name unknown method-name
-     * @param array  $args argument array
-     *
-     * @return mixed
-     */
-    public function __call($name, $args)
-    {
-        return $this->ext->_callExternalMethod($this, $name, $args);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_debug.php b/libraries/Smarty/libs/sysplugins/smarty_internal_debug.php
deleted file mode 100644
index 24b233e26..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_debug.php
+++ /dev/null
@@ -1,425 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Debug
- * Class to collect data for the Smarty Debugging Console
- *
- * @package    Smarty
- * @subpackage Debug
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Debug Class
- *
- * @package    Smarty
- * @subpackage Debug
- */
-class Smarty_Internal_Debug extends Smarty_Internal_Data
-{
-    /**
-     * template data
-     *
-     * @var array
-     */
-    public $template_data = array();
-
-    /**
-     * List of uid's which shall be ignored
-     *
-     * @var array
-     */
-    public $ignore_uid = array();
-
-    /**
-     * Index of display() and fetch() calls
-     *
-     * @var int
-     */
-    public $index = 0;
-
-    /**
-     * Counter for window offset
-     *
-     * @var int
-     */
-    public $offset = 0;
-
-    /**
-     * Start logging template
-     *
-     * @param \Smarty_Internal_Template $template template
-     * @param null                      $mode     true: display   false: fetch  null: subtemplate
-     */
-    public function start_template(Smarty_Internal_Template $template, $mode = null)
-    {
-        if (isset($mode) && !$template->_isSubTpl()) {
-            $this->index++;
-            $this->offset++;
-            $this->template_data[ $this->index ] = null;
-        }
-        $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'start_template_time' ] = microtime(true);
-    }
-
-    /**
-     * End logging of cache time
-     *
-     * @param \Smarty_Internal_Template $template cached template
-     */
-    public function end_template(Smarty_Internal_Template $template)
-    {
-        $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
-        //$this->template_data[$this->index][$key]['properties'] = $template->properties;
-    }
-
-    /**
-     * Start logging of compile time
-     *
-     * @param \Smarty_Internal_Template $template
-     */
-    public function start_compile(Smarty_Internal_Template $template)
-    {
-        static $_is_stringy = array('string' => true, 'eval' => true);
-        if (!empty($template->compiler->trace_uid)) {
-            $key = $template->compiler->trace_uid;
-            if (!isset($this->template_data[ $this->index ][ $key ])) {
-                if (isset($_is_stringy[ $template->source->type ])) {
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] =
-                        '\'' . substr($template->source->name, 0, 25) . '...\'';
-                } else {
-                    $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
-                }
-                $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
-                $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
-                $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
-            }
-        } else {
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
-                return;
-            }
-            $key = $this->get_key($template);
-        }
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
-    }
-
-    /**
-     * End logging of compile time
-     *
-     * @param \Smarty_Internal_Template $template
-     */
-    public function end_compile(Smarty_Internal_Template $template)
-    {
-        if (!empty($template->compiler->trace_uid)) {
-            $key = $template->compiler->trace_uid;
-        } else {
-            if (isset($this->ignore_uid[ $template->source->uid ])) {
-                return;
-            }
-            $key = $this->get_key($template);
-        }
-        $this->template_data[ $this->index ][ $key ][ 'compile_time' ] +=
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
-    }
-
-    /**
-     * Start logging of render time
-     *
-     * @param \Smarty_Internal_Template $template
-     */
-    public function start_render(Smarty_Internal_Template $template)
-    {
-        $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
-    }
-
-    /**
-     * End logging of compile time
-     *
-     * @param \Smarty_Internal_Template $template
-     */
-    public function end_render(Smarty_Internal_Template $template)
-    {
-        $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
-    }
-
-    /**
-     * Start logging of cache time
-     *
-     * @param \Smarty_Internal_Template $template cached template
-     */
-    public function start_cache(Smarty_Internal_Template $template)
-    {
-        $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'start_time' ] = microtime(true);
-    }
-
-    /**
-     * End logging of cache time
-     *
-     * @param \Smarty_Internal_Template $template cached template
-     */
-    public function end_cache(Smarty_Internal_Template $template)
-    {
-        $key = $this->get_key($template);
-        $this->template_data[ $this->index ][ $key ][ 'cache_time' ] +=
-            microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
-    }
-
-    /**
-     * Register template object
-     *
-     * @param \Smarty_Internal_Template $template cached template
-     */
-    public function register_template(Smarty_Internal_Template $template)
-    {
-    }
-
-    /**
-     * Register data object
-     *
-     * @param \Smarty_Data $data data object
-     */
-    public static function register_data(Smarty_Data $data)
-    {
-    }
-
-    /**
-     * Opens a window for the Smarty Debugging Console and display the data
-     *
-     * @param Smarty_Internal_Template|Smarty $obj object to debug
-     * @param bool                            $full
-     *
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function display_debug($obj, $full = false)
-    {
-        if (!$full) {
-            $this->offset++;
-            $savedIndex = $this->index;
-            $this->index = 9999;
-        }
-        $smarty = $obj->_getSmartyObj();
-        // create fresh instance of smarty for displaying the debug console
-        // to avoid problems if the application did overload the Smarty class
-        $debObj = new Smarty();
-        // copy the working dirs from application
-        $debObj->setCompileDir($smarty->getCompileDir());
-        // init properties by hand as user may have edited the original Smarty class
-        $debObj->setPluginsDir(is_dir(dirname(__FILE__) . '/../plugins') ? dirname(__FILE__) .
-                                                                           '/../plugins' : $smarty->getPluginsDir());
-        $debObj->force_compile = false;
-        $debObj->compile_check = Smarty::COMPILECHECK_ON;
-        $debObj->left_delimiter = '{';
-        $debObj->right_delimiter = '}';
-        $debObj->security_policy = null;
-        $debObj->debugging = false;
-        $debObj->debugging_ctrl = 'NONE';
-        $debObj->error_reporting = E_ALL & ~E_NOTICE;
-        $debObj->debug_tpl =
-            isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . dirname(__FILE__) . '/../debug.tpl';
-        $debObj->registered_plugins = array();
-        $debObj->registered_resources = array();
-        $debObj->registered_filters = array();
-        $debObj->autoload_filters = array();
-        $debObj->default_modifiers = array();
-        $debObj->escape_html = true;
-        $debObj->caching = Smarty::CACHING_OFF;
-        $debObj->compile_id = null;
-        $debObj->cache_id = null;
-        // prepare information of assigned variables
-        $ptr = $this->get_debug_vars($obj);
-        $_assigned_vars = $ptr->tpl_vars;
-        ksort($_assigned_vars);
-        $_config_vars = $ptr->config_vars;
-        ksort($_config_vars);
-        $debugging = $smarty->debugging;
-        $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
-        if ($obj->_isTplObj()) {
-            $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
-        }
-        if ($obj->_objType === 1 || $full) {
-            $_template->assign('template_data', $this->template_data[ $this->index ]);
-        } else {
-            $_template->assign('template_data', null);
-        }
-        $_template->assign('assigned_vars', $_assigned_vars);
-        $_template->assign('config_vars', $_config_vars);
-        $_template->assign('execution_time', microtime(true) - $smarty->start_time);
-        $_template->assign('display_mode', $debugging === 2 || !$full);
-        $_template->assign('offset', $this->offset * 50);
-        echo $_template->fetch();
-        if (isset($full)) {
-            $this->index--;
-        }
-        if (!$full) {
-            $this->index = $savedIndex;
-        }
-    }
-
-    /**
-     * Recursively gets variables from all template/data scopes
-     *
-     * @param Smarty_Internal_Template|Smarty_Data $obj object to debug
-     *
-     * @return StdClass
-     */
-    public function get_debug_vars($obj)
-    {
-        $config_vars = array();
-        foreach ($obj->config_vars as $key => $var) {
-            $config_vars[ $key ][ 'value' ] = $var;
-            if ($obj->_isTplObj()) {
-                $config_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
-            } elseif ($obj->_isDataObj()) {
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
-            } else {
-                $config_vars[ $key ][ 'scope' ] = 'Smarty object';
-            }
-        }
-        $tpl_vars = array();
-        foreach ($obj->tpl_vars as $key => $var) {
-            foreach ($var as $varkey => $varvalue) {
-                if ($varkey === 'value') {
-                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
-                } else {
-                    if ($varkey === 'nocache') {
-                        if ($varvalue === true) {
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
-                        }
-                    } else {
-                        if ($varkey !== 'scope' || $varvalue !== 0) {
-                            $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
-                        }
-                    }
-                }
-            }
-            if ($obj->_isTplObj()) {
-                $tpl_vars[ $key ][ 'scope' ] = $obj->source->type . ':' . $obj->source->name;
-            } elseif ($obj->_isDataObj()) {
-                $tpl_vars[ $key ][ 'scope' ] = $obj->dataObjectName;
-            } else {
-                $tpl_vars[ $key ][ 'scope' ] = 'Smarty object';
-            }
-        }
-        if (isset($obj->parent)) {
-            $parent = $this->get_debug_vars($obj->parent);
-            foreach ($parent->tpl_vars as $name => $pvar) {
-                if (isset($tpl_vars[ $name ]) && $tpl_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
-                    $tpl_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
-                }
-            }
-            $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);
-            foreach ($parent->config_vars as $name => $pvar) {
-                if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) {
-                    $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ];
-                }
-            }
-            $config_vars = array_merge($parent->config_vars, $config_vars);
-        } else {
-            foreach (Smarty::$global_tpl_vars as $key => $var) {
-                if (!array_key_exists($key, $tpl_vars)) {
-                    foreach ($var as $varkey => $varvalue) {
-                        if ($varkey === 'value') {
-                            $tpl_vars[ $key ][ $varkey ] = $varvalue;
-                        } else {
-                            if ($varkey === 'nocache') {
-                                if ($varvalue === true) {
-                                    $tpl_vars[ $key ][ $varkey ] = $varvalue;
-                                }
-                            } else {
-                                if ($varkey !== 'scope' || $varvalue !== 0) {
-                                    $tpl_vars[ $key ][ 'attributes' ][ $varkey ] = $varvalue;
-                                }
-                            }
-                        }
-                    }
-                    $tpl_vars[ $key ][ 'scope' ] = 'Global';
-                }
-            }
-        }
-        return (object)array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
-    }
-
-    /**
-     * Return key into $template_data for template
-     *
-     * @param \Smarty_Internal_Template $template template object
-     *
-     * @return string key into $template_data
-     */
-    private function get_key(Smarty_Internal_Template $template)
-    {
-        static $_is_stringy = array('string' => true, 'eval' => true);
-        // calculate Uid if not already done
-        if ($template->source->uid === '') {
-            $template->source->filepath;
-        }
-        $key = $template->source->uid;
-        if (isset($this->template_data[ $this->index ][ $key ])) {
-            return $key;
-        } else {
-            if (isset($_is_stringy[ $template->source->type ])) {
-                $this->template_data[ $this->index ][ $key ][ 'name' ] =
-                    '\'' . substr($template->source->name, 0, 25) . '...\'';
-            } else {
-                $this->template_data[ $this->index ][ $key ][ 'name' ] = $template->source->filepath;
-            }
-            $this->template_data[ $this->index ][ $key ][ 'compile_time' ] = 0;
-            $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0;
-            $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0;
-            $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0;
-            return $key;
-        }
-    }
-
-    /**
-     * Ignore template
-     *
-     * @param \Smarty_Internal_Template $template
-     */
-    public function ignore(Smarty_Internal_Template $template)
-    {
-        // calculate Uid if not already done
-        if ($template->source->uid === '') {
-            $template->source->filepath;
-        }
-        $this->ignore_uid[ $template->source->uid ] = true;
-    }
-
-    /**
-     * handle 'URL' debugging mode
-     *
-     * @param Smarty $smarty
-     */
-    public function debugUrl(Smarty $smarty)
-    {
-        if (isset($_SERVER[ 'QUERY_STRING' ])) {
-            $_query_string = $_SERVER[ 'QUERY_STRING' ];
-        } else {
-            $_query_string = '';
-        }
-        if (false !== strpos($_query_string, $smarty->smarty_debug_id)) {
-            if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) {
-                // enable debugging for this browser session
-                setcookie('SMARTY_DEBUG', true);
-                $smarty->debugging = true;
-            } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) {
-                // disable debugging for this browser session
-                setcookie('SMARTY_DEBUG', false);
-                $smarty->debugging = false;
-            } else {
-                // enable debugging for this page
-                $smarty->debugging = true;
-            }
-        } else {
-            if (isset($_COOKIE[ 'SMARTY_DEBUG' ])) {
-                $smarty->debugging = true;
-            }
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_errorhandler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_errorhandler.php
deleted file mode 100644
index 56dca18fa..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_errorhandler.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-/**
- * Smarty error handler
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- *
- * @deprecated
-Smarty does no longer use @filemtime()
- */
-class Smarty_Internal_ErrorHandler
-{
-    /**
-     * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
-     */
-    public static $mutedDirectories = array();
-
-    /**
-     * error handler returned by set_error_handler() in self::muteExpectedErrors()
-     */
-    private static $previousErrorHandler = null;
-
-    /**
-     * Enable error handler to mute expected messages
-     *
-     */
-    public static function muteExpectedErrors()
-    {
-        /*
-            error muting is done because some people implemented custom error_handlers using
-            http://php.net/set_error_handler and for some reason did not understand the following paragraph:
-
-                It is important to remember that the standard PHP error handler is completely bypassed for the
-                error types specified by error_types unless the callback function returns FALSE.
-                error_reporting() settings will have no effect and your error handler will be called regardless -
-                however you are still able to read the current value of error_reporting and act appropriately.
-                Of particular note is that this value will be 0 if the statement that caused the error was
-                prepended by the @ error-control operator.
-
-            Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include
-                - @filemtime() is almost twice as fast as using an additional file_exists()
-                - between file_exists() and filemtime() a possible race condition is opened,
-                  which does not exist using the simple @filemtime() approach.
-        */
-        $error_handler = array('Smarty_Internal_ErrorHandler', 'mutingErrorHandler');
-        $previous = set_error_handler($error_handler);
-        // avoid dead loops
-        if ($previous !== $error_handler) {
-            self::$previousErrorHandler = $previous;
-        }
-    }
-
-    /**
-     * Error Handler to mute expected messages
-     *
-     * @link http://php.net/set_error_handler
-     *
-     * @param integer $errno Error level
-     * @param         $errstr
-     * @param         $errfile
-     * @param         $errline
-     * @param         $errcontext
-     *
-     * @return bool
-     */
-    public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = array())
-    {
-        $_is_muted_directory = false;
-        // add the SMARTY_DIR to the list of muted directories
-        if (!isset(self::$mutedDirectories[ SMARTY_DIR ])) {
-            $smarty_dir = realpath(SMARTY_DIR);
-            if ($smarty_dir !== false) {
-                self::$mutedDirectories[ SMARTY_DIR ] =
-                    array('file' => $smarty_dir, 'length' => strlen($smarty_dir),);
-            }
-        }
-        // walk the muted directories and test against $errfile
-        foreach (self::$mutedDirectories as $key => &$dir) {
-            if (!$dir) {
-                // resolve directory and length for speedy comparisons
-                $file = realpath($key);
-                if ($file === false) {
-                    // this directory does not exist, remove and skip it
-                    unset(self::$mutedDirectories[ $key ]);
-                    continue;
-                }
-                $dir = array('file' => $file, 'length' => strlen($file),);
-            }
-            if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) {
-                $_is_muted_directory = true;
-                break;
-            }
-        }
-        // pass to next error handler if this error did not occur inside SMARTY_DIR
-        // or the error was within smarty but masked to be ignored
-        if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
-            if (self::$previousErrorHandler) {
-                return call_user_func(
-                    self::$previousErrorHandler,
-                    $errno,
-                    $errstr,
-                    $errfile,
-                    $errline,
-                    $errcontext
-                );
-            } else {
-                return false;
-            }
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_extension_handler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_extension_handler.php
deleted file mode 100644
index b07615526..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_extension_handler.php
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-/**
- * Smarty Extension handler
- *
- * Load extensions dynamically
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- *
- * Runtime extensions
- * @property   Smarty_Internal_Runtime_CacheModify       $_cacheModify
- * @property   Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile
- * @property   Smarty_Internal_Runtime_Capture           $_capture
- * @property   Smarty_Internal_Runtime_CodeFrame         $_codeFrame
- * @property   Smarty_Internal_Runtime_FilterHandler     $_filterHandler
- * @property   Smarty_Internal_Runtime_Foreach           $_foreach
- * @property   Smarty_Internal_Runtime_GetIncludePath    $_getIncludePath
- * @property   Smarty_Internal_Runtime_Make_Nocache      $_make_nocache
- * @property   Smarty_Internal_Runtime_UpdateCache       $_updateCache
- * @property   Smarty_Internal_Runtime_UpdateScope       $_updateScope
- * @property   Smarty_Internal_Runtime_TplFunction       $_tplFunction
- * @property   Smarty_Internal_Runtime_WriteFile         $_writeFile
- *
- * Method extensions
- * @property   Smarty_Internal_Method_GetTemplateVars    $getTemplateVars
- * @property   Smarty_Internal_Method_Append             $append
- * @property   Smarty_Internal_Method_AppendByRef        $appendByRef
- * @property   Smarty_Internal_Method_AssignGlobal       $assignGlobal
- * @property   Smarty_Internal_Method_AssignByRef        $assignByRef
- * @property   Smarty_Internal_Method_LoadFilter         $loadFilter
- * @property   Smarty_Internal_Method_LoadPlugin         $loadPlugin
- * @property   Smarty_Internal_Method_RegisterFilter     $registerFilter
- * @property   Smarty_Internal_Method_RegisterObject     $registerObject
- * @property   Smarty_Internal_Method_RegisterPlugin     $registerPlugin
- * @property   mixed|\Smarty_Template_Cached             configLoad
- */
-class Smarty_Internal_Extension_Handler
-{
-    public $objType = null;
-
-    /**
-     * Cache for property information from generic getter/setter
-     * Preloaded with names which should not use with generic getter/setter
-     *
-     * @var array
-     */
-    private $_property_info     = array(
-        'AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
-        'DebugTemplate'   => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
-        'TemplateVars'    => 0, 'Literals' => 'Literals',
-    );//
-
-    private $resolvedProperties = array();
-
-    /**
-     * Call external Method
-     *
-     * @param \Smarty_Internal_Data $data
-     * @param string                $name external method names
-     * @param array                 $args argument array
-     *
-     * @return mixed
-     */
-    public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
-    {
-        /* @var Smarty $data ->smarty */
-        $smarty = isset($data->smarty) ? $data->smarty : $data;
-        if (!isset($smarty->ext->$name)) {
-            if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) {
-                $basename = $this->upperCase($match[ 4 ]);
-                if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ])
-                    && is_string($this->_property_info[ $basename ])
-                ) {
-                    $class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ];
-                    if (class_exists($class)) {
-                        $classObj = new $class();
-                        $methodes = get_class_methods($classObj);
-                        foreach ($methodes as $method) {
-                            $smarty->ext->$method = $classObj;
-                        }
-                    }
-                }
-                if (!empty($match[ 2 ]) && !isset($smarty->ext->$name)) {
-                    $class = 'Smarty_Internal_Method_' . $this->upperCase($name);
-                    if (!class_exists($class)) {
-                        $objType = $data->_objType;
-                        $propertyType = false;
-                        if (!isset($this->resolvedProperties[ $match[ 0 ] ][ $objType ])) {
-                            $property = isset($this->resolvedProperties[ 'property' ][ $basename ]) ?
-                                $this->resolvedProperties[ 'property' ][ $basename ] :
-                                $property = $this->resolvedProperties[ 'property' ][ $basename ] = strtolower(
-                                    join(
-                                        '_',
-                                        preg_split(
-                                            '/([A-Z][^A-Z]*)/',
-                                            $basename,
-                                            -1,
-                                            PREG_SPLIT_NO_EMPTY |
-                                            PREG_SPLIT_DELIM_CAPTURE
-                                        )
-                                    )
-                                );
-                            if ($property !== false) {
-                                if (property_exists($data, $property)) {
-                                    $propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ] = 1;
-                                } elseif (property_exists($smarty, $property)) {
-                                    $propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ] = 2;
-                                } else {
-                                    $this->resolvedProperties[ 'property' ][ $basename ] = $property = false;
-                                }
-                            }
-                        } else {
-                            $propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ];
-                            $property = $this->resolvedProperties[ 'property' ][ $basename ];
-                        }
-                        if ($propertyType) {
-                            $obj = $propertyType === 1 ? $data : $smarty;
-                            if ($match[ 2 ] === 'get') {
-                                return $obj->$property;
-                            } elseif ($match[ 2 ] === 'set') {
-                                return $obj->$property = $args[ 0 ];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        $callback = array($smarty->ext->$name, $name);
-        array_unshift($args, $data);
-        if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) {
-            return call_user_func_array($callback, $args);
-        }
-        return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
-    }
-
-    /**
-     * Make first character of name parts upper case
-     *
-     * @param string $name
-     *
-     * @return string
-     */
-    public function upperCase($name)
-    {
-        $_name = explode('_', $name);
-        $_name = array_map('ucfirst', $_name);
-        return implode('_', $_name);
-    }
-
-    /**
-     * get extension object
-     *
-     * @param string $property_name property name
-     *
-     * @return mixed|Smarty_Template_Cached
-     */
-    public function __get($property_name)
-    {
-        // object properties of runtime template extensions will start with '_'
-        if ($property_name[ 0 ] === '_') {
-            $class = 'Smarty_Internal_Runtime' . $this->upperCase($property_name);
-        } else {
-            $class = 'Smarty_Internal_Method_' . $this->upperCase($property_name);
-        }
-        if (!class_exists($class)) {
-            return $this->$property_name = new Smarty_Internal_Undefined($class);
-        }
-        return $this->$property_name = new $class();
-    }
-
-    /**
-     * set extension property
-     *
-     * @param string $property_name property name
-     * @param mixed  $value         value
-     *
-     */
-    public function __set($property_name, $value)
-    {
-        $this->$property_name = $value;
-    }
-
-    /**
-     * Call error handler for undefined method
-     *
-     * @param string $name unknown method-name
-     * @param array  $args argument array
-     *
-     * @return mixed
-     */
-    public function __call($name, $args)
-    {
-        return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this));
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
deleted file mode 100644
index a05f55a82..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/**
- * Smarty Method AddAutoloadFilters
- *
- * Smarty::addAutoloadFilters() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
-{
-    /**
-     * Add autoload filters
-     *
-     * @api Smarty::setAutoloadFilters()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param array                                                           $filters filters to load automatically
-     * @param string                                                          $type    "pre", "output", … specify
-     *                                                                                 the filter type to set.
-     *                                                                                 Defaults to none treating
-     *                                                                                 $filters' keys as the
-     *                                                                                 appropriate types
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if ($type !== null) {
-            $this->_checkFilterType($type);
-            if (!empty($smarty->autoload_filters[ $type ])) {
-                $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array)$filters);
-            } else {
-                $smarty->autoload_filters[ $type ] = (array)$filters;
-            }
-        } else {
-            foreach ((array)$filters as $type => $value) {
-                $this->_checkFilterType($type);
-                if (!empty($smarty->autoload_filters[ $type ])) {
-                    $smarty->autoload_filters[ $type ] =
-                        array_merge($smarty->autoload_filters[ $type ], (array)$value);
-                } else {
-                    $smarty->autoload_filters[ $type ] = (array)$value;
-                }
-            }
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
deleted file mode 100644
index c3feb3d8b..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * Smarty Method AddDefaultModifiers
- *
- * Smarty::addDefaultModifiers() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_AddDefaultModifiers
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Add default modifiers
-     *
-     * @api Smarty::addDefaultModifiers()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param array|string                                                    $modifiers modifier or list of modifiers
-     *                                                                                   to add
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function addDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (is_array($modifiers)) {
-            $smarty->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
-        } else {
-            $smarty->default_modifiers[] = $modifiers;
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_append.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_append.php
deleted file mode 100644
index 881375efe..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_append.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * Smarty Method Append
- *
- * Smarty::append() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_Append
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * appends values to template variables
-     *
-     * @api  Smarty::append()
-     * @link http://www.smarty.net/docs/en/api.append.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param array|string                                            $tpl_var the template variable name(s)
-     * @param mixed                                                   $value   the value to append
-     * @param bool                                                    $merge   flag if array elements shall be merged
-     * @param bool                                                    $nocache if true any output of this variable will
-     *                                                                         be not cached
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function append(Smarty_Internal_Data $data, $tpl_var, $value = null, $merge = false, $nocache = false)
-    {
-        if (is_array($tpl_var)) {
-            // $tpl_var is an array, ignore $value
-            foreach ($tpl_var as $_key => $_val) {
-                if ($_key !== '') {
-                    $this->append($data, $_key, $_val, $merge, $nocache);
-                }
-            }
-        } else {
-            if ($tpl_var !== '' && isset($value)) {
-                if (!isset($data->tpl_vars[ $tpl_var ])) {
-                    $tpl_var_inst = $data->ext->getTemplateVars->_getVariable($data, $tpl_var, null, true, false);
-                    if ($tpl_var_inst instanceof Smarty_Undefined_Variable) {
-                        $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache);
-                    } else {
-                        $data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst;
-                    }
-                }
-                if (!(is_array($data->tpl_vars[ $tpl_var ]->value)
-                      || $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess)
-                ) {
-                    settype($data->tpl_vars[ $tpl_var ]->value, 'array');
-                }
-                if ($merge && is_array($value)) {
-                    foreach ($value as $_mkey => $_mval) {
-                        $data->tpl_vars[ $tpl_var ]->value[ $_mkey ] = $_mval;
-                    }
-                } else {
-                    $data->tpl_vars[ $tpl_var ]->value[] = $value;
-                }
-            }
-            if ($data->_isTplObj() && $data->scope) {
-                $data->ext->_updateScope->_updateScope($data, $tpl_var);
-            }
-        }
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php
deleted file mode 100644
index c95904460..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * Smarty Method AppendByRef
- *
- * Smarty::appendByRef() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_AppendByRef
-{
-    /**
-     * appends values to template variables by reference
-     *
-     * @api  Smarty::appendByRef()
-     * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $tpl_var the template variable name
-     * @param mixed                                                   &$value  the referenced value to append
-     * @param bool                                                    $merge   flag if array elements shall be merged
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false)
-    {
-        if ($tpl_var !== '' && isset($value)) {
-            if (!isset($data->tpl_vars[ $tpl_var ])) {
-                $data->tpl_vars[ $tpl_var ] = new Smarty_Variable();
-            }
-            if (!is_array($data->tpl_vars[ $tpl_var ]->value)) {
-                settype($data->tpl_vars[ $tpl_var ]->value, 'array');
-            }
-            if ($merge && is_array($value)) {
-                foreach ($value as $_key => $_val) {
-                    $data->tpl_vars[ $tpl_var ]->value[ $_key ] = &$value[ $_key ];
-                }
-            } else {
-                $data->tpl_vars[ $tpl_var ]->value[] = &$value;
-            }
-            if ($data->_isTplObj() && $data->scope) {
-                $data->ext->_updateScope->_updateScope($data, $tpl_var);
-            }
-        }
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php
deleted file mode 100644
index fa705bb80..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Smarty Method AssignByRef
- *
- * Smarty::assignByRef() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_AssignByRef
-{
-    /**
-     * assigns values to template variables by reference
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $tpl_var the template variable name
-     * @param                                                         $value
-     * @param boolean                                                 $nocache if true any output of this variable will
-     *                                                                         be not cached
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache)
-    {
-        if ($tpl_var !== '') {
-            $data->tpl_vars[ $tpl_var ] = new Smarty_Variable(null, $nocache);
-            $data->tpl_vars[ $tpl_var ]->value = &$value;
-            if ($data->_isTplObj() && $data->scope) {
-                $data->ext->_updateScope->_updateScope($data, $tpl_var);
-            }
-        }
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php
deleted file mode 100644
index 08cfa4693..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Smarty Method AssignGlobal
- *
- * Smarty::assignGlobal() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_AssignGlobal
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * assigns a global Smarty variable
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $varName the global variable name
-     * @param mixed                                                   $value   the value to assign
-     * @param boolean                                                 $nocache if true any output of this variable will
-     *                                                                         be not cached
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function assignGlobal(Smarty_Internal_Data $data, $varName, $value = null, $nocache = false)
-    {
-        if ($varName !== '') {
-            Smarty::$global_tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache);
-            $ptr = $data;
-            while ($ptr->_isTplObj()) {
-                $ptr->tpl_vars[ $varName ] = clone Smarty::$global_tpl_vars[ $varName ];
-                $ptr = $ptr->parent;
-            }
-        }
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php
deleted file mode 100644
index 29ff2ffb0..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Smarty Method ClearAllAssign
- *
- * Smarty::clearAllAssign() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ClearAllAssign
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * clear all the assigned template variables.
-     *
-     * @api  Smarty::clearAllAssign()
-     * @link http://www.smarty.net/docs/en/api.clear.all.assign.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function clearAllAssign(Smarty_Internal_Data $data)
-    {
-        $data->tpl_vars = array();
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php
deleted file mode 100644
index 30d55f7d2..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Smarty Method ClearAllCache
- *
- * Smarty::clearAllCache() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ClearAllCache
-{
-    /**
-     * Valid for Smarty object
-     *
-     * @var int
-     */
-    public $objMap = 1;
-
-    /**
-     * Empty cache folder
-     *
-     * @api  Smarty::clearAllCache()
-     * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl
-     *
-     * @param \Smarty $smarty
-     * @param integer $exp_time expiration time
-     * @param string  $type     resource type
-     *
-     * @return int number of cache files deleted
-     * @throws \SmartyException
-     */
-    public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null)
-    {
-        $smarty->_clearTemplateCache();
-        // load cache resource and call clearAll
-        $_cache_resource = Smarty_CacheResource::load($smarty, $type);
-        return $_cache_resource->clearAll($smarty, $exp_time);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php
deleted file mode 100644
index 22bfa2d31..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * Smarty Method ClearAssign
- *
- * Smarty::clearAssign() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ClearAssign
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * clear the given assigned template variable(s).
-     *
-     * @api  Smarty::clearAssign()
-     * @link http://www.smarty.net/docs/en/api.clear.assign.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string|array                                            $tpl_var the template variable(s) to clear
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function clearAssign(Smarty_Internal_Data $data, $tpl_var)
-    {
-        if (is_array($tpl_var)) {
-            foreach ($tpl_var as $curr_var) {
-                unset($data->tpl_vars[ $curr_var ]);
-            }
-        } else {
-            unset($data->tpl_vars[ $tpl_var ]);
-        }
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php
deleted file mode 100644
index a5dd4e26e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * Smarty Method ClearCache
- *
- * Smarty::clearCache() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ClearCache
-{
-    /**
-     * Valid for Smarty object
-     *
-     * @var int
-     */
-    public $objMap = 1;
-
-    /**
-     * Empty cache for a specific template
-     *
-     * @api  Smarty::clearCache()
-     * @link http://www.smarty.net/docs/en/api.clear.cache.tpl
-     *
-     * @param \Smarty $smarty
-     * @param string  $template_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time
-     * @param string  $type          resource type
-     *
-     * @return int number of cache files deleted
-     * @throws \SmartyException
-     */
-    public function clearCache(
-        Smarty $smarty,
-        $template_name,
-        $cache_id = null,
-        $compile_id = null,
-        $exp_time = null,
-        $type = null
-    ) {
-        $smarty->_clearTemplateCache();
-        // load cache resource and call clear
-        $_cache_resource = Smarty_CacheResource::load($smarty, $type);
-        return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
deleted file mode 100644
index bf4929807..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-
-/**
- * Smarty Method ClearCompiledTemplate
- *
- * Smarty::clearCompiledTemplate() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ClearCompiledTemplate
-{
-    /**
-     * Valid for Smarty object
-     *
-     * @var int
-     */
-    public $objMap = 1;
-
-    /**
-     * Delete compiled template file
-     *
-     * @api  Smarty::clearCompiledTemplate()
-     * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl
-     *
-     * @param \Smarty $smarty
-     * @param string  $resource_name template name
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time
-     *
-     * @return int number of template files deleted
-     * @throws \SmartyException
-     */
-    public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
-    {
-        // clear template objects cache
-        $smarty->_clearTemplateCache();
-        $_compile_dir = $smarty->getCompileDir();
-        if ($_compile_dir === '/') { //We should never want to delete this!
-            return 0;
-        }
-        $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
-        $_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
-        if (isset($resource_name)) {
-            $_save_stat = $smarty->caching;
-            $smarty->caching = Smarty::CACHING_OFF;
-            /* @var Smarty_Internal_Template $tpl */
-            $tpl = $smarty->createTemplate($resource_name);
-            $smarty->caching = $_save_stat;
-            if (!$tpl->source->handler->uncompiled && !$tpl->source->handler->recompiled && $tpl->source->exists) {
-                $_resource_part_1 = basename(str_replace('^', DIRECTORY_SEPARATOR, $tpl->compiled->filepath));
-                $_resource_part_1_length = strlen($_resource_part_1);
-            } else {
-                return 0;
-            }
-            $_resource_part_2 = str_replace('.php', '.cache.php', $_resource_part_1);
-            $_resource_part_2_length = strlen($_resource_part_2);
-        }
-        $_dir = $_compile_dir;
-        if ($smarty->use_sub_dirs && isset($_compile_id)) {
-            $_dir .= $_compile_id . $_dir_sep;
-        }
-        if (isset($_compile_id)) {
-            $_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep;
-            $_compile_id_part_length = strlen($_compile_id_part);
-        }
-        $_count = 0;
-        try {
-            $_compileDirs = new RecursiveDirectoryIterator($_dir);
-            // NOTE: UnexpectedValueException thrown for PHP >= 5.3
-        } catch (Exception $e) {
-            return 0;
-        }
-        $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
-        foreach ($_compile as $_file) {
-            if (substr(basename($_file->getPathname()), 0, 1) === '.') {
-                continue;
-            }
-            $_filepath = (string)$_file;
-            if ($_file->isDir()) {
-                if (!$_compile->isDot()) {
-                    // delete folder if empty
-                    @rmdir($_file->getPathname());
-                }
-            } else {
-                // delete only php files
-                if (substr($_filepath, -4) !== '.php') {
-                    continue;
-                }
-                $unlink = false;
-                if ((!isset($_compile_id) ||
-                     (isset($_filepath[ $_compile_id_part_length ]) &&
-                      $a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
-                    && (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ])
-                                                   && substr_compare(
-                                                          $_filepath,
-                                                          $_resource_part_1,
-                                                          -$_resource_part_1_length,
-                                                          $_resource_part_1_length
-                                                      ) === 0) || (isset($_filepath[ $_resource_part_2_length ])
-                                                                   && substr_compare(
-                                                                          $_filepath,
-                                                                          $_resource_part_2,
-                                                                          -$_resource_part_2_length,
-                                                                          $_resource_part_2_length
-                                                                      ) === 0))
-                ) {
-                    if (isset($exp_time)) {
-                        if (is_file($_filepath) && time() - filemtime($_filepath) >= $exp_time) {
-                            $unlink = true;
-                        }
-                    } else {
-                        $unlink = true;
-                    }
-                }
-                if ($unlink && is_file($_filepath) && @unlink($_filepath)) {
-                    $_count++;
-                    if (function_exists('opcache_invalidate')
-                        && (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api')) < 1)
-                    ) {
-                        opcache_invalidate($_filepath, true);
-                    } elseif (function_exists('apc_delete_file')) {
-                        apc_delete_file($_filepath);
-                    }
-                }
-            }
-        }
-        return $_count;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php
deleted file mode 100644
index 15bf492a1..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Smarty Method ClearConfig
- *
- * Smarty::clearConfig() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ClearConfig
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * clear a single or all config variables
-     *
-     * @api  Smarty::clearConfig()
-     * @link http://www.smarty.net/docs/en/api.clear.config.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string|null                                             $name variable name or null
-     *
-     * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
-     */
-    public function clearConfig(Smarty_Internal_Data $data, $name = null)
-    {
-        if (isset($name)) {
-            unset($data->config_vars[ $name ]);
-        } else {
-            $data->config_vars = array();
-        }
-        return $data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php
deleted file mode 100644
index 3934ca042..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Smarty Method CompileAllConfig
- *
- * Smarty::compileAllConfig() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_CompileAllTemplates
-{
-    /**
-     * Compile all config files
-     *
-     * @api Smarty::compileAllConfig()
-     *
-     * @param \Smarty $smarty        passed smarty object
-     * @param string  $extension     file extension
-     * @param bool    $force_compile force all to recompile
-     * @param int     $time_limit
-     * @param int     $max_errors
-     *
-     * @return int number of template files recompiled
-     */
-    public function compileAllConfig(
-        Smarty $smarty,
-        $extension = '.conf',
-        $force_compile = false,
-        $time_limit = 0,
-        $max_errors = null
-    ) {
-        return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php
deleted file mode 100644
index 5c046da40..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-/**
- * Smarty Method CompileAllTemplates
- *
- * Smarty::compileAllTemplates() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_CompileAllTemplates
-{
-    /**
-     * Valid for Smarty object
-     *
-     * @var int
-     */
-    public $objMap = 1;
-
-    /**
-     * Compile all template files
-     *
-     * @api Smarty::compileAllTemplates()
-     *
-     * @param \Smarty $smarty        passed smarty object
-     * @param string  $extension     file extension
-     * @param bool    $force_compile force all to recompile
-     * @param int     $time_limit
-     * @param int     $max_errors
-     *
-     * @return integer number of template files recompiled
-     */
-    public function compileAllTemplates(
-        Smarty $smarty,
-        $extension = '.tpl',
-        $force_compile = false,
-        $time_limit = 0,
-        $max_errors = null
-    ) {
-        return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
-    }
-
-    /**
-     * Compile all template or config files
-     *
-     * @param \Smarty $smarty
-     * @param string  $extension     template file name extension
-     * @param bool    $force_compile force all to recompile
-     * @param int     $time_limit    set maximum execution time
-     * @param int     $max_errors    set maximum allowed errors
-     * @param bool    $isConfig      flag true if called for config files
-     *
-     * @return int number of template files compiled
-     */
-    protected function compileAll(
-        Smarty $smarty,
-        $extension,
-        $force_compile,
-        $time_limit,
-        $max_errors,
-        $isConfig = false
-    ) {
-        // switch off time limit
-        if (function_exists('set_time_limit')) {
-            @set_time_limit($time_limit);
-        }
-        $_count = 0;
-        $_error_count = 0;
-        $sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
-        // loop over array of source directories
-        foreach ($sourceDir as $_dir) {
-            $_dir_1 = new RecursiveDirectoryIterator(
-                $_dir,
-                defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
-                    FilesystemIterator::FOLLOW_SYMLINKS : 0
-            );
-            $_dir_2 = new RecursiveIteratorIterator($_dir_1);
-            foreach ($_dir_2 as $_fileinfo) {
-                $_file = $_fileinfo->getFilename();
-                if (substr(basename($_fileinfo->getPathname()), 0, 1) === '.' || strpos($_file, '.svn') !== false) {
-                    continue;
-                }
-                if (substr_compare($_file, $extension, -strlen($extension)) !== 0) {
-                    continue;
-                }
-                if ($_fileinfo->getPath() !== substr($_dir, 0, -1)) {
-                    $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DIRECTORY_SEPARATOR . $_file;
-                }
-                echo "\n<br>", $_dir, '---', $_file;
-                flush();
-                $_start_time = microtime(true);
-                $_smarty = clone $smarty;
-                //
-                $_smarty->_cache = array();
-                $_smarty->ext = new Smarty_Internal_Extension_Handler();
-                $_smarty->ext->objType = $_smarty->_objType;
-                $_smarty->force_compile = $force_compile;
-                try {
-                    /* @var Smarty_Internal_Template $_tpl */
-                    $_tpl = new $smarty->template_class($_file, $_smarty);
-                    $_tpl->caching = Smarty::CACHING_OFF;
-                    $_tpl->source =
-                        $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
-                    if ($_tpl->mustCompile()) {
-                        $_tpl->compileTemplateSource();
-                        $_count++;
-                        echo ' compiled in  ', microtime(true) - $_start_time, ' seconds';
-                        flush();
-                    } else {
-                        echo ' is up to date';
-                        flush();
-                    }
-                } catch (Exception $e) {
-                    echo "\n<br>        ------>Error: ", $e->getMessage(), "<br><br>\n";
-                    $_error_count++;
-                }
-                // free memory
-                unset($_tpl);
-                $_smarty->_clearTemplateCache();
-                if ($max_errors !== null && $_error_count === $max_errors) {
-                    echo "\n<br><br>too many errors\n";
-                    exit(1);
-                }
-            }
-        }
-        echo "\n<br>";
-        return $_count;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_configload.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_configload.php
deleted file mode 100644
index 2e6254880..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_configload.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-/**
- * Smarty Method ConfigLoad
- *
- * Smarty::configLoad() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_ConfigLoad
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * load a config file, optionally load just selected sections
-     *
-     * @api  Smarty::configLoad()
-     * @link http://www.smarty.net/docs/en/api.config.load.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $config_file filename
-     * @param mixed                                                   $sections    array of section names, single
-     *                                                                             section or null
-     *
-     * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
-     * @throws \Exception
-     */
-    public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
-    {
-        $this->_loadConfigFile($data, $config_file, $sections, null);
-        return $data;
-    }
-
-    /**
-     * load a config file, optionally load just selected sections
-     *
-     * @api  Smarty::configLoad()
-     * @link http://www.smarty.net/docs/en/api.config.load.tpl
-     *
-     * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
-     * @param string                                                  $config_file filename
-     * @param mixed                                                   $sections    array of section names, single
-     *                                                                             section or null
-     * @param int                                                     $scope       scope into which config variables
-     *                                                                             shall be loaded
-     *
-     * @throws \Exception
-     */
-    public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
-    {
-        /* @var \Smarty $smarty */
-        $smarty = $data->_getSmartyObj();
-        /* @var \Smarty_Internal_Template $confObj */
-        $confObj = new Smarty_Internal_Template($config_file, $smarty, $data, null, null, null, null, true);
-        $confObj->caching = Smarty::CACHING_OFF;
-        $confObj->source->config_sections = $sections;
-        $confObj->source->scope = $scope;
-        $confObj->compiled = Smarty_Template_Compiled::load($confObj);
-        $confObj->compiled->render($confObj);
-        if ($data->_isTplObj()) {
-            $data->compiled->file_dependency[ $confObj->source->uid ] =
-                array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
-        }
-    }
-
-    /**
-     * load config variables into template object
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param array                     $new_config_vars
-     */
-    public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
-    {
-        $this->_assignConfigVars($tpl->parent->config_vars, $tpl, $new_config_vars);
-        $tagScope = $tpl->source->scope;
-        if ($tagScope >= 0) {
-            if ($tagScope === Smarty::SCOPE_LOCAL) {
-                $this->_updateVarStack($tpl, $new_config_vars);
-                $tagScope = 0;
-                if (!$tpl->scope) {
-                    return;
-                }
-            }
-            if ($tpl->parent->_isTplObj() && ($tagScope || $tpl->parent->scope)) {
-                $mergedScope = $tagScope | $tpl->scope;
-                if ($mergedScope) {
-                    // update scopes
-                    /* @var \Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $ptr */
-                    foreach ($tpl->smarty->ext->_updateScope->_getAffectedScopes($tpl->parent, $mergedScope) as $ptr) {
-                        $this->_assignConfigVars($ptr->config_vars, $tpl, $new_config_vars);
-                        if ($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) {
-                            $this->_updateVarStack($tpl, $new_config_vars);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Assign all config variables in given scope
-     *
-     * @param array                     $config_vars     config variables in scope
-     * @param \Smarty_Internal_Template $tpl
-     * @param array                     $new_config_vars loaded config variables
-     */
-    public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars)
-    {
-        // copy global config vars
-        foreach ($new_config_vars[ 'vars' ] as $variable => $value) {
-            if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
-                $config_vars[ $variable ] = $value;
-            } else {
-                $config_vars[ $variable ] = array_merge((array)$config_vars[ $variable ], (array)$value);
-            }
-        }
-        // scan sections
-        $sections = $tpl->source->config_sections;
-        if (!empty($sections)) {
-            foreach ((array)$sections as $tpl_section) {
-                if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) {
-                    foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) {
-                        if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) {
-                            $config_vars[ $variable ] = $value;
-                        } else {
-                            $config_vars[ $variable ] = array_merge((array)$config_vars[ $variable ], (array)$value);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Update config variables in template local variable stack
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param array                     $config_vars
-     */
-    public function _updateVarStack(Smarty_Internal_Template $tpl, $config_vars)
-    {
-        $i = 0;
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
-            $this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars);
-            $i++;
-        }
-    }
-
-    /**
-     * gets  a config variable value
-     *
-     * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
-     * @param string                                                  $varName the name of the config variable
-     * @param bool                                                    $errorEnable
-     *
-     * @return null|string  the value of the config variable
-     */
-    public function _getConfigVariable(Smarty_Internal_Data $data, $varName, $errorEnable = true)
-    {
-        $_ptr = $data;
-        while ($_ptr !== null) {
-            if (isset($_ptr->config_vars[ $varName ])) {
-                // found it, return it
-                return $_ptr->config_vars[ $varName ];
-            }
-            // not found, try at parent
-            $_ptr = $_ptr->parent;
-        }
-        if ($data->smarty->error_unassigned && $errorEnable) {
-            // force a notice
-            $x = $$varName;
-        }
-        return null;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_createdata.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_createdata.php
deleted file mode 100644
index f95097519..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_createdata.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Smarty Method CreateData
- *
- * Smarty::createData() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_CreateData
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * creates a data object
-     *
-     * @api  Smarty::createData()
-     * @link http://www.smarty.net/docs/en/api.create.data.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty      $obj
-     * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty
-     *                                                                                     variables
-     * @param string                                                               $name   optional data block name
-     *
-     * @return \Smarty_Data data object
-     */
-    public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null)
-    {
-        /* @var Smarty $smarty */
-        $smarty = $obj->_getSmartyObj();
-        $dataObj = new Smarty_Data($parent, $smarty, $name);
-        if ($smarty->debugging) {
-            Smarty_Internal_Debug::register_data($dataObj);
-        }
-        return $dataObj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
deleted file mode 100644
index 4145db10b..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetAutoloadFilters
- *
- * Smarty::getAutoloadFilters() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
-{
-    /**
-     * Get autoload filters
-     *
-     * @api Smarty::getAutoloadFilters()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type type of filter to get auto loads
-     *                                                                              for. Defaults to all autoload
-     *                                                                              filters
-     *
-     * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
-     *                was specified
-     * @throws \SmartyException
-     */
-    public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if ($type !== null) {
-            $this->_checkFilterType($type);
-            return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array();
-        }
-        return $smarty->autoload_filters;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php
deleted file mode 100644
index b54815123..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetConfigVariable
- *
- * Smarty::getConfigVariable() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetConfigVariable
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * gets  a config variable value
-     *
-     * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
-     * @param string                                                  $varName the name of the config variable
-     * @param bool                                                    $errorEnable
-     *
-     * @return null|string  the value of the config variable
-     */
-    public function getConfigVariable(Smarty_Internal_Data $data, $varName = null, $errorEnable = true)
-    {
-        return $data->ext->configLoad->_getConfigVariable($data, $varName, $errorEnable);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php
deleted file mode 100644
index 1d11e44c1..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetConfigVars
- *
- * Smarty::getConfigVars() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetConfigVars
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * Returns a single or all config variables
-     *
-     * @api  Smarty::getConfigVars()
-     * @link http://www.smarty.net/docs/en/api.get.config.vars.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $varname        variable name or null
-     * @param bool                                                    $search_parents include parent templates?
-     *
-     * @return mixed variable value or or array of variables
-     */
-    public function getConfigVars(Smarty_Internal_Data $data, $varname = null, $search_parents = true)
-    {
-        $_ptr = $data;
-        $var_array = array();
-        while ($_ptr !== null) {
-            if (isset($varname)) {
-                if (isset($_ptr->config_vars[ $varname ])) {
-                    return $_ptr->config_vars[ $varname ];
-                }
-            } else {
-                $var_array = array_merge($_ptr->config_vars, $var_array);
-            }
-            // not found, try at parent
-            if ($search_parents) {
-                $_ptr = $_ptr->parent;
-            } else {
-                $_ptr = null;
-            }
-        }
-        if (isset($varname)) {
-            return '';
-        } else {
-            return $var_array;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
deleted file mode 100644
index 77d908c15..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetDebugTemplate
- *
- * Smarty::getDebugTemplate() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetDebugTemplate
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * return name of debugging template
-     *
-     * @api Smarty::getDebugTemplate()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     *
-     * @return string
-     */
-    public function getDebugTemplate(Smarty_Internal_TemplateBase $obj)
-    {
-        $smarty = $obj->_getSmartyObj();
-        return $smarty->debug_tpl;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
deleted file mode 100644
index 57da85c49..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetDefaultModifiers
- *
- * Smarty::getDefaultModifiers() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetDefaultModifiers
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Get default modifiers
-     *
-     * @api Smarty::getDefaultModifiers()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     *
-     * @return array list of default modifiers
-     */
-    public function getDefaultModifiers(Smarty_Internal_TemplateBase $obj)
-    {
-        $smarty = $obj->_getSmartyObj();
-        return $smarty->default_modifiers;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getglobal.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getglobal.php
deleted file mode 100644
index 2be11d7e8..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getglobal.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetGlobal
- *
- * Smarty::getGlobal() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetGlobal
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * Returns a single or all global  variables
-     *
-     * @api Smarty::getGlobal()
-     *
-     * @param \Smarty_Internal_Data $data
-     * @param string                $varName variable name or null
-     *
-     * @return string|array variable value or or array of variables
-     */
-    public function getGlobal(Smarty_Internal_Data $data, $varName = null)
-    {
-        if (isset($varName)) {
-            if (isset(Smarty::$global_tpl_vars[ $varName ])) {
-                return Smarty::$global_tpl_vars[ $varName ]->value;
-            } else {
-                return '';
-            }
-        } else {
-            $_result = array();
-            foreach (Smarty::$global_tpl_vars as $key => $var) {
-                $_result[ $key ] = $var->value;
-            }
-            return $_result;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php
deleted file mode 100644
index df6ede130..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetRegisteredObject
- *
- * Smarty::getRegisteredObject() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetRegisteredObject
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * return a reference to a registered object
-     *
-     * @api  Smarty::getRegisteredObject()
-     * @link http://www.smarty.net/docs/en/api.get.registered.object.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $object_name object name
-     *
-     * @return object
-     * @throws \SmartyException if no such object is found
-     */
-    public function getRegisteredObject(Smarty_Internal_TemplateBase $obj, $object_name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (!isset($smarty->registered_objects[ $object_name ])) {
-            throw new SmartyException("'$object_name' is not a registered object");
-        }
-        if (!is_object($smarty->registered_objects[ $object_name ][ 0 ])) {
-            throw new SmartyException("registered '$object_name' is not an object");
-        }
-        return $smarty->registered_objects[ $object_name ][ 0 ];
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php
deleted file mode 100644
index 8db39c525..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetStreamVariable
- *
- * Smarty::getStreamVariable() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetStreamVariable
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * gets  a stream variable
-     *
-     * @api Smarty::getStreamVariable()
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $variable the stream of the variable
-     *
-     * @return mixed
-     * @throws \SmartyException
-     */
-    public function getStreamVariable(Smarty_Internal_Data $data, $variable)
-    {
-        $_result = '';
-        $fp = fopen($variable, 'r+');
-        if ($fp) {
-            while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
-                $_result .= $current_line;
-            }
-            fclose($fp);
-            return $_result;
-        }
-        $smarty = isset($data->smarty) ? $data->smarty : $data;
-        if ($smarty->error_unassigned) {
-            throw new SmartyException('Undefined stream variable "' . $variable . '"');
-        } else {
-            return null;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_gettags.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_gettags.php
deleted file mode 100644
index c07ae07ec..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_gettags.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetTags
- *
- * Smarty::getTags() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetTags
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Return array of tag/attributes of all tags used by an template
-     *
-     * @api  Smarty::getTags()
-     * @link http://www.smarty.net/docs/en/api.get.tags.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param null|string|Smarty_Internal_Template                            $template
-     *
-     * @return array of tag/attributes
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function getTags(Smarty_Internal_TemplateBase $obj, $template = null)
-    {
-        /* @var Smarty $smarty */
-        $smarty = $obj->_getSmartyObj();
-        if ($obj->_isTplObj() && !isset($template)) {
-            $tpl = clone $obj;
-        } elseif (isset($template) && $template->_isTplObj()) {
-            $tpl = clone $template;
-        } elseif (isset($template) && is_string($template)) {
-            /* @var Smarty_Internal_Template $tpl */
-            $tpl = new $smarty->template_class($template, $smarty);
-            // checks if template exists
-            if (!$tpl->source->exists) {
-                throw new SmartyException("Unable to load template {$tpl->source->type} '{$tpl->source->name}'");
-            }
-        }
-        if (isset($tpl)) {
-            $tpl->smarty = clone $tpl->smarty;
-            $tpl->smarty->_cache[ 'get_used_tags' ] = true;
-            $tpl->_cache[ 'used_tags' ] = array();
-            $tpl->smarty->merge_compiled_includes = false;
-            $tpl->smarty->disableSecurity();
-            $tpl->caching = Smarty::CACHING_OFF;
-            $tpl->loadCompiler();
-            $tpl->compiler->compileTemplate($tpl);
-            return $tpl->_cache[ 'used_tags' ];
-        }
-        throw new SmartyException('Missing template specification');
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php
deleted file mode 100644
index 9ef7d46bb..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetTemplateVars
- *
- * Smarty::getTemplateVars() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_GetTemplateVars
-{
-    /**
-     * Valid for all objects
-     *
-     * @var int
-     */
-    public $objMap = 7;
-
-    /**
-     * Returns a single or all template variables
-     *
-     * @api  Smarty::getTemplateVars()
-     * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $varName       variable name or null
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
-     * @param bool                                                    $searchParents include parent templates?
-     *
-     * @return mixed variable value or or array of variables
-     */
-    public function getTemplateVars(
-        Smarty_Internal_Data $data,
-        $varName = null,
-        Smarty_Internal_Data $_ptr = null,
-        $searchParents = true
-    ) {
-        if (isset($varName)) {
-            $_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false);
-            if (is_object($_var)) {
-                return $_var->value;
-            } else {
-                return null;
-            }
-        } else {
-            $_result = array();
-            if ($_ptr === null) {
-                $_ptr = $data;
-            }
-            while ($_ptr !== null) {
-                foreach ($_ptr->tpl_vars as $key => $var) {
-                    if (!array_key_exists($key, $_result)) {
-                        $_result[ $key ] = $var->value;
-                    }
-                }
-                // not found, try at parent
-                if ($searchParents && isset($_ptr->parent)) {
-                    $_ptr = $_ptr->parent;
-                } else {
-                    $_ptr = null;
-                }
-            }
-            if ($searchParents && isset(Smarty::$global_tpl_vars)) {
-                foreach (Smarty::$global_tpl_vars as $key => $var) {
-                    if (!array_key_exists($key, $_result)) {
-                        $_result[ $key ] = $var->value;
-                    }
-                }
-            }
-            return $_result;
-        }
-    }
-
-    /**
-     * gets the object of a Smarty variable
-     *
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
-     * @param string                                                  $varName       the name of the Smarty variable
-     * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr          optional pointer to data object
-     * @param bool                                                    $searchParents search also in parent data
-     * @param bool                                                    $errorEnable
-     *
-     * @return \Smarty_Variable
-     */
-    public function _getVariable(
-        Smarty_Internal_Data $data,
-        $varName,
-        Smarty_Internal_Data $_ptr = null,
-        $searchParents = true,
-        $errorEnable = true
-    ) {
-        if ($_ptr === null) {
-            $_ptr = $data;
-        }
-        while ($_ptr !== null) {
-            if (isset($_ptr->tpl_vars[ $varName ])) {
-                // found it, return it
-                return $_ptr->tpl_vars[ $varName ];
-            }
-            // not found, try at parent
-            if ($searchParents && isset($_ptr->parent)) {
-                $_ptr = $_ptr->parent;
-            } else {
-                $_ptr = null;
-            }
-        }
-        if (isset(Smarty::$global_tpl_vars[ $varName ])) {
-            // found it, return it
-            return Smarty::$global_tpl_vars[ $varName ];
-        }
-        if ($errorEnable && $data->_getSmartyObj()->error_unassigned) {
-            // force a notice
-            $x = $$varName;
-        }
-        return new Smarty_Undefined_Variable;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_literals.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_literals.php
deleted file mode 100644
index bfa3f58ec..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_literals.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-/**
- * Smarty Method GetLiterals
- *
- * Smarty::getLiterals() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_Literals
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Get literals
-     *
-     * @api Smarty::getLiterals()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     *
-     * @return array list of literals
-     */
-    public function getLiterals(Smarty_Internal_TemplateBase $obj)
-    {
-        $smarty = $obj->_getSmartyObj();
-        return (array)$smarty->literals;
-    }
-
-    /**
-     * Add literals
-     *
-     * @api Smarty::addLiterals()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param array|string                                                    $literals literal or list of literals
-     *                                                                                  to addto add
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function addLiterals(Smarty_Internal_TemplateBase $obj, $literals = null)
-    {
-        if (isset($literals)) {
-            $this->set($obj->_getSmartyObj(), (array)$literals);
-        }
-        return $obj;
-    }
-
-    /**
-     * Set literals
-     *
-     * @api Smarty::setLiterals()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param array|string                                                    $literals literal or list of literals
-     *                                                                                  to setto set
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function setLiterals(Smarty_Internal_TemplateBase $obj, $literals = null)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $smarty->literals = array();
-        if (!empty($literals)) {
-            $this->set($smarty, (array)$literals);
-        }
-        return $obj;
-    }
-
-    /**
-     * common setter for literals for easier handling of duplicates the
-     * Smarty::$literals array gets filled with identical key values
-     *
-     * @param \Smarty $smarty
-     * @param array   $literals
-     *
-     * @throws \SmartyException
-     */
-    private function set(Smarty $smarty, $literals)
-    {
-        $literals = array_combine($literals, $literals);
-        $error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array();
-        $error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error;
-        if (!empty($error)) {
-            throw new SmartyException(
-                'User defined literal(s) "' . $error .
-                '" may not be identical with left or right delimiter'
-            );
-        }
-        $smarty->literals = array_merge((array)$smarty->literals, (array)$literals);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php
deleted file mode 100644
index 66d80d474..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * Smarty Method LoadFilter
- *
- * Smarty::loadFilter() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_LoadFilter
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Valid filter types
-     *
-     * @var array
-     */
-    private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
-
-    /**
-     * load a filter of specified type and name
-     *
-     * @api  Smarty::loadFilter()
-     *
-     * @link http://www.smarty.net/docs/en/api.load.filter.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type filter type
-     * @param string                                                          $name filter name
-     *
-     * @return bool
-     * @throws SmartyException if filter could not be loaded
-     */
-    public function loadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $this->_checkFilterType($type);
-        $_plugin = "smarty_{$type}filter_{$name}";
-        $_filter_name = $_plugin;
-        if (is_callable($_plugin)) {
-            $smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin;
-            return true;
-        }
-        if ($smarty->loadPlugin($_plugin)) {
-            if (class_exists($_plugin, false)) {
-                $_plugin = array($_plugin, 'execute');
-            }
-            if (is_callable($_plugin)) {
-                $smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin;
-                return true;
-            }
-        }
-        throw new SmartyException("{$type}filter '{$name}' not found or callable");
-    }
-
-    /**
-     * Check if filter type is valid
-     *
-     * @param string $type
-     *
-     * @throws \SmartyException
-     */
-    public function _checkFilterType($type)
-    {
-        if (!isset($this->filterTypes[ $type ])) {
-            throw new SmartyException("Illegal filter type '{$type}'");
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php
deleted file mode 100644
index 3bd659cb8..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * Smarty Extension Loadplugin
- *
- * $smarty->loadPlugin() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_LoadPlugin
-{
-    /**
-     * Cache of searched plugin files
-     *
-     * @var array
-     */
-    public $plugin_files = array();
-
-    /**
-     * Takes unknown classes and loads plugin files for them
-     * class name format: Smarty_PluginType_PluginName
-     * plugin filename format: plugintype.pluginname.php
-     *
-     * @param \Smarty $smarty
-     * @param string  $plugin_name class plugin name to load
-     * @param bool    $check       check if already loaded
-     *
-     * @return bool|string
-     * @throws \SmartyException
-     */
-    public function loadPlugin(Smarty $smarty, $plugin_name, $check)
-    {
-        // if function or class exists, exit silently (already loaded)
-        if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
-            return true;
-        }
-        if (!preg_match('#^smarty_((internal)|([^_]+))_(.+)$#i', $plugin_name, $match)) {
-            throw new SmartyException("plugin {$plugin_name} is not a valid name format");
-        }
-        if (!empty($match[ 2 ])) {
-            $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
-            if (isset($this->plugin_files[ $file ])) {
-                if ($this->plugin_files[ $file ] !== false) {
-                    return $this->plugin_files[ $file ];
-                } else {
-                    return false;
-                }
-            } else {
-                if (is_file($file)) {
-                    $this->plugin_files[ $file ] = $file;
-                    include_once $file;
-                    return $file;
-                } else {
-                    $this->plugin_files[ $file ] = false;
-                    return false;
-                }
-            }
-        }
-        // plugin filename is expected to be: [type].[name].php
-        $_plugin_filename = "{$match[1]}.{$match[4]}.php";
-        $_lower_filename = strtolower($_plugin_filename);
-        if (isset($this->plugin_files)) {
-            if (isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
-                if (!$smarty->use_include_path || $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] !== false) {
-                    return $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ];
-                }
-            }
-            if (!$smarty->use_include_path || $smarty->ext->_getIncludePath->isNewIncludePath($smarty)) {
-                unset($this->plugin_files[ 'include_path' ]);
-            } else {
-                if (isset($this->plugin_files[ 'include_path' ][ $_lower_filename ])) {
-                    return $this->plugin_files[ 'include_path' ][ $_lower_filename ];
-                }
-            }
-        }
-        $_file_names = array($_plugin_filename);
-        if ($_lower_filename !== $_plugin_filename) {
-            $_file_names[] = $_lower_filename;
-        }
-        $_p_dirs = $smarty->getPluginsDir();
-        if (!isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
-            // loop through plugin dirs and find the plugin
-            foreach ($_p_dirs as $_plugin_dir) {
-                foreach ($_file_names as $name) {
-                    $file = $_plugin_dir . $name;
-                    if (is_file($file)) {
-                        $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file;
-                        include_once $file;
-                        return $file;
-                    }
-                    $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false;
-                }
-            }
-        }
-        if ($smarty->use_include_path) {
-            foreach ($_file_names as $_file_name) {
-                // try PHP include_path
-                $file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
-                $this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file;
-                if ($file !== false) {
-                    include_once $file;
-                    return $file;
-                }
-            }
-        }
-        // no plugin loaded
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php
deleted file mode 100644
index 39318838e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * Smarty Method MustCompile
- *
- * Smarty_Internal_Template::mustCompile() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_MustCompile
-{
-    /**
-     * Valid for template object
-     *
-     * @var int
-     */
-    public $objMap = 2;
-
-    /**
-     * Returns if the current template must be compiled by the Smarty compiler
-     * It does compare the timestamps of template source and the compiled templates and checks the force compile
-     * configuration
-     *
-     * @param \Smarty_Internal_Template $_template
-     *
-     * @return bool
-     * @throws \SmartyException
-     */
-    public function mustCompile(Smarty_Internal_Template $_template)
-    {
-        if (!$_template->source->exists) {
-            if ($_template->_isSubTpl()) {
-                $parent_resource = " in '$_template->parent->template_resource}'";
-            } else {
-                $parent_resource = '';
-            }
-            throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
-        }
-        if ($_template->mustCompile === null) {
-            $_template->mustCompile = (!$_template->source->handler->uncompiled &&
-                                       ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
-                                        !$_template->compiled->exists || ($_template->compile_check &&
-                                                                          $_template->compiled->getTimeStamp() <
-                                                                          $_template->source->getTimeStamp())));
-        }
-        return $_template->mustCompile;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php
deleted file mode 100644
index 648365619..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterCacheResource
- *
- * Smarty::registerCacheResource() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterCacheResource
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers a resource to fetch a template
-     *
-     * @api  Smarty::registerCacheResource()
-     * @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $name name of resource type
-     * @param \Smarty_CacheResource                                           $resource_handler
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function registerCacheResource(
-        Smarty_Internal_TemplateBase $obj,
-        $name,
-        Smarty_CacheResource $resource_handler
-    ) {
-        $smarty = $obj->_getSmartyObj();
-        $smarty->registered_cache_resources[ $name ] = $resource_handler;
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php
deleted file mode 100644
index 8d18547e2..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterClass
- *
- * Smarty::registerClass() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterClass
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers static classes to be used in templates
-     *
-     * @api  Smarty::registerClass()
-     * @link http://www.smarty.net/docs/en/api.register.class.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $class_name
-     * @param string                                                          $class_impl the referenced PHP class to
-     *                                                                                    register
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function registerClass(Smarty_Internal_TemplateBase $obj, $class_name, $class_impl)
-    {
-        $smarty = $obj->_getSmartyObj();
-        // test if exists
-        if (!class_exists($class_impl)) {
-            throw new SmartyException("Undefined class '$class_impl' in register template class");
-        }
-        // register the class
-        $smarty->registered_classes[ $class_name ] = $class_impl;
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
deleted file mode 100644
index b340f178d..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterDefaultConfigHandler
- *
- * Smarty::registerDefaultConfigHandler() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterDefaultConfigHandler
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Register config default handler
-     *
-     * @api Smarty::registerDefaultConfigHandler()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param callable                                                        $callback class/method name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws SmartyException              if $callback is not callable
-     */
-    public function registerDefaultConfigHandler(Smarty_Internal_TemplateBase $obj, $callback)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (is_callable($callback)) {
-            $smarty->default_config_handler_func = $callback;
-        } else {
-            throw new SmartyException('Default config handler not callable');
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
deleted file mode 100644
index a9fb78dc6..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterDefaultPluginHandler
- *
- * Smarty::registerDefaultPluginHandler() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterDefaultPluginHandler
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers a default plugin handler
-     *
-     * @api  Smarty::registerDefaultPluginHandler()
-     * @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param callable                                                        $callback class/method name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws SmartyException              if $callback is not callable
-     */
-    public function registerDefaultPluginHandler(Smarty_Internal_TemplateBase $obj, $callback)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (is_callable($callback)) {
-            $smarty->default_plugin_handler_func = $callback;
-        } else {
-            throw new SmartyException("Default plugin handler '$callback' not callable");
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
deleted file mode 100644
index cbc133ccd..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterDefaultTemplateHandler
- *
- * Smarty::registerDefaultTemplateHandler() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterDefaultTemplateHandler
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Register template default handler
-     *
-     * @api Smarty::registerDefaultTemplateHandler()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param callable                                                        $callback class/method name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws SmartyException              if $callback is not callable
-     */
-    public function registerDefaultTemplateHandler(Smarty_Internal_TemplateBase $obj, $callback)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (is_callable($callback)) {
-            $smarty->default_template_handler_func = $callback;
-        } else {
-            throw new SmartyException('Default template handler not callable');
-        }
-        return $obj;
-    }
-
-    /**
-     * get default content from template or config resource handler
-     *
-     * @param Smarty_Template_Source $source
-     *
-     * @throws \SmartyException
-     */
-    public static function _getDefaultTemplate(Smarty_Template_Source $source)
-    {
-        if ($source->isConfig) {
-            $default_handler = $source->smarty->default_config_handler_func;
-        } else {
-            $default_handler = $source->smarty->default_template_handler_func;
-        }
-        $_content = $_timestamp = null;
-        $_return = call_user_func_array(
-            $default_handler,
-            array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty)
-        );
-        if (is_string($_return)) {
-            $source->exists = is_file($_return);
-            if ($source->exists) {
-                $source->timestamp = filemtime($_return);
-            } else {
-                throw new SmartyException(
-                    'Default handler: Unable to load ' .
-                    ($source->isConfig ? 'config' : 'template') .
-                    " default file '{$_return}' for '{$source->type}:{$source->name}'"
-                );
-            }
-            $source->name = $source->filepath = $_return;
-            $source->uid = sha1($source->filepath);
-        } elseif ($_return === true) {
-            $source->content = $_content;
-            $source->exists = true;
-            $source->uid = $source->name = sha1($_content);
-            $source->handler = Smarty_Resource::load($source->smarty, 'eval');
-        } else {
-            $source->exists = false;
-            throw new SmartyException(
-                'Default handler: No ' . ($source->isConfig ? 'config' : 'template') .
-                " default content for '{$source->type}:{$source->name}'"
-            );
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php
deleted file mode 100644
index c0f9fff10..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterFilter
- *
- * Smarty::registerFilter() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterFilter
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Valid filter types
-     *
-     * @var array
-     */
-    private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
-
-    /**
-     * Registers a filter function
-     *
-     * @api  Smarty::registerFilter()
-     *
-     * @link http://www.smarty.net/docs/en/api.register.filter.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type filter type
-     * @param callback                                                        $callback
-     * @param string|null                                                     $name optional filter name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function registerFilter(Smarty_Internal_TemplateBase $obj, $type, $callback, $name = null)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $this->_checkFilterType($type);
-        $name = isset($name) ? $name : $this->_getFilterName($callback);
-        if (!is_callable($callback)) {
-            throw new SmartyException("{$type}filter '{$name}' not callable");
-        }
-        $smarty->registered_filters[ $type ][ $name ] = $callback;
-        return $obj;
-    }
-
-    /**
-     * Return internal filter name
-     *
-     * @param callback $function_name
-     *
-     * @return string   internal filter name
-     */
-    public function _getFilterName($function_name)
-    {
-        if (is_array($function_name)) {
-            $_class_name = (is_object($function_name[ 0 ]) ? get_class($function_name[ 0 ]) : $function_name[ 0 ]);
-            return $_class_name . '_' . $function_name[ 1 ];
-        } elseif (is_string($function_name)) {
-            return $function_name;
-        } else {
-            return 'closure';
-        }
-    }
-
-    /**
-     * Check if filter type is valid
-     *
-     * @param string $type
-     *
-     * @throws \SmartyException
-     */
-    public function _checkFilterType($type)
-    {
-        if (!isset($this->filterTypes[ $type ])) {
-            throw new SmartyException("Illegal filter type '{$type}'");
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php
deleted file mode 100644
index 4646e4f22..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterObject
- *
- * Smarty::registerObject() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterObject
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers object to be used in templates
-     *
-     * @api  Smarty::registerObject()
-     * @link http://www.smarty.net/docs/en/api.register.object.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $object_name
-     * @param object                                                          $object                     the
-     *                                                                                                    referenced
-     *                                                                                                    PHP
-     *                                                                                                    object
-     *                                                                                                    to
-     *                                                                                                    register
-     *
-     * @param array                                                           $allowed_methods_properties list of
-     *                                                                                                    allowed
-     *                                                                                                    methods
-     *                                                                                                    (empty
-     *                                                                                                    = all)
-     *
-     * @param bool                                                            $format                     smarty
-     *                                                                                                    argument
-     *                                                                                                    format,
-     *                                                                                                    else
-     *                                                                                                    traditional
-     *
-     * @param array                                                           $block_methods              list of
-     *                                                                                                    block-methods
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function registerObject(
-        Smarty_Internal_TemplateBase $obj,
-        $object_name,
-        $object,
-        $allowed_methods_properties = array(),
-        $format = true,
-        $block_methods = array()
-    ) {
-        $smarty = $obj->_getSmartyObj();
-        // test if allowed methods callable
-        if (!empty($allowed_methods_properties)) {
-            foreach ((array)$allowed_methods_properties as $method) {
-                if (!is_callable(array($object, $method)) && !property_exists($object, $method)) {
-                    throw new SmartyException("Undefined method or property '$method' in registered object");
-                }
-            }
-        }
-        // test if block methods callable
-        if (!empty($block_methods)) {
-            foreach ((array)$block_methods as $method) {
-                if (!is_callable(array($object, $method))) {
-                    throw new SmartyException("Undefined method '$method' in registered object");
-                }
-            }
-        }
-        // register the object
-        $smarty->registered_objects[ $object_name ] =
-            array($object, (array)$allowed_methods_properties, (boolean)$format, (array)$block_methods);
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
deleted file mode 100644
index ed18d84bb..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterPlugin
- *
- * Smarty::registerPlugin() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterPlugin
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers plugin to be used in templates
-     *
-     * @api  Smarty::registerPlugin()
-     * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type       plugin type
-     * @param string                                                          $name       name of template tag
-     * @param callback                                                        $callback   PHP callback to register
-     * @param bool                                                            $cacheable  if true (default) this
-     *                                                                                    function is cache able
-     * @param mixed                                                           $cache_attr caching attributes if any
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws SmartyException              when the plugin tag is invalid
-     */
-    public function registerPlugin(
-        Smarty_Internal_TemplateBase $obj,
-        $type,
-        $name,
-        $callback,
-        $cacheable = true,
-        $cache_attr = null
-    ) {
-        $smarty = $obj->_getSmartyObj();
-        if (isset($smarty->registered_plugins[ $type ][ $name ])) {
-            throw new SmartyException("Plugin tag '{$name}' already registered");
-        } elseif (!is_callable($callback)) {
-            throw new SmartyException("Plugin '{$name}' not callable");
-        } elseif ($cacheable && $cache_attr) {
-            throw new SmartyException("Cannot set caching attributes for plugin '{$name}' when it is cacheable.");
-        } else {
-            $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool)$cacheable, (array)$cache_attr);
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php
deleted file mode 100644
index 7c7d0f78a..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Smarty Method RegisterResource
- *
- * Smarty::registerResource() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_RegisterResource
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers a resource to fetch a template
-     *
-     * @api  Smarty::registerResource()
-     * @link http://www.smarty.net/docs/en/api.register.resource.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $name             name of resource type
-     * @param Smarty_Resource|array                                           $resource_handler or instance of
-     *                                                                                          Smarty_Resource,
-     *                                                                                          or array of
-     *                                                                                          callbacks to
-     *                                                                                          handle
-     *                                                                                          resource
-     *                                                                                          (deprecated)
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function registerResource(Smarty_Internal_TemplateBase $obj, $name, $resource_handler)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $smarty->registered_resources[ $name ] =
-            $resource_handler instanceof Smarty_Resource ? $resource_handler : array($resource_handler, false);
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
deleted file mode 100644
index 2972f3ce1..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Smarty Method SetAutoloadFilters
- *
- * Smarty::setAutoloadFilters() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_SetAutoloadFilters
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Valid filter types
-     *
-     * @var array
-     */
-    private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
-
-    /**
-     * Set autoload filters
-     *
-     * @api Smarty::setAutoloadFilters()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param array                                                           $filters filters to load automatically
-     * @param string                                                          $type    "pre", "output", … specify
-     *                                                                                 the filter type to set.
-     *                                                                                 Defaults to none treating
-     *                                                                                 $filters' keys as the
-     *                                                                                 appropriate types
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if ($type !== null) {
-            $this->_checkFilterType($type);
-            $smarty->autoload_filters[ $type ] = (array)$filters;
-        } else {
-            foreach ((array)$filters as $type => $value) {
-                $this->_checkFilterType($type);
-            }
-            $smarty->autoload_filters = (array)$filters;
-        }
-        return $obj;
-    }
-
-    /**
-     * Check if filter type is valid
-     *
-     * @param string $type
-     *
-     * @throws \SmartyException
-     */
-    public function _checkFilterType($type)
-    {
-        if (!isset($this->filterTypes[ $type ])) {
-            throw new SmartyException("Illegal filter type '{$type}'");
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
deleted file mode 100644
index cc9d23e2a..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Smarty Method SetDebugTemplate
- *
- * Smarty::setDebugTemplate() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_SetDebugTemplate
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * set the debug template
-     *
-     * @api Smarty::setDebugTemplate()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $tpl_name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws SmartyException if file is not readable
-     */
-    public function setDebugTemplate(Smarty_Internal_TemplateBase $obj, $tpl_name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (!is_readable($tpl_name)) {
-            throw new SmartyException("Unknown file '{$tpl_name}'");
-        }
-        $smarty->debug_tpl = $tpl_name;
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
deleted file mode 100644
index eadc2de1b..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Smarty Method SetDefaultModifiers
- *
- * Smarty::setDefaultModifiers() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_SetDefaultModifiers
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Set default modifiers
-     *
-     * @api Smarty::setDefaultModifiers()
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param array|string                                                    $modifiers modifier or list of modifiers
-     *                                                                                   to set
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function setDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $smarty->default_modifiers = (array)$modifiers;
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
deleted file mode 100644
index 55e1596be..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * Smarty Method UnloadFilter
- *
- * Smarty::unloadFilter() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFilter
-{
-    /**
-     * load a filter of specified type and name
-     *
-     * @api  Smarty::unloadFilter()
-     *
-     * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type filter type
-     * @param string                                                          $name filter name
-     *
-     * @return Smarty_Internal_TemplateBase
-     * @throws \SmartyException
-     */
-    public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $this->_checkFilterType($type);
-        if (isset($smarty->registered_filters[ $type ])) {
-            $_filter_name = "smarty_{$type}filter_{$name}";
-            if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
-                unset($smarty->registered_filters[ $type ][ $_filter_name ]);
-                if (empty($smarty->registered_filters[ $type ])) {
-                    unset($smarty->registered_filters[ $type ]);
-                }
-            }
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
deleted file mode 100644
index b99903867..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Smarty Method UnregisterCacheResource
- *
- * Smarty::unregisterCacheResource() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_UnregisterCacheResource
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers a resource to fetch a template
-     *
-     * @api  Smarty::unregisterCacheResource()
-     * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param                                                                 $name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (isset($smarty->registered_cache_resources[ $name ])) {
-            unset($smarty->registered_cache_resources[ $name ]);
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php
deleted file mode 100644
index 9cb494a52..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * Smarty Method UnregisterFilter
- *
- * Smarty::unregisterFilter() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_RegisterFilter
-{
-    /**
-     * Unregisters a filter function
-     *
-     * @api  Smarty::unregisterFilter()
-     *
-     * @link http://www.smarty.net/docs/en/api.unregister.filter.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type filter type
-     * @param callback|string                                                 $callback
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function unregisterFilter(Smarty_Internal_TemplateBase $obj, $type, $callback)
-    {
-        $smarty = $obj->_getSmartyObj();
-        $this->_checkFilterType($type);
-        if (isset($smarty->registered_filters[ $type ])) {
-            $name = is_string($callback) ? $callback : $this->_getFilterName($callback);
-            if (isset($smarty->registered_filters[ $type ][ $name ])) {
-                unset($smarty->registered_filters[ $type ][ $name ]);
-                if (empty($smarty->registered_filters[ $type ])) {
-                    unset($smarty->registered_filters[ $type ]);
-                }
-            }
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php
deleted file mode 100644
index 1e592b339..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Smarty Method UnregisterObject
- *
- * Smarty::unregisterObject() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_UnregisterObject
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers plugin to be used in templates
-     *
-     * @api  Smarty::unregisterObject()
-     * @link http://www.smarty.net/docs/en/api.unregister.object.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $object_name name of object
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function unregisterObject(Smarty_Internal_TemplateBase $obj, $object_name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (isset($smarty->registered_objects[ $object_name ])) {
-            unset($smarty->registered_objects[ $object_name ]);
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php
deleted file mode 100644
index f39e31678..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Smarty Method UnregisterPlugin
- *
- * Smarty::unregisterPlugin() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_UnregisterPlugin
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers plugin to be used in templates
-     *
-     * @api  Smarty::unregisterPlugin()
-     * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type plugin type
-     * @param string                                                          $name name of template tag
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (isset($smarty->registered_plugins[ $type ][ $name ])) {
-            unset($smarty->registered_plugins[ $type ][ $name ]);
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php b/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php
deleted file mode 100644
index a79db4299..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Smarty Method UnregisterResource
- *
- * Smarty::unregisterResource() method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Method_UnregisterResource
-{
-    /**
-     * Valid for Smarty and template object
-     *
-     * @var int
-     */
-    public $objMap = 3;
-
-    /**
-     * Registers a resource to fetch a template
-     *
-     * @api  Smarty::unregisterResource()
-     * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl
-     *
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
-     * @param string                                                          $type name of resource type
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     */
-    public function unregisterResource(Smarty_Internal_TemplateBase $obj, $type)
-    {
-        $smarty = $obj->_getSmartyObj();
-        if (isset($smarty->registered_resources[ $type ])) {
-            unset($smarty->registered_resources[ $type ]);
-        }
-        return $obj;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_nocache_insert.php b/libraries/Smarty/libs/sysplugins/smarty_internal_nocache_insert.php
deleted file mode 100644
index 88694dcfd..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_nocache_insert.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Nocache Insert
- * Compiles the {insert} tag into the cache file
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Plugin Compile Insert Class
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_Nocache_Insert
-{
-    /**
-     * Compiles code for the {insert} tag into cache file
-     *
-     * @param string                   $_function insert function name
-     * @param array                    $_attr     array with parameter
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $_script   script name to load or 'null'
-     * @param string                   $_assign   optional variable name
-     *
-     * @return string                   compiled code
-     */
-    public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
-    {
-        $_output = '<?php ';
-        if ($_script !== 'null') {
-            // script which must be included
-            // code for script file loading
-            $_output .= "require_once '{$_script}';";
-        }
-        // call insert
-        if (isset($_assign)) {
-            $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
-                        ',\$_smarty_tpl), true);?>';
-        } else {
-            $_output .= "echo {$_function}(" . var_export($_attr, true) . ',$_smarty_tpl);?>';
-        }
-        $_tpl = $_template;
-        while ($_tpl->_isSubTpl()) {
-            $_tpl = $_tpl->parent;
-        }
-        return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree.php
deleted file mode 100644
index 9f7678526..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Templateparser Parsetree
- * These are classes to build parsetree in the template parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Thue Kristensen
- * @author     Uwe Tews
- */
-
-/**
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-abstract class Smarty_Internal_ParseTree
-{
-    /**
-     * Buffer content
-     *
-     * @var mixed
-     */
-    public $data;
-
-    /**
-     * Subtree array
-     *
-     * @var array
-     */
-    public $subtrees = array();
-
-    /**
-     * Return buffer
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string buffer content
-     */
-    abstract public function to_smarty_php(Smarty_Internal_Templateparser $parser);
-
-    /**
-     * Template data object destructor
-     */
-    public function __destruct()
-    {
-        $this->data = null;
-        $this->subtrees = null;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_code.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_code.php
deleted file mode 100644
index 7bd0bc45c..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_code.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Templateparser Parse Tree
- * These are classes to build parse trees in the template parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Thue Kristensen
- * @author     Uwe Tews
- */
-
-/**
- * Code fragment inside a tag .
- *
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-class Smarty_Internal_ParseTree_Code extends Smarty_Internal_ParseTree
-{
-    /**
-     * Create parse tree buffer for code fragment
-     *
-     * @param string $data content
-     */
-    public function __construct($data)
-    {
-        $this->data = $data;
-    }
-
-    /**
-     * Return buffer content in parentheses
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string content
-     */
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
-    {
-        return sprintf('(%s)', $this->data);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dq.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dq.php
deleted file mode 100644
index 8655f5869..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dq.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/**
- * Double quoted string inside a tag.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-
-/**
- * Double quoted string inside a tag.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree
-{
-    /**
-     * Create parse tree buffer for double quoted string subtrees
-     *
-     * @param object                    $parser  parser object
-     * @param Smarty_Internal_ParseTree $subtree parse tree buffer
-     */
-    public function __construct($parser, Smarty_Internal_ParseTree $subtree)
-    {
-        $this->subtrees[] = $subtree;
-        if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
-            $parser->block_nesting_level = count($parser->compiler->_tag_stack);
-        }
-    }
-
-    /**
-     * Append buffer to subtree
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     * @param Smarty_Internal_ParseTree       $subtree parse tree buffer
-     */
-    public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
-    {
-        $last_subtree = count($this->subtrees) - 1;
-        if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag
-            && $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
-        ) {
-            if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
-                $this->subtrees[ $last_subtree ]->data =
-                    $parser->compiler->appendCode(
-                        $this->subtrees[ $last_subtree ]->data,
-                        '<?php echo ' . $subtree->data . ';?>'
-                    );
-            } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
-                $this->subtrees[ $last_subtree ]->data =
-                    $parser->compiler->appendCode(
-                        $this->subtrees[ $last_subtree ]->data,
-                        '<?php echo "' . $subtree->data . '";?>'
-                    );
-            } else {
-                $this->subtrees[ $last_subtree ]->data =
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
-            }
-        } else {
-            $this->subtrees[] = $subtree;
-        }
-        if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
-            $parser->block_nesting_level = count($parser->compiler->_tag_stack);
-        }
-    }
-
-    /**
-     * Merge subtree buffer content together
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string compiled template code
-     */
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
-    {
-        $code = '';
-        foreach ($this->subtrees as $subtree) {
-            if ($code !== '') {
-                $code .= '.';
-            }
-            if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
-                $more_php = $subtree->assign_to_var($parser);
-            } else {
-                $more_php = $subtree->to_smarty_php($parser);
-            }
-            $code .= $more_php;
-            if (!$subtree instanceof Smarty_Internal_ParseTree_DqContent) {
-                $parser->compiler->has_variable_string = true;
-            }
-        }
-        return $code;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php
deleted file mode 100644
index a8ca389d9..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Templateparser Parse Tree
- * These are classes to build parse tree  in the template parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Thue Kristensen
- * @author     Uwe Tews
- */
-
-/**
- * Raw chars as part of a double quoted string.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-class Smarty_Internal_ParseTree_DqContent extends Smarty_Internal_ParseTree
-{
-    /**
-     * Create parse tree buffer with string content
-     *
-     * @param string $data string section
-     */
-    public function __construct($data)
-    {
-        $this->data = $data;
-    }
-
-    /**
-     * Return content as double quoted string
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string doubled quoted string
-     */
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
-    {
-        return '"' . $this->data . '"';
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_tag.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_tag.php
deleted file mode 100644
index e6c755604..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_tag.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Templateparser Parse Tree
- * These are classes to build parse tree in the template parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Thue Kristensen
- * @author     Uwe Tews
- */
-
-/**
- * A complete smarty tag.
- *
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree
-{
-    /**
-     * Saved block nesting level
-     *
-     * @var int
-     */
-    public $saved_block_nesting;
-
-    /**
-     * Create parse tree buffer for Smarty tag
-     *
-     * @param \Smarty_Internal_Templateparser $parser parser object
-     * @param string                          $data   content
-     */
-    public function __construct(Smarty_Internal_Templateparser $parser, $data)
-    {
-        $this->data = $data;
-        $this->saved_block_nesting = $parser->block_nesting_level;
-    }
-
-    /**
-     * Return buffer content
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string content
-     */
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
-    {
-        return $this->data;
-    }
-
-    /**
-     * Return complied code that loads the evaluated output of buffer content into a temporary variable
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string template code
-     */
-    public function assign_to_var(Smarty_Internal_Templateparser $parser)
-    {
-        $var = $parser->compiler->getNewPrefixVariable();
-        $tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data);
-        $tmp = $parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
-        $parser->compiler->prefix_code[] = sprintf('%s', $tmp);
-        return $var;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_template.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_template.php
deleted file mode 100644
index ab4c3ec3b..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_template.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Templateparser Parse Tree
- * These are classes to build parse tree in the template parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Thue Kristensen
- * @author     Uwe Tews
- */
-
-/**
- * Template element
- *
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
-{
-    /**
-     * Array of template elements
-     *
-     * @var array
-     */
-    public $subtrees = array();
-
-    /**
-     * Create root of parse tree for template elements
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * Append buffer to subtree
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     * @param Smarty_Internal_ParseTree       $subtree
-     */
-    public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
-    {
-        if (!empty($subtree->subtrees)) {
-            $this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
-        } else {
-            if ($subtree->data !== '') {
-                $this->subtrees[] = $subtree;
-            }
-        }
-    }
-
-    /**
-     * Append array to subtree
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     * @param \Smarty_Internal_ParseTree[]    $array
-     */
-    public function append_array(Smarty_Internal_Templateparser $parser, $array = array())
-    {
-        if (!empty($array)) {
-            $this->subtrees = array_merge($this->subtrees, (array)$array);
-        }
-    }
-
-    /**
-     * Prepend array to subtree
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     * @param \Smarty_Internal_ParseTree[]    $array
-     */
-    public function prepend_array(Smarty_Internal_Templateparser $parser, $array = array())
-    {
-        if (!empty($array)) {
-            $this->subtrees = array_merge((array)$array, $this->subtrees);
-        }
-    }
-
-    /**
-     * Sanitize and merge subtree buffers together
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string template code content
-     */
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
-    {
-        $code = '';
-
-        foreach ($this->getChunkedSubtrees() as $chunk) {
-	        $text = '';
-	        switch ($chunk['mode']) {
-		        case 'textstripped':
-			        foreach ($chunk['subtrees'] as $subtree) {
-				        $text .= $subtree->to_smarty_php($parser);
-			        }
-			        $code .= preg_replace(
-				        '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
-				        "<?php echo '\$1'; ?>\n",
-				        $parser->compiler->processText($text)
-			        );
-			        break;
-		        case 'text':
-			        foreach ($chunk['subtrees'] as $subtree) {
-				        $text .= $subtree->to_smarty_php($parser);
-			        }
-			        $code .= preg_replace(
-				        '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
-				        "<?php echo '\$1'; ?>\n",
-				        $text
-			        );
-			        break;
-		        case 'tag':
-			        foreach ($chunk['subtrees'] as $subtree) {
-				        $text = $parser->compiler->appendCode($text, $subtree->to_smarty_php($parser));
-			        }
-			        $code .= $text;
-			        break;
-		        default:
-			        foreach ($chunk['subtrees'] as $subtree) {
-				        $text = $subtree->to_smarty_php($parser);
-			        }
-			        $code .= $text;
-
-	        }
-        }
-        return $code;
-    }
-
-    private function getChunkedSubtrees() {
-    	$chunks = array();
-    	$currentMode = null;
-    	$currentChunk = array();
-	    for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
-
-	    	if ($this->subtrees[ $key ]->data === '' && in_array($currentMode, array('textstripped', 'text', 'tag'))) {
-	    		continue;
-	    	}
-
-		    if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text
-			    && $this->subtrees[ $key ]->isToBeStripped()) {
-		    	$newMode = 'textstripped';
-		    } elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
-			    $newMode = 'text';
-		    } elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
-			    $newMode = 'tag';
-		    } else {
-			    $newMode = 'other';
-		    }
-
-		    if ($newMode == $currentMode) {
-			    $currentChunk[] = $this->subtrees[ $key ];
-		    } else {
-		    	$chunks[] = array(
-		    		'mode' => $currentMode,
-				    'subtrees' => $currentChunk
-			    );
-		    	$currentMode = $newMode;
-			    $currentChunk = array($this->subtrees[ $key ]);
-		    }
-	    }
-	    if ($currentMode && $currentChunk) {
-		    $chunks[] = array(
-			    'mode' => $currentMode,
-			    'subtrees' => $currentChunk
-		    );
-	    }
-		return $chunks;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_text.php b/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_text.php
deleted file mode 100644
index 399e84941..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_text.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * Smarty Internal Plugin Templateparser Parse Tree
- * These are classes to build parse tree in the template parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Thue Kristensen
- * @author     Uwe Tews
- *             *
- *             template text
- * @package    Smarty
- * @subpackage Compiler
- * @ignore
- */
-class Smarty_Internal_ParseTree_Text extends Smarty_Internal_ParseTree
-{
-
-	/**
-	 * Wether this section should be stripped on output to smarty php
-	 * @var bool
-	 */
-	private $toBeStripped = false;
-
-	/**
-	 * Create template text buffer
-	 *
-	 * @param string $data text
-	 * @param bool $toBeStripped wether this section should be stripped on output to smarty php
-	 */
-    public function __construct($data, $toBeStripped = false)
-    {
-        $this->data = $data;
-        $this->toBeStripped = $toBeStripped;
-    }
-
-	/**
-	 * Wether this section should be stripped on output to smarty php
-	 * @return bool
-	 */
-	public function isToBeStripped() {
-    	return $this->toBeStripped;
-    }
-
-    /**
-     * Return buffer content
-     *
-     * @param \Smarty_Internal_Templateparser $parser
-     *
-     * @return string text
-     */
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
-    {
-        return $this->data;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_eval.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_eval.php
deleted file mode 100644
index 3b552a589..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_eval.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Resource Eval
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource Eval
- * Implements the strings as resource for Smarty template
- * {@internal unlike string-resources the compiled state of eval-resources is NOT saved for subsequent access}}
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled
-{
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $source->uid = $source->filepath = sha1($source->name);
-        $source->timestamp = $source->exists = true;
-    }
-
-    /**
-     * Load template's source from $resource_name into current template object
-     *
-     * @uses decode() to decode base64 and urlencoded template_resources
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        return $this->decode($source->name);
-    }
-
-    /**
-     * decode base64 and urlencode
-     *
-     * @param string $string template_resource to decode
-     *
-     * @return string decoded template_resource
-     */
-    protected function decode($string)
-    {
-        // decode if specified
-        if (($pos = strpos($string, ':')) !== false) {
-            if (!strncmp($string, 'base64', 6)) {
-                return base64_decode(substr($string, 7));
-            } elseif (!strncmp($string, 'urlencode', 9)) {
-                return urldecode(substr($string, 10));
-            }
-        }
-        return $string;
-    }
-
-    /**
-     * modify resource_name according to resource handlers specifications
-     *
-     * @param Smarty  $smarty        Smarty instance
-     * @param string  $resource_name resource_name to make unique
-     * @param boolean $isConfig      flag for config resource
-     *
-     * @return string unique resource name
-     */
-    public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false)
-    {
-        return get_class($this) . '#' . $this->decode($resource_name);
-    }
-
-    /**
-     * Determine basename for compiled filename
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return '';
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_extends.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_extends.php
deleted file mode 100644
index 80946932e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_extends.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Resource Extends
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource Extends
- * Implements the file system as resource for Smarty which {extend}s a chain of template files templates
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Resource_Extends extends Smarty_Resource
-{
-    /**
-     * mbstring.overload flag
-     *
-     * @var int
-     */
-    public $mbstring_overload = 0;
-
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @throws SmartyException
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $uid = '';
-        $sources = array();
-        $components = explode('|', $source->name);
-        $smarty = &$source->smarty;
-        $exists = true;
-        foreach ($components as $component) {
-            /* @var \Smarty_Template_Source $_s */
-            $_s = Smarty_Template_Source::load(null, $smarty, $component);
-            if ($_s->type === 'php') {
-                throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
-            }
-            $sources[ $_s->uid ] = $_s;
-            $uid .= $_s->filepath;
-            if ($_template) {
-                $exists = $exists && $_s->exists;
-            }
-        }
-        $source->components = $sources;
-        $source->filepath = $_s->filepath;
-        $source->uid = sha1($uid . $source->smarty->_joined_template_dir);
-        $source->exists = $exists;
-        if ($_template) {
-            $source->timestamp = $_s->timestamp;
-        }
-    }
-
-    /**
-     * populate Source Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Source $source source object
-     */
-    public function populateTimestamp(Smarty_Template_Source $source)
-    {
-        $source->exists = true;
-        /* @var \Smarty_Template_Source $_s */
-        foreach ($source->components as $_s) {
-            $source->exists = $source->exists && $_s->exists;
-        }
-        $source->timestamp = $source->exists ? $_s->getTimeStamp() : false;
-    }
-
-    /**
-     * Load template's source from files into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string template source
-     * @throws SmartyException if source cannot be loaded
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        if (!$source->exists) {
-            throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'");
-        }
-        $_components = array_reverse($source->components);
-        $_content = '';
-        /* @var \Smarty_Template_Source $_s */
-        foreach ($_components as $_s) {
-            // read content
-            $_content .= $_s->getContent();
-        }
-        return $_content;
-    }
-
-    /**
-     * Determine basename for compiled filename
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return str_replace(':', '.', basename($source->filepath));
-    }
-
-    /*
-      * Disable timestamp checks for extends resource.
-      * The individual source components will be checked.
-      *
-      * @return bool
-      */
-    /**
-     * @return bool
-     */
-    public function checkTimestamps()
-    {
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_file.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_file.php
deleted file mode 100644
index ae2060673..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_file.php
+++ /dev/null
@@ -1,180 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Resource File
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource File
- * Implements the file system as resource for Smarty templates
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Resource_File extends Smarty_Resource
-{
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @throws \SmartyException
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $source->filepath = $this->buildFilepath($source, $_template);
-        if ($source->filepath !== false) {
-            if (isset($source->smarty->security_policy) && is_object($source->smarty->security_policy)) {
-                $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
-            }
-            $source->exists = true;
-            $source->uid = sha1(
-                $source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
-                    $source->smarty->_joined_template_dir)
-            );
-            $source->timestamp = filemtime($source->filepath);
-        } else {
-            $source->timestamp = $source->exists = false;
-        }
-    }
-
-    /**
-     * populate Source Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Source $source source object
-     */
-    public function populateTimestamp(Smarty_Template_Source $source)
-    {
-        if (!$source->exists) {
-            $source->timestamp = $source->exists = is_file($source->filepath);
-        }
-        if ($source->exists) {
-            $source->timestamp = filemtime($source->filepath);
-        }
-    }
-
-    /**
-     * Load template's source from file into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     * @throws SmartyException        if source cannot be loaded
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        if ($source->exists) {
-            return file_get_contents($source->filepath);
-        }
-        throw new SmartyException(
-            'Unable to read ' . ($source->isConfig ? 'config' : 'template') .
-            " {$source->type} '{$source->name}'"
-        );
-    }
-
-    /**
-     * Determine basename for compiled filename
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return basename($source->filepath);
-    }
-
-    /**
-     * build template filepath by traversing the template_dir array
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string fully qualified filepath
-     * @throws SmartyException
-     */
-    protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $file = $source->name;
-        // absolute file ?
-        if ($file[ 0 ] === '/' || $file[ 1 ] === ':') {
-            $file = $source->smarty->_realpath($file, true);
-            return is_file($file) ? $file : false;
-        }
-        // go relative to a given template?
-        if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl()
-            && preg_match('#^[.]{1,2}[\\\/]#', $file)
-        ) {
-            if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends'
-                && !isset($_template->parent->_cache[ 'allow_relative_path' ])
-            ) {
-                throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
-            }
-            // normalize path
-            $path =
-                $source->smarty->_realpath(dirname($_template->parent->source->filepath) . DIRECTORY_SEPARATOR . $file);
-            // files relative to a template only get one shot
-            return is_file($path) ? $path : false;
-        }
-        // normalize DIRECTORY_SEPARATOR
-        if (strpos($file, DIRECTORY_SEPARATOR === '/' ? '\\' : '/') !== false) {
-            $file = str_replace(DIRECTORY_SEPARATOR === '/' ? '\\' : '/', DIRECTORY_SEPARATOR, $file);
-        }
-        $_directories = $source->smarty->getTemplateDir(null, $source->isConfig);
-        // template_dir index?
-        if ($file[ 0 ] === '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) {
-            $file = $fileMatch[ 2 ];
-            $_indices = explode(',', $fileMatch[ 1 ]);
-            $_index_dirs = array();
-            foreach ($_indices as $index) {
-                $index = trim($index);
-                // try string indexes
-                if (isset($_directories[ $index ])) {
-                    $_index_dirs[] = $_directories[ $index ];
-                } elseif (is_numeric($index)) {
-                    // try numeric index
-                    $index = (int)$index;
-                    if (isset($_directories[ $index ])) {
-                        $_index_dirs[] = $_directories[ $index ];
-                    } else {
-                        // try at location index
-                        $keys = array_keys($_directories);
-                        if (isset($_directories[ $keys[ $index ] ])) {
-                            $_index_dirs[] = $_directories[ $keys[ $index ] ];
-                        }
-                    }
-                }
-            }
-            if (empty($_index_dirs)) {
-                // index not found
-                return false;
-            } else {
-                $_directories = $_index_dirs;
-            }
-        }
-        // relative file name?
-        foreach ($_directories as $_directory) {
-            $path = $_directory . $file;
-            if (is_file($path)) {
-                return (strpos($path, '.' . DIRECTORY_SEPARATOR) !== false) ? $source->smarty->_realpath($path) : $path;
-            }
-        }
-        if (!isset($_index_dirs)) {
-            // Could be relative to cwd
-            $path = $source->smarty->_realpath($file, true);
-            if (is_file($path)) {
-                return $path;
-            }
-        }
-        // Use include path ?
-        if ($source->smarty->use_include_path) {
-            return $source->smarty->ext->_getIncludePath->getIncludePath($_directories, $file, $source->smarty);
-        }
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_php.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_php.php
deleted file mode 100644
index 9d98ae181..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_php.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-
-/**
- * Smarty Internal Plugin Resource PHP
- * Implements the file system as resource for PHP templates
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
-{
-    /**
-     * Flag that it's an uncompiled resource
-     *
-     * @var bool
-     */
-    public $uncompiled = true;
-
-    /**
-     * Resource does implement populateCompiledFilepath() method
-     *
-     * @var bool
-     */
-    public $hasCompiledHandler = true;
-
-    /**
-     * container for short_open_tag directive's value before executing PHP templates
-     *
-     * @var string
-     */
-    protected $short_open_tag;
-
-    /**
-     * Create a new PHP Resource
-     */
-    public function __construct()
-    {
-        $this->short_open_tag = function_exists('ini_get') ? ini_get('short_open_tag') : 1;
-    }
-
-    /**
-     * Load template's source from file into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     * @throws SmartyException        if source cannot be loaded
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        if ($source->exists) {
-            return '';
-        }
-        throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
-    }
-
-    /**
-     * populate compiled object with compiled filepath
-     *
-     * @param Smarty_Template_Compiled $compiled  compiled object
-     * @param Smarty_Internal_Template $_template template object (is ignored)
-     */
-    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
-    {
-        $compiled->filepath = $_template->source->filepath;
-        $compiled->timestamp = $_template->source->timestamp;
-        $compiled->exists = $_template->source->exists;
-        $compiled->file_dependency[ $_template->source->uid ] =
-            array(
-                $compiled->filepath,
-                $compiled->timestamp,
-                $_template->source->type,
-            );
-    }
-
-    /**
-     * Render and output the template (without using the compiler)
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     * @throws SmartyException          if template cannot be loaded or allow_php_templates is disabled
-     */
-    public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
-    {
-        if (!$source->smarty->allow_php_templates) {
-            throw new SmartyException('PHP templates are disabled');
-        }
-        if (!$source->exists) {
-            throw new SmartyException(
-                "Unable to load template '{$source->type}:{$source->name}'" .
-                ($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '')
-            );
-        }
-        // prepare variables
-        extract($_template->getTemplateVars());
-        // include PHP template with short open tags enabled
-        if (function_exists('ini_set')) {
-            ini_set('short_open_tag', '1');
-        }
-        /**
-         *
-         *
-         * @var Smarty_Internal_Template $_smarty_template
-         * used in included file
-         */
-        $_smarty_template = $_template;
-        include $source->filepath;
-        if (function_exists('ini_set')) {
-            ini_set('short_open_tag', $this->short_open_tag);
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_registered.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_registered.php
deleted file mode 100644
index df526101f..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_registered.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Resource Registered
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource Registered
- * Implements the registered resource for Smarty template
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @deprecated
- */
-class Smarty_Internal_Resource_Registered extends Smarty_Resource
-{
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $source->filepath = $source->type . ':' . $source->name;
-        $source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);
-        $source->timestamp = $this->getTemplateTimestamp($source);
-        $source->exists = !!$source->timestamp;
-    }
-
-    /**
-     * populate Source Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return void
-     */
-    public function populateTimestamp(Smarty_Template_Source $source)
-    {
-        $source->timestamp = $this->getTemplateTimestamp($source);
-        $source->exists = !!$source->timestamp;
-    }
-
-    /**
-     * Get timestamp (epoch) the template source was modified
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return integer|boolean        timestamp (epoch) the template was modified, false if resources has no timestamp
-     */
-    public function getTemplateTimestamp(Smarty_Template_Source $source)
-    {
-        // return timestamp
-        $time_stamp = false;
-        call_user_func_array(
-            $source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ],
-            array($source->name, &$time_stamp, $source->smarty)
-        );
-        return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp;
-    }
-
-    /**
-     * Load template's source by invoking the registered callback into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     * @throws SmartyException        if source cannot be loaded
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        // return template string
-        $content = null;
-        $t = call_user_func_array(
-            $source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
-            array($source->name, &$content, $source->smarty)
-        );
-        if (is_bool($t) && !$t) {
-            throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
-        }
-        return $content;
-    }
-
-    /**
-     * Determine basename for compiled filename
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return basename($source->name);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_stream.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_stream.php
deleted file mode 100644
index 9956bd073..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_stream.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Resource Stream
- * Implements the streams as resource for Smarty template
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource Stream
- * Implements the streams as resource for Smarty template
- *
- * @link       http://php.net/streams
- * @package    Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled
-{
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        if (strpos($source->resource, '://') !== false) {
-            $source->filepath = $source->resource;
-        } else {
-            $source->filepath = str_replace(':', '://', $source->resource);
-        }
-        $source->uid = false;
-        $source->content = $this->getContent($source);
-        $source->timestamp = $source->exists = !!$source->content;
-    }
-
-    /**
-     * Load template's source from stream into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string template source
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        $t = '';
-        // the availability of the stream has already been checked in Smarty_Resource::fetch()
-        $fp = fopen($source->filepath, 'r+');
-        if ($fp) {
-            while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
-                $t .= $current_line;
-            }
-            fclose($fp);
-            return $t;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * modify resource_name according to resource handlers specifications
-     *
-     * @param Smarty  $smarty        Smarty instance
-     * @param string  $resource_name resource_name to make unique
-     * @param boolean $isConfig      flag for config resource
-     *
-     * @return string unique resource name
-     */
-    public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false)
-    {
-        return get_class($this) . '#' . $resource_name;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_string.php b/libraries/Smarty/libs/sysplugins/smarty_internal_resource_string.php
deleted file mode 100644
index 3fecbb7ef..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_resource_string.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Resource String
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Internal Plugin Resource String
- * Implements the strings as resource for Smarty template
- * {@internal unlike eval-resources the compiled state of string-resources is saved for subsequent access}}
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-class Smarty_Internal_Resource_String extends Smarty_Resource
-{
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $source->uid = $source->filepath = sha1($source->name . $source->smarty->_joined_template_dir);
-        $source->timestamp = $source->exists = true;
-    }
-
-    /**
-     * Load template's source from $resource_name into current template object
-     *
-     * @uses decode() to decode base64 and urlencoded template_resources
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        return $this->decode($source->name);
-    }
-
-    /**
-     * decode base64 and urlencode
-     *
-     * @param string $string template_resource to decode
-     *
-     * @return string decoded template_resource
-     */
-    protected function decode($string)
-    {
-        // decode if specified
-        if (($pos = strpos($string, ':')) !== false) {
-            if (!strncmp($string, 'base64', 6)) {
-                return base64_decode(substr($string, 7));
-            } elseif (!strncmp($string, 'urlencode', 9)) {
-                return urldecode(substr($string, 10));
-            }
-        }
-        return $string;
-    }
-
-    /**
-     * modify resource_name according to resource handlers specifications
-     *
-     * @param Smarty  $smarty        Smarty instance
-     * @param string  $resource_name resource_name to make unique
-     * @param boolean $isConfig      flag for config resource
-     *
-     * @return string unique resource name
-     */
-    public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false)
-    {
-        return get_class($this) . '#' . $this->decode($resource_name);
-    }
-
-    /**
-     * Determine basename for compiled filename
-     * Always returns an empty string.
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return '';
-    }
-
-    /*
-        * Disable timestamp checks for string resource.
-        *
-        * @return bool
-        */
-    /**
-     * @return bool
-     */
-    public function checkTimestamps()
-    {
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php
deleted file mode 100644
index 6e12d2ae1..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Inline Runtime Methods render, setSourceByUid, setupSubTemplate
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- **/
-class Smarty_Internal_Runtime_CacheModify
-{
-    /**
-     * check client side cache
-     *
-     * @param \Smarty_Template_Cached   $cached
-     * @param \Smarty_Internal_Template $_template
-     * @param string                    $content
-     *
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
-    {
-        $_isCached = $_template->isCached() && !$_template->compiled->has_nocache_code;
-        $_last_modified_date =
-            @substr($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ], 0, strpos($_SERVER[ 'HTTP_IF_MODIFIED_SINCE' ], 'GMT') + 3);
-        if ($_isCached && $cached->timestamp <= strtotime($_last_modified_date)) {
-            switch (PHP_SAPI) {
-                case 'cgi': // php-cgi < 5.3
-                case 'cgi-fcgi': // php-cgi >= 5.3
-                case 'fpm-fcgi': // php-fpm >= 5.3.3
-                    header('Status: 304 Not Modified');
-                    break;
-                case 'cli':
-                    if (/* ^phpunit */
-                    !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
-                    ) {
-                        $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified';
-                    }
-                    break;
-                default:
-                    if (/* ^phpunit */
-                    !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
-                    ) {
-                        $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified';
-                    } else {
-                        header($_SERVER[ 'SERVER_PROTOCOL' ] . ' 304 Not Modified');
-                    }
-                    break;
-            }
-        } else {
-            switch (PHP_SAPI) {
-                case 'cli':
-                    if (/* ^phpunit */
-                    !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
-                    ) {
-                        $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] =
-                            'Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT';
-                    }
-                    break;
-                default:
-                    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT');
-                    break;
-            }
-            echo $content;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php
deleted file mode 100644
index 287096438..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-/**
- * Smarty cache resource file clear method
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Internal Runtime Cache Resource File Class
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Runtime_CacheResourceFile
-{
-    /**
-     * Empty cache for a specific template
-     *
-     * @param Smarty  $smarty
-     * @param string  $resource_name template name
-     * @param string  $cache_id      cache id
-     * @param string  $compile_id    compile id
-     * @param integer $exp_time      expiration time (number of seconds, not timestamp)
-     *
-     * @return integer number of cache files deleted
-     */
-    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
-    {
-        $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
-        $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
-        $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
-        $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
-        $_dir = $smarty->getCacheDir();
-        if ($_dir === '/') { //We should never want to delete this!
-            return 0;
-        }
-        $_dir_length = strlen($_dir);
-        if (isset($_cache_id)) {
-            $_cache_id_parts = explode('|', $_cache_id);
-            $_cache_id_parts_count = count($_cache_id_parts);
-            if ($smarty->use_sub_dirs) {
-                foreach ($_cache_id_parts as $id_part) {
-                    $_dir .= $id_part . '/';
-                }
-            }
-        }
-        if (isset($resource_name)) {
-            $_save_stat = $smarty->caching;
-            $smarty->caching = Smarty::CACHING_LIFETIME_CURRENT;
-            $tpl = new $smarty->template_class($resource_name, $smarty);
-            $smarty->caching = $_save_stat;
-            // remove from template cache
-            $tpl->source; // have the template registered before unset()
-            if ($tpl->source->exists) {
-                $_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));
-            } else {
-                return 0;
-            }
-        }
-        $_count = 0;
-        $_time = time();
-        if (file_exists($_dir)) {
-            $_cacheDirs = new RecursiveDirectoryIterator($_dir);
-            $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
-            foreach ($_cache as $_file) {
-                if (substr(basename($_file->getPathname()), 0, 1) === '.') {
-                    continue;
-                }
-                $_filepath = (string)$_file;
-                // directory ?
-                if ($_file->isDir()) {
-                    if (!$_cache->isDot()) {
-                        // delete folder if empty
-                        @rmdir($_file->getPathname());
-                    }
-                } else {
-                    // delete only php files
-                    if (substr($_filepath, -4) !== '.php') {
-                        continue;
-                    }
-                    $_parts = explode($_dir_sep, str_replace('\\', '/', substr($_filepath, $_dir_length)));
-                    $_parts_count = count($_parts);
-                    // check name
-                    if (isset($resource_name)) {
-                        if ($_parts[ $_parts_count - 1 ] !== $_resourcename_parts) {
-                            continue;
-                        }
-                    }
-                    // check compile id
-                    if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ])
-                                                || $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id)
-                    ) {
-                        continue;
-                    }
-                    // check cache id
-                    if (isset($_cache_id)) {
-                        // count of cache id parts
-                        $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset :
-                            $_parts_count - 1 - $_compile_id_offset;
-                        if ($_parts_count < $_cache_id_parts_count) {
-                            continue;
-                        }
-                        for ($i = 0; $i < $_cache_id_parts_count; $i++) {
-                            if ($_parts[ $i ] !== $_cache_id_parts[ $i ]) {
-                                continue 2;
-                            }
-                        }
-                    }
-                    if (is_file($_filepath)) {
-                        // expired ?
-                        if (isset($exp_time)) {
-                            if ($exp_time < 0) {
-                                preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_filepath), $match);
-                                if ($_time < (filemtime($_filepath) + $match[ 1 ])) {
-                                    continue;
-                                }
-                            } else {
-                                if ($_time - filemtime($_filepath) < $exp_time) {
-                                    continue;
-                                }
-                            }
-                        }
-                        $_count += @unlink($_filepath) ? 1 : 0;
-                        if (function_exists('opcache_invalidate')
-                            && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
-                        ) {
-                            opcache_invalidate($_filepath, true);
-                        } elseif (function_exists('apc_delete_file')) {
-                            apc_delete_file($_filepath);
-                        }
-                    }
-                }
-            }
-        }
-        return $_count;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_capture.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_capture.php
deleted file mode 100644
index c9dca83d9..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_capture.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-
-/**
- * Runtime Extension Capture
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Runtime_Capture
-{
-    /**
-     * Flag that this instance  will not be cached
-     *
-     * @var bool
-     */
-    public $isPrivateExtension = true;
-
-    /**
-     * Stack of capture parameter
-     *
-     * @var array
-     */
-    private $captureStack = array();
-
-    /**
-     * Current open capture sections
-     *
-     * @var int
-     */
-    private $captureCount = 0;
-
-    /**
-     * Count stack
-     *
-     * @var int[]
-     */
-    private $countStack = array();
-
-    /**
-     * Named buffer
-     *
-     * @var string[]
-     */
-    private $namedBuffer = array();
-
-    /**
-     * Flag if callbacks are registered
-     *
-     * @var bool
-     */
-    private $isRegistered = false;
-
-    /**
-     * Open capture section
-     *
-     * @param \Smarty_Internal_Template $_template
-     * @param string                    $buffer capture name
-     * @param string                    $assign variable name
-     * @param string                    $append variable name
-     */
-    public function open(Smarty_Internal_Template $_template, $buffer, $assign, $append)
-    {
-        if (!$this->isRegistered) {
-            $this->register($_template);
-        }
-        $this->captureStack[] = array(
-            $buffer,
-            $assign,
-            $append
-        );
-        $this->captureCount++;
-        ob_start();
-    }
-
-    /**
-     * Register callbacks in template class
-     *
-     * @param \Smarty_Internal_Template $_template
-     */
-    private function register(Smarty_Internal_Template $_template)
-    {
-        $_template->startRenderCallbacks[] = array(
-            $this,
-            'startRender'
-        );
-        $_template->endRenderCallbacks[] = array(
-            $this,
-            'endRender'
-        );
-        $this->startRender($_template);
-        $this->isRegistered = true;
-    }
-
-    /**
-     * Start render callback
-     *
-     * @param \Smarty_Internal_Template $_template
-     */
-    public function startRender(Smarty_Internal_Template $_template)
-    {
-        $this->countStack[] = $this->captureCount;
-        $this->captureCount = 0;
-    }
-
-    /**
-     * Close capture section
-     *
-     * @param \Smarty_Internal_Template $_template
-     *
-     * @throws \SmartyException
-     */
-    public function close(Smarty_Internal_Template $_template)
-    {
-        if ($this->captureCount) {
-            list($buffer, $assign, $append) = array_pop($this->captureStack);
-            $this->captureCount--;
-            if (isset($assign)) {
-                $_template->assign($assign, ob_get_contents());
-            }
-            if (isset($append)) {
-                $_template->append($append, ob_get_contents());
-            }
-            $this->namedBuffer[ $buffer ] = ob_get_clean();
-        } else {
-            $this->error($_template);
-        }
-    }
-
-    /**
-     * Error exception on not matching {capture}{/capture}
-     *
-     * @param \Smarty_Internal_Template $_template
-     *
-     * @throws \SmartyException
-     */
-    public function error(Smarty_Internal_Template $_template)
-    {
-        throw new SmartyException("Not matching {capture}{/capture} in '{$_template->template_resource}'");
-    }
-
-    /**
-     * Return content of named capture buffer by key or as array
-     *
-     * @param \Smarty_Internal_Template $_template
-     * @param string|null               $name
-     *
-     * @return string|string[]|null
-     */
-    public function getBuffer(Smarty_Internal_Template $_template, $name = null)
-    {
-        if (isset($name)) {
-            return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
-        } else {
-            return $this->namedBuffer;
-        }
-    }
-
-    /**
-     * End render callback
-     *
-     * @param \Smarty_Internal_Template $_template
-     *
-     * @throws \SmartyException
-     */
-    public function endRender(Smarty_Internal_Template $_template)
-    {
-        if ($this->captureCount) {
-            $this->error($_template);
-        } else {
-            $this->captureCount = array_pop($this->countStack);
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php
deleted file mode 100644
index 983ca6180..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/**
- * Smarty Internal Extension
- * This file contains the Smarty template extension to create a code frame
- *
- * @package    Smarty
- * @subpackage Template
- * @author     Uwe Tews
- */
-
-/**
- * Class Smarty_Internal_Extension_CodeFrame
- * Create code frame for compiled and cached templates
- */
-class Smarty_Internal_Runtime_CodeFrame
-{
-    /**
-     * Create code frame for compiled and cached templates
-     *
-     * @param Smarty_Internal_Template              $_template
-     * @param string                                $content   optional template content
-     * @param string                                $functions compiled template function and block code
-     * @param bool                                  $cache     flag for cache file
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
-     *
-     * @return string
-     */
-    public function create(
-        Smarty_Internal_Template $_template,
-        $content = '',
-        $functions = '',
-        $cache = false,
-        Smarty_Internal_TemplateCompilerBase $compiler = null
-    ) {
-        // build property code
-        $properties[ 'version' ] = Smarty::SMARTY_VERSION;
-        $properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
-        if (!$cache) {
-            $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code;
-            $properties[ 'file_dependency' ] = $_template->compiled->file_dependency;
-            $properties[ 'includes' ] = $_template->compiled->includes;
-        } else {
-            $properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code;
-            $properties[ 'file_dependency' ] = $_template->cached->file_dependency;
-            $properties[ 'cache_lifetime' ] = $_template->cache_lifetime;
-        }
-        $output = "<?php\n";
-        $output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") .
-                   "\n  from '" . str_replace('*/', '* /', $_template->source->filepath) . "' */\n\n";
-        $output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
-        $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
-               ($cache ? 'true' : 'false') . ')';
-        $output .= "if ({$dec}) {\n";
-        $output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n";
-        if (!$cache && !empty($compiler->tpl_function)) {
-            $output .= '$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions($_smarty_tpl, ';
-            $output .= var_export($compiler->tpl_function, true);
-            $output .= ");\n";
-        }
-        if ($cache && isset($_template->smarty->ext->_tplFunction)) {
-            $output .= "\$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " .
-                       var_export($_template->smarty->ext->_tplFunction->getTplFunction($_template), true) . ");\n";
-        }
-        $output .= "?>";
-        $output .= $content;
-        $output .= "<?php }\n?>";
-        $output .= $functions;
-        $output .= "<?php }\n";
-        // remove unneeded PHP tags
-        if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) {
-            $curr_split = preg_split(
-                '/\s*\?>[\n]?<\?php\s*/',
-                $output
-            );
-            preg_match_all(
-                '/\s*\?>[\n]?<\?php\s*/',
-                $output,
-                $curr_parts
-            );
-            $output = '';
-            foreach ($curr_split as $idx => $curr_output) {
-                $output .= $curr_output;
-                if (isset($curr_parts[ 0 ][ $idx ])) {
-                    $output .= "\n";
-                }
-            }
-        }
-        if (preg_match('/\?>\s*$/', $output)) {
-            $curr_split = preg_split(
-                '/\?>\s*$/',
-                $output
-            );
-            $output = '';
-            foreach ($curr_split as $idx => $curr_output) {
-                $output .= $curr_output;
-            }
-        }
-        return $output;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php
deleted file mode 100644
index 9f868e1a4..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Filter Handler
- * Smarty filter handler class
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-
-/**
- * Class for filter processing
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Runtime_FilterHandler
-{
-    /**
-     * Run filters over content
-     * The filters will be lazy loaded if required
-     * class name format: Smarty_FilterType_FilterName
-     * plugin filename format: filtertype.filtername.php
-     * Smarty2 filter plugins could be used
-     *
-     * @param string                   $type     the type of filter ('pre','post','output') which shall run
-     * @param string                   $content  the content which shall be processed by the filters
-     * @param Smarty_Internal_Template $template template object
-     *
-     * @throws SmartyException
-     * @return string                   the filtered content
-     */
-    public function runFilter($type, $content, Smarty_Internal_Template $template)
-    {
-        // loop over autoload filters of specified type
-        if (!empty($template->smarty->autoload_filters[ $type ])) {
-            foreach ((array)$template->smarty->autoload_filters[ $type ] as $name) {
-                $plugin_name = "Smarty_{$type}filter_{$name}";
-                if (function_exists($plugin_name)) {
-                    $callback = $plugin_name;
-                } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
-                    $callback = array($plugin_name, 'execute');
-                } elseif ($template->smarty->loadPlugin($plugin_name, false)) {
-                    if (function_exists($plugin_name)) {
-                        // use loaded Smarty2 style plugin
-                        $callback = $plugin_name;
-                    } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
-                        // loaded class of filter plugin
-                        $callback = array($plugin_name, 'execute');
-                    } else {
-                        throw new SmartyException("Auto load {$type}-filter plugin method '{$plugin_name}::execute' not callable");
-                    }
-                } else {
-                    // nothing found, throw exception
-                    throw new SmartyException("Unable to auto load {$type}-filter plugin '{$plugin_name}'");
-                }
-                $content = call_user_func($callback, $content, $template);
-            }
-        }
-        // loop over registered filters of specified type
-        if (!empty($template->smarty->registered_filters[ $type ])) {
-            foreach ($template->smarty->registered_filters[ $type ] as $key => $name) {
-                $content = call_user_func($template->smarty->registered_filters[ $type ][ $key ], $content, $template);
-            }
-        }
-        // return filtered output
-        return $content;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php
deleted file mode 100644
index badead165..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-
-/**
- * Foreach Runtime Methods count(), init(), restore()
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Runtime_Foreach
-{
-    /**
-     * Stack of saved variables
-     *
-     * @var array
-     */
-    private $stack = array();
-
-    /**
-     * Init foreach loop
-     *  - save item and key variables, named foreach property data if defined
-     *  - init item and key variables, named foreach property data if required
-     *  - count total if required
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param mixed                     $from       values to loop over
-     * @param string                    $item       variable name
-     * @param bool                      $needTotal  flag if we need to count values
-     * @param null|string               $key        variable name
-     * @param null|string               $name       of named foreach
-     * @param array                     $properties of named foreach
-     *
-     * @return mixed $from
-     */
-    public function init(
-        Smarty_Internal_Template $tpl,
-        $from,
-        $item,
-        $needTotal = false,
-        $key = null,
-        $name = null,
-        $properties = array()
-    ) {
-        $needTotal = $needTotal || isset($properties[ 'total' ]);
-        $saveVars = array();
-        $total = null;
-        if (!is_array($from)) {
-            if (is_object($from)) {
-                if ($needTotal) {
-                    $total = $this->count($from);
-                }
-            } else {
-                settype($from, 'array');
-            }
-        }
-        if (!isset($total)) {
-            $total = empty($from) ? 0 : ($needTotal ? count($from) : 1);
-        }
-        if (isset($tpl->tpl_vars[ $item ])) {
-            $saveVars[ 'item' ] = array(
-                $item,
-                $tpl->tpl_vars[ $item ]
-            );
-        }
-        $tpl->tpl_vars[ $item ] = new Smarty_Variable(null, $tpl->isRenderingCache);
-        if ($total === 0) {
-            $from = null;
-        } else {
-            if ($key) {
-                if (isset($tpl->tpl_vars[ $key ])) {
-                    $saveVars[ 'key' ] = array(
-                        $key,
-                        $tpl->tpl_vars[ $key ]
-                    );
-                }
-                $tpl->tpl_vars[ $key ] = new Smarty_Variable(null, $tpl->isRenderingCache);
-            }
-        }
-        if ($needTotal) {
-            $tpl->tpl_vars[ $item ]->total = $total;
-        }
-        if ($name) {
-            $namedVar = "__smarty_foreach_{$name}";
-            if (isset($tpl->tpl_vars[ $namedVar ])) {
-                $saveVars[ 'named' ] = array(
-                    $namedVar,
-                    $tpl->tpl_vars[ $namedVar ]
-                );
-            }
-            $namedProp = array();
-            if (isset($properties[ 'total' ])) {
-                $namedProp[ 'total' ] = $total;
-            }
-            if (isset($properties[ 'iteration' ])) {
-                $namedProp[ 'iteration' ] = 0;
-            }
-            if (isset($properties[ 'index' ])) {
-                $namedProp[ 'index' ] = -1;
-            }
-            if (isset($properties[ 'show' ])) {
-                $namedProp[ 'show' ] = ($total > 0);
-            }
-            $tpl->tpl_vars[ $namedVar ] = new Smarty_Variable($namedProp);
-        }
-        $this->stack[] = $saveVars;
-        return $from;
-    }
-
-    /**
-     * [util function] counts an array, arrayAccess/traversable or PDOStatement object
-     *
-     * @param mixed $value
-     *
-     * @return int   the count for arrays and objects that implement countable, 1 for other objects that don't, and 0
-     *               for empty elements
-     */
-    public function count($value)
-    {
-        if ($value instanceof IteratorAggregate) {
-            // Note: getIterator() returns a Traversable, not an Iterator
-            // thus rewind() and valid() methods may not be present
-            return iterator_count($value->getIterator());
-        } elseif ($value instanceof Iterator) {
-            return $value instanceof Generator ? 1 : iterator_count($value);
-        } elseif ($value instanceof Countable) {
-            return count($value);
-        } elseif ($value instanceof PDOStatement) {
-            return $value->rowCount();
-        } elseif ($value instanceof Traversable) {
-            return iterator_count($value);
-        }
-        return count((array)$value);
-    }
-
-    /**
-     * Restore saved variables
-     *
-     * will be called by {break n} or {continue n} for the required number of levels
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param int                       $levels number of levels
-     */
-    public function restore(Smarty_Internal_Template $tpl, $levels = 1)
-    {
-        while ($levels) {
-            $saveVars = array_pop($this->stack);
-            if (!empty($saveVars)) {
-                if (isset($saveVars[ 'item' ])) {
-                    $item = &$saveVars[ 'item' ];
-                    $tpl->tpl_vars[ $item[ 0 ] ]->value = $item[ 1 ]->value;
-                }
-                if (isset($saveVars[ 'key' ])) {
-                    $tpl->tpl_vars[ $saveVars[ 'key' ][ 0 ] ] = $saveVars[ 'key' ][ 1 ];
-                }
-                if (isset($saveVars[ 'named' ])) {
-                    $tpl->tpl_vars[ $saveVars[ 'named' ][ 0 ] ] = $saveVars[ 'named' ][ 1 ];
-                }
-            }
-            $levels--;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php
deleted file mode 100644
index 5ae98304e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-/**
- * Smarty read include path plugin
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Monte Ohrt
- */
-
-/**
- * Smarty Internal Read Include Path Class
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Runtime_GetIncludePath
-{
-    /**
-     * include path cache
-     *
-     * @var string
-     */
-    public $_include_path = '';
-
-    /**
-     * include path directory cache
-     *
-     * @var array
-     */
-    public $_include_dirs = array();
-
-    /**
-     * include path directory cache
-     *
-     * @var array
-     */
-    public $_user_dirs = array();
-
-    /**
-     * stream cache
-     *
-     * @var string[][]
-     */
-    public $isFile = array();
-
-    /**
-     * stream cache
-     *
-     * @var string[]
-     */
-    public $isPath = array();
-
-    /**
-     * stream cache
-     *
-     * @var int[]
-     */
-    public $number = array();
-
-    /**
-     * status cache
-     *
-     * @var bool
-     */
-    public $_has_stream_include = null;
-
-    /**
-     * Number for array index
-     *
-     * @var int
-     */
-    public $counter = 0;
-
-    /**
-     * Check if include path was updated
-     *
-     * @param \Smarty $smarty
-     *
-     * @return bool
-     */
-    public function isNewIncludePath(Smarty $smarty)
-    {
-        $_i_path = get_include_path();
-        if ($this->_include_path !== $_i_path) {
-            $this->_include_dirs = array();
-            $this->_include_path = $_i_path;
-            $_dirs = (array)explode(PATH_SEPARATOR, $_i_path);
-            foreach ($_dirs as $_path) {
-                if (is_dir($_path)) {
-                    $this->_include_dirs[] = $smarty->_realpath($_path . DIRECTORY_SEPARATOR, true);
-                }
-            }
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * return array with include path directories
-     *
-     * @param \Smarty $smarty
-     *
-     * @return array
-     */
-    public function getIncludePathDirs(Smarty $smarty)
-    {
-        $this->isNewIncludePath($smarty);
-        return $this->_include_dirs;
-    }
-
-    /**
-     * Return full file path from PHP include_path
-     *
-     * @param string[] $dirs
-     * @param string   $file
-     * @param \Smarty  $smarty
-     *
-     * @return bool|string full filepath or false
-     */
-    public function getIncludePath($dirs, $file, Smarty $smarty)
-    {
-        //if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
-        if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
-            $this->_has_stream_include = function_exists('stream_resolve_include_path'))
-        ) {
-            $this->isNewIncludePath($smarty);
-        }
-        // try PHP include_path
-        foreach ($dirs as $dir) {
-            $dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter++;
-            if (isset($this->isFile[ $dir_n ][ $file ])) {
-                if ($this->isFile[ $dir_n ][ $file ]) {
-                    return $this->isFile[ $dir_n ][ $file ];
-                } else {
-                    continue;
-                }
-            }
-            if (isset($this->_user_dirs[ $dir_n ])) {
-                if (false === $this->_user_dirs[ $dir_n ]) {
-                    continue;
-                } else {
-                    $dir = $this->_user_dirs[ $dir_n ];
-                }
-            } else {
-                if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') {
-                    $dir = str_ireplace(getcwd(), '.', $dir);
-                    if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') {
-                        $this->_user_dirs[ $dir_n ] = false;
-                        continue;
-                    }
-                }
-                $dir = substr($dir, 2);
-                $this->_user_dirs[ $dir_n ] = $dir;
-            }
-            if ($this->_has_stream_include) {
-                $path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
-                if ($path) {
-                    return $this->isFile[ $dir_n ][ $file ] = $path;
-                }
-            } else {
-                foreach ($this->_include_dirs as $key => $_i_path) {
-                    $path = isset($this->isPath[ $key ][ $dir_n ]) ? $this->isPath[ $key ][ $dir_n ] :
-                        $this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
-                    if ($path === false) {
-                        continue;
-                    }
-                    if (isset($file)) {
-                        $_file = $this->isFile[ $dir_n ][ $file ] = (is_file($path . $file)) ? $path . $file : false;
-                        if ($_file) {
-                            return $_file;
-                        }
-                    } else {
-                        // no file was given return directory path
-                        return $path;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php
deleted file mode 100644
index 8f7f02d59..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php
+++ /dev/null
@@ -1,251 +0,0 @@
-<?php
-
-/**
- * Inheritance Runtime Methods processBlock, endChild, init
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- **/
-class Smarty_Internal_Runtime_Inheritance
-{
-    /**
-     * State machine
-     * - 0 idle next extends will create a new inheritance tree
-     * - 1 processing child template
-     * - 2 wait for next inheritance template
-     * - 3 assume parent template, if child will loaded goto state 1
-     *     a call to a sub template resets the state to 0
-     *
-     * @var int
-     */
-    public $state = 0;
-
-    /**
-     * Array of root child {block} objects
-     *
-     * @var Smarty_Internal_Block[]
-     */
-    public $childRoot = array();
-
-    /**
-     * inheritance template nesting level
-     *
-     * @var int
-     */
-    public $inheritanceLevel = 0;
-
-    /**
-     * inheritance template index
-     *
-     * @var int
-     */
-    public $tplIndex = -1;
-
-    /**
-     * Array of template source objects
-     *
-     * @var Smarty_Template_Source[]
-     */
-    public $sources = array();
-
-    /**
-     * Stack of source objects while executing block code
-     *
-     * @var Smarty_Template_Source[]
-     */
-    public $sourceStack = array();
-
-    /**
-     * Initialize inheritance
-     *
-     * @param \Smarty_Internal_Template $tpl        template object of caller
-     * @param bool                      $initChild  if true init for child template
-     * @param array                     $blockNames outer level block name
-     */
-    public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
-    {
-        // if called while executing parent template it must be a sub-template with new inheritance root
-        if ($initChild && $this->state === 3 && (strpos($tpl->template_resource, 'extendsall') === false)) {
-            $tpl->inheritance = new Smarty_Internal_Runtime_Inheritance();
-            $tpl->inheritance->init($tpl, $initChild, $blockNames);
-            return;
-        }
-        ++$this->tplIndex;
-        $this->sources[ $this->tplIndex ] = $tpl->source;
-        // start of child sub template(s)
-        if ($initChild) {
-            $this->state = 1;
-            if (!$this->inheritanceLevel) {
-                //grab any output of child templates
-                ob_start();
-            }
-            ++$this->inheritanceLevel;
-            //           $tpl->startRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateStart');
-            //           $tpl->endRenderCallbacks[ 'inheritance' ] = array($this, 'subTemplateEnd');
-        }
-        // if state was waiting for parent change state to parent
-        if ($this->state === 2) {
-            $this->state = 3;
-        }
-    }
-
-    /**
-     * End of child template(s)
-     * - if outer level is reached flush output buffer and switch to wait for parent template state
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param null|string               $template optional name of inheritance parent template
-     * @param null|string               $uid      uid of inline template
-     * @param null|string               $func     function call name of inline template
-     *
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function endChild(Smarty_Internal_Template $tpl, $template = null, $uid = null, $func = null)
-    {
-        --$this->inheritanceLevel;
-        if (!$this->inheritanceLevel) {
-            ob_end_clean();
-            $this->state = 2;
-        }
-        if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends')
-                                 || $tpl->smarty->extends_recursion)
-        ) {
-            $tpl->_subTemplateRender(
-                $template,
-                $tpl->cache_id,
-                $tpl->compile_id,
-                $tpl->caching ? 9999 : 0,
-                $tpl->cache_lifetime,
-                array(),
-                2,
-                false,
-                $uid,
-                $func
-            );
-        }
-    }
-
-    /**
-     * Smarty_Internal_Block constructor.
-     * - if outer level {block} of child template ($state === 1) save it as child root block
-     * - otherwise process inheritance and render
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param                           $className
-     * @param string                    $name
-     * @param int|null                  $tplIndex index of outer level {block} if nested
-     *
-     * @throws \SmartyException
-     */
-    public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null)
-    {
-        $block = new $className($name, isset($tplIndex) ? $tplIndex : $this->tplIndex);
-        if (isset($this->childRoot[ $name ])) {
-            $block->child = $this->childRoot[ $name ];
-        }
-        if ($this->state === 1) {
-            $this->childRoot[ $name ] = $block;
-            return;
-        }
-        // make sure we got child block of child template of current block
-        while ($block->child && $block->child->child && $block->tplIndex <= $block->child->tplIndex) {
-            $block->child = $block->child->child;
-        }
-        $this->process($tpl, $block);
-    }
-
-    /**
-     * Goto child block or render this
-     *
-     * @param \Smarty_Internal_Template   $tpl
-     * @param \Smarty_Internal_Block      $block
-     * @param \Smarty_Internal_Block|null $parent
-     *
-     * @throws \SmartyException
-     */
-    public function process(
-        Smarty_Internal_Template $tpl,
-        Smarty_Internal_Block $block,
-        Smarty_Internal_Block $parent = null
-    ) {
-        if ($block->hide && !isset($block->child)) {
-            return;
-        }
-        if (isset($block->child) && $block->child->hide && !isset($block->child->child)) {
-            $block->child = null;
-        }
-        $block->parent = $parent;
-        if ($block->append && !$block->prepend && isset($parent)) {
-            $this->callParent($tpl, $block, '\'{block append}\'');
-        }
-        if ($block->callsChild || !isset($block->child) || ($block->child->hide && !isset($block->child->child))) {
-            $this->callBlock($block, $tpl);
-        } else {
-            $this->process($tpl, $block->child, $block);
-        }
-        if ($block->prepend && isset($parent)) {
-            $this->callParent($tpl, $block, '{block prepend}');
-            if ($block->append) {
-                if ($block->callsChild || !isset($block->child)
-                    || ($block->child->hide && !isset($block->child->child))
-                ) {
-                    $this->callBlock($block, $tpl);
-                } else {
-                    $this->process($tpl, $block->child, $block);
-                }
-            }
-        }
-        $block->parent = null;
-    }
-
-    /**
-     * Render child on \$smarty.block.child
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param \Smarty_Internal_Block    $block
-     *
-     * @return null|string block content
-     * @throws \SmartyException
-     */
-    public function callChild(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block)
-    {
-        if (isset($block->child)) {
-            $this->process($tpl, $block->child, $block);
-        }
-    }
-
-    /**
-     * Render parent block on \$smarty.block.parent or {block append/prepend}
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param \Smarty_Internal_Block    $block
-     * @param string                    $tag
-     *
-     * @return null|string  block content
-     * @throws \SmartyException
-     */
-    public function callParent(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, $tag)
-    {
-        if (isset($block->parent)) {
-            $this->callBlock($block->parent, $tpl);
-        } else {
-            throw new SmartyException("inheritance: illegal '{$tag}' used in child template '{$tpl->inheritance->sources[$block->tplIndex]->filepath}' block '{$block->name}'");
-        }
-    }
-
-    /**
-     * render block
-     *
-     * @param \Smarty_Internal_Block    $block
-     * @param \Smarty_Internal_Template $tpl
-     */
-    public function callBlock(Smarty_Internal_Block $block, Smarty_Internal_Template $tpl)
-    {
-        $this->sourceStack[] = $tpl->source;
-        $tpl->source = $this->sources[ $block->tplIndex ];
-        $block->callBlock($tpl);
-        $tpl->source = array_pop($this->sourceStack);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php
deleted file mode 100644
index 53069148d..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * {make_nocache} Runtime Methods save(), store()
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Runtime_Make_Nocache
-{
-    /**
-     * Save current variable value while rendering compiled template and inject nocache code to
-     * assign variable value in cahed template
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param string                    $var variable name
-     *
-     * @throws \SmartyException
-     */
-    public function save(Smarty_Internal_Template $tpl, $var)
-    {
-        if (isset($tpl->tpl_vars[ $var ])) {
-            $export =
-                preg_replace('/^Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true));
-            if (preg_match('/(\w+)::__set_state/', $export, $match)) {
-                throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
-            }
-            echo "/*%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/<?php " .
-                 addcslashes("\$_smarty_tpl->smarty->ext->_make_nocache->store(\$_smarty_tpl, '{$var}', ", '\\') .
-                 $export . ");?>\n/*/%%SmartyNocache:{$tpl->compiled->nocache_hash}%%*/";
-        }
-    }
-
-    /**
-     * Store variable value saved while rendering compiled template in cached template context
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param string                    $var variable name
-     * @param array                     $properties
-     */
-    public function store(Smarty_Internal_Template $tpl, $var, $properties)
-    {
-        // do not overwrite existing nocache variables
-        if (!isset($tpl->tpl_vars[ $var ]) || !$tpl->tpl_vars[ $var ]->nocache) {
-            $newVar = new Smarty_Variable();
-            unset($properties[ 'nocache' ]);
-            foreach ($properties as $k => $v) {
-                $newVar->$k = $v;
-            }
-            $tpl->tpl_vars[ $var ] = $newVar;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php
deleted file mode 100644
index e5f8e48f7..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-
-/**
- * TplFunction Runtime Methods callTemplateFunction
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- **/
-class Smarty_Internal_Runtime_TplFunction
-{
-    /**
-     * Call template function
-     *
-     * @param \Smarty_Internal_Template $tpl     template object
-     * @param string                    $name    template function name
-     * @param array                     $params  parameter array
-     * @param bool                      $nocache true if called nocache
-     *
-     * @throws \SmartyException
-     */
-    public function callTemplateFunction(Smarty_Internal_Template $tpl, $name, $params, $nocache)
-    {
-        $funcParam = isset($tpl->tplFunctions[ $name ]) ? $tpl->tplFunctions[ $name ] :
-            (isset($tpl->smarty->tplFunctions[ $name ]) ? $tpl->smarty->tplFunctions[ $name ] : null);
-        if (isset($funcParam)) {
-            if (!$tpl->caching || ($tpl->caching && $nocache)) {
-                $function = $funcParam[ 'call_name' ];
-            } else {
-                if (isset($funcParam[ 'call_name_caching' ])) {
-                    $function = $funcParam[ 'call_name_caching' ];
-                } else {
-                    $function = $funcParam[ 'call_name' ];
-                }
-            }
-            if (function_exists($function)) {
-                $this->saveTemplateVariables($tpl, $name);
-                $function($tpl, $params);
-                $this->restoreTemplateVariables($tpl, $name);
-                return;
-            }
-            // try to load template function dynamically
-            if ($this->addTplFuncToCache($tpl, $name, $function)) {
-                $this->saveTemplateVariables($tpl, $name);
-                $function($tpl, $params);
-                $this->restoreTemplateVariables($tpl, $name);
-                return;
-            }
-        }
-        throw new SmartyException("Unable to find template function '{$name}'");
-    }
-
-    /**
-     * Register template functions defined by template
-     *
-     * @param \Smarty|\Smarty_Internal_Template|\Smarty_Internal_TemplateBase $obj
-     * @param array                                                           $tplFunctions source information array of
-     *                                                                                      template functions defined
-     *                                                                                      in template
-     * @param bool                                                            $override     if true replace existing
-     *                                                                                      functions with same name
-     */
-    public function registerTplFunctions(Smarty_Internal_TemplateBase $obj, $tplFunctions, $override = true)
-    {
-        $obj->tplFunctions =
-            $override ? array_merge($obj->tplFunctions, $tplFunctions) : array_merge($tplFunctions, $obj->tplFunctions);
-        // make sure that the template functions are known in parent templates
-        if ($obj->_isSubTpl()) {
-            $obj->smarty->ext->_tplFunction->registerTplFunctions($obj->parent, $tplFunctions, false);
-        } else {
-            $obj->smarty->tplFunctions = $override ? array_merge($obj->smarty->tplFunctions, $tplFunctions) :
-                array_merge($tplFunctions, $obj->smarty->tplFunctions);
-        }
-    }
-
-    /**
-     * Return source parameter array for single or all template functions
-     *
-     * @param \Smarty_Internal_Template $tpl  template object
-     * @param null|string               $name template function name
-     *
-     * @return array|bool|mixed
-     */
-    public function getTplFunction(Smarty_Internal_Template $tpl, $name = null)
-    {
-        if (isset($name)) {
-            return isset($tpl->tplFunctions[ $name ]) ? $tpl->tplFunctions[ $name ] :
-                (isset($tpl->smarty->tplFunctions[ $name ]) ? $tpl->smarty->tplFunctions[ $name ] : false);
-        } else {
-            return empty($tpl->tplFunctions) ? $tpl->smarty->tplFunctions : $tpl->tplFunctions;
-        }
-    }
-
-    /**
-     * Add template function to cache file for nocache calls
-     *
-     * @param Smarty_Internal_Template $tpl
-     * @param string                   $_name     template function name
-     * @param string                   $_function PHP function name
-     *
-     * @return bool
-     */
-    public function addTplFuncToCache(Smarty_Internal_Template $tpl, $_name, $_function)
-    {
-        $funcParam = $tpl->tplFunctions[ $_name ];
-        if (is_file($funcParam[ 'compiled_filepath' ])) {
-            // read compiled file
-            $code = file_get_contents($funcParam[ 'compiled_filepath' ]);
-            // grab template function
-            if (preg_match("/\/\* {$_function} \*\/([\S\s]*?)\/\*\/ {$_function} \*\//", $code, $match)) {
-                // grab source info from file dependency
-                preg_match("/\s*'{$funcParam['uid']}'([\S\s]*?)\),/", $code, $match1);
-                unset($code);
-                // make PHP function known
-                eval($match[ 0 ]);
-                if (function_exists($_function)) {
-                    // search cache file template
-                    $tplPtr = $tpl;
-                    while (!isset($tplPtr->cached) && isset($tplPtr->parent)) {
-                        $tplPtr = $tplPtr->parent;
-                    }
-                    // add template function code to cache file
-                    if (isset($tplPtr->cached)) {
-                        $content = $tplPtr->cached->read($tplPtr);
-                        if ($content) {
-                            // check if we must update file dependency
-                            if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) {
-                                $content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content);
-                            }
-                            $tplPtr->smarty->ext->_updateCache->write(
-                                $tplPtr,
-                                preg_replace('/\s*\?>\s*$/', "\n", $content) .
-                                "\n" . preg_replace(
-                                    array(
-                                        '/^\s*<\?php\s+/',
-                                        '/\s*\?>\s*$/',
-                                    ),
-                                    "\n",
-                                    $match[ 0 ]
-                                )
-                            );
-                        }
-                    }
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Save current template variables on stack
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param string                    $name stack name
-     */
-    public function saveTemplateVariables(Smarty_Internal_Template $tpl, $name)
-    {
-        $tpl->_cache[ 'varStack' ][] =
-            array('tpl' => $tpl->tpl_vars, 'config' => $tpl->config_vars, 'name' => "_tplFunction_{$name}");
-    }
-
-    /**
-     * Restore saved variables into template objects
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param string                    $name stack name
-     */
-    public function restoreTemplateVariables(Smarty_Internal_Template $tpl, $name)
-    {
-        if (isset($tpl->_cache[ 'varStack' ])) {
-            $vars = array_pop($tpl->_cache[ 'varStack' ]);
-            $tpl->tpl_vars = $vars[ 'tpl' ];
-            $tpl->config_vars = $vars[ 'config' ];
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php
deleted file mode 100644
index c1abbb321..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-
-/**
- * Inline Runtime Methods render, setSourceByUid, setupSubTemplate
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- **/
-class Smarty_Internal_Runtime_UpdateCache
-{
-    /**
-     * check client side cache
-     *
-     * @param \Smarty_Template_Cached  $cached
-     * @param Smarty_Internal_Template $_template
-     * @param string                   $content
-     */
-    public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
-    {
-    }
-
-    /**
-     * Cache was invalid , so render from compiled and write to cache
-     *
-     * @param \Smarty_Template_Cached   $cached
-     * @param \Smarty_Internal_Template $_template
-     * @param                           $no_output_filter
-     *
-     * @throws \Exception
-     */
-    public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
-    {
-        ob_start();
-        if (!isset($_template->compiled)) {
-            $_template->loadCompiled();
-        }
-        $_template->compiled->render($_template);
-        if ($_template->smarty->debugging) {
-            $_template->smarty->_debug->start_cache($_template);
-        }
-        $this->removeNoCacheHash($cached, $_template, $no_output_filter);
-        $compile_check = (int)$_template->compile_check;
-        $_template->compile_check = Smarty::COMPILECHECK_OFF;
-        if ($_template->_isSubTpl()) {
-            $_template->compiled->unifunc = $_template->parent->compiled->unifunc;
-        }
-        if (!$_template->cached->processed) {
-            $_template->cached->process($_template, true);
-        }
-        $_template->compile_check = $compile_check;
-        $cached->getRenderedTemplateCode($_template);
-        if ($_template->smarty->debugging) {
-            $_template->smarty->_debug->end_cache($_template);
-        }
-    }
-
-    /**
-     * Sanitize content and write it to cache resource
-     *
-     * @param \Smarty_Template_Cached  $cached
-     * @param Smarty_Internal_Template $_template
-     * @param bool                     $no_output_filter
-     *
-     * @throws \SmartyException
-     */
-    public function removeNoCacheHash(
-        Smarty_Template_Cached $cached,
-        Smarty_Internal_Template $_template,
-        $no_output_filter
-    ) {
-        $php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/';
-        $content = ob_get_clean();
-        $hash_array = $cached->hashes;
-        $hash_array[ $_template->compiled->nocache_hash ] = true;
-        $hash_array = array_keys($hash_array);
-        $nocache_hash = '(' . implode('|', $hash_array) . ')';
-        $_template->cached->has_nocache_code = false;
-        // get text between non-cached items
-        $cache_split =
-            preg_split(
-                "!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
-                $content
-            );
-        // get non-cached items
-        preg_match_all(
-            "!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
-            $content,
-            $cache_parts
-        );
-        $content = '';
-        // loop over items, stitch back together
-        foreach ($cache_split as $curr_idx => $curr_split) {
-            if (preg_match($php_pattern, $curr_split)) {
-                // escape PHP tags in template content
-                $php_split = preg_split(
-                    $php_pattern,
-                    $curr_split
-                );
-                preg_match_all(
-                    $php_pattern,
-                    $curr_split,
-                    $php_parts
-                );
-                foreach ($php_split as $idx_php => $curr_php) {
-                    $content .= $curr_php;
-                    if (isset($php_parts[ 0 ][ $idx_php ])) {
-                        $content .= "<?php echo '{$php_parts[ 1 ][ $idx_php ]}'; ?>\n";
-                    }
-                }
-            } else {
-                $content .= $curr_split;
-            }
-            if (isset($cache_parts[ 0 ][ $curr_idx ])) {
-                $_template->cached->has_nocache_code = true;
-                $content .= $cache_parts[ 2 ][ $curr_idx ];
-            }
-        }
-        if (!$no_output_filter && !$_template->cached->has_nocache_code
-            && (isset($_template->smarty->autoload_filters[ 'output' ])
-                || isset($_template->smarty->registered_filters[ 'output' ]))
-        ) {
-            $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
-        }
-        // write cache file content
-        $this->writeCachedContent($_template, $content);
-    }
-
-    /**
-     * Writes the content to cache resource
-     *
-     * @param Smarty_Internal_Template $_template
-     * @param string                   $content
-     *
-     * @return bool
-     */
-    public function writeCachedContent(Smarty_Internal_Template $_template, $content)
-    {
-        if ($_template->source->handler->recompiled || !$_template->caching
-        ) {
-            // don't write cache file
-            return false;
-        }
-        if (!isset($_template->cached)) {
-            $_template->loadCached();
-        }
-        $content = $_template->smarty->ext->_codeFrame->create($_template, $content, '', true);
-        return $this->write($_template, $content);
-    }
-
-    /**
-     * Write this cache object to handler
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $content   content to cache
-     *
-     * @return bool success
-     */
-    public function write(Smarty_Internal_Template $_template, $content)
-    {
-        if (!$_template->source->handler->recompiled) {
-            $cached = $_template->cached;
-            if ($cached->handler->writeCachedContent($_template, $content)) {
-                $cached->content = null;
-                $cached->timestamp = time();
-                $cached->exists = true;
-                $cached->valid = true;
-                $cached->cache_lifetime = $_template->cache_lifetime;
-                $cached->processed = false;
-                if ($_template->smarty->cache_locking) {
-                    $cached->handler->releaseLock($_template->smarty, $cached);
-                }
-                return true;
-            }
-            $cached->content = null;
-            $cached->timestamp = false;
-            $cached->exists = false;
-            $cached->valid = false;
-            $cached->processed = false;
-        }
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php
deleted file mode 100644
index 2240f97ca..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-
-/**
- * Runtime Extension updateScope
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- **/
-class Smarty_Internal_Runtime_UpdateScope
-{
-    /**
-     * Update new assigned template or config variable in other effected scopes
-     *
-     * @param Smarty_Internal_Template $tpl      data object
-     * @param string|null              $varName  variable name
-     * @param int                      $tagScope tag scope to which bubble up variable value
-     */
-    public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0)
-    {
-        if ($tagScope) {
-            $this->_updateVarStack($tpl, $varName);
-            $tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
-            if (!$tpl->scope && !$tagScope) {
-                return;
-            }
-        }
-        $mergedScope = $tagScope | $tpl->scope;
-        if ($mergedScope) {
-            if ($mergedScope & Smarty::SCOPE_GLOBAL && $varName) {
-                Smarty::$global_tpl_vars[ $varName ] = $tpl->tpl_vars[ $varName ];
-            }
-            // update scopes
-            foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
-                $this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
-                if ($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) {
-                    $this->_updateVarStack($ptr, $varName);
-                }
-            }
-        }
-    }
-
-    /**
-     * Get array of objects which needs to be updated  by given scope value
-     *
-     * @param Smarty_Internal_Template $tpl
-     * @param int                      $mergedScope merged tag and template scope to which bubble up variable value
-     *
-     * @return array
-     */
-    public function _getAffectedScopes(Smarty_Internal_Template $tpl, $mergedScope)
-    {
-        $_stack = array();
-        $ptr = $tpl->parent;
-        if ($mergedScope && isset($ptr) && $ptr->_isTplObj()) {
-            $_stack[] = $ptr;
-            $mergedScope = $mergedScope & ~Smarty::SCOPE_PARENT;
-            if (!$mergedScope) {
-                // only parent was set, we are done
-                return $_stack;
-            }
-            $ptr = $ptr->parent;
-        }
-        while (isset($ptr) && $ptr->_isTplObj()) {
-            $_stack[] = $ptr;
-            $ptr = $ptr->parent;
-        }
-        if ($mergedScope & Smarty::SCOPE_SMARTY) {
-            if (isset($tpl->smarty)) {
-                $_stack[] = $tpl->smarty;
-            }
-        } elseif ($mergedScope & Smarty::SCOPE_ROOT) {
-            while (isset($ptr)) {
-                if (!$ptr->_isTplObj()) {
-                    $_stack[] = $ptr;
-                    break;
-                }
-                $ptr = $ptr->parent;
-            }
-        }
-        return $_stack;
-    }
-
-    /**
-     * Update variable in other scope
-     *
-     * @param array                     $tpl_vars template variable array
-     * @param \Smarty_Internal_Template $from
-     * @param string                    $varName  variable name
-     */
-    public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName)
-    {
-        if (!isset($tpl_vars[ $varName ])) {
-            $tpl_vars[ $varName ] = clone $from->tpl_vars[ $varName ];
-        } else {
-            $tpl_vars[ $varName ] = clone $tpl_vars[ $varName ];
-            $tpl_vars[ $varName ]->value = $from->tpl_vars[ $varName ]->value;
-        }
-    }
-
-    /**
-     * Update variable in template local variable stack
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param string|null               $varName variable name or null for config variables
-     */
-    public function _updateVarStack(Smarty_Internal_Template $tpl, $varName)
-    {
-        $i = 0;
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
-            $this->_updateVariableInOtherScope($tpl->_cache[ 'varStack' ][ $i ][ 'tpl' ], $tpl, $varName);
-            $i++;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php b/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php
deleted file mode 100644
index 4383e6f38..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/**
- * Smarty write file plugin
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Monte Ohrt
- */
-
-/**
- * Smarty Internal Write File Class
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- */
-class Smarty_Internal_Runtime_WriteFile
-{
-    /**
-     * Writes file in a safe way to disk
-     *
-     * @param string $_filepath complete filepath
-     * @param string $_contents file content
-     * @param Smarty $smarty    smarty instance
-     *
-     * @throws SmartyException
-     * @return boolean true
-     */
-    public function writeFile($_filepath, $_contents, Smarty $smarty)
-    {
-        $_error_reporting = error_reporting();
-        error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
-        $_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644;
-        $_dir_perms =
-            property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771;
-        if ($_file_perms !== null) {
-            $old_umask = umask(0);
-        }
-        $_dirpath = dirname($_filepath);
-        // if subdirs, create dir structure
-        if ($_dirpath !== '.') {
-            $i = 0;
-            // loop if concurrency problem occurs
-            // see https://bugs.php.net/bug.php?id=35326
-            while (!is_dir($_dirpath)) {
-                if (@mkdir($_dirpath, $_dir_perms, true)) {
-                    break;
-                }
-                clearstatcache();
-                if (++$i === 3) {
-                    error_reporting($_error_reporting);
-                    throw new SmartyException("unable to create directory {$_dirpath}");
-                }
-                sleep(1);
-            }
-        }
-        // write to tmp file, then move to overt file lock race condition
-        $_tmp_file = $_dirpath . DIRECTORY_SEPARATOR . str_replace(array('.', ','), '_', uniqid('wrt', true));
-        if (!file_put_contents($_tmp_file, $_contents)) {
-            error_reporting($_error_reporting);
-            throw new SmartyException("unable to write file {$_tmp_file}");
-        }
-        /*
-         * Windows' rename() fails if the destination exists,
-         * Linux' rename() properly handles the overwrite.
-         * Simply unlink()ing a file might cause other processes
-         * currently reading that file to fail, but linux' rename()
-         * seems to be smart enough to handle that for us.
-         */
-        if (Smarty::$_IS_WINDOWS) {
-            // remove original file
-            if (is_file($_filepath)) {
-                @unlink($_filepath);
-            }
-            // rename tmp file
-            $success = @rename($_tmp_file, $_filepath);
-        } else {
-            // rename tmp file
-            $success = @rename($_tmp_file, $_filepath);
-            if (!$success) {
-                // remove original file
-                if (is_file($_filepath)) {
-                    @unlink($_filepath);
-                }
-                // rename tmp file
-                $success = @rename($_tmp_file, $_filepath);
-            }
-        }
-        if (!$success) {
-            error_reporting($_error_reporting);
-            throw new SmartyException("unable to write file {$_filepath}");
-        }
-        if ($_file_perms !== null) {
-            // set file permissions
-            chmod($_filepath, $_file_perms);
-            umask($old_umask);
-        }
-        error_reporting($_error_reporting);
-        return true;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php b/libraries/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php
deleted file mode 100644
index 21f4e3fdd..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Smarty Template Compiler Base
- * This file contains the basic classes and methods for compiling Smarty templates with lexer/parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Class SmartyTemplateCompiler
- *
- * @package    Smarty
- * @subpackage Compiler
- */
-class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase
-{
-    /**
-     * Lexer class name
-     *
-     * @var string
-     */
-    public $lexer_class;
-
-    /**
-     * Parser class name
-     *
-     * @var string
-     */
-    public $parser_class;
-
-    /**
-     * array of vars which can be compiled in local scope
-     *
-     * @var array
-     */
-    public $local_var = array();
-
-    /**
-     * array of callbacks called when the normal compile process of template is finished
-     *
-     * @var array
-     */
-    public $postCompileCallbacks = array();
-
-    /**
-     * prefix code
-     *
-     * @var string
-     */
-    public $prefixCompiledCode = '';
-
-    /**
-     * postfix code
-     *
-     * @var string
-     */
-    public $postfixCompiledCode = '';
-
-    /**
-     * Initialize compiler
-     *
-     * @param string $lexer_class  class name
-     * @param string $parser_class class name
-     * @param Smarty $smarty       global instance
-     */
-    public function __construct($lexer_class, $parser_class, Smarty $smarty)
-    {
-        parent::__construct($smarty);
-        // get required plugins
-        $this->lexer_class = $lexer_class;
-        $this->parser_class = $parser_class;
-    }
-
-    /**
-     * method to compile a Smarty template
-     *
-     * @param mixed $_content template source
-     * @param bool  $isTemplateSource
-     *
-     * @return bool true if compiling succeeded, false if it failed
-     * @throws \SmartyCompilerException
-     */
-    protected function doCompile($_content, $isTemplateSource = false)
-    {
-        /* here is where the compiling takes place. Smarty
-          tags in the templates are replaces with PHP code,
-          then written to compiled files. */
-        // init the lexer/parser to compile the template
-        $this->parser =
-            new $this->parser_class(
-                new $this->lexer_class(
-                    str_replace(
-                        array(
-                            "\r\n",
-                            "\r"
-                        ),
-                        "\n",
-                        $_content
-                    ),
-                    $this
-                ),
-                $this
-            );
-        if ($isTemplateSource && $this->template->caching) {
-            $this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n");
-        }
-        if (function_exists('mb_internal_encoding')
-            && function_exists('ini_get')
-            && ((int)ini_get('mbstring.func_overload')) & 2
-        ) {
-            $mbEncoding = mb_internal_encoding();
-            mb_internal_encoding('ASCII');
-        } else {
-            $mbEncoding = null;
-        }
-        if ($this->smarty->_parserdebug) {
-            $this->parser->PrintTrace();
-            $this->parser->lex->PrintTrace();
-        }
-        // get tokens from lexer and parse them
-        while ($this->parser->lex->yylex()) {
-            if ($this->smarty->_parserdebug) {
-                echo "<pre>Line {$this->parser->lex->line} Parsing  {$this->parser->yyTokenName[$this->parser->lex->token]} Token " .
-                     htmlentities($this->parser->lex->value) . "</pre>";
-            }
-            $this->parser->doParse($this->parser->lex->token, $this->parser->lex->value);
-        }
-        // finish parsing process
-        $this->parser->doParse(0, 0);
-        if ($mbEncoding) {
-            mb_internal_encoding($mbEncoding);
-        }
-        // check for unclosed tags
-        if (count($this->_tag_stack) > 0) {
-            // get stacked info
-            list($openTag, $_data) = array_pop($this->_tag_stack);
-            $this->trigger_template_error(
-                "unclosed {$this->smarty->left_delimiter}" . $openTag .
-                "{$this->smarty->right_delimiter} tag"
-            );
-        }
-        // call post compile callbacks
-        foreach ($this->postCompileCallbacks as $cb) {
-            $parameter = $cb;
-            $parameter[ 0 ] = $this;
-            call_user_func_array($cb[ 0 ], $parameter);
-        }
-        // return compiled code
-        return $this->prefixCompiledCode . $this->parser->retvalue . $this->postfixCompiledCode;
-    }
-
-    /**
-     * Register a post compile callback
-     * - when the callback is called after template compiling the compiler object will be inserted as first parameter
-     *
-     * @param callback $callback
-     * @param array    $parameter optional parameter array
-     * @param string   $key       optional key for callback
-     * @param bool     $replace   if true replace existing keyed callback
-     */
-    public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false)
-    {
-        array_unshift($parameter, $callback);
-        if (isset($key)) {
-            if ($replace || !isset($this->postCompileCallbacks[ $key ])) {
-                $this->postCompileCallbacks[ $key ] = $parameter;
-            }
-        } else {
-            $this->postCompileCallbacks[] = $parameter;
-        }
-    }
-
-    /**
-     * Remove a post compile callback
-     *
-     * @param string $key callback key
-     */
-    public function unregisterPostCompileCallback($key)
-    {
-        unset($this->postCompileCallbacks[ $key ]);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_template.php b/libraries/Smarty/libs/sysplugins/smarty_internal_template.php
deleted file mode 100644
index bae22a7d5..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_template.php
+++ /dev/null
@@ -1,740 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Template
- * This file contains the Smarty template engine
- *
- * @package    Smarty
- * @subpackage Template
- * @author     Uwe Tews
- */
-
-/**
- * Main class with template data structures and methods
- *
- * @package    Smarty
- * @subpackage Template
- *
- * @property Smarty_Template_Compiled             $compiled
- * @property Smarty_Template_Cached               $cached
- * @property Smarty_Internal_TemplateCompilerBase $compiler
- * @property mixed|\Smarty_Template_Cached        registered_plugins
- *
- * The following methods will be dynamically loaded by the extension handler when they are called.
- * They are located in a corresponding Smarty_Internal_Method_xxxx class
- *
- * @method bool mustCompile()
- */
-class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
-{
-    /**
-     * Template object cache
-     *
-     * @var Smarty_Internal_Template[]
-     */
-    public static $tplObjCache = array();
-
-    /**
-     * Template object cache for Smarty::isCached() === true
-     *
-     * @var Smarty_Internal_Template[]
-     */
-    public static $isCacheTplObj = array();
-
-    /**
-     * Sub template Info Cache
-     * - index name
-     * - value use count
-     *
-     * @var int[]
-     */
-    public static $subTplInfo = array();
-
-    /**
-     * This object type (Smarty = 1, template = 2, data = 4)
-     *
-     * @var int
-     */
-    public $_objType = 2;
-
-    /**
-     * Global smarty instance
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * Source instance
-     *
-     * @var Smarty_Template_Source|Smarty_Template_Config
-     */
-    public $source = null;
-
-    /**
-     * Inheritance runtime extension
-     *
-     * @var Smarty_Internal_Runtime_Inheritance
-     */
-    public $inheritance = null;
-
-    /**
-     * Template resource
-     *
-     * @var string
-     */
-    public $template_resource = null;
-
-    /**
-     * flag if compiled template is invalid and must be (re)compiled
-     *
-     * @var bool
-     */
-    public $mustCompile = null;
-
-    /**
-     * Template Id
-     *
-     * @var null|string
-     */
-    public $templateId = null;
-
-    /**
-     * Scope in which variables shall be assigned
-     *
-     * @var int
-     */
-    public $scope = 0;
-
-    /**
-     * Flag which is set while rending a cache file
-     *
-     * @var bool
-     */
-    public $isRenderingCache = false;
-
-    /**
-     * Callbacks called before rendering template
-     *
-     * @var callback[]
-     */
-    public $startRenderCallbacks = array();
-
-    /**
-     * Callbacks called after rendering template
-     *
-     * @var callback[]
-     */
-    public $endRenderCallbacks = array();
-
-    /**
-     * Create template data object
-     * Some of the global Smarty settings copied to template scope
-     * It load the required template resources and caching plugins
-     *
-     * @param string                                                       $template_resource template resource string
-     * @param Smarty                                                       $smarty            Smarty instance
-     * @param null|\Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent           back pointer to parent
-     *                                                                                        object with variables or
-     *                                                                                        null
-     * @param mixed                                                        $_cache_id         cache   id or null
-     * @param mixed                                                        $_compile_id       compile id or null
-     * @param bool|int|null                                                $_caching          use caching?
-     * @param int|null                                                     $_cache_lifetime   cache life-time in
-     *                                                                                        seconds
-     * @param bool                                                         $_isConfig
-     *
-     * @throws \SmartyException
-     */
-    public function __construct(
-        $template_resource,
-        Smarty $smarty,
-        Smarty_Internal_Data $_parent = null,
-        $_cache_id = null,
-        $_compile_id = null,
-        $_caching = null,
-        $_cache_lifetime = null,
-        $_isConfig = false
-    ) {
-        $this->smarty = $smarty;
-        // Smarty parameter
-        $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
-        $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id;
-        $this->caching = (int)($_caching === null ? $this->smarty->caching : $_caching);
-        $this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime;
-        $this->compile_check = (int)$smarty->compile_check;
-        $this->parent = $_parent;
-        // Template resource
-        $this->template_resource = $template_resource;
-        $this->source = $_isConfig ? Smarty_Template_Config::load($this) : Smarty_Template_Source::load($this);
-        parent::__construct();
-        if ($smarty->security_policy && method_exists($smarty->security_policy, 'registerCallBacks')) {
-            $smarty->security_policy->registerCallBacks($this);
-        }
-    }
-
-    /**
-     * render template
-     *
-     * @param bool      $no_output_filter if true do not run output filter
-     * @param null|bool $display          true: display, false: fetch null: sub-template
-     *
-     * @return string
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function render($no_output_filter = true, $display = null)
-    {
-        if ($this->smarty->debugging) {
-            if (!isset($this->smarty->_debug)) {
-                $this->smarty->_debug = new Smarty_Internal_Debug();
-            }
-            $this->smarty->_debug->start_template($this, $display);
-        }
-        // checks if template exists
-        if (!$this->source->exists) {
-            throw new SmartyException(
-                "Unable to load template '{$this->source->type}:{$this->source->name}'" .
-                ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '')
-            );
-        }
-        // disable caching for evaluated code
-        if ($this->source->handler->recompiled) {
-            $this->caching = Smarty::CACHING_OFF;
-        }
-        // read from cache or render
-        if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) {
-            if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id
-                || $this->cached->compile_id !== $this->compile_id
-            ) {
-                $this->loadCached(true);
-            }
-            $this->cached->render($this, $no_output_filter);
-        } else {
-            if (!isset($this->compiled) || $this->compiled->compile_id !== $this->compile_id) {
-                $this->loadCompiled(true);
-            }
-            $this->compiled->render($this);
-        }
-        // display or fetch
-        if ($display) {
-            if ($this->caching && $this->smarty->cache_modified_check) {
-                $this->smarty->ext->_cacheModify->cacheModifiedCheck(
-                    $this->cached,
-                    $this,
-                    isset($content) ? $content : ob_get_clean()
-                );
-            } else {
-                if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
-                    && !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ])
-                                              || isset($this->smarty->registered_filters[ 'output' ]))
-                ) {
-                    echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
-                } else {
-                    echo ob_get_clean();
-                }
-            }
-            if ($this->smarty->debugging) {
-                $this->smarty->_debug->end_template($this);
-                // debug output
-                $this->smarty->_debug->display_debug($this, true);
-            }
-            return '';
-        } else {
-            if ($this->smarty->debugging) {
-                $this->smarty->_debug->end_template($this);
-                if ($this->smarty->debugging === 2 && $display === false) {
-                    $this->smarty->_debug->display_debug($this, true);
-                }
-            }
-            if (!$no_output_filter
-                && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
-                && (isset($this->smarty->autoload_filters[ 'output' ])
-                    || isset($this->smarty->registered_filters[ 'output' ]))
-            ) {
-                return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
-            }
-            // return cache content
-            return null;
-        }
-    }
-
-    /**
-     * Runtime function to render sub-template
-     *
-     * @param string  $template       template name
-     * @param mixed   $cache_id       cache id
-     * @param mixed   $compile_id     compile id
-     * @param integer $caching        cache mode
-     * @param integer $cache_lifetime life time of cache data
-     * @param array   $data           passed parameter template variables
-     * @param int     $scope          scope in which {include} should execute
-     * @param bool    $forceTplCache  cache template object
-     * @param string  $uid            file dependency uid
-     * @param string  $content_func   function name
-     *
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function _subTemplateRender(
-        $template,
-        $cache_id,
-        $compile_id,
-        $caching,
-        $cache_lifetime,
-        $data,
-        $scope,
-        $forceTplCache,
-        $uid = null,
-        $content_func = null
-    ) {
-        $tpl = clone $this;
-        $tpl->parent = $this;
-        $smarty = &$this->smarty;
-        $_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl);
-        // recursive call ?
-        if (isset($tpl->templateId) ? $tpl->templateId : $tpl->_getTemplateId() !== $_templateId) {
-            // already in template cache?
-            if (isset(self::$tplObjCache[ $_templateId ])) {
-                // copy data from cached object
-                $cachedTpl = &self::$tplObjCache[ $_templateId ];
-                $tpl->templateId = $cachedTpl->templateId;
-                $tpl->template_resource = $cachedTpl->template_resource;
-                $tpl->cache_id = $cachedTpl->cache_id;
-                $tpl->compile_id = $cachedTpl->compile_id;
-                $tpl->source = $cachedTpl->source;
-                if (isset($cachedTpl->compiled)) {
-                    $tpl->compiled = $cachedTpl->compiled;
-                } else {
-                    unset($tpl->compiled);
-                }
-                if ($caching !== 9999 && isset($cachedTpl->cached)) {
-                    $tpl->cached = $cachedTpl->cached;
-                } else {
-                    unset($tpl->cached);
-                }
-            } else {
-                $tpl->templateId = $_templateId;
-                $tpl->template_resource = $template;
-                $tpl->cache_id = $cache_id;
-                $tpl->compile_id = $compile_id;
-                if (isset($uid)) {
-                    // for inline templates we can get all resource information from file dependency
-                    list($filepath, $timestamp, $type) = $tpl->compiled->file_dependency[ $uid ];
-                    $tpl->source = new Smarty_Template_Source($smarty, $filepath, $type, $filepath);
-                    $tpl->source->filepath = $filepath;
-                    $tpl->source->timestamp = $timestamp;
-                    $tpl->source->exists = true;
-                    $tpl->source->uid = $uid;
-                } else {
-                    $tpl->source = Smarty_Template_Source::load($tpl);
-                    unset($tpl->compiled);
-                }
-                if ($caching !== 9999) {
-                    unset($tpl->cached);
-                }
-            }
-        } else {
-            // on recursive calls force caching
-            $forceTplCache = true;
-        }
-        $tpl->caching = $caching;
-        $tpl->cache_lifetime = $cache_lifetime;
-        // set template scope
-        $tpl->scope = $scope;
-        if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) {
-            // check if template object should be cached
-            if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ])
-                                   && self::$subTplInfo[ $tpl->template_resource ] > 1)
-                || ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ]))
-            ) {
-                self::$tplObjCache[ $tpl->templateId ] = $tpl;
-            }
-        }
-        if (!empty($data)) {
-            // set up variable values
-            foreach ($data as $_key => $_val) {
-                $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val, $this->isRenderingCache);
-            }
-        }
-        if ($tpl->caching === 9999) {
-            if (!isset($tpl->compiled)) {
-                $this->loadCompiled(true);
-            }
-            if ($tpl->compiled->has_nocache_code) {
-                $this->cached->hashes[ $tpl->compiled->nocache_hash ] = true;
-            }
-        }
-        $tpl->_cache = array();
-        if (isset($uid)) {
-            if ($smarty->debugging) {
-                if (!isset($smarty->_debug)) {
-                    $smarty->_debug = new Smarty_Internal_Debug();
-                }
-                $smarty->_debug->start_template($tpl);
-                $smarty->_debug->start_render($tpl);
-            }
-            $tpl->compiled->getRenderedTemplateCode($tpl, $content_func);
-            if ($smarty->debugging) {
-                $smarty->_debug->end_template($tpl);
-                $smarty->_debug->end_render($tpl);
-            }
-        } else {
-            if (isset($tpl->compiled)) {
-                $tpl->compiled->render($tpl);
-            } else {
-                $tpl->render();
-            }
-        }
-    }
-
-    /**
-     * Get called sub-templates and save call count
-     */
-    public function _subTemplateRegister()
-    {
-        foreach ($this->compiled->includes as $name => $count) {
-            if (isset(self::$subTplInfo[ $name ])) {
-                self::$subTplInfo[ $name ] += $count;
-            } else {
-                self::$subTplInfo[ $name ] = $count;
-            }
-        }
-    }
-
-    /**
-     * Check if this is a sub template
-     *
-     * @return bool true is sub template
-     */
-    public function _isSubTpl()
-    {
-        return isset($this->parent) && $this->parent->_isTplObj();
-    }
-
-    /**
-     * Assign variable in scope
-     *
-     * @param string $varName variable name
-     * @param mixed  $value   value
-     * @param bool   $nocache nocache flag
-     * @param int    $scope   scope into which variable shall be assigned
-     */
-    public function _assignInScope($varName, $value, $nocache = false, $scope = 0)
-    {
-        if (isset($this->tpl_vars[ $varName ])) {
-            $this->tpl_vars[ $varName ] = clone $this->tpl_vars[ $varName ];
-            $this->tpl_vars[ $varName ]->value = $value;
-            if ($nocache || $this->isRenderingCache) {
-                $this->tpl_vars[ $varName ]->nocache = true;
-            }
-        } else {
-            $this->tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache || $this->isRenderingCache);
-        }
-        if ($scope >= 0) {
-            if ($scope > 0 || $this->scope > 0) {
-                $this->smarty->ext->_updateScope->_updateScope($this, $varName, $scope);
-            }
-        }
-    }
-
-    /**
-     * Check if plugins are callable require file otherwise
-     *
-     * @param array $plugins required plugins
-     *
-     * @throws \SmartyException
-     */
-    public function _checkPlugins($plugins)
-    {
-        static $checked = array();
-        foreach ($plugins as $plugin) {
-            $name = join('::', (array)$plugin[ 'function' ]);
-            if (!isset($checked[ $name ])) {
-                if (!is_callable($plugin[ 'function' ])) {
-                    if (is_file($plugin[ 'file' ])) {
-                        include_once $plugin[ 'file' ];
-                        if (is_callable($plugin[ 'function' ])) {
-                            $checked[ $name ] = true;
-                        }
-                    }
-                } else {
-                    $checked[ $name ] = true;
-                }
-            }
-            if (!isset($checked[ $name ])) {
-                if (false !== $this->smarty->loadPlugin($name)) {
-                    $checked[ $name ] = true;
-                } else {
-                    throw new SmartyException("Plugin '{$name}' not callable");
-                }
-            }
-        }
-    }
-
-    /**
-     * This function is executed automatically when a compiled or cached template file is included
-     * - Decode saved properties from compiled template and cache files
-     * - Check if compiled or cache file is valid
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param array                     $properties special template properties
-     * @param bool                      $cache      flag if called from cache file
-     *
-     * @return bool flag if compiled or cache file is valid
-     * @throws \SmartyException
-     */
-    public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
-    {
-        // on cache resources other than file check version stored in cache code
-        if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
-            if ($cache) {
-                $tpl->smarty->clearAllCache();
-            } else {
-                $tpl->smarty->clearCompiledTemplate();
-            }
-            return false;
-        }
-        $is_valid = true;
-        if (!empty($properties[ 'file_dependency' ])
-            && ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON)
-        ) {
-            // check file dependencies at compiled code
-            foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
-                if ($_file_to_check[ 2 ] === 'file' || $_file_to_check[ 2 ] === 'php') {
-                    if ($tpl->source->filepath === $_file_to_check[ 0 ]) {
-                        // do not recheck current template
-                        continue;
-                        //$mtime = $tpl->source->getTimeStamp();
-                    } else {
-                        // file and php types can be checked without loading the respective resource handlers
-                        $mtime = is_file($_file_to_check[ 0 ]) ? filemtime($_file_to_check[ 0 ]) : false;
-                    }
-                } else {
-                    $handler = Smarty_Resource::load($tpl->smarty, $_file_to_check[ 2 ]);
-                    if ($handler->checkTimestamps()) {
-                        $source = Smarty_Template_Source::load($tpl, $tpl->smarty, $_file_to_check[ 0 ]);
-                        $mtime = $source->getTimeStamp();
-                    } else {
-                        continue;
-                    }
-                }
-                if ($mtime === false || $mtime > $_file_to_check[ 1 ]) {
-                    $is_valid = false;
-                    break;
-                }
-            }
-        }
-        if ($cache) {
-            // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc
-            if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0
-                && (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ]))
-            ) {
-                $is_valid = false;
-            }
-            $tpl->cached->cache_lifetime = $properties[ 'cache_lifetime' ];
-            $tpl->cached->valid = $is_valid;
-            $resource = $tpl->cached;
-        } else {
-            $tpl->mustCompile = !$is_valid;
-            $resource = $tpl->compiled;
-            $resource->includes = isset($properties[ 'includes' ]) ? $properties[ 'includes' ] : array();
-        }
-        if ($is_valid) {
-            $resource->unifunc = $properties[ 'unifunc' ];
-            $resource->has_nocache_code = $properties[ 'has_nocache_code' ];
-            //            $tpl->compiled->nocache_hash = $properties['nocache_hash'];
-            $resource->file_dependency = $properties[ 'file_dependency' ];
-        }
-        return $is_valid && !function_exists($properties[ 'unifunc' ]);
-    }
-
-    /**
-     * Compiles the template
-     * If the template is not evaluated the compiled template is saved on disk
-     *
-     * @throws \Exception
-     */
-    public function compileTemplateSource()
-    {
-        return $this->compiled->compileTemplateSource($this);
-    }
-
-    /**
-     * Writes the content to cache resource
-     *
-     * @param string $content
-     *
-     * @return bool
-     */
-    public function writeCachedContent($content)
-    {
-        return $this->smarty->ext->_updateCache->writeCachedContent($this, $content);
-    }
-
-    /**
-     * Get unique template id
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function _getTemplateId()
-    {
-        return isset($this->templateId) ? $this->templateId : $this->templateId =
-            $this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id);
-    }
-
-    /**
-     * runtime error not matching capture tags
-     *
-     * @throws \SmartyException
-     */
-    public function capture_error()
-    {
-        throw new SmartyException("Not matching {capture} open/close in '{$this->template_resource}'");
-    }
-
-    /**
-     * Load compiled object
-     *
-     * @param bool $force force new compiled object
-     */
-    public function loadCompiled($force = false)
-    {
-        if ($force || !isset($this->compiled)) {
-            $this->compiled = Smarty_Template_Compiled::load($this);
-        }
-    }
-
-    /**
-     * Load cached object
-     *
-     * @param bool $force force new cached object
-     */
-    public function loadCached($force = false)
-    {
-        if ($force || !isset($this->cached)) {
-            $this->cached = Smarty_Template_Cached::load($this);
-        }
-    }
-
-    /**
-     * Load inheritance object
-     */
-    public function _loadInheritance()
-    {
-        if (!isset($this->inheritance)) {
-            $this->inheritance = new Smarty_Internal_Runtime_Inheritance();
-        }
-    }
-
-    /**
-     * Unload inheritance object
-     */
-    public function _cleanUp()
-    {
-        $this->startRenderCallbacks = array();
-        $this->endRenderCallbacks = array();
-        $this->inheritance = null;
-    }
-
-    /**
-     * Load compiler object
-     *
-     * @throws \SmartyException
-     */
-    public function loadCompiler()
-    {
-        if (!class_exists($this->source->compiler_class)) {
-            $this->smarty->loadPlugin($this->source->compiler_class);
-        }
-        $this->compiler =
-            new $this->source->compiler_class(
-                $this->source->template_lexer_class,
-                $this->source->template_parser_class,
-                $this->smarty
-            );
-    }
-
-    /**
-     * Handle unknown class methods
-     *
-     * @param string $name unknown method-name
-     * @param array  $args argument array
-     *
-     * @return mixed
-     */
-    public function __call($name, $args)
-    {
-        // method of Smarty object?
-        if (method_exists($this->smarty, $name)) {
-            return call_user_func_array(array($this->smarty, $name), $args);
-        }
-        // parent
-        return parent::__call($name, $args);
-    }
-
-    /**
-     * get Smarty property in template context
-     *
-     * @param string $property_name property name
-     *
-     * @return mixed|Smarty_Template_Cached
-     * @throws SmartyException
-     */
-    public function __get($property_name)
-    {
-        switch ($property_name) {
-            case 'compiled':
-                $this->loadCompiled();
-                return $this->compiled;
-            case 'cached':
-                $this->loadCached();
-                return $this->cached;
-            case 'compiler':
-                $this->loadCompiler();
-                return $this->compiler;
-            default:
-                // Smarty property ?
-                if (property_exists($this->smarty, $property_name)) {
-                    return $this->smarty->$property_name;
-                }
-        }
-        throw new SmartyException("template property '$property_name' does not exist.");
-    }
-
-    /**
-     * set Smarty property in template context
-     *
-     * @param string $property_name property name
-     * @param mixed  $value         value
-     *
-     * @throws SmartyException
-     */
-    public function __set($property_name, $value)
-    {
-        switch ($property_name) {
-            case 'compiled':
-            case 'cached':
-            case 'compiler':
-                $this->$property_name = $value;
-                return;
-            default:
-                // Smarty property ?
-                if (property_exists($this->smarty, $property_name)) {
-                    $this->smarty->$property_name = $value;
-                    return;
-                }
-        }
-        throw new SmartyException("invalid template property '$property_name'.");
-    }
-
-    /**
-     * Template data object destructor
-     */
-    public function __destruct()
-    {
-        if ($this->smarty->cache_locking && isset($this->cached) && $this->cached->is_locked) {
-            $this->cached->handler->releaseLock($this->smarty, $this->cached);
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_templatebase.php b/libraries/Smarty/libs/sysplugins/smarty_internal_templatebase.php
deleted file mode 100644
index 200c11bb5..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_templatebase.php
+++ /dev/null
@@ -1,386 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Smarty Template  Base
- * This file contains the basic shared methods for template handling
- *
- * @package    Smarty
- * @subpackage Template
- * @author     Uwe Tews
- */
-
-/**
- * Class with shared smarty/template methods
- *
- * @package    Smarty
- * @subpackage Template
- *
- * @property int $_objType
- *
- * The following methods will be dynamically loaded by the extension handler when they are called.
- * They are located in a corresponding Smarty_Internal_Method_xxxx class
- *
- * @method Smarty_Internal_TemplateBase addAutoloadFilters(mixed $filters, string $type = null)
- * @method Smarty_Internal_TemplateBase addDefaultModifiers(mixed $modifiers)
- * @method Smarty_Internal_TemplateBase addLiterals(mixed $literals)
- * @method Smarty_Internal_TemplateBase createData(Smarty_Internal_Data $parent = null, string $name = null)
- * @method array getAutoloadFilters(string $type = null)
- * @method string getDebugTemplate()
- * @method array getDefaultModifier()
- * @method array getLiterals()
- * @method array getTags(mixed $template = null)
- * @method object getRegisteredObject(string $object_name)
- * @method Smarty_Internal_TemplateBase registerCacheResource(string $name, Smarty_CacheResource $resource_handler)
- * @method Smarty_Internal_TemplateBase registerClass(string $class_name, string $class_impl)
- * @method Smarty_Internal_TemplateBase registerDefaultConfigHandler(callback $callback)
- * @method Smarty_Internal_TemplateBase registerDefaultPluginHandler(callback $callback)
- * @method Smarty_Internal_TemplateBase registerDefaultTemplateHandler(callback $callback)
- * @method Smarty_Internal_TemplateBase registerResource(string $name, mixed $resource_handler)
- * @method Smarty_Internal_TemplateBase setAutoloadFilters(mixed $filters, string $type = null)
- * @method Smarty_Internal_TemplateBase setDebugTemplate(string $tpl_name)
- * @method Smarty_Internal_TemplateBase setDefaultModifiers(mixed $modifiers)
- * @method Smarty_Internal_TemplateBase setLiterals(mixed $literals)
- * @method Smarty_Internal_TemplateBase unloadFilter(string $type, string $name)
- * @method Smarty_Internal_TemplateBase unregisterCacheResource(string $name)
- * @method Smarty_Internal_TemplateBase unregisterObject(string $object_name)
- * @method Smarty_Internal_TemplateBase unregisterPlugin(string $type, string $name)
- * @method Smarty_Internal_TemplateBase unregisterFilter(string $type, mixed $callback)
- * @method Smarty_Internal_TemplateBase unregisterResource(string $name)
- */
-abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
-{
-    /**
-     * Set this if you want different sets of cache files for the same
-     * templates.
-     *
-     * @var string
-     */
-    public $cache_id = null;
-
-    /**
-     * Set this if you want different sets of compiled files for the same
-     * templates.
-     *
-     * @var string
-     */
-    public $compile_id = null;
-
-    /**
-     * caching enabled
-     *
-     * @var int
-     */
-    public $caching = Smarty::CACHING_OFF;
-
-    /**
-     * check template for modifications?
-     *
-     * @var int
-     */
-    public $compile_check = Smarty::COMPILECHECK_ON;
-
-    /**
-     * cache lifetime in seconds
-     *
-     * @var integer
-     */
-    public $cache_lifetime = 3600;
-
-    /**
-     * Array of source information for known template functions
-     *
-     * @var array
-     */
-    public $tplFunctions = array();
-
-    /**
-     * universal cache
-     *
-     * @var array()
-     */
-    public $_cache = array();
-
-    /**
-     * fetches a rendered Smarty template
-     *
-     * @param string $template   the resource handle of the template file or template object
-     * @param mixed  $cache_id   cache id to be used with this template
-     * @param mixed  $compile_id compile id to be used with this template
-     * @param object $parent     next higher level of Smarty variables
-     *
-     * @throws Exception
-     * @throws SmartyException
-     * @return string rendered template output
-     */
-    public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null)
-    {
-        $result = $this->_execute($template, $cache_id, $compile_id, $parent, 0);
-        return $result === null ? ob_get_clean() : $result;
-    }
-
-    /**
-     * displays a Smarty template
-     *
-     * @param string $template   the resource handle of the template file or template object
-     * @param mixed  $cache_id   cache id to be used with this template
-     * @param mixed  $compile_id compile id to be used with this template
-     * @param object $parent     next higher level of Smarty variables
-     *
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
-    {
-        // display template
-        $this->_execute($template, $cache_id, $compile_id, $parent, 1);
-    }
-
-    /**
-     * test if cache is valid
-     *
-     * @api  Smarty::isCached()
-     * @link http://www.smarty.net/docs/en/api.is.cached.tpl
-     *
-     * @param null|string|\Smarty_Internal_Template $template   the resource handle of the template file or template
-     *                                                          object
-     * @param mixed                                 $cache_id   cache id to be used with this template
-     * @param mixed                                 $compile_id compile id to be used with this template
-     * @param object                                $parent     next higher level of Smarty variables
-     *
-     * @return bool cache status
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
-    {
-        return $this->_execute($template, $cache_id, $compile_id, $parent, 2);
-    }
-
-    /**
-     * fetches a rendered Smarty template
-     *
-     * @param string $template   the resource handle of the template file or template object
-     * @param mixed  $cache_id   cache id to be used with this template
-     * @param mixed  $compile_id compile id to be used with this template
-     * @param object $parent     next higher level of Smarty variables
-     * @param string $function   function type 0 = fetch,  1 = display, 2 = isCache
-     *
-     * @return mixed
-     * @throws \Exception
-     * @throws \SmartyException
-     */
-    private function _execute($template, $cache_id, $compile_id, $parent, $function)
-    {
-        $smarty = $this->_getSmartyObj();
-        $saveVars = true;
-        if ($template === null) {
-            if (!$this->_isTplObj()) {
-                throw new SmartyException($function . '():Missing \'$template\' parameter');
-            } else {
-                $template = $this;
-            }
-        } elseif (is_object($template)) {
-            /* @var Smarty_Internal_Template $template */
-            if (!isset($template->_objType) || !$template->_isTplObj()) {
-                throw new SmartyException($function . '():Template object expected');
-            }
-        } else {
-            // get template object
-            $saveVars = false;
-            $template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false);
-            if ($this->_objType === 1) {
-                // set caching in template object
-                $template->caching = $this->caching;
-            }
-        }
-        // make sure we have integer values
-        $template->caching = (int)$template->caching;
-        // fetch template content
-        $level = ob_get_level();
-        try {
-            $_smarty_old_error_level =
-                isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) : null;
-            if ($this->_objType === 2) {
-                /* @var Smarty_Internal_Template $this */
-                $template->tplFunctions = $this->tplFunctions;
-                $template->inheritance = $this->inheritance;
-            }
-            /* @var Smarty_Internal_Template $parent */
-            if (isset($parent->_objType) && ($parent->_objType === 2) && !empty($parent->tplFunctions)) {
-                $template->tplFunctions = array_merge($parent->tplFunctions, $template->tplFunctions);
-            }
-            if ($function === 2) {
-                if ($template->caching) {
-                    // return cache status of template
-                    if (!isset($template->cached)) {
-                        $template->loadCached();
-                    }
-                    $result = $template->cached->isCached($template);
-                    Smarty_Internal_Template::$isCacheTplObj[ $template->_getTemplateId() ] = $template;
-                } else {
-                    return false;
-                }
-            } else {
-                if ($saveVars) {
-                    $savedTplVars = $template->tpl_vars;
-                    $savedConfigVars = $template->config_vars;
-                }
-                ob_start();
-                $template->_mergeVars();
-                if (!empty(Smarty::$global_tpl_vars)) {
-                    $template->tpl_vars = array_merge(Smarty::$global_tpl_vars, $template->tpl_vars);
-                }
-                $result = $template->render(false, $function);
-                $template->_cleanUp();
-                if ($saveVars) {
-                    $template->tpl_vars = $savedTplVars;
-                    $template->config_vars = $savedConfigVars;
-                } else {
-                    if (!$function && !isset(Smarty_Internal_Template::$tplObjCache[ $template->templateId ])) {
-                        $template->parent = null;
-                        $template->tpl_vars = $template->config_vars = array();
-                        Smarty_Internal_Template::$tplObjCache[ $template->templateId ] = $template;
-                    }
-                }
-            }
-            if (isset($_smarty_old_error_level)) {
-                error_reporting($_smarty_old_error_level);
-            }
-            return $result;
-        } catch (Exception $e) {
-            while (ob_get_level() > $level) {
-                ob_end_clean();
-            }
-            if (isset($_smarty_old_error_level)) {
-                error_reporting($_smarty_old_error_level);
-            }
-            throw $e;
-        }
-    }
-
-    /**
-     * Registers plugin to be used in templates
-     *
-     * @api  Smarty::registerPlugin()
-     * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
-     *
-     * @param string   $type       plugin type
-     * @param string   $name       name of template tag
-     * @param callable $callback   PHP callback to register
-     * @param bool     $cacheable  if true (default) this function is cache able
-     * @param mixed    $cache_attr caching attributes if any
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null)
-    {
-        return $this->ext->registerPlugin->registerPlugin($this, $type, $name, $callback, $cacheable, $cache_attr);
-    }
-
-    /**
-     * load a filter of specified type and name
-     *
-     * @api  Smarty::loadFilter()
-     * @link http://www.smarty.net/docs/en/api.load.filter.tpl
-     *
-     * @param string $type filter type
-     * @param string $name filter name
-     *
-     * @return bool
-     * @throws \SmartyException
-     */
-    public function loadFilter($type, $name)
-    {
-        return $this->ext->loadFilter->loadFilter($this, $type, $name);
-    }
-
-    /**
-     * Registers a filter function
-     *
-     * @api  Smarty::registerFilter()
-     * @link http://www.smarty.net/docs/en/api.register.filter.tpl
-     *
-     * @param string      $type filter type
-     * @param callable    $callback
-     * @param string|null $name optional filter name
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function registerFilter($type, $callback, $name = null)
-    {
-        return $this->ext->registerFilter->registerFilter($this, $type, $callback, $name);
-    }
-
-    /**
-     * Registers object to be used in templates
-     *
-     * @api  Smarty::registerObject()
-     * @link http://www.smarty.net/docs/en/api.register.object.tpl
-     *
-     * @param string $object_name
-     * @param object $object                     the referenced PHP object to register
-     * @param array  $allowed_methods_properties list of allowed methods (empty = all)
-     * @param bool   $format                     smarty argument format, else traditional
-     * @param array  $block_methods              list of block-methods
-     *
-     * @return \Smarty|\Smarty_Internal_Template
-     * @throws \SmartyException
-     */
-    public function registerObject(
-        $object_name,
-        $object,
-        $allowed_methods_properties = array(),
-        $format = true,
-        $block_methods = array()
-    ) {
-        return $this->ext->registerObject->registerObject(
-            $this,
-            $object_name,
-            $object,
-            $allowed_methods_properties,
-            $format,
-            $block_methods
-        );
-    }
-
-    /**
-     * @param int $compile_check
-     */
-    public function setCompileCheck($compile_check)
-    {
-        $this->compile_check = (int)$compile_check;
-    }
-
-    /**
-     * @param int $caching
-     */
-    public function setCaching($caching)
-    {
-        $this->caching = (int)$caching;
-    }
-
-    /**
-     * @param int $cache_lifetime
-     */
-    public function setCacheLifetime($cache_lifetime)
-    {
-        $this->cache_lifetime = $cache_lifetime;
-    }
-
-    /**
-     * @param string $compile_id
-     */
-    public function setCompileId($compile_id)
-    {
-        $this->compile_id = $compile_id;
-    }
-
-    /**
-     * @param string $cache_id
-     */
-    public function setCacheId($cache_id)
-    {
-        $this->cache_id = $cache_id;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libraries/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
deleted file mode 100644
index 3cc957dec..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
+++ /dev/null
@@ -1,1760 +0,0 @@
-<?php
-/**
- * Smarty Internal Plugin Smarty Template Compiler Base
- * This file contains the basic classes and methods for compiling Smarty templates with lexer/parser
- *
- * @package    Smarty
- * @subpackage Compiler
- * @author     Uwe Tews
- */
-
-/**
- * Main abstract compiler class
- *
- * @package    Smarty
- * @subpackage Compiler
- *
- * @property Smarty_Internal_SmartyTemplateCompiler $prefixCompiledCode  = ''
- * @property Smarty_Internal_SmartyTemplateCompiler $postfixCompiledCode = ''
- * @method   registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false)
- * @method   unregisterPostCompileCallback($key)
- */
-abstract class Smarty_Internal_TemplateCompilerBase
-{
-    /**
-     * compile tag objects cache
-     *
-     * @var array
-     */
-    public static $_tag_objects = array();
-
-    /**
-     * counter for prefix variable number
-     *
-     * @var int
-     */
-    public static $prefixVariableNumber = 0;
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * Parser object
-     *
-     * @var Smarty_Internal_Templateparser
-     */
-    public $parser = null;
-
-    /**
-     * hash for nocache sections
-     *
-     * @var mixed
-     */
-    public $nocache_hash = null;
-
-    /**
-     * suppress generation of nocache code
-     *
-     * @var bool
-     */
-    public $suppressNocacheProcessing = false;
-
-    /**
-     * caching enabled (copied from template object)
-     *
-     * @var int
-     */
-    public $caching = 0;
-
-    /**
-     * tag stack
-     *
-     * @var array
-     */
-    public $_tag_stack = array();
-
-    /**
-     * tag stack count
-     *
-     * @var array
-     */
-    public $_tag_stack_count = array();
-
-    /**
-     * Plugins used by template
-     *
-     * @var array
-     */
-    public $required_plugins = array('compiled' => array(), 'nocache' => array());
-
-    /**
-     * Required plugins stack
-     *
-     * @var array
-     */
-    public $required_plugins_stack = array();
-
-    /**
-     * current template
-     *
-     * @var Smarty_Internal_Template
-     */
-    public $template = null;
-
-    /**
-     * merged included sub template data
-     *
-     * @var array
-     */
-    public $mergedSubTemplatesData = array();
-
-    /**
-     * merged sub template code
-     *
-     * @var array
-     */
-    public $mergedSubTemplatesCode = array();
-
-    /**
-     * collected template properties during compilation
-     *
-     * @var array
-     */
-    public $templateProperties = array();
-
-    /**
-     * source line offset for error messages
-     *
-     * @var int
-     */
-    public $trace_line_offset = 0;
-
-    /**
-     * trace uid
-     *
-     * @var string
-     */
-    public $trace_uid = '';
-
-    /**
-     * trace file path
-     *
-     * @var string
-     */
-    public $trace_filepath = '';
-
-    /**
-     * stack for tracing file and line of nested {block} tags
-     *
-     * @var array
-     */
-    public $trace_stack = array();
-
-    /**
-     * plugins loaded by default plugin handler
-     *
-     * @var array
-     */
-    public $default_handler_plugins = array();
-
-    /**
-     * saved preprocessed modifier list
-     *
-     * @var mixed
-     */
-    public $default_modifier_list = null;
-
-    /**
-     * force compilation of complete template as nocache
-     *
-     * @var boolean
-     */
-    public $forceNocache = false;
-
-    /**
-     * flag if compiled template file shall we written
-     *
-     * @var bool
-     */
-    public $write_compiled_code = true;
-
-    /**
-     * Template functions
-     *
-     * @var array
-     */
-    public $tpl_function = array();
-
-    /**
-     * called sub functions from template function
-     *
-     * @var array
-     */
-    public $called_functions = array();
-
-    /**
-     * compiled template or block function code
-     *
-     * @var string
-     */
-    public $blockOrFunctionCode = '';
-
-    /**
-     * php_handling setting either from Smarty or security
-     *
-     * @var int
-     */
-    public $php_handling = 0;
-
-    /**
-     * flags for used modifier plugins
-     *
-     * @var array
-     */
-    public $modifier_plugins = array();
-
-    /**
-     * type of already compiled modifier
-     *
-     * @var array
-     */
-    public $known_modifier_type = array();
-
-    /**
-     * parent compiler object for merged subtemplates and template functions
-     *
-     * @var Smarty_Internal_TemplateCompilerBase
-     */
-    public $parent_compiler = null;
-
-    /**
-     * Flag true when compiling nocache section
-     *
-     * @var bool
-     */
-    public $nocache = false;
-
-    /**
-     * Flag true when tag is compiled as nocache
-     *
-     * @var bool
-     */
-    public $tag_nocache = false;
-
-    /**
-     * Compiled tag prefix code
-     *
-     * @var array
-     */
-    public $prefix_code = array();
-
-    /**
-     * used prefix variables by current compiled tag
-     *
-     * @var array
-     */
-    public $usedPrefixVariables = array();
-
-    /**
-     * Prefix code  stack
-     *
-     * @var array
-     */
-    public $prefixCodeStack = array();
-
-    /**
-     * Tag has compiled code
-     *
-     * @var bool
-     */
-    public $has_code = false;
-
-    /**
-     * A variable string was compiled
-     *
-     * @var bool
-     */
-    public $has_variable_string = false;
-
-    /**
-     * Stack for {setfilter} {/setfilter}
-     *
-     * @var array
-     */
-    public $variable_filter_stack = array();
-
-    /**
-     * variable filters for {setfilter} {/setfilter}
-     *
-     * @var array
-     */
-    public $variable_filters = array();
-
-    /**
-     * Nesting count of looping tags like {foreach}, {for}, {section}, {while}
-     *
-     * @var int
-     */
-    public $loopNesting = 0;
-
-    /**
-     * Strip preg pattern
-     *
-     * @var string
-     */
-    public $stripRegEx = '![\t ]*[\r\n]+[\t ]*!';
-
-    /**
-     * plugin search order
-     *
-     * @var array
-     */
-    public $plugin_search_order = array(
-        'function',
-        'block',
-        'compiler',
-        'class'
-    );
-
-    /**
-     * General storage area for tag compiler plugins
-     *
-     * @var array
-     */
-    public $_cache = array();
-
-    /**
-     * Lexer preg pattern for left delimiter
-     *
-     * @var string
-     */
-    private $ldelPreg = '[{]';
-
-    /**
-     * Lexer preg pattern for right delimiter
-     *
-     * @var string
-     */
-    private $rdelPreg = '[}]';
-
-    /**
-     * Length of right delimiter
-     *
-     * @var int
-     */
-    private $rdelLength = 0;
-
-    /**
-     * Length of left delimiter
-     *
-     * @var int
-     */
-    private $ldelLength = 0;
-
-    /**
-     * Lexer preg pattern for user literals
-     *
-     * @var string
-     */
-    private $literalPreg = '';
-
-    /**
-     * Initialize compiler
-     *
-     * @param Smarty $smarty global instance
-     */
-    public function __construct(Smarty $smarty)
-    {
-        $this->smarty = $smarty;
-        $this->nocache_hash = str_replace(
-            array(
-                '.',
-                ','
-            ),
-            '_',
-            uniqid(mt_rand(), true)
-        );
-    }
-
-    /**
-     * Method to compile a Smarty template
-     *
-     * @param Smarty_Internal_Template                  $template template object to compile
-     * @param bool                                      $nocache  true is shall be compiled in nocache mode
-     * @param null|Smarty_Internal_TemplateCompilerBase $parent_compiler
-     *
-     * @return bool true if compiling succeeded, false if it failed
-     * @throws \Exception
-     */
-    public function compileTemplate(
-        Smarty_Internal_Template $template,
-        $nocache = null,
-        Smarty_Internal_TemplateCompilerBase $parent_compiler = null
-    ) {
-        // get code frame of compiled template
-        $_compiled_code = $template->smarty->ext->_codeFrame->create(
-            $template,
-            $this->compileTemplateSource(
-                $template,
-                $nocache,
-                $parent_compiler
-            ),
-            $this->postFilter($this->blockOrFunctionCode) .
-            join('', $this->mergedSubTemplatesCode),
-            false,
-            $this
-        );
-        return $_compiled_code;
-    }
-
-    /**
-     * Compile template source and run optional post filter
-     *
-     * @param \Smarty_Internal_Template             $template
-     * @param null|bool                             $nocache flag if template must be compiled in nocache mode
-     * @param \Smarty_Internal_TemplateCompilerBase $parent_compiler
-     *
-     * @return string
-     * @throws \Exception
-     */
-    public function compileTemplateSource(
-        Smarty_Internal_Template $template,
-        $nocache = null,
-        Smarty_Internal_TemplateCompilerBase $parent_compiler = null
-    ) {
-        try {
-            // save template object in compiler class
-            $this->template = $template;
-            if (property_exists($this->template->smarty, 'plugin_search_order')) {
-                $this->plugin_search_order = $this->template->smarty->plugin_search_order;
-            }
-            if ($this->smarty->debugging) {
-                if (!isset($this->smarty->_debug)) {
-                    $this->smarty->_debug = new Smarty_Internal_Debug();
-                }
-                $this->smarty->_debug->start_compile($this->template);
-            }
-            if (isset($this->template->smarty->security_policy)) {
-                $this->php_handling = $this->template->smarty->security_policy->php_handling;
-            } else {
-                $this->php_handling = $this->template->smarty->php_handling;
-            }
-            $this->parent_compiler = $parent_compiler ? $parent_compiler : $this;
-            $nocache = isset($nocache) ? $nocache : false;
-            if (empty($template->compiled->nocache_hash)) {
-                $template->compiled->nocache_hash = $this->nocache_hash;
-            } else {
-                $this->nocache_hash = $template->compiled->nocache_hash;
-            }
-            $this->caching = $template->caching;
-            // flag for nocache sections
-            $this->nocache = $nocache;
-            $this->tag_nocache = false;
-            // reset has nocache code flag
-            $this->template->compiled->has_nocache_code = false;
-            $this->has_variable_string = false;
-            $this->prefix_code = array();
-            // add file dependency
-            if ($this->smarty->merge_compiled_includes || $this->template->source->handler->checkTimestamps()) {
-                $this->parent_compiler->template->compiled->file_dependency[ $this->template->source->uid ] =
-                    array(
-                        $this->template->source->filepath,
-                        $this->template->source->getTimeStamp(),
-                        $this->template->source->type,
-                    );
-            }
-            $this->smarty->_current_file = $this->template->source->filepath;
-            // get template source
-            if (!empty($this->template->source->components)) {
-                // we have array of inheritance templates by extends: resource
-                // generate corresponding source code sequence
-                $_content =
-                    Smarty_Internal_Compile_Extends::extendsSourceArrayCode($this->template);
-            } else {
-                // get template source
-                $_content = $this->template->source->getContent();
-            }
-            $_compiled_code = $this->postFilter($this->doCompile($this->preFilter($_content), true));
-            if (!empty($this->required_plugins[ 'compiled' ]) || !empty($this->required_plugins[ 'nocache' ])) {
-                $_compiled_code = '<?php ' . $this->compileRequiredPlugins() . "?>\n" . $_compiled_code;
-            }
-        } catch (Exception $e) {
-            if ($this->smarty->debugging) {
-                $this->smarty->_debug->end_compile($this->template);
-            }
-            $this->_tag_stack = array();
-            // free memory
-            $this->parent_compiler = null;
-            $this->template = null;
-            $this->parser = null;
-            throw $e;
-        }
-        if ($this->smarty->debugging) {
-            $this->smarty->_debug->end_compile($this->template);
-        }
-        $this->parent_compiler = null;
-        $this->parser = null;
-        return $_compiled_code;
-    }
-
-    /**
-     * Optionally process compiled code by post filter
-     *
-     * @param string $code compiled code
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function postFilter($code)
-    {
-        // run post filter if on code
-        if (!empty($code)
-            && (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ]))
-        ) {
-            return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template);
-        } else {
-            return $code;
-        }
-    }
-
-    /**
-     * Run optional prefilter
-     *
-     * @param string $_content template source
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function preFilter($_content)
-    {
-        // run pre filter if required
-        if ($_content !== ''
-            && ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ])))
-        ) {
-            return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template);
-        } else {
-            return $_content;
-        }
-    }
-
-    /**
-     * Compile Tag
-     * This is a call back from the lexer/parser
-     *
-     * Save current prefix code
-     * Compile tag
-     * Merge tag prefix code with saved one
-     * (required nested tags in attributes)
-     *
-     * @param string $tag       tag name
-     * @param array  $args      array with tag attributes
-     * @param array  $parameter array with compilation parameter
-     *
-     * @throws SmartyCompilerException
-     * @throws SmartyException
-     * @return string compiled code
-     */
-    public function compileTag($tag, $args, $parameter = array())
-    {
-        $this->prefixCodeStack[] = $this->prefix_code;
-        $this->prefix_code = array();
-        $result = $this->compileTag2($tag, $args, $parameter);
-        $this->prefix_code = array_merge($this->prefix_code, array_pop($this->prefixCodeStack));
-        return $result;
-    }
-
-    /**
-     * compile variable
-     *
-     * @param string $variable
-     *
-     * @return string
-     */
-    public function compileVariable($variable)
-    {
-        if (!strpos($variable, '(')) {
-            // not a variable variable
-            $var = trim($variable, '\'');
-            $this->tag_nocache = $this->tag_nocache |
-                                 $this->template->ext->getTemplateVars->_getVariable(
-                                     $this->template,
-                                     $var,
-                                     null,
-                                     true,
-                                     false
-                                 )->nocache;
-            // todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
-        }
-        return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
-    }
-
-    /**
-     * compile config variable
-     *
-     * @param string $variable
-     *
-     * @return string
-     */
-    public function compileConfigVariable($variable)
-    {
-        // return '$_smarty_tpl->config_vars[' . $variable . ']';
-        return '$_smarty_tpl->smarty->ext->configLoad->_getConfigVariable($_smarty_tpl, ' . $variable . ')';
-    }
-
-    /**
-     * compile PHP function call
-     *
-     * @param string $name
-     * @param array  $parameter
-     *
-     * @return string
-     * @throws \SmartyCompilerException
-     */
-    public function compilePHPFunctionCall($name, $parameter)
-    {
-        if (!$this->smarty->security_policy || $this->smarty->security_policy->isTrustedPhpFunction($name, $this)) {
-            if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0
-                || strcasecmp($name, 'array') === 0 || is_callable($name)
-            ) {
-                $func_name = strtolower($name);
-
-                if ($func_name === 'isset') {
-                    if (count($parameter) === 0) {
-                        $this->trigger_template_error('Illegal number of parameter in "isset()"');
-                    }
-
-	                $pa = array();
-	                foreach ($parameter as $p) {
-		                $pa[] = $this->syntaxMatchesVariable($p) ? 'isset(' . $p . ')' : '(' . $p . ' !== null )';
-	                }
-	                return '(' . implode(' && ', $pa) . ')';
-
-                } elseif (in_array(
-                    $func_name,
-                    array(
-                        'empty',
-                        'reset',
-                        'current',
-                        'end',
-                        'prev',
-                        'next'
-                    )
-                )
-                ) {
-                    if (count($parameter) !== 1) {
-                        $this->trigger_template_error("Illegal number of parameter in '{$func_name()}'");
-                    }
-                    if ($func_name === 'empty') {
-                        if (!$this->syntaxMatchesVariable($parameter[0]) && version_compare(PHP_VERSION, '5.5.0', '<')) {
-                            return '(' . $parameter[ 0 ] . ' === false )';
-                        } else {
-                            return $func_name . '(' .
-                                   str_replace("')->value", "',null,true,false)->value", $parameter[ 0 ]) . ')';
-                        }
-                    } else {
-                        return $func_name . '(' . $parameter[ 0 ] . ')';
-                    }
-                } else {
-                    return $name . '(' . implode(',', $parameter) . ')';
-                }
-            } else {
-                $this->trigger_template_error("unknown function '{$name}'");
-            }
-        }
-    }
-
-	/**
-	 * Determines whether the passed string represents a valid (PHP) variable.
-	 * This is important, because `isset()` only works on variables and `empty()` can only be passed
-	 * a variable prior to php5.5
-	 * @param $string
-	 * @return bool
-	 */
-	private function syntaxMatchesVariable($string) {
-    	static $regex_pattern = '/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*((->)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\[.*]*\])*$/';
-    	return 1 === preg_match($regex_pattern, trim($string));
-    }
-
-    /**
-     * This method is called from parser to process a text content section if strip is enabled
-     * - remove text from inheritance child templates as they may generate output
-     *
-     * @param string $text
-     *
-     * @return string
-     */
-    public function processText($text)
-    {
-
-        if (strpos($text, '<') === false) {
-        	return preg_replace($this->stripRegEx, '', $text);
-        }
-
-	    $store = array();
-	    $_store = 0;
-
-        // capture html elements not to be messed with
-        $_offset = 0;
-        if (preg_match_all(
-            '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
-            $text,
-            $matches,
-            PREG_OFFSET_CAPTURE | PREG_SET_ORDER
-        )
-        ) {
-            foreach ($matches as $match) {
-                $store[] = $match[ 0 ][ 0 ];
-                $_length = strlen($match[ 0 ][ 0 ]);
-                $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
-                $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);
-                $_offset += $_length - strlen($replace);
-                $_store++;
-            }
-        }
-        $expressions = array(// replace multiple spaces between tags by a single space
-                             '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s'                            => '\1 \2',
-                             // remove newline between tags
-                             '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s'                     => '\1\2',
-                             // remove multiple spaces between attributes (but not in attribute values!)
-                             '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
-                             '#>[\040\011]+$#Ss'                                                       => '> ',
-                             '#>[\040\011]*[\n]\s*$#Ss'                                                => '>',
-                             $this->stripRegEx                                                         => '',
-        );
-        $text = preg_replace(array_keys($expressions), array_values($expressions), $text);
-        $_offset = 0;
-        if (preg_match_all(
-            '#@!@SMARTY:([0-9]+):SMARTY@!@#is',
-            $text,
-            $matches,
-            PREG_OFFSET_CAPTURE | PREG_SET_ORDER
-        )
-        ) {
-            foreach ($matches as $match) {
-                $_length = strlen($match[ 0 ][ 0 ]);
-                $replace = $store[ $match[ 1 ][ 0 ] ];
-                $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);
-                $_offset += strlen($replace) - $_length;
-                $_store++;
-            }
-        }
-        return $text;
-    }
-
-    /**
-     * lazy loads internal compile plugin for tag and calls the compile method
-     * compile objects cached for reuse.
-     * class name format:  Smarty_Internal_Compile_TagName
-     * plugin filename format: Smarty_Internal_TagName.php
-     *
-     * @param string $tag    tag name
-     * @param array  $args   list of tag attributes
-     * @param mixed  $param1 optional parameter
-     * @param mixed  $param2 optional parameter
-     * @param mixed  $param3 optional parameter
-     *
-     * @return bool|string compiled code or false
-     * @throws \SmartyCompilerException
-     */
-    public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null)
-    {
-        /* @var Smarty_Internal_CompileBase $tagCompiler */
-        $tagCompiler = $this->getTagCompiler($tag);
-        // compile this tag
-        return $tagCompiler === false ? false : $tagCompiler->compile($args, $this, $param1, $param2, $param3);
-    }
-
-    /**
-     * lazy loads internal compile plugin for tag compile objects cached for reuse.
-     *
-     * class name format:  Smarty_Internal_Compile_TagName
-     * plugin filename format: Smarty_Internal_TagName.php
-     *
-     * @param string $tag tag name
-     *
-     * @return bool|\Smarty_Internal_CompileBase tag compiler object or false if not found
-     */
-    public function getTagCompiler($tag)
-    {
-        // re-use object if already exists
-        if (!isset(self::$_tag_objects[ $tag ])) {
-            // lazy load internal compiler plugin
-            $_tag = explode('_', $tag);
-            $_tag = array_map('ucfirst', $_tag);
-            $class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag);
-            if (class_exists($class_name)
-                && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))
-            ) {
-                self::$_tag_objects[ $tag ] = new $class_name;
-            } else {
-                self::$_tag_objects[ $tag ] = false;
-            }
-        }
-        return self::$_tag_objects[ $tag ];
-    }
-
-    /**
-     * Check for plugins and return function name
-     *
-     * @param        $plugin_name
-     * @param string $plugin_type type of plugin
-     *
-     * @return string call name of function
-     * @throws \SmartyException
-     */
-    public function getPlugin($plugin_name, $plugin_type)
-    {
-        $function = null;
-        if ($this->caching && ($this->nocache || $this->tag_nocache)) {
-            if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) {
-                $function =
-                    $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ];
-            } elseif (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) {
-                $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ] =
-                    $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ];
-                $function =
-                    $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ];
-            }
-        } else {
-            if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) {
-                $function =
-                    $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ];
-            } elseif (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) {
-                $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ] =
-                    $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ];
-                $function =
-                    $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ];
-            }
-        }
-        if (isset($function)) {
-            if ($plugin_type === 'modifier') {
-                $this->modifier_plugins[ $plugin_name ] = true;
-            }
-            return $function;
-        }
-        // loop through plugin dirs and find the plugin
-        $function = 'smarty_' . $plugin_type . '_' . $plugin_name;
-        $file = $this->smarty->loadPlugin($function, false);
-        if (is_string($file)) {
-            if ($this->caching && ($this->nocache || $this->tag_nocache)) {
-                $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'file' ] =
-                    $file;
-                $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ] =
-                    $function;
-            } else {
-                $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'file' ] =
-                    $file;
-                $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ] =
-                    $function;
-            }
-            if ($plugin_type === 'modifier') {
-                $this->modifier_plugins[ $plugin_name ] = true;
-            }
-            return $function;
-        }
-        if (is_callable($function)) {
-            // plugin function is defined in the script
-            return $function;
-        }
-        return false;
-    }
-
-    /**
-     * Check for plugins by default plugin handler
-     *
-     * @param string $tag         name of tag
-     * @param string $plugin_type type of plugin
-     *
-     * @return bool true if found
-     * @throws \SmartyCompilerException
-     */
-    public function getPluginFromDefaultHandler($tag, $plugin_type)
-    {
-        $callback = null;
-        $script = null;
-        $cacheable = true;
-        $result = call_user_func_array(
-            $this->smarty->default_plugin_handler_func,
-            array(
-                $tag,
-                $plugin_type,
-                $this->template,
-                &$callback,
-                &$script,
-                &$cacheable,
-            )
-        );
-        if ($result) {
-            $this->tag_nocache = $this->tag_nocache || !$cacheable;
-            if ($script !== null) {
-                if (is_file($script)) {
-                    if ($this->caching && ($this->nocache || $this->tag_nocache)) {
-                        $this->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'file' ] =
-                            $script;
-                        $this->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'function' ] =
-                            $callback;
-                    } else {
-                        $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'file' ] =
-                            $script;
-                        $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] =
-                            $callback;
-                    }
-                    include_once $script;
-                } else {
-                    $this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found");
-                }
-            }
-            if (is_callable($callback)) {
-                $this->default_handler_plugins[ $plugin_type ][ $tag ] = array(
-                    $callback,
-                    true,
-                    array()
-                );
-                return true;
-            } else {
-                $this->trigger_template_error("Default plugin handler: Returned callback for '{$tag}' not callable");
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Append code segments and remove unneeded ?> <?php transitions
-     *
-     * @param string $left
-     * @param string $right
-     *
-     * @return string
-     */
-    public function appendCode($left, $right)
-    {
-        if (preg_match('/\s*\?>\s?$/D', $left) && preg_match('/^<\?php\s+/', $right)) {
-            $left = preg_replace('/\s*\?>\s?$/D', "\n", $left);
-            $left .= preg_replace('/^<\?php\s+/', '', $right);
-        } else {
-            $left .= $right;
-        }
-        return $left;
-    }
-
-    /**
-     * Inject inline code for nocache template sections
-     * This method gets the content of each template element from the parser.
-     * If the content is compiled code and it should be not cached the code is injected
-     * into the rendered output.
-     *
-     * @param string  $content content of template element
-     * @param boolean $is_code true if content is compiled code
-     *
-     * @return string  content
-     */
-    public function processNocacheCode($content, $is_code)
-    {
-        // If the template is not evaluated and we have a nocache section and or a nocache tag
-        if ($is_code && !empty($content)) {
-            // generate replacement code
-            if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching
-                && !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache)
-            ) {
-                $this->template->compiled->has_nocache_code = true;
-                $_output = addcslashes($content, '\'\\');
-                $_output = str_replace('^#^', '\'', $_output);
-                $_output =
-                    "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n";
-                // make sure we include modifier plugins for nocache code
-                foreach ($this->modifier_plugins as $plugin_name => $dummy) {
-                    if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ])) {
-                        $this->required_plugins[ 'nocache' ][ $plugin_name ][ 'modifier' ] =
-                            $this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ];
-                    }
-                }
-            } else {
-                $_output = $content;
-            }
-        } else {
-            $_output = $content;
-        }
-        $this->modifier_plugins = array();
-        $this->suppressNocacheProcessing = false;
-        $this->tag_nocache = false;
-        return $_output;
-    }
-
-    /**
-     * Get Id
-     *
-     * @param string $input
-     *
-     * @return bool|string
-     */
-    public function getId($input)
-    {
-        if (preg_match('~^([\'"]*)([0-9]*[a-zA-Z_]\w*)\1$~', $input, $match)) {
-            return $match[ 2 ];
-        }
-        return false;
-    }
-
-    /**
-     * Get variable name from string
-     *
-     * @param string $input
-     *
-     * @return bool|string
-     */
-    public function getVariableName($input)
-    {
-        if (preg_match('~^[$]_smarty_tpl->tpl_vars\[[\'"]*([0-9]*[a-zA-Z_]\w*)[\'"]*\]->value$~', $input, $match)) {
-            return $match[ 1 ];
-        }
-        return false;
-    }
-
-    /**
-     * Set nocache flag in variable or create new variable
-     *
-     * @param string $varName
-     */
-    public function setNocacheInVariable($varName)
-    {
-        // create nocache var to make it know for further compiling
-        if ($_var = $this->getId($varName)) {
-            if (isset($this->template->tpl_vars[ $_var ])) {
-                $this->template->tpl_vars[ $_var ] = clone $this->template->tpl_vars[ $_var ];
-                $this->template->tpl_vars[ $_var ]->nocache = true;
-            } else {
-                $this->template->tpl_vars[ $_var ] = new Smarty_Variable(null, true);
-            }
-        }
-    }
-
-    /**
-     * @param array $_attr tag attributes
-     * @param array $validScopes
-     *
-     * @return int|string
-     * @throws \SmartyCompilerException
-     */
-    public function convertScope($_attr, $validScopes)
-    {
-        $_scope = 0;
-        if (isset($_attr[ 'scope' ])) {
-            $_scopeName = trim($_attr[ 'scope' ], '\'"');
-            if (is_numeric($_scopeName) && in_array($_scopeName, $validScopes)) {
-                $_scope = $_scopeName;
-            } elseif (is_string($_scopeName)) {
-                $_scopeName = trim($_scopeName, '\'"');
-                $_scope = isset($validScopes[ $_scopeName ]) ? $validScopes[ $_scopeName ] : false;
-            } else {
-                $_scope = false;
-            }
-            if ($_scope === false) {
-                $err = var_export($_scopeName, true);
-                $this->trigger_template_error("illegal value '{$err}' for \"scope\" attribute", null, true);
-            }
-        }
-        return $_scope;
-    }
-
-    /**
-     * Generate nocache code string
-     *
-     * @param string $code PHP code
-     *
-     * @return string
-     */
-    public function makeNocacheCode($code)
-    {
-        return "echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/<?php " .
-               str_replace('^#^', '\'', addcslashes($code, '\'\\')) .
-               "?>/*/%%SmartyNocache:{$this->nocache_hash}%%*/';\n";
-    }
-
-    /**
-     * display compiler error messages without dying
-     * If parameter $args is empty it is a parser detected syntax error.
-     * In this case the parser is called to obtain information about expected tokens.
-     * If parameter $args contains a string this is used as error message
-     *
-     * @param string    $args    individual error message or null
-     * @param string    $line    line-number
-     * @param null|bool $tagline if true the line number of last tag
-     *
-     * @throws \SmartyCompilerException when an unexpected token is found
-     */
-    public function trigger_template_error($args = null, $line = null, $tagline = null)
-    {
-        $lex = $this->parser->lex;
-        if ($tagline === true) {
-            // get line number of Tag
-            $line = $lex->taglineno;
-        } elseif (!isset($line)) {
-            // get template source line which has error
-            $line = $lex->line;
-        } else {
-            $line = (int)$line;
-        }
-        if (in_array(
-            $this->template->source->type,
-            array(
-                'eval',
-                'string'
-            )
-        )
-        ) {
-            $templateName = $this->template->source->type . ':' . trim(
-                    preg_replace(
-                        '![\t\r\n]+!',
-                        ' ',
-                        strlen($lex->data) > 40 ?
-                            substr($lex->data, 0, 40) .
-                            '...' : $lex->data
-                    )
-                );
-        } else {
-            $templateName = $this->template->source->type . ':' . $this->template->source->filepath;
-        }
-        //        $line += $this->trace_line_offset;
-        $match = preg_split("/\n/", $lex->data);
-        $error_text =
-            'Syntax error in template "' . (empty($this->trace_filepath) ? $templateName : $this->trace_filepath) .
-            '"  on line ' . ($line + $this->trace_line_offset) . ' "' .
-            trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])) . '" ';
-        if (isset($args)) {
-            // individual error message
-            $error_text .= $args;
-        } else {
-            $expect = array();
-            // expected token from parser
-            $error_text .= ' - Unexpected "' . $lex->value . '"';
-            if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) {
-                foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
-                    $exp_token = $this->parser->yyTokenName[ $token ];
-                    if (isset($lex->smarty_token_names[ $exp_token ])) {
-                        // token type from lexer
-                        $expect[] = '"' . $lex->smarty_token_names[ $exp_token ] . '"';
-                    } else {
-                        // otherwise internal token name
-                        $expect[] = $this->parser->yyTokenName[ $token ];
-                    }
-                }
-                $error_text .= ', expected one of: ' . implode(' , ', $expect);
-            }
-        }
-        if ($this->smarty->_parserdebug) {
-            $this->parser->errorRunDown();
-            echo ob_get_clean();
-            flush();
-        }
-        $e = new SmartyCompilerException($error_text);
-        $e->line = $line;
-        $e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ]));
-        $e->desc = $args;
-        $e->template = $this->template->source->filepath;
-        throw $e;
-    }
-
-    /**
-     * Return var_export() value with all white spaces removed
-     *
-     * @param mixed $value
-     *
-     * @return string
-     */
-    public function getVarExport($value)
-    {
-        return preg_replace('/\s/', '', var_export($value, true));
-    }
-
-    /**
-     *  enter double quoted string
-     *  - save tag stack count
-     */
-    public function enterDoubleQuote()
-    {
-        array_push($this->_tag_stack_count, $this->getTagStackCount());
-    }
-
-    /**
-     * Return tag stack count
-     *
-     * @return int
-     */
-    public function getTagStackCount()
-    {
-        return count($this->_tag_stack);
-    }
-
-    /**
-     * @param $lexerPreg
-     *
-     * @return mixed
-     */
-    public function replaceDelimiter($lexerPreg)
-    {
-        return str_replace(
-            array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'),
-            array(
-                $this->ldelPreg, $this->literalPreg, $this->rdelPreg,
-                $this->smarty->getAutoLiteral() ? '{1,}' : '{9}',
-                $this->smarty->getAutoLiteral() ? '' : '\\s*'
-            ),
-            $lexerPreg
-        );
-    }
-
-    /**
-     * Build lexer regular expressions for left and right delimiter and user defined literals
-     */
-    public function initDelimiterPreg()
-    {
-        $ldel = $this->smarty->getLeftDelimiter();
-        $this->ldelLength = strlen($ldel);
-        $this->ldelPreg = '';
-        foreach (str_split($ldel, 1) as $chr) {
-            $this->ldelPreg .= '[' . preg_quote($chr,'/') . ']';
-        }
-        $rdel = $this->smarty->getRightDelimiter();
-        $this->rdelLength = strlen($rdel);
-        $this->rdelPreg = '';
-        foreach (str_split($rdel, 1) as $chr) {
-            $this->rdelPreg .= '[' . preg_quote($chr,'/') . ']';
-        }
-        $literals = $this->smarty->getLiterals();
-        if (!empty($literals)) {
-            foreach ($literals as $key => $literal) {
-                $literalPreg = '';
-                foreach (str_split($literal, 1) as $chr) {
-                    $literalPreg .= '[' . preg_quote($chr,'/') . ']';
-                }
-                $literals[ $key ] = $literalPreg;
-            }
-            $this->literalPreg = '|' . implode('|', $literals);
-        } else {
-            $this->literalPreg = '';
-        }
-    }
-
-    /**
-     *  leave double quoted string
-     *  - throw exception if block in string was not closed
-     *
-     * @throws \SmartyCompilerException
-     */
-    public function leaveDoubleQuote()
-    {
-        if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) {
-            $tag = $this->getOpenBlockTag();
-            $this->trigger_template_error(
-                "unclosed '{{$tag}}' in doubled quoted string",
-                null,
-                true
-            );
-        }
-    }
-
-    /**
-     * Get left delimiter preg
-     *
-     * @return string
-     */
-    public function getLdelPreg()
-    {
-        return $this->ldelPreg;
-    }
-
-    /**
-     * Get right delimiter preg
-     *
-     * @return string
-     */
-    public function getRdelPreg()
-    {
-        return $this->rdelPreg;
-    }
-
-    /**
-     * Get length of left delimiter
-     *
-     * @return int
-     */
-    public function getLdelLength()
-    {
-        return $this->ldelLength;
-    }
-
-    /**
-     * Get length of right delimiter
-     *
-     * @return int
-     */
-    public function getRdelLength()
-    {
-        return $this->rdelLength;
-    }
-
-    /**
-     * Get name of current open block tag
-     *
-     * @return string|boolean
-     */
-    public function getOpenBlockTag()
-    {
-        $tagCount = $this->getTagStackCount();
-        if ($tagCount) {
-            return $this->_tag_stack[ $tagCount - 1 ][ 0 ];
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * Check if $value contains variable elements
-     *
-     * @param mixed $value
-     *
-     * @return bool|int
-     */
-    public function isVariable($value)
-    {
-        if (is_string($value)) {
-            return preg_match('/[$(]/', $value);
-        }
-        if (is_bool($value) || is_numeric($value)) {
-            return false;
-        }
-        if (is_array($value)) {
-            foreach ($value as $k => $v) {
-                if ($this->isVariable($k) || $this->isVariable($v)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-        return false;
-    }
-
-    /**
-     * Get new prefix variable name
-     *
-     * @return string
-     */
-    public function getNewPrefixVariable()
-    {
-        ++self::$prefixVariableNumber;
-        return $this->getPrefixVariable();
-    }
-
-    /**
-     * Get current prefix variable name
-     *
-     * @return string
-     */
-    public function getPrefixVariable()
-    {
-        return '$_prefixVariable' . self::$prefixVariableNumber;
-    }
-
-    /**
-     * append  code to prefix buffer
-     *
-     * @param string $code
-     */
-    public function appendPrefixCode($code)
-    {
-        $this->prefix_code[] = $code;
-    }
-
-    /**
-     * get prefix code string
-     *
-     * @return string
-     */
-    public function getPrefixCode()
-    {
-        $code = '';
-        $prefixArray = array_merge($this->prefix_code, array_pop($this->prefixCodeStack));
-        $this->prefixCodeStack[] = array();
-        foreach ($prefixArray as $c) {
-            $code = $this->appendCode($code, $c);
-        }
-        $this->prefix_code = array();
-        return $code;
-    }
-
-    /**
-     * Save current required plugins
-     *
-     * @param bool $init if true init required plugins
-     */
-    public function saveRequiredPlugins($init = false)
-    {
-        $this->required_plugins_stack[] = $this->required_plugins;
-        if ($init) {
-            $this->required_plugins = array('compiled' => array(), 'nocache' => array());
-        }
-    }
-
-    /**
-     * Restore required plugins
-     */
-    public function restoreRequiredPlugins()
-    {
-        $this->required_plugins = array_pop($this->required_plugins_stack);
-    }
-
-    /**
-     * Compile code to call Smarty_Internal_Template::_checkPlugins()
-     * for required plugins
-     *
-     * @return string
-     */
-    public function compileRequiredPlugins()
-    {
-        $code = $this->compileCheckPlugins($this->required_plugins[ 'compiled' ]);
-        if ($this->caching && !empty($this->required_plugins[ 'nocache' ])) {
-            $code .= $this->makeNocacheCode($this->compileCheckPlugins($this->required_plugins[ 'nocache' ]));
-        }
-        return $code;
-    }
-
-    /**
-     * Compile code to call Smarty_Internal_Template::_checkPlugins
-     *   - checks if plugin is callable require otherwise
-     *
-     * @param $requiredPlugins
-     *
-     * @return string
-     */
-    public function compileCheckPlugins($requiredPlugins)
-    {
-        if (!empty($requiredPlugins)) {
-            $plugins = array();
-            foreach ($requiredPlugins as $plugin) {
-                foreach ($plugin as $data) {
-                    $plugins[] = $data;
-                }
-            }
-            return '$_smarty_tpl->_checkPlugins(' . $this->getVarExport($plugins) . ');' . "\n";
-        } else {
-            return '';
-        }
-    }
-
-    /**
-     * method to compile a Smarty template
-     *
-     * @param mixed $_content template source
-     * @param bool  $isTemplateSource
-     *
-     * @return bool true if compiling succeeded, false if it failed
-     */
-    abstract protected function doCompile($_content, $isTemplateSource = false);
-
-    /**
-     * Compile Tag
-     *
-     * @param string $tag       tag name
-     * @param array  $args      array with tag attributes
-     * @param array  $parameter array with compilation parameter
-     *
-     * @throws SmartyCompilerException
-     * @throws SmartyException
-     * @return string compiled code
-     */
-    private function compileTag2($tag, $args, $parameter)
-    {
-        $plugin_type = '';
-        // $args contains the attributes parsed and compiled by the lexer/parser
-        // assume that tag does compile into code, but creates no HTML output
-        $this->has_code = true;
-        // log tag/attributes
-        if (isset($this->smarty->_cache[ 'get_used_tags' ])) {
-            $this->template->_cache[ 'used_tags' ][] = array(
-                $tag,
-                $args
-            );
-        }
-        // check nocache option flag
-        foreach ($args as $arg) {
-            if (!is_array($arg)) {
-                if ($arg === "'nocache'" || $arg === 'nocache') {
-                    $this->tag_nocache = true;
-                }
-            } else {
-                foreach ($arg as $k => $v) {
-                    if (($k === "'nocache'" || $k === 'nocache') && (trim($v, "'\" ") === 'true')) {
-                        $this->tag_nocache = true;
-                    }
-                }
-            }
-        }
-        // compile the smarty tag (required compile classes to compile the tag are auto loaded)
-        if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {
-            if (isset($this->parent_compiler->tpl_function[ $tag ])
-                || (isset($this->template->smarty->ext->_tplFunction)
-                    && $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false)
-            ) {
-                // template defined by {template} tag
-                $args[ '_attr' ][ 'name' ] = "'{$tag}'";
-                $_output = $this->callTagCompiler('call', $args, $parameter);
-            }
-        }
-        if ($_output !== false) {
-            if ($_output !== true) {
-                // did we get compiled code
-                if ($this->has_code) {
-                    // return compiled code
-                    return $_output;
-                }
-            }
-            // tag did not produce compiled code
-            return null;
-        } else {
-            // map_named attributes
-            if (isset($args[ '_attr' ])) {
-                foreach ($args[ '_attr' ] as $key => $attribute) {
-                    if (is_array($attribute)) {
-                        $args = array_merge($args, $attribute);
-                    }
-                }
-            }
-            // not an internal compiler tag
-            if (strlen($tag) < 6 || substr($tag, -5) !== 'close') {
-                // check if tag is a registered object
-                if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) {
-                    $method = $parameter[ 'object_method' ];
-                    if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])
-                        && (empty($this->smarty->registered_objects[ $tag ][ 1 ])
-                            || in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ]))
-                    ) {
-                        return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method);
-                    } elseif (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) {
-                        return $this->callTagCompiler(
-                            'private_object_block_function',
-                            $args,
-                            $parameter,
-                            $tag,
-                            $method
-                        );
-                    } else {
-                        // throw exception
-                        $this->trigger_template_error(
-                            'not allowed method "' . $method . '" in registered object "' .
-                            $tag . '"',
-                            null,
-                            true
-                        );
-                    }
-                }
-                // check if tag is registered
-                foreach (array(
-                    Smarty::PLUGIN_COMPILER,
-                    Smarty::PLUGIN_FUNCTION,
-                    Smarty::PLUGIN_BLOCK,
-                ) as $plugin_type) {
-                    if (isset($this->smarty->registered_plugins[ $plugin_type ][ $tag ])) {
-                        // if compiler function plugin call it now
-                        if ($plugin_type === Smarty::PLUGIN_COMPILER) {
-                            $new_args = array();
-                            foreach ($args as $key => $mixed) {
-                                if (is_array($mixed)) {
-                                    $new_args = array_merge($new_args, $mixed);
-                                } else {
-                                    $new_args[ $key ] = $mixed;
-                                }
-                            }
-                            if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) {
-                                $this->tag_nocache = true;
-                            }
-                            return call_user_func_array(
-                                $this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ],
-                                array(
-                                    $new_args,
-                                    $this
-                                )
-                            );
-                        }
-                        // compile registered function or block function
-                        if ($plugin_type === Smarty::PLUGIN_FUNCTION || $plugin_type === Smarty::PLUGIN_BLOCK) {
-                            return $this->callTagCompiler(
-                                'private_registered_' . $plugin_type,
-                                $args,
-                                $parameter,
-                                $tag
-                            );
-                        }
-                    }
-                }
-                // check plugins from plugins folder
-                foreach ($this->plugin_search_order as $plugin_type) {
-                    if ($plugin_type === Smarty::PLUGIN_COMPILER
-                        && $this->smarty->loadPlugin('smarty_compiler_' . $tag)
-                        && (!isset($this->smarty->security_policy)
-                            || $this->smarty->security_policy->isTrustedTag($tag, $this))
-                    ) {
-                        $plugin = 'smarty_compiler_' . $tag;
-                        if (is_callable($plugin)) {
-                            // convert arguments format for old compiler plugins
-                            $new_args = array();
-                            foreach ($args as $key => $mixed) {
-                                if (is_array($mixed)) {
-                                    $new_args = array_merge($new_args, $mixed);
-                                } else {
-                                    $new_args[ $key ] = $mixed;
-                                }
-                            }
-                            return $plugin($new_args, $this->smarty);
-                        }
-                        if (class_exists($plugin, false)) {
-                            $plugin_object = new $plugin;
-                            if (method_exists($plugin_object, 'compile')) {
-                                return $plugin_object->compile($args, $this);
-                            }
-                        }
-                        throw new SmartyException("Plugin '{$tag}' not callable");
-                    } else {
-                        if ($function = $this->getPlugin($tag, $plugin_type)) {
-                            if (!isset($this->smarty->security_policy)
-                                || $this->smarty->security_policy->isTrustedTag($tag, $this)
-                            ) {
-                                return $this->callTagCompiler(
-                                    'private_' . $plugin_type . '_plugin',
-                                    $args,
-                                    $parameter,
-                                    $tag,
-                                    $function
-                                );
-                            }
-                        }
-                    }
-                }
-                if (is_callable($this->smarty->default_plugin_handler_func)) {
-                    $found = false;
-                    // look for already resolved tags
-                    foreach ($this->plugin_search_order as $plugin_type) {
-                        if (isset($this->default_handler_plugins[ $plugin_type ][ $tag ])) {
-                            $found = true;
-                            break;
-                        }
-                    }
-                    if (!$found) {
-                        // call default handler
-                        foreach ($this->plugin_search_order as $plugin_type) {
-                            if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) {
-                                $found = true;
-                                break;
-                            }
-                        }
-                    }
-                    if ($found) {
-                        // if compiler function plugin call it now
-                        if ($plugin_type === Smarty::PLUGIN_COMPILER) {
-                            $new_args = array();
-                            foreach ($args as $key => $mixed) {
-                                if (is_array($mixed)) {
-                                    $new_args = array_merge($new_args, $mixed);
-                                } else {
-                                    $new_args[ $key ] = $mixed;
-                                }
-                            }
-                            return call_user_func_array(
-                                $this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ],
-                                array(
-                                    $new_args,
-                                    $this
-                                )
-                            );
-                        } else {
-                            return $this->callTagCompiler(
-                                'private_registered_' . $plugin_type,
-                                $args,
-                                $parameter,
-                                $tag
-                            );
-                        }
-                    }
-                }
-            } else {
-                // compile closing tag of block function
-                $base_tag = substr($tag, 0, -5);
-                // check if closing tag is a registered object
-                if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) {
-                    $method = $parameter[ 'object_method' ];
-                    if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) {
-                        return $this->callTagCompiler(
-                            'private_object_block_function',
-                            $args,
-                            $parameter,
-                            $tag,
-                            $method
-                        );
-                    } else {
-                        // throw exception
-                        $this->trigger_template_error(
-                            'not allowed closing tag method "' . $method .
-                            '" in registered object "' . $base_tag . '"',
-                            null,
-                            true
-                        );
-                    }
-                }
-                // registered block tag ?
-                if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ])
-                    || isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ])
-                ) {
-                    return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);
-                }
-                // registered function tag ?
-                if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) {
-                    return $this->callTagCompiler('private_registered_function', $args, $parameter, $tag);
-                }
-                // block plugin?
-                if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {
-                    return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);
-                }
-                // function plugin?
-                if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) {
-                    if (!isset($this->smarty->security_policy)
-                        || $this->smarty->security_policy->isTrustedTag($tag, $this)
-                    ) {
-                        return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function);
-                    }
-                }
-                // registered compiler plugin ?
-                if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ])) {
-                    // if compiler function plugin call it now
-                    $args = array();
-                    if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) {
-                        $this->tag_nocache = true;
-                    }
-                    return call_user_func_array(
-                        $this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ],
-                        array(
-                            $args,
-                            $this
-                        )
-                    );
-                }
-                if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
-                    $plugin = 'smarty_compiler_' . $tag;
-                    if (is_callable($plugin)) {
-                        return $plugin($args, $this->smarty);
-                    }
-                    if (class_exists($plugin, false)) {
-                        $plugin_object = new $plugin;
-                        if (method_exists($plugin_object, 'compile')) {
-                            return $plugin_object->compile($args, $this);
-                        }
-                    }
-                    throw new SmartyException("Plugin '{$tag}' not callable");
-                }
-            }
-            $this->trigger_template_error("unknown tag '{$tag}'", null, true);
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_templatelexer.php b/libraries/Smarty/libs/sysplugins/smarty_internal_templatelexer.php
deleted file mode 100644
index 867a31d26..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_templatelexer.php
+++ /dev/null
@@ -1,1095 +0,0 @@
-<?php
-/*
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Smarty_Internal_Templatelexer
- * This is the template file lexer.
- * It is generated from the smarty_internal_templatelexer.plex file
- *
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Templatelexer
-{
-    const TEXT               = 1;
-    const TAG                = 2;
-    const TAGBODY            = 3;
-    const LITERAL            = 4;
-    const DOUBLEQUOTEDSTRING = 5;
-
-    /**
-     * Source
-     *
-     * @var string
-     */
-    public $data;
-
-    /**
-     * Source length
-     *
-     * @var int
-     */
-    public $dataLength = null;
-
-    /**
-     * byte counter
-     *
-     * @var int
-     */
-    public $counter;
-
-    /**
-     * token number
-     *
-     * @var int
-     */
-    public $token;
-
-    /**
-     * token value
-     *
-     * @var string
-     */
-    public $value;
-
-    /**
-     * current line
-     *
-     * @var int
-     */
-    public $line;
-
-    /**
-     * tag start line
-     *
-     * @var
-     */
-    public $taglineno;
-
-    /**
-     * php code type
-     *
-     * @var string
-     */
-    public $phpType = '';
-
-    /**
-     * state number
-     *
-     * @var int
-     */
-    public $state = 1;
-
-    /**
-     * Smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_TemplateCompilerBase
-     */
-    public $compiler = null;
-
-    /**
-     * trace file
-     *
-     * @var resource
-     */
-    public $yyTraceFILE;
-
-    /**
-     * trace prompt
-     *
-     * @var string
-     */
-    public $yyTracePrompt;
-
-    /**
-     * XML flag true while processing xml
-     *
-     * @var bool
-     */
-    public $is_xml = false;
-
-    /**
-     * state names
-     *
-     * @var array
-     */
-    public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
-
-    /**
-     * token names
-     *
-     * @var array
-     */
-    public $smarty_token_names = array(        // Text for parser error messages
-                                               'NOT'         => '(!,not)',
-                                               'OPENP'       => '(',
-                                               'CLOSEP'      => ')',
-                                               'OPENB'       => '[',
-                                               'CLOSEB'      => ']',
-                                               'PTR'         => '->',
-                                               'APTR'        => '=>',
-                                               'EQUAL'       => '=',
-                                               'NUMBER'      => 'number',
-                                               'UNIMATH'     => '+" , "-',
-                                               'MATH'        => '*" , "/" , "%',
-                                               'INCDEC'      => '++" , "--',
-                                               'SPACE'       => ' ',
-                                               'DOLLAR'      => '$',
-                                               'SEMICOLON'   => ';',
-                                               'COLON'       => ':',
-                                               'DOUBLECOLON' => '::',
-                                               'AT'          => '@',
-                                               'HATCH'       => '#',
-                                               'QUOTE'       => '"',
-                                               'BACKTICK'    => '`',
-                                               'VERT'        => '"|" modifier',
-                                               'DOT'         => '.',
-                                               'COMMA'       => '","',
-                                               'QMARK'       => '"?"',
-                                               'ID'          => 'id, name',
-                                               'TEXT'        => 'text',
-                                               'LDELSLASH'   => '{/..} closing tag',
-                                               'LDEL'        => '{...} Smarty tag',
-                                               'COMMENT'     => 'comment',
-                                               'AS'          => 'as',
-                                               'TO'          => 'to',
-                                               'PHP'         => '"<?php", "<%", "{php}" tag',
-                                               'LOGOP'       => '"<", "==" ... logical operator',
-                                               'TLOGOP'      => '"lt", "eq" ... logical operator; "is div by" ... if condition',
-                                               'SCOND'       => '"is even" ... if condition',
-    );
-
-    /**
-     * literal tag nesting level
-     *
-     * @var int
-     */
-    private $literal_cnt = 0;
-
-    /**
-     * preg token pattern for state TEXT
-     *
-     * @var string
-     */
-    private $yy_global_pattern1 = null;
-
-    /**
-     * preg token pattern for state TAG
-     *
-     * @var string
-     */
-    private $yy_global_pattern2 = null;
-
-    /**
-     * preg token pattern for state TAGBODY
-     *
-     * @var string
-     */
-    private $yy_global_pattern3 = null;
-
-    /**
-     * preg token pattern for state LITERAL
-     *
-     * @var string
-     */
-    private $yy_global_pattern4 = null;
-
-    /**
-     * preg token pattern for state DOUBLEQUOTEDSTRING
-     *
-     * @var null
-     */
-    private $yy_global_pattern5 = null;
-
-    /**
-     * preg token pattern for text
-     *
-     * @var null
-     */
-    private $yy_global_text = null;
-
-    /**
-     * preg token pattern for literal
-     *
-     * @var null
-     */
-    private $yy_global_literal = null;
-
-    private $_yy_state         = 1;
-
-    private $_yy_stack         = array();
-
-    /**
-     * constructor
-     *
-     * @param   string                             $source template source
-     * @param Smarty_Internal_TemplateCompilerBase $compiler
-     */
-    public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->data = $source;
-        $this->dataLength = strlen($this->data);
-        $this->counter = 0;
-        if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
-            $this->counter += strlen($match[ 0 ]);
-        }
-        $this->line = 1;
-        $this->smarty = $compiler->template->smarty;
-        $this->compiler = $compiler;
-        $this->compiler->initDelimiterPreg();
-        $this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter();
-        $this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter();
-    }
-
-    /**
-     * open lexer/parser trace file
-     *
-     */
-    public function PrintTrace()
-    {
-        $this->yyTraceFILE = fopen('php://output', 'w');
-        $this->yyTracePrompt = '<br>';
-    }
-
-    /**
-     * replace placeholders with runtime preg  code
-     *
-     * @param string $preg
-     *
-     * @return string
-     */
-    public function replace($preg)
-    {
-        return $this->compiler->replaceDelimiter($preg);
-    }
-
-    /**
-     * check if current value is an autoliteral left delimiter
-     *
-     * @return bool
-     */
-    public function isAutoLiteral()
-    {
-        return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
-            strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
-    } // end function
-
-    public function yylex()
-    {
-        return $this->{'yylex' . $this->_yy_state}();
-    }
-
-    public function yypushstate($state)
-    {
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
-        }
-        array_push($this->_yy_stack, $this->_yy_state);
-        $this->_yy_state = $state;
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
-        }
-    }
-
-    public function yypopstate()
-    {
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
-        }
-        $this->_yy_state = array_pop($this->_yy_stack);
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
-        }
-    }
-
-    public function yybegin($state)
-    {
-        $this->_yy_state = $state;
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
-                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
-        }
-    }
-
-    public function yylex1()
-    {
-        if (!isset($this->yy_global_pattern1)) {
-            $this->yy_global_pattern1 =
-                $this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G([\S\s])/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr($this->data,
-                            $this->counter, 5) . '... state TEXT');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r1_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line ' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r1_1()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r1_2()
-    {
-        $to = $this->dataLength;
-        preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE,
-            $this->counter);
-        if (isset($match[ 0 ][ 1 ])) {
-            $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
-        } else {
-            $this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
-        }
-        $this->value = substr($this->data, $this->counter, $to - $this->counter);
-        return false;
-    }
-
-    public function yy_r1_4()
-    {
-        $this->compiler->getTagCompiler('private_php')->parsePhp($this);
-    }
-
-    public function yy_r1_8()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r1_10()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
-        $this->yypushstate(self::LITERAL);
-    }
-
-    public function yy_r1_12()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
-        $this->yypushstate(self::LITERAL);
-    } // end function
-
-    public function yy_r1_14()
-    {
-        $this->yypushstate(self::TAG);
-        return true;
-    }
-
-    public function yy_r1_16()
-    {
-        $this->compiler->getTagCompiler('private_php')->parsePhp($this);
-    }
-
-    public function yy_r1_19()
-    {
-        if (!isset($this->yy_global_text)) {
-            $this->yy_global_text =
-                $this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
-        }
-        $to = $this->dataLength;
-        preg_match($this->yy_global_text, $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
-        if (isset($match[ 0 ][ 1 ])) {
-            $to = $match[ 0 ][ 1 ];
-        }
-        $this->value = substr($this->data, $this->counter, $to - $this->counter);
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yylex2()
-    {
-        if (!isset($this->yy_global_pattern2)) {
-            $this->yy_global_pattern2 =
-                $this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr($this->data,
-                            $this->counter, 5) . '... state TAG');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r2_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line ' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r2_1()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_4()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_6()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_8()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_10()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_12()
-    {
-        $this->yypopstate();
-        $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_15()
-    {
-        $this->yypopstate();
-        $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_18()
-    {
-        $this->yypopstate();
-        $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_20()
-    {
-        if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
-            $this->yypopstate();
-            $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
-            $this->taglineno = $this->line;
-        } else {
-            $this->value = $this->smarty->getLeftDelimiter();
-            $this->token = Smarty_Internal_Templateparser::TP_LDEL;
-            $this->yybegin(self::TAGBODY);
-            $this->taglineno = $this->line;
-        }
-    } // end function
-
-    public function yy_r2_23()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r2_25()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDEL;
-        $this->yybegin(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yylex3()
-    {
-        if (!isset($this->yy_global_pattern3)) {
-            $this->yy_global_pattern3 =
-                $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G(array\\s*[(]\\s*)|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr($this->data,
-                            $this->counter, 5) . '... state TAGBODY');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r3_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line ' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r3_1()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_RDEL;
-        $this->yypopstate();
-    }
-
-    public function yy_r3_2()
-    {
-        $this->yypushstate(self::TAG);
-        return true;
-    }
-
-    public function yy_r3_4()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
-        $this->yypushstate(self::DOUBLEQUOTEDSTRING);
-        $this->compiler->enterDoubleQuote();
-    }
-
-    public function yy_r3_5()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
-    }
-
-    public function yy_r3_6()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
-    }
-
-    public function yy_r3_7()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
-    }
-
-    public function yy_r3_8()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_ISIN;
-    }
-
-    public function yy_r3_9()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_AS;
-    }
-
-    public function yy_r3_10()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TO;
-    }
-
-    public function yy_r3_11()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_STEP;
-    }
-
-    public function yy_r3_12()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
-    }
-
-    public function yy_r3_13()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
-    }
-
-    public function yy_r3_15()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
-    }
-
-    public function yy_r3_17()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
-    }
-
-    public function yy_r3_20()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
-    }
-
-    public function yy_r3_23()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_NOT;
-    }
-
-    public function yy_r3_24()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
-    }
-
-    public function yy_r3_28()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_OPENP;
-    }
-
-    public function yy_r3_29()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
-    }
-
-    public function yy_r3_30()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_OPENB;
-    }
-
-    public function yy_r3_31()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
-    }
-
-    public function yy_r3_32()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_PTR;
-    }
-
-    public function yy_r3_33()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_APTR;
-    }
-
-    public function yy_r3_34()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
-    }
-
-    public function yy_r3_35()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
-    }
-
-    public function yy_r3_37()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
-    }
-
-    public function yy_r3_39()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_MATH;
-    }
-
-    public function yy_r3_41()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_AT;
-    }
-
-    public function yy_r3_42()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
-    }
-
-    public function yy_r3_43()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_HATCH;
-    }
-
-    public function yy_r3_44()
-    {
-        // resolve conflicts with shorttag and right_delimiter starting with '='
-        if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
-            $this->smarty->getRightDelimiter()) {
-            preg_match('/\s+/', $this->value, $match);
-            $this->value = $match[ 0 ];
-            $this->token = Smarty_Internal_Templateparser::TP_SPACE;
-        } else {
-            $this->token = Smarty_Internal_Templateparser::TP_ATTR;
-        }
-    }
-
-    public function yy_r3_45()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
-    }
-
-    public function yy_r3_48()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_ID;
-    }
-
-    public function yy_r3_49()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
-    }
-
-    public function yy_r3_50()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
-        $this->yypopstate();
-    }
-
-    public function yy_r3_51()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_VERT;
-    }
-
-    public function yy_r3_52()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_DOT;
-    }
-
-    public function yy_r3_53()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_COMMA;
-    }
-
-    public function yy_r3_54()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
-    }
-
-    public function yy_r3_55()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
-    }
-
-    public function yy_r3_56()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_COLON;
-    }
-
-    public function yy_r3_57()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_QMARK;
-    }
-
-    public function yy_r3_58()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_HEX;
-    }
-
-    public function yy_r3_59()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_SPACE;
-    } // end function
-
-    public function yy_r3_60()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yylex4()
-    {
-        if (!isset($this->yy_global_pattern4)) {
-            $this->yy_global_pattern4 =
-                $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G([\S\s])/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr($this->data,
-                            $this->counter, 5) . '... state LITERAL');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r4_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line ' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r4_1()
-    {
-        $this->literal_cnt++;
-        $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
-    }
-
-    public function yy_r4_3()
-    {
-        if ($this->literal_cnt) {
-            $this->literal_cnt--;
-            $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
-        } else {
-            $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
-            $this->yypopstate();
-        }
-    }
-
-    public function yy_r4_5()
-    {
-        if (!isset($this->yy_global_literal)) {
-            $this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
-        }
-        $to = $this->dataLength;
-        preg_match($this->yy_global_literal, $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
-        if (isset($match[ 0 ][ 1 ])) {
-            $to = $match[ 0 ][ 1 ];
-        } else {
-            $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
-        }
-        $this->value = substr($this->data, $this->counter, $to - $this->counter);
-        $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
-    } // end function
-
-    public function yylex5()
-    {
-        if (!isset($this->yy_global_pattern5)) {
-            $this->yy_global_pattern5 =
-                $this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))|\G([\S\s])/isS");
-        }
-        if (!isset($this->dataLength)) {
-            $this->dataLength = strlen($this->data);
-        }
-        if ($this->counter >= $this->dataLength) {
-            return false; // end of input
-        }
-        do {
-            if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
-                if (!isset($yymatches[ 0 ][ 1 ])) {
-                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
-                } else {
-                    $yymatches = array_filter($yymatches);
-                }
-                if (empty($yymatches)) {
-                    throw new Exception('Error: lexing failed because a rule matched' .
-                                        ' an empty string.  Input "' . substr($this->data,
-                            $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
-                }
-                next($yymatches); // skip global match
-                $this->token = key($yymatches); // token number
-                $this->value = current($yymatches); // token value
-                $r = $this->{'yy_r5_' . $this->token}();
-                if ($r === null) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    // accept this token
-                    return true;
-                } elseif ($r === true) {
-                    // we have changed state
-                    // process this token in the new state
-                    return $this->yylex();
-                } elseif ($r === false) {
-                    $this->counter += strlen($this->value);
-                    $this->line += substr_count($this->value, "\n");
-                    if ($this->counter >= $this->dataLength) {
-                        return false; // end of input
-                    }
-                    // skip this token
-                    continue;
-                }
-            } else {
-                throw new Exception('Unexpected input at line ' . $this->line .
-                                    ': ' . $this->data[ $this->counter ]);
-            }
-            break;
-        } while (true);
-    }
-
-    public function yy_r5_1()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r5_3()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r5_5()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r5_7()
-    {
-        $this->yypushstate(self::TAG);
-        return true;
-    }
-
-    public function yy_r5_9()
-    {
-        $this->yypushstate(self::TAG);
-        return true;
-    }
-
-    public function yy_r5_11()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_LDEL;
-        $this->taglineno = $this->line;
-        $this->yypushstate(self::TAGBODY);
-    }
-
-    public function yy_r5_13()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
-        $this->yypopstate();
-    }
-
-    public function yy_r5_14()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
-        $this->value = substr($this->value, 0, -1);
-        $this->yypushstate(self::TAGBODY);
-        $this->taglineno = $this->line;
-    }
-
-    public function yy_r5_15()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
-    }
-
-    public function yy_r5_16()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r5_17()
-    {
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-
-    public function yy_r5_22()
-    {
-        $to = $this->dataLength;
-        $this->value = substr($this->data, $this->counter, $to - $this->counter);
-        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
-    }
-}
-
-     
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_templateparser.php b/libraries/Smarty/libs/sysplugins/smarty_internal_templateparser.php
deleted file mode 100644
index aaeae63b7..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_templateparser.php
+++ /dev/null
@@ -1,3623 +0,0 @@
-<?php
-
-class TP_yyStackEntry
-{
-    public $stateno;       /* The state-number */
-    public $major;         /* The major token value.  This is the code
-                     ** number for the token at this stack level */
-    public $minor; /* The user-supplied minor token value.  This
-                     ** is the value of the token  */
-}
-
-// line 11 "../smarty/lexer/smarty_internal_templateparser.y"
-
-/**
- * Smarty Template Parser Class
- *
- * This is the template parser.
- * It is generated from the smarty_internal_templateparser.y file
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
-class Smarty_Internal_Templateparser
-{
-    // line 23 "../smarty/lexer/smarty_internal_templateparser.y"
-    const ERR1                      = 'Security error: Call to private object member not allowed';
-    const ERR2                      = 'Security error: Call to dynamic object member not allowed';
-    const ERR3                      = 'PHP in template not allowed. Use SmartyBC to enable it';
-    const TP_VERT                   = 1;
-    const TP_COLON                  = 2;
-    const TP_PHP                    = 3;
-    const TP_TEXT                   = 4;
-    const TP_STRIPON                = 5;
-    const TP_STRIPOFF               = 6;
-    const TP_LITERALSTART           = 7;
-    const TP_LITERALEND             = 8;
-    const TP_LITERAL                = 9;
-    const TP_SIMPELOUTPUT           = 10;
-    const TP_SIMPLETAG              = 11;
-    const TP_SMARTYBLOCKCHILDPARENT = 12;
-    const TP_LDEL                   = 13;
-    const TP_RDEL                   = 14;
-    const TP_DOLLARID               = 15;
-    const TP_EQUAL                  = 16;
-    const TP_ID                     = 17;
-    const TP_PTR                    = 18;
-    const TP_LDELMAKENOCACHE        = 19;
-    const TP_LDELIF                 = 20;
-    const TP_LDELFOR                = 21;
-    const TP_SEMICOLON              = 22;
-    const TP_INCDEC                 = 23;
-    const TP_TO                     = 24;
-    const TP_STEP                   = 25;
-    const TP_LDELFOREACH            = 26;
-    const TP_SPACE                  = 27;
-    const TP_AS                     = 28;
-    const TP_APTR                   = 29;
-    const TP_LDELSETFILTER          = 30;
-    const TP_CLOSETAG               = 31;
-    const TP_LDELSLASH              = 32;
-    const TP_ATTR                   = 33;
-    const TP_INTEGER                = 34;
-    const TP_COMMA                  = 35;
-    const TP_OPENP                  = 36;
-    const TP_CLOSEP                 = 37;
-    const TP_MATH                   = 38;
-    const TP_UNIMATH                = 39;
-    const TP_ISIN                   = 40;
-    const TP_QMARK                  = 41;
-    const TP_NOT                    = 42;
-    const TP_TYPECAST               = 43;
-    const TP_HEX                    = 44;
-    const TP_DOT                    = 45;
-    const TP_INSTANCEOF             = 46;
-    const TP_SINGLEQUOTESTRING      = 47;
-    const TP_DOUBLECOLON            = 48;
-    const TP_NAMESPACE              = 49;
-    const TP_AT                     = 50;
-    const TP_HATCH                  = 51;
-    const TP_OPENB                  = 52;
-    const TP_CLOSEB                 = 53;
-    const TP_DOLLAR                 = 54;
-    const TP_LOGOP                  = 55;
-    const TP_SLOGOP                 = 56;
-    const TP_TLOGOP                 = 57;
-    const TP_SINGLECOND             = 58;
-    const TP_ARRAYOPEN              = 59;
-    const TP_QUOTE                  = 60;
-    const TP_BACKTICK               = 61;
-    const YY_NO_ACTION              = 516;
-    const YY_ACCEPT_ACTION          = 515;
-    const YY_ERROR_ACTION           = 514;
-    const YY_SZ_ACTTAB              = 2071;
-    const YY_SHIFT_USE_DFLT         = -31;
-    const YY_SHIFT_MAX              = 230;
-    const YY_REDUCE_USE_DFLT        = -91;
-    const YY_REDUCE_MAX             = 178;
-    const YYNOCODE                  = 110;
-    const YYSTACKDEPTH              = 500;
-    const YYNSTATE                  = 327;
-    const YYNRULE                   = 187;
-    const YYERRORSYMBOL             = 62;
-    const YYERRSYMDT                = 'yy0';
-    const YYFALLBACK                = 0;
-
-    public static $yy_action        = array(
-        251, 234, 237, 1, 144, 127, 428, 184, 199, 212,
-        10, 54, 19, 175, 282, 215, 109, 389, 428, 428,
-        224, 321, 223, 303, 203, 389, 13, 389, 281, 43,
-        389, 428, 41, 40, 266, 225, 389, 213, 389, 194,
-        389, 52, 4, 308, 301, 383, 34, 209, 222, 3,
-        50, 153, 251, 234, 237, 1, 199, 131, 383, 198,
-        305, 212, 10, 54, 383, 16, 199, 428, 109, 385,
-        132, 18, 224, 321, 223, 222, 221, 12, 32, 428,
-        116, 43, 385, 262, 41, 40, 266, 225, 385, 233,
-        95, 194, 16, 52, 4, 131, 301, 252, 18, 265,
-        164, 3, 50, 324, 251, 234, 237, 1, 23, 130,
-        229, 198, 150, 212, 10, 54, 326, 11, 170, 284,
-        109, 42, 22, 239, 224, 321, 223, 193, 221, 261,
-        13, 52, 157, 43, 301, 286, 41, 40, 266, 225,
-        205, 233, 5, 194, 96, 52, 4, 263, 301, 301,
-        99, 349, 96, 3, 50, 199, 251, 234, 237, 1,
-        238, 130, 241, 181, 349, 212, 10, 54, 382, 240,
-        349, 36, 109, 185, 104, 256, 224, 321, 223, 132,
-        191, 382, 13, 49, 91, 43, 12, 382, 41, 40,
-        266, 225, 257, 233, 152, 194, 457, 52, 4, 457,
-        301, 301, 228, 457, 282, 3, 50, 285, 251, 234,
-        237, 1, 301, 131, 441, 198, 238, 212, 10, 54,
-        349, 441, 325, 175, 109, 30, 349, 273, 224, 321,
-        223, 20, 221, 295, 32, 211, 457, 39, 166, 49,
-        41, 40, 266, 225, 87, 233, 205, 194, 279, 52,
-        4, 24, 301, 204, 200, 280, 99, 3, 50, 199,
-        251, 234, 237, 1, 31, 130, 96, 198, 205, 212,
-        10, 54, 350, 55, 293, 207, 109, 283, 99, 96,
-        224, 321, 223, 199, 180, 350, 13, 134, 230, 43,
-        222, 350, 41, 40, 266, 225, 104, 233, 316, 194,
-        279, 52, 4, 24, 301, 165, 284, 280, 85, 3,
-        50, 25, 251, 234, 237, 1, 131, 129, 210, 198,
-        14, 212, 10, 54, 269, 270, 301, 116, 109, 295,
-        216, 211, 224, 321, 223, 171, 221, 95, 13, 28,
-        219, 43, 323, 9, 41, 40, 266, 225, 151, 233,
-        324, 194, 52, 52, 4, 301, 301, 30, 282, 302,
-        178, 3, 50, 7, 251, 234, 237, 1, 136, 130,
-        304, 179, 238, 212, 10, 54, 279, 175, 282, 24,
-        109, 238, 429, 280, 224, 321, 223, 177, 221, 270,
-        13, 255, 281, 43, 429, 49, 41, 40, 266, 225,
-        275, 233, 318, 194, 49, 52, 4, 276, 301, 163,
-        26, 199, 8, 3, 50, 119, 251, 234, 237, 1,
-        11, 93, 291, 51, 107, 212, 10, 54, 226, 428,
-        206, 201, 109, 148, 178, 322, 224, 321, 223, 441,
-        221, 428, 13, 282, 9, 43, 441, 115, 41, 40,
-        266, 225, 167, 233, 227, 194, 457, 52, 4, 457,
-        301, 96, 158, 457, 101, 3, 50, 271, 251, 234,
-        237, 1, 282, 130, 235, 186, 135, 212, 10, 54,
-        199, 37, 119, 315, 109, 165, 284, 176, 224, 321,
-        223, 104, 221, 149, 13, 281, 146, 43, 281, 300,
-        41, 40, 266, 225, 30, 233, 289, 194, 21, 52,
-        4, 272, 301, 211, 18, 301, 161, 3, 50, 110,
-        251, 234, 237, 1, 137, 128, 282, 198, 268, 212,
-        10, 54, 222, 169, 515, 92, 109, 172, 284, 31,
-        224, 321, 223, 29, 221, 238, 6, 260, 53, 43,
-        232, 139, 41, 40, 266, 225, 154, 233, 178, 194,
-        168, 52, 4, 214, 301, 145, 99, 33, 49, 3,
-        50, 245, 208, 211, 320, 282, 90, 111, 311, 183,
-        98, 70, 309, 297, 236, 178, 95, 319, 142, 258,
-        247, 267, 249, 264, 250, 195, 231, 199, 246, 324,
-        317, 253, 254, 259, 126, 137, 133, 251, 234, 237,
-        1, 326, 290, 105, 143, 156, 212, 10, 54, 88,
-        84, 83, 484, 109, 322, 282, 37, 224, 321, 223,
-        245, 208, 211, 320, 281, 90, 111, 298, 182, 98,
-        56, 245, 298, 211, 178, 95, 103, 147, 258, 197,
-        102, 75, 141, 250, 195, 231, 95, 246, 324, 258,
-        279, 242, 89, 24, 250, 195, 231, 280, 246, 324,
-        298, 298, 298, 298, 298, 298, 298, 16, 298, 192,
-        277, 298, 298, 18, 294, 44, 45, 38, 298, 298,
-        251, 234, 237, 2, 298, 296, 298, 298, 298, 212,
-        10, 54, 310, 312, 313, 314, 109, 162, 298, 298,
-        224, 321, 223, 298, 298, 298, 294, 282, 298, 42,
-        22, 239, 251, 234, 237, 2, 298, 296, 298, 298,
-        298, 212, 10, 54, 298, 159, 298, 298, 109, 298,
-        298, 17, 224, 321, 223, 282, 298, 42, 22, 239,
-        298, 298, 245, 298, 211, 278, 298, 103, 111, 298,
-        183, 98, 70, 298, 298, 298, 298, 95, 298, 298,
-        258, 298, 292, 17, 298, 250, 195, 231, 279, 246,
-        324, 24, 298, 395, 245, 280, 211, 298, 298, 103,
-        298, 298, 197, 102, 75, 16, 298, 140, 298, 95,
-        298, 18, 258, 298, 298, 298, 298, 250, 195, 231,
-        298, 246, 324, 298, 298, 298, 298, 428, 298, 395,
-        395, 395, 202, 277, 298, 245, 298, 211, 298, 428,
-        103, 298, 298, 197, 120, 69, 395, 395, 395, 395,
-        95, 298, 298, 258, 298, 298, 298, 160, 250, 195,
-        231, 86, 246, 324, 245, 16, 211, 282, 298, 103,
-        196, 18, 197, 120, 69, 298, 44, 45, 38, 95,
-        298, 298, 258, 298, 298, 298, 178, 250, 195, 231,
-        298, 246, 324, 310, 312, 313, 314, 298, 298, 190,
-        245, 298, 211, 298, 298, 103, 298, 298, 197, 102,
-        75, 298, 298, 298, 298, 95, 298, 298, 258, 298,
-        298, 298, 298, 250, 195, 231, 298, 246, 324, 298,
-        298, 298, 245, 298, 211, 298, 199, 100, 298, 288,
-        197, 120, 47, 298, 106, 298, 298, 95, 298, 353,
-        258, 155, 298, 218, 298, 250, 195, 231, 298, 246,
-        324, 282, 16, 42, 22, 239, 298, 245, 18, 211,
-        298, 428, 103, 298, 298, 197, 120, 69, 298, 298,
-        298, 298, 95, 428, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 100, 189, 298, 197, 120, 59, 245, 207, 211,
-        298, 95, 103, 298, 258, 197, 120, 81, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 120, 80, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 67, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 120, 57, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 120, 58, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 82, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 97, 76, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 120, 71, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 187, 120, 61, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 120, 63, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 94, 79, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 59, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 120, 77, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 188, 108, 64, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 65, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 97, 66, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 120, 68, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 62, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 120, 60, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 120, 74, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 72, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 120, 48, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 120, 46, 298, 298,
-        298, 298, 95, 298, 298, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 120, 78, 245, 298, 211,
-        298, 95, 103, 298, 258, 197, 120, 73, 298, 250,
-        195, 231, 95, 246, 324, 258, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 125, 298, 298, 298,
-        298, 298, 95, 298, 298, 298, 298, 298, 298, 244,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 114, 298, 245, 298, 211,
-        298, 95, 103, 298, 298, 197, 122, 298, 243, 250,
-        195, 231, 95, 246, 324, 298, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 117, 298, 298, 298,
-        298, 298, 95, 298, 298, 298, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 121, 298, 245, 298, 211,
-        298, 95, 103, 298, 298, 197, 124, 298, 298, 250,
-        195, 231, 95, 246, 324, 298, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 298, 245, 298, 211,
-        298, 298, 103, 298, 298, 197, 118, 298, 298, 298,
-        298, 298, 95, 298, 298, 298, 298, 298, 298, 298,
-        250, 195, 231, 298, 246, 324, 245, 298, 211, 298,
-        298, 103, 298, 298, 197, 123, 298, 245, 298, 211,
-        298, 95, 103, 298, 298, 197, 113, 298, 298, 250,
-        195, 231, 95, 246, 324, 298, 298, 298, 298, 298,
-        250, 195, 231, 220, 246, 324, 298, 27, 298, 16,
-        298, 457, 298, 298, 457, 18, 298, 26, 457, 441,
-        44, 45, 38, 217, 44, 45, 38, 298, 298, 298,
-        298, 298, 298, 298, 298, 298, 298, 310, 312, 313,
-        314, 310, 312, 313, 314, 298, 441, 298, 298, 441,
-        298, 457, 220, 441, 457, 298, 298, 457, 298, 298,
-        457, 457, 441, 457, 298, 298, 220, 457, 441, 298,
-        298, 298, 298, 298, 457, 298, 298, 457, 298, 298,
-        5, 457, 441, 298, 298, 298, 298, 298, 298, 441,
-        298, 298, 441, 298, 457, 441, 441, 298, 441, 298,
-        457, 298, 441, 306, 298, 298, 298, 298, 298, 441,
-        298, 298, 441, 298, 457, 220, 441, 298, 298, 298,
-        298, 298, 298, 457, 298, 298, 457, 298, 298, 15,
-        457, 441, 35, 274, 44, 45, 38, 457, 298, 298,
-        457, 298, 298, 298, 457, 441, 298, 298, 298, 298,
-        298, 310, 312, 313, 314, 298, 298, 298, 441, 298,
-        298, 441, 298, 457, 298, 441, 287, 298, 44, 45,
-        38, 298, 441, 298, 298, 441, 298, 457, 298, 441,
-        248, 298, 298, 298, 298, 310, 312, 313, 314, 298,
-        44, 45, 38, 298, 298, 112, 298, 44, 45, 38,
-        298, 173, 298, 298, 44, 45, 38, 310, 312, 313,
-        314, 44, 45, 38, 310, 312, 313, 314, 298, 298,
-        299, 310, 312, 313, 314, 44, 45, 38, 310, 312,
-        313, 314, 174, 298, 298, 298, 138, 298, 298, 298,
-        298, 298, 310, 312, 313, 314, 44, 45, 38, 298,
-        298, 298, 44, 45, 38, 298, 44, 45, 38, 298,
-        44, 45, 38, 310, 312, 313, 314, 307, 298, 310,
-        312, 313, 314, 310, 312, 313, 314, 310, 312, 313,
-        314,
-    );
-
-    public static $yy_lookahead     = array(
-        10, 11, 12, 13, 74, 15, 36, 17, 1, 19,
-        20, 21, 29, 103, 84, 45, 26, 14, 48, 36,
-        30, 31, 32, 53, 34, 22, 36, 24, 98, 39,
-        27, 48, 42, 43, 44, 45, 33, 47, 35, 49,
-        37, 51, 52, 53, 54, 14, 16, 16, 45, 59,
-        60, 96, 10, 11, 12, 13, 1, 15, 27, 17,
-        53, 19, 20, 21, 33, 27, 1, 36, 26, 14,
-        45, 33, 30, 31, 32, 45, 34, 52, 36, 48,
-        72, 39, 27, 75, 42, 43, 44, 45, 33, 47,
-        82, 49, 27, 51, 52, 15, 54, 17, 33, 91,
-        83, 59, 60, 95, 10, 11, 12, 13, 13, 15,
-        15, 17, 17, 19, 20, 21, 97, 35, 99, 100,
-        26, 86, 87, 88, 30, 31, 32, 66, 34, 49,
-        36, 51, 96, 39, 54, 53, 42, 43, 44, 45,
-        72, 47, 16, 49, 18, 51, 52, 79, 54, 54,
-        82, 14, 18, 59, 60, 1, 10, 11, 12, 13,
-        23, 15, 15, 17, 27, 19, 20, 21, 14, 17,
-        33, 13, 26, 15, 48, 17, 30, 31, 32, 45,
-        34, 27, 36, 46, 83, 39, 52, 33, 42, 43,
-        44, 45, 34, 47, 74, 49, 10, 51, 52, 13,
-        54, 54, 50, 17, 84, 59, 60, 14, 10, 11,
-        12, 13, 54, 15, 45, 17, 23, 19, 20, 21,
-        27, 52, 100, 103, 26, 35, 33, 37, 30, 31,
-        32, 22, 34, 67, 36, 69, 50, 39, 83, 46,
-        42, 43, 44, 45, 35, 47, 72, 49, 10, 51,
-        52, 13, 54, 79, 80, 17, 82, 59, 60, 1,
-        10, 11, 12, 13, 16, 15, 18, 17, 72, 19,
-        20, 21, 14, 107, 108, 79, 26, 71, 82, 18,
-        30, 31, 32, 1, 34, 27, 36, 15, 50, 39,
-        45, 33, 42, 43, 44, 45, 48, 47, 53, 49,
-        10, 51, 52, 13, 54, 99, 100, 17, 36, 59,
-        60, 29, 10, 11, 12, 13, 15, 15, 17, 17,
-        13, 19, 20, 21, 8, 9, 54, 72, 26, 67,
-        75, 69, 30, 31, 32, 78, 34, 82, 36, 24,
-        50, 39, 17, 36, 42, 43, 44, 45, 74, 47,
-        95, 49, 51, 51, 52, 54, 54, 35, 84, 37,
-        103, 59, 60, 36, 10, 11, 12, 13, 74, 15,
-        108, 17, 23, 19, 20, 21, 10, 103, 84, 13,
-        26, 23, 36, 17, 30, 31, 32, 7, 34, 9,
-        36, 17, 98, 39, 48, 46, 42, 43, 44, 45,
-        17, 47, 53, 49, 46, 51, 52, 93, 54, 78,
-        16, 1, 36, 59, 60, 101, 10, 11, 12, 13,
-        35, 15, 37, 17, 48, 19, 20, 21, 18, 36,
-        65, 66, 26, 74, 103, 104, 30, 31, 32, 45,
-        34, 48, 36, 84, 36, 39, 52, 17, 42, 43,
-        44, 45, 15, 47, 17, 49, 10, 51, 52, 13,
-        54, 18, 74, 17, 82, 59, 60, 34, 10, 11,
-        12, 13, 84, 15, 93, 17, 15, 19, 20, 21,
-        1, 2, 101, 101, 26, 99, 100, 17, 30, 31,
-        32, 48, 34, 96, 36, 98, 96, 39, 98, 71,
-        42, 43, 44, 45, 35, 47, 37, 49, 27, 51,
-        52, 67, 54, 69, 33, 54, 74, 59, 60, 17,
-        10, 11, 12, 13, 96, 15, 84, 17, 34, 19,
-        20, 21, 45, 78, 63, 64, 26, 99, 100, 16,
-        30, 31, 32, 16, 34, 23, 36, 17, 17, 39,
-        23, 51, 42, 43, 44, 45, 72, 47, 103, 49,
-        78, 51, 52, 17, 54, 74, 82, 41, 46, 59,
-        60, 67, 68, 69, 70, 84, 72, 73, 53, 75,
-        76, 77, 53, 61, 15, 103, 82, 14, 51, 85,
-        14, 37, 17, 8, 90, 91, 92, 1, 94, 95,
-        3, 4, 5, 6, 7, 96, 82, 10, 11, 12,
-        13, 97, 84, 81, 96, 74, 19, 20, 21, 78,
-        82, 82, 1, 26, 104, 84, 2, 30, 31, 32,
-        67, 68, 69, 70, 98, 72, 73, 109, 75, 76,
-        77, 67, 109, 69, 103, 82, 72, 96, 85, 75,
-        76, 77, 96, 90, 91, 92, 82, 94, 95, 85,
-        10, 14, 96, 13, 90, 91, 92, 17, 94, 95,
-        109, 109, 109, 109, 109, 109, 109, 27, 109, 105,
-        106, 109, 109, 33, 4, 38, 39, 40, 109, 109,
-        10, 11, 12, 13, 109, 15, 109, 109, 109, 19,
-        20, 21, 55, 56, 57, 58, 26, 74, 109, 109,
-        30, 31, 32, 109, 109, 109, 4, 84, 109, 86,
-        87, 88, 10, 11, 12, 13, 109, 15, 109, 109,
-        109, 19, 20, 21, 109, 74, 109, 109, 26, 109,
-        60, 61, 30, 31, 32, 84, 109, 86, 87, 88,
-        109, 109, 67, 109, 69, 70, 109, 72, 73, 109,
-        75, 76, 77, 109, 109, 109, 109, 82, 109, 109,
-        85, 109, 60, 61, 109, 90, 91, 92, 10, 94,
-        95, 13, 109, 2, 67, 17, 69, 109, 109, 72,
-        109, 109, 75, 76, 77, 27, 109, 29, 109, 82,
-        109, 33, 85, 109, 109, 109, 109, 90, 91, 92,
-        109, 94, 95, 109, 109, 109, 109, 36, 109, 38,
-        39, 40, 105, 106, 109, 67, 109, 69, 109, 48,
-        72, 109, 109, 75, 76, 77, 55, 56, 57, 58,
-        82, 109, 109, 85, 109, 109, 109, 74, 90, 91,
-        92, 78, 94, 95, 67, 27, 69, 84, 109, 72,
-        102, 33, 75, 76, 77, 109, 38, 39, 40, 82,
-        109, 109, 85, 109, 109, 109, 103, 90, 91, 92,
-        109, 94, 95, 55, 56, 57, 58, 109, 109, 102,
-        67, 109, 69, 109, 109, 72, 109, 109, 75, 76,
-        77, 109, 109, 109, 109, 82, 109, 109, 85, 109,
-        109, 109, 109, 90, 91, 92, 109, 94, 95, 109,
-        109, 109, 67, 109, 69, 109, 1, 72, 109, 106,
-        75, 76, 77, 109, 79, 109, 109, 82, 109, 14,
-        85, 74, 109, 18, 109, 90, 91, 92, 109, 94,
-        95, 84, 27, 86, 87, 88, 109, 67, 33, 69,
-        109, 36, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 48, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 102, 109, 75, 76, 77, 67, 79, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 77, 109, 109,
-        109, 109, 82, 109, 109, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 77, 67, 109, 69,
-        109, 82, 72, 109, 85, 75, 76, 77, 109, 90,
-        91, 92, 82, 94, 95, 85, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 109, 109, 109,
-        109, 109, 82, 109, 109, 109, 109, 109, 109, 89,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 109, 67, 109, 69,
-        109, 82, 72, 109, 109, 75, 76, 109, 89, 90,
-        91, 92, 82, 94, 95, 109, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 109, 109, 109,
-        109, 109, 82, 109, 109, 109, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 109, 67, 109, 69,
-        109, 82, 72, 109, 109, 75, 76, 109, 109, 90,
-        91, 92, 82, 94, 95, 109, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 109, 67, 109, 69,
-        109, 109, 72, 109, 109, 75, 76, 109, 109, 109,
-        109, 109, 82, 109, 109, 109, 109, 109, 109, 109,
-        90, 91, 92, 109, 94, 95, 67, 109, 69, 109,
-        109, 72, 109, 109, 75, 76, 109, 67, 109, 69,
-        109, 82, 72, 109, 109, 75, 76, 109, 109, 90,
-        91, 92, 82, 94, 95, 109, 109, 109, 109, 109,
-        90, 91, 92, 2, 94, 95, 109, 25, 109, 27,
-        109, 10, 109, 109, 13, 33, 109, 16, 17, 18,
-        38, 39, 40, 37, 38, 39, 40, 109, 109, 109,
-        109, 109, 109, 109, 109, 109, 109, 55, 56, 57,
-        58, 55, 56, 57, 58, 109, 45, 109, 109, 48,
-        109, 50, 2, 52, 10, 109, 109, 13, 109, 109,
-        10, 17, 18, 13, 109, 109, 2, 17, 18, 109,
-        109, 109, 109, 109, 10, 109, 109, 13, 109, 109,
-        16, 17, 18, 109, 109, 109, 109, 109, 109, 45,
-        109, 109, 48, 109, 50, 45, 52, 109, 48, 109,
-        50, 109, 52, 53, 109, 109, 109, 109, 109, 45,
-        109, 109, 48, 109, 50, 2, 52, 109, 109, 109,
-        109, 109, 109, 10, 109, 109, 13, 109, 109, 2,
-        17, 18, 2, 37, 38, 39, 40, 10, 109, 109,
-        13, 109, 109, 109, 17, 18, 109, 109, 109, 109,
-        109, 55, 56, 57, 58, 109, 109, 109, 45, 109,
-        109, 48, 109, 50, 109, 52, 14, 109, 38, 39,
-        40, 109, 45, 109, 109, 48, 109, 50, 109, 52,
-        14, 109, 109, 109, 109, 55, 56, 57, 58, 109,
-        38, 39, 40, 109, 109, 22, 109, 38, 39, 40,
-        109, 14, 109, 109, 38, 39, 40, 55, 56, 57,
-        58, 38, 39, 40, 55, 56, 57, 58, 109, 109,
-        61, 55, 56, 57, 58, 38, 39, 40, 55, 56,
-        57, 58, 14, 109, 109, 109, 28, 109, 109, 109,
-        109, 109, 55, 56, 57, 58, 38, 39, 40, 109,
-        109, 109, 38, 39, 40, 109, 38, 39, 40, 109,
-        38, 39, 40, 55, 56, 57, 58, 53, 109, 55,
-        56, 57, 58, 55, 56, 57, 58, 55, 56, 57,
-        58,
-    );
-
-    public static $yy_shift_ofst    = array(
-        -31, 406, 406, 458, 458, 94, 510, 94, 94, 94,
-        510, 458, -10, 94, 94, 354, 146, 94, 94, 94,
-        94, 146, 94, 94, 94, 94, 250, 94, 94, 94,
-        94, 94, 94, 302, 94, 94, 94, 198, 42, 42,
-        42, 42, 42, 42, 42, 42, 1772, 828, 828, 80,
-        712, 925, 301, 65, 272, 680, 1942, 1920, 1886, 1776,
-        647, 1949, 1977, 2008, 2004, 1963, 1998, 1956, 2012, 2012,
-        2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012,
-        2012, 2012, 2012, 768, 650, 272, 65, 272, 65, 134,
-        126, 479, 597, 1854, 154, 290, 95, 55, 258, 366,
-        248, 366, 282, 443, 437, 38, 38, 437, 7, 481,
-        410, 38, 461, 621, 596, 596, 261, 596, 596, 261,
-        596, 596, 596, 596, 596, -31, -31, 1840, 1791, 1917,
-        1903, 1834, 158, 238, 394, 446, 38, 25, 147, 169,
-        147, 25, 169, 25, 38, 38, 25, 25, 38, 25,
-        307, 38, 38, 25, 527, 38, 38, 25, 38, 38,
-        38, 38, 38, 596, 624, 261, 624, 327, 596, 596,
-        261, 596, 261, -31, -31, -31, -31, -31, -31, 781,
-        3, 31, 193, 137, -30, 186, -17, 522, 349, 469,
-        322, 30, 82, 316, 346, 376, 190, 358, 393, 152,
-        209, 380, 385, 245, 315, 523, 585, 554, 576, 575,
-        537, 573, 569, 529, 525, 546, 500, 526, 531, 325,
-        530, 487, 494, 502, 470, 433, 430, 408, 383, 327,
-        374,
-    );
-
-    public static $yy_reduce_ofst   = array(
-        471, 504, 563, 717, 574, 685, 919, 890, 787, 758,
-        855, 823, 1240, 1199, 1140, 1100, 1070, 1129, 1170, 1210,
-        1269, 1280, 1310, 1339, 1350, 1380, 1409, 1420, 1450, 1479,
-        1490, 1059, 1030, 1000, 930, 960, 989, 1520, 1549, 1700,
-        1619, 1689, 1660, 1630, 1590, 1560, 633, 661, 867, 8,
-        166, 773, 255, 541, 174, 262, 35, 35, 35, 35,
-        35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
-        35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
-        35, 35, 35, 294, -70, 196, 120, 68, 274, 19,
-        206, 331, 444, 428, 257, 400, 382, 257, 257, 400,
-        386, 397, 257, 386, 381, 388, 359, 314, 257, 442,
-        482, 491, 484, 257, 257, 455, 386, 257, 257, 438,
-        257, 257, 257, 257, 257, 257, 365, 509, 509, 509,
-        509, 509, 524, 536, 509, 509, 528, 514, 539, 551,
-        538, 514, 556, 514, 528, 528, 514, 514, 528, 514,
-        518, 528, 528, 514, 532, 528, 528, 514, 528, 528,
-        528, 528, 528, -90, 520, 122, 520, 566, -90, -90,
-        122, -90, 122, -45, 36, 155, 101, 61, 17,
-    );
-
-    public static $yyExpectedTokens = array(
-        array(),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 53, 54, 59,
-            60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(
-            10, 11, 12, 13, 15, 17, 19, 20, 21, 26, 30, 31, 32, 34, 36, 39, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59, 60,
-        ),
-        array(25, 27, 33, 38, 39, 40, 55, 56, 57, 58,),
-        array(27, 33, 38, 39, 40, 55, 56, 57, 58,),
-        array(27, 33, 38, 39, 40, 55, 56, 57, 58,),
-        array(15, 17, 49, 51, 54,),
-        array(4, 10, 11, 12, 13, 15, 19, 20, 21, 26, 30, 31, 32, 60, 61,),
-        array(1, 14, 18, 27, 33, 36, 48,),
-        array(15, 17, 51, 54,),
-        array(1, 27, 33,),
-        array(15, 36, 54,),
-        array(4, 10, 11, 12, 13, 15, 19, 20, 21, 26, 30, 31, 32, 60, 61,),
-        array(14, 38, 39, 40, 55, 56, 57, 58,),
-        array(2, 38, 39, 40, 55, 56, 57, 58,),
-        array(37, 38, 39, 40, 55, 56, 57, 58,),
-        array(37, 38, 39, 40, 55, 56, 57, 58,),
-        array(14, 38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58, 61,),
-        array(14, 38, 39, 40, 55, 56, 57, 58,),
-        array(14, 38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 53, 55, 56, 57, 58,),
-        array(22, 38, 39, 40, 55, 56, 57, 58,),
-        array(28, 38, 39, 40, 55, 56, 57, 58,),
-        array(14, 38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(38, 39, 40, 55, 56, 57, 58,),
-        array(10, 13, 17, 27, 29, 33,),
-        array(10, 13, 17, 27, 33,),
-        array(15, 36, 54,),
-        array(1, 27, 33,),
-        array(15, 36, 54,),
-        array(1, 27, 33,),
-        array(18, 45, 52,),
-        array(16, 18, 48,),
-        array(1, 2,),
-        array(3, 4, 5, 6, 7, 10, 11, 12, 13, 19, 20, 21, 26, 30, 31, 32,),
-        array(2, 10, 13, 16, 17, 18, 45, 48, 50, 52,),
-        array(1, 14, 27, 33,),
-        array(10, 13, 17, 50,),
-        array(13, 15, 17, 54,),
-        array(1, 14, 27, 33,),
-        array(1, 14, 27, 33,),
-        array(10, 13, 17,),
-        array(16, 18, 48,),
-        array(10, 13, 17,),
-        array(1, 29,),
-        array(18, 48,),
-        array(15, 17,),
-        array(27, 33,),
-        array(27, 33,),
-        array(15, 17,),
-        array(1, 53,),
-        array(27, 33,),
-        array(1, 18,),
-        array(27, 33,),
-        array(15, 54,),
-        array(1,),
-        array(1,),
-        array(1,),
-        array(18,),
-        array(1,),
-        array(1,),
-        array(18,),
-        array(1,),
-        array(1,),
-        array(1,),
-        array(1,),
-        array(1,),
-        array(),
-        array(),
-        array(2, 10, 13, 17, 18, 45, 48, 50, 52, 53,),
-        array(2, 10, 13, 16, 17, 18, 45, 48, 50, 52,),
-        array(2, 10, 13, 17, 18, 45, 48, 50, 52,),
-        array(2, 10, 13, 17, 18, 45, 48, 50, 52,),
-        array(10, 13, 17, 18, 45, 48, 50, 52,),
-        array(13, 15, 17, 34, 54,),
-        array(10, 13, 17, 50,),
-        array(16, 45, 52,),
-        array(10, 13, 17,),
-        array(27, 33,),
-        array(45, 52,),
-        array(15, 54,),
-        array(45, 52,),
-        array(15, 54,),
-        array(45, 52,),
-        array(45, 52,),
-        array(45, 52,),
-        array(27, 33,),
-        array(27, 33,),
-        array(45, 52,),
-        array(45, 52,),
-        array(27, 33,),
-        array(45, 52,),
-        array(13, 36,),
-        array(27, 33,),
-        array(27, 33,),
-        array(45, 52,),
-        array(16, 23,),
-        array(27, 33,),
-        array(27, 33,),
-        array(45, 52,),
-        array(27, 33,),
-        array(27, 33,),
-        array(27, 33,),
-        array(27, 33,),
-        array(27, 33,),
-        array(1,),
-        array(2,),
-        array(18,),
-        array(2,),
-        array(36,),
-        array(1,),
-        array(1,),
-        array(18,),
-        array(1,),
-        array(18,),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(2, 36, 38, 39, 40, 48, 55, 56, 57, 58,),
-        array(14, 22, 24, 27, 33, 35, 37, 45,),
-        array(14, 16, 27, 33, 36, 48,),
-        array(14, 23, 27, 33, 46,),
-        array(14, 23, 27, 33, 46,),
-        array(36, 45, 48, 53,),
-        array(10, 13, 17, 50,),
-        array(29, 36, 48,),
-        array(23, 46, 61,),
-        array(23, 46, 53,),
-        array(35, 37,),
-        array(35, 37,),
-        array(16, 45,),
-        array(35, 53,),
-        array(8, 9,),
-        array(36, 48,),
-        array(36, 48,),
-        array(35, 37,),
-        array(23, 46,),
-        array(36, 48,),
-        array(17, 50,),
-        array(22, 35,),
-        array(7, 9,),
-        array(35, 37,),
-        array(45, 53,),
-        array(24,),
-        array(16,),
-        array(8,),
-        array(37,),
-        array(14,),
-        array(17,),
-        array(51,),
-        array(14,),
-        array(15,),
-        array(53,),
-        array(53,),
-        array(17,),
-        array(51,),
-        array(41,),
-        array(17,),
-        array(17,),
-        array(17,),
-        array(45,),
-        array(34,),
-        array(17,),
-        array(17,),
-        array(34,),
-        array(17,),
-        array(36,),
-        array(17,),
-        array(36,),
-        array(17,),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-        array(),
-    );
-
-    public static $yy_default       = array(
-        338, 514, 514, 499, 499, 514, 514, 476, 476, 476,
-        514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
-        514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
-        514, 514, 514, 514, 514, 514, 514, 514, 514, 514,
-        514, 514, 514, 514, 514, 514, 379, 358, 379, 514,
-        514, 415, 514, 379, 514, 514, 351, 514, 514, 514,
-        514, 514, 514, 514, 514, 514, 384, 514, 399, 475,
-        351, 403, 390, 474, 500, 502, 384, 501, 363, 381,
-        404, 386, 391, 379, 379, 514, 379, 514, 379, 489,
-        431, 370, 327, 430, 393, 441, 514, 393, 393, 441,
-        431, 441, 393, 431, 514, 379, 360, 514, 393, 379,
-        373, 379, 514, 406, 402, 375, 431, 396, 398, 486,
-        393, 408, 397, 407, 406, 483, 336, 430, 430, 430,
-        430, 430, 514, 443, 457, 441, 367, 438, 514, 436,
-        514, 435, 434, 466, 368, 348, 439, 437, 361, 467,
-        441, 356, 354, 468, 514, 366, 355, 469, 362, 359,
-        352, 369, 365, 371, 478, 463, 477, 441, 374, 376,
-        490, 424, 487, 441, 441, 482, 482, 336, 482, 415,
-        411, 415, 405, 405, 415, 442, 415, 405, 405, 514,
-        514, 411, 514, 514, 425, 514, 514, 405, 415, 514,
-        514, 334, 514, 411, 387, 514, 514, 514, 514, 514,
-        514, 514, 514, 420, 514, 514, 514, 417, 514, 514,
-        514, 411, 413, 514, 514, 514, 514, 488, 514, 457,
-        514, 421, 364, 420, 340, 422, 357, 341, 409, 400,
-        480, 457, 462, 401, 485, 423, 426, 342, 447, 380,
-        416, 339, 428, 329, 330, 444, 445, 446, 394, 331,
-        395, 429, 419, 388, 332, 418, 410, 392, 412, 333,
-        335, 414, 337, 472, 417, 479, 427, 497, 347, 461,
-        460, 459, 378, 346, 464, 510, 495, 511, 498, 473,
-        377, 496, 503, 506, 513, 512, 509, 507, 504, 508,
-        345, 458, 471, 448, 505, 454, 452, 455, 456, 450,
-        491, 449, 492, 493, 494, 470, 451, 328, 453, 343,
-        344, 372, 481, 432, 433, 465, 440,
-    );
-
-    public static $yyFallback       = array();
-
-    public static $yyRuleName       = array(
-        'start ::= template',
-        'template ::= template PHP',
-        'template ::= template TEXT',
-        'template ::= template STRIPON',
-        'template ::= template STRIPOFF',
-        'template ::= template LITERALSTART literal_e2 LITERALEND',
-        'literal_e2 ::= literal_e1 LITERALSTART literal_e1 LITERALEND',
-        'literal_e2 ::= literal_e1',
-        'literal_e1 ::= literal_e1 LITERAL',
-        'literal_e1 ::=',
-        'template ::= template smartytag',
-        'template ::=',
-        'smartytag ::= SIMPELOUTPUT',
-        'smartytag ::= SIMPLETAG',
-        'smartytag ::= SMARTYBLOCKCHILDPARENT',
-        'smartytag ::= LDEL tagbody RDEL',
-        'smartytag ::= tag RDEL',
-        'tagbody ::= outattr',
-        'tagbody ::= DOLLARID eqoutattr',
-        'tagbody ::= varindexed eqoutattr',
-        'eqoutattr ::= EQUAL outattr',
-        'outattr ::= output attributes',
-        'output ::= variable',
-        'output ::= value',
-        'output ::= expr',
-        'tag ::= LDEL ID attributes',
-        'tag ::= LDEL ID',
-        'tag ::= LDEL ID modifierlist attributes',
-        'tag ::= LDEL ID PTR ID attributes',
-        'tag ::= LDEL ID PTR ID modifierlist attributes',
-        'tag ::= LDELMAKENOCACHE DOLLARID',
-        'tag ::= LDELIF expr',
-        'tag ::= LDELIF expr attributes',
-        'tag ::= LDELIF statement',
-        'tag ::= LDELIF statement attributes',
-        'tag ::= LDELFOR statements SEMICOLON expr SEMICOLON varindexed foraction attributes',
-        'foraction ::= EQUAL expr',
-        'foraction ::= INCDEC',
-        'tag ::= LDELFOR statement TO expr attributes',
-        'tag ::= LDELFOR statement TO expr STEP expr attributes',
-        'tag ::= LDELFOREACH SPACE expr AS varvar attributes',
-        'tag ::= LDELFOREACH SPACE expr AS varvar APTR varvar attributes',
-        'tag ::= LDELFOREACH attributes',
-        'tag ::= LDELSETFILTER ID modparameters',
-        'tag ::= LDELSETFILTER ID modparameters modifierlist',
-        'smartytag ::= CLOSETAG',
-        'tag ::= LDELSLASH ID',
-        'tag ::= LDELSLASH ID modifierlist',
-        'tag ::= LDELSLASH ID PTR ID',
-        'tag ::= LDELSLASH ID PTR ID modifierlist',
-        'attributes ::= attributes attribute',
-        'attributes ::= attribute',
-        'attributes ::=',
-        'attribute ::= SPACE ID EQUAL ID',
-        'attribute ::= ATTR expr',
-        'attribute ::= ATTR value',
-        'attribute ::= SPACE ID',
-        'attribute ::= SPACE expr',
-        'attribute ::= SPACE value',
-        'attribute ::= SPACE INTEGER EQUAL expr',
-        'statements ::= statement',
-        'statements ::= statements COMMA statement',
-        'statement ::= DOLLARID EQUAL INTEGER',
-        'statement ::= DOLLARID EQUAL expr',
-        'statement ::= varindexed EQUAL expr',
-        'statement ::= OPENP statement CLOSEP',
-        'expr ::= value',
-        'expr ::= ternary',
-        'expr ::= DOLLARID COLON ID',
-        'expr ::= expr MATH value',
-        'expr ::= expr UNIMATH value',
-        'expr ::= expr tlop value',
-        'expr ::= expr lop expr',
-        'expr ::= expr scond',
-        'expr ::= expr ISIN array',
-        'expr ::= expr ISIN value',
-        'ternary ::= OPENP expr CLOSEP QMARK DOLLARID COLON expr',
-        'ternary ::= OPENP expr CLOSEP QMARK expr COLON expr',
-        'value ::= variable',
-        'value ::= UNIMATH value',
-        'value ::= NOT value',
-        'value ::= TYPECAST value',
-        'value ::= variable INCDEC',
-        'value ::= HEX',
-        'value ::= INTEGER',
-        'value ::= INTEGER DOT INTEGER',
-        'value ::= INTEGER DOT',
-        'value ::= DOT INTEGER',
-        'value ::= ID',
-        'value ::= function',
-        'value ::= OPENP expr CLOSEP',
-        'value ::= variable INSTANCEOF ns1',
-        'value ::= variable INSTANCEOF variable',
-        'value ::= SINGLEQUOTESTRING',
-        'value ::= doublequoted_with_quotes',
-        'value ::= varindexed DOUBLECOLON static_class_access',
-        'value ::= smartytag',
-        'value ::= value modifierlist',
-        'value ::= NAMESPACE',
-        'value ::= arraydef',
-        'value ::= ns1 DOUBLECOLON static_class_access',
-        'ns1 ::= ID',
-        'ns1 ::= NAMESPACE',
-        'variable ::= DOLLARID',
-        'variable ::= varindexed',
-        'variable ::= varvar AT ID',
-        'variable ::= object',
-        'variable ::= HATCH ID HATCH',
-        'variable ::= HATCH ID HATCH arrayindex',
-        'variable ::= HATCH variable HATCH',
-        'variable ::= HATCH variable HATCH arrayindex',
-        'varindexed ::= DOLLARID arrayindex',
-        'varindexed ::= varvar arrayindex',
-        'arrayindex ::= arrayindex indexdef',
-        'arrayindex ::=',
-        'indexdef ::= DOT DOLLARID',
-        'indexdef ::= DOT varvar',
-        'indexdef ::= DOT varvar AT ID',
-        'indexdef ::= DOT ID',
-        'indexdef ::= DOT INTEGER',
-        'indexdef ::= DOT LDEL expr RDEL',
-        'indexdef ::= OPENB ID CLOSEB',
-        'indexdef ::= OPENB ID DOT ID CLOSEB',
-        'indexdef ::= OPENB SINGLEQUOTESTRING CLOSEB',
-        'indexdef ::= OPENB INTEGER CLOSEB',
-        'indexdef ::= OPENB DOLLARID CLOSEB',
-        'indexdef ::= OPENB variable CLOSEB',
-        'indexdef ::= OPENB value CLOSEB',
-        'indexdef ::= OPENB expr CLOSEB',
-        'indexdef ::= OPENB CLOSEB',
-        'varvar ::= DOLLARID',
-        'varvar ::= DOLLAR',
-        'varvar ::= varvar varvarele',
-        'varvarele ::= ID',
-        'varvarele ::= SIMPELOUTPUT',
-        'varvarele ::= LDEL expr RDEL',
-        'object ::= varindexed objectchain',
-        'objectchain ::= objectelement',
-        'objectchain ::= objectchain objectelement',
-        'objectelement ::= PTR ID arrayindex',
-        'objectelement ::= PTR varvar arrayindex',
-        'objectelement ::= PTR LDEL expr RDEL arrayindex',
-        'objectelement ::= PTR ID LDEL expr RDEL arrayindex',
-        'objectelement ::= PTR method',
-        'function ::= ns1 OPENP params CLOSEP',
-        'method ::= ID OPENP params CLOSEP',
-        'method ::= DOLLARID OPENP params CLOSEP',
-        'params ::= params COMMA expr',
-        'params ::= expr',
-        'params ::=',
-        'modifierlist ::= modifierlist modifier modparameters',
-        'modifierlist ::= modifier modparameters',
-        'modifier ::= VERT AT ID',
-        'modifier ::= VERT ID',
-        'modparameters ::= modparameters modparameter',
-        'modparameters ::=',
-        'modparameter ::= COLON value',
-        'modparameter ::= COLON UNIMATH value',
-        'modparameter ::= COLON array',
-        'static_class_access ::= method',
-        'static_class_access ::= method objectchain',
-        'static_class_access ::= ID',
-        'static_class_access ::= DOLLARID arrayindex',
-        'static_class_access ::= DOLLARID arrayindex objectchain',
-        'lop ::= LOGOP',
-        'lop ::= SLOGOP',
-        'tlop ::= TLOGOP',
-        'scond ::= SINGLECOND',
-        'arraydef ::= OPENB arrayelements CLOSEB',
-        'arraydef ::= ARRAYOPEN arrayelements CLOSEP',
-        'arrayelements ::= arrayelement',
-        'arrayelements ::= arrayelements COMMA arrayelement',
-        'arrayelements ::=',
-        'arrayelement ::= value APTR expr',
-        'arrayelement ::= ID APTR expr',
-        'arrayelement ::= expr',
-        'doublequoted_with_quotes ::= QUOTE QUOTE',
-        'doublequoted_with_quotes ::= QUOTE doublequoted QUOTE',
-        'doublequoted ::= doublequoted doublequotedcontent',
-        'doublequoted ::= doublequotedcontent',
-        'doublequotedcontent ::= BACKTICK variable BACKTICK',
-        'doublequotedcontent ::= BACKTICK expr BACKTICK',
-        'doublequotedcontent ::= DOLLARID',
-        'doublequotedcontent ::= LDEL variable RDEL',
-        'doublequotedcontent ::= LDEL expr RDEL',
-        'doublequotedcontent ::= smartytag',
-        'doublequotedcontent ::= TEXT',
-    );
-
-    public static $yyRuleInfo       = array(
-        array(0 => 63, 1 => 1),
-        array(0 => 64, 1 => 2),
-        array(0 => 64, 1 => 2),
-        array(0 => 64, 1 => 2),
-        array(0 => 64, 1 => 2),
-        array(0 => 64, 1 => 4),
-        array(0 => 65, 1 => 4),
-        array(0 => 65, 1 => 1),
-        array(0 => 66, 1 => 2),
-        array(0 => 66, 1 => 0),
-        array(0 => 64, 1 => 2),
-        array(0 => 64, 1 => 0),
-        array(0 => 67, 1 => 1),
-        array(0 => 67, 1 => 1),
-        array(0 => 67, 1 => 1),
-        array(0 => 67, 1 => 3),
-        array(0 => 67, 1 => 2),
-        array(0 => 68, 1 => 1),
-        array(0 => 68, 1 => 2),
-        array(0 => 68, 1 => 2),
-        array(0 => 71, 1 => 2),
-        array(0 => 70, 1 => 2),
-        array(0 => 73, 1 => 1),
-        array(0 => 73, 1 => 1),
-        array(0 => 73, 1 => 1),
-        array(0 => 69, 1 => 3),
-        array(0 => 69, 1 => 2),
-        array(0 => 69, 1 => 4),
-        array(0 => 69, 1 => 5),
-        array(0 => 69, 1 => 6),
-        array(0 => 69, 1 => 2),
-        array(0 => 69, 1 => 2),
-        array(0 => 69, 1 => 3),
-        array(0 => 69, 1 => 2),
-        array(0 => 69, 1 => 3),
-        array(0 => 69, 1 => 8),
-        array(0 => 81, 1 => 2),
-        array(0 => 81, 1 => 1),
-        array(0 => 69, 1 => 5),
-        array(0 => 69, 1 => 7),
-        array(0 => 69, 1 => 6),
-        array(0 => 69, 1 => 8),
-        array(0 => 69, 1 => 2),
-        array(0 => 69, 1 => 3),
-        array(0 => 69, 1 => 4),
-        array(0 => 67, 1 => 1),
-        array(0 => 69, 1 => 2),
-        array(0 => 69, 1 => 3),
-        array(0 => 69, 1 => 4),
-        array(0 => 69, 1 => 5),
-        array(0 => 74, 1 => 2),
-        array(0 => 74, 1 => 1),
-        array(0 => 74, 1 => 0),
-        array(0 => 84, 1 => 4),
-        array(0 => 84, 1 => 2),
-        array(0 => 84, 1 => 2),
-        array(0 => 84, 1 => 2),
-        array(0 => 84, 1 => 2),
-        array(0 => 84, 1 => 2),
-        array(0 => 84, 1 => 4),
-        array(0 => 80, 1 => 1),
-        array(0 => 80, 1 => 3),
-        array(0 => 79, 1 => 3),
-        array(0 => 79, 1 => 3),
-        array(0 => 79, 1 => 3),
-        array(0 => 79, 1 => 3),
-        array(0 => 77, 1 => 1),
-        array(0 => 77, 1 => 1),
-        array(0 => 77, 1 => 3),
-        array(0 => 77, 1 => 3),
-        array(0 => 77, 1 => 3),
-        array(0 => 77, 1 => 3),
-        array(0 => 77, 1 => 3),
-        array(0 => 77, 1 => 2),
-        array(0 => 77, 1 => 3),
-        array(0 => 77, 1 => 3),
-        array(0 => 85, 1 => 7),
-        array(0 => 85, 1 => 7),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 3),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 3),
-        array(0 => 76, 1 => 3),
-        array(0 => 76, 1 => 3),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 3),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 2),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 1),
-        array(0 => 76, 1 => 3),
-        array(0 => 91, 1 => 1),
-        array(0 => 91, 1 => 1),
-        array(0 => 75, 1 => 1),
-        array(0 => 75, 1 => 1),
-        array(0 => 75, 1 => 3),
-        array(0 => 75, 1 => 1),
-        array(0 => 75, 1 => 3),
-        array(0 => 75, 1 => 4),
-        array(0 => 75, 1 => 3),
-        array(0 => 75, 1 => 4),
-        array(0 => 72, 1 => 2),
-        array(0 => 72, 1 => 2),
-        array(0 => 96, 1 => 2),
-        array(0 => 96, 1 => 0),
-        array(0 => 97, 1 => 2),
-        array(0 => 97, 1 => 2),
-        array(0 => 97, 1 => 4),
-        array(0 => 97, 1 => 2),
-        array(0 => 97, 1 => 2),
-        array(0 => 97, 1 => 4),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 5),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 3),
-        array(0 => 97, 1 => 2),
-        array(0 => 82, 1 => 1),
-        array(0 => 82, 1 => 1),
-        array(0 => 82, 1 => 2),
-        array(0 => 98, 1 => 1),
-        array(0 => 98, 1 => 1),
-        array(0 => 98, 1 => 3),
-        array(0 => 95, 1 => 2),
-        array(0 => 99, 1 => 1),
-        array(0 => 99, 1 => 2),
-        array(0 => 100, 1 => 3),
-        array(0 => 100, 1 => 3),
-        array(0 => 100, 1 => 5),
-        array(0 => 100, 1 => 6),
-        array(0 => 100, 1 => 2),
-        array(0 => 90, 1 => 4),
-        array(0 => 101, 1 => 4),
-        array(0 => 101, 1 => 4),
-        array(0 => 102, 1 => 3),
-        array(0 => 102, 1 => 1),
-        array(0 => 102, 1 => 0),
-        array(0 => 78, 1 => 3),
-        array(0 => 78, 1 => 2),
-        array(0 => 103, 1 => 3),
-        array(0 => 103, 1 => 2),
-        array(0 => 83, 1 => 2),
-        array(0 => 83, 1 => 0),
-        array(0 => 104, 1 => 2),
-        array(0 => 104, 1 => 3),
-        array(0 => 104, 1 => 2),
-        array(0 => 93, 1 => 1),
-        array(0 => 93, 1 => 2),
-        array(0 => 93, 1 => 1),
-        array(0 => 93, 1 => 2),
-        array(0 => 93, 1 => 3),
-        array(0 => 87, 1 => 1),
-        array(0 => 87, 1 => 1),
-        array(0 => 86, 1 => 1),
-        array(0 => 88, 1 => 1),
-        array(0 => 94, 1 => 3),
-        array(0 => 94, 1 => 3),
-        array(0 => 105, 1 => 1),
-        array(0 => 105, 1 => 3),
-        array(0 => 105, 1 => 0),
-        array(0 => 106, 1 => 3),
-        array(0 => 106, 1 => 3),
-        array(0 => 106, 1 => 1),
-        array(0 => 92, 1 => 2),
-        array(0 => 92, 1 => 3),
-        array(0 => 107, 1 => 2),
-        array(0 => 107, 1 => 1),
-        array(0 => 108, 1 => 3),
-        array(0 => 108, 1 => 3),
-        array(0 => 108, 1 => 1),
-        array(0 => 108, 1 => 3),
-        array(0 => 108, 1 => 3),
-        array(0 => 108, 1 => 1),
-        array(0 => 108, 1 => 1),
-    );
-
-    public static $yyReduceMap      = array(
-        0   => 0,
-        1   => 1,
-        2   => 2,
-        3   => 3,
-        4   => 4,
-        5   => 5,
-        6   => 6,
-        7   => 7,
-        22  => 7,
-        23  => 7,
-        24  => 7,
-        37  => 7,
-        57  => 7,
-        58  => 7,
-        66  => 7,
-        67  => 7,
-        78  => 7,
-        83  => 7,
-        84  => 7,
-        89  => 7,
-        93  => 7,
-        94  => 7,
-        98  => 7,
-        99  => 7,
-        101 => 7,
-        106 => 7,
-        170 => 7,
-        175 => 7,
-        8   => 8,
-        9   => 9,
-        10  => 10,
-        12  => 12,
-        13  => 13,
-        14  => 14,
-        15  => 15,
-        16  => 16,
-        17  => 17,
-        18  => 18,
-        19  => 19,
-        20  => 20,
-        21  => 21,
-        25  => 25,
-        26  => 26,
-        27  => 27,
-        28  => 28,
-        29  => 29,
-        30  => 30,
-        31  => 31,
-        32  => 32,
-        34  => 32,
-        33  => 33,
-        35  => 35,
-        36  => 36,
-        38  => 38,
-        39  => 39,
-        40  => 40,
-        41  => 41,
-        42  => 42,
-        43  => 43,
-        44  => 44,
-        45  => 45,
-        46  => 46,
-        47  => 47,
-        48  => 48,
-        49  => 49,
-        50  => 50,
-        51  => 51,
-        60  => 51,
-        148 => 51,
-        152 => 51,
-        156 => 51,
-        158 => 51,
-        52  => 52,
-        149 => 52,
-        155 => 52,
-        53  => 53,
-        54  => 54,
-        55  => 54,
-        56  => 56,
-        133 => 56,
-        59  => 59,
-        61  => 61,
-        62  => 62,
-        63  => 62,
-        64  => 64,
-        65  => 65,
-        68  => 68,
-        69  => 69,
-        70  => 69,
-        71  => 71,
-        72  => 72,
-        73  => 73,
-        74  => 74,
-        75  => 75,
-        76  => 76,
-        77  => 77,
-        79  => 79,
-        81  => 79,
-        82  => 79,
-        113 => 79,
-        80  => 80,
-        85  => 85,
-        86  => 86,
-        87  => 87,
-        88  => 88,
-        90  => 90,
-        91  => 91,
-        92  => 91,
-        95  => 95,
-        96  => 96,
-        97  => 97,
-        100 => 100,
-        102 => 102,
-        103 => 103,
-        104 => 104,
-        105 => 105,
-        107 => 107,
-        108 => 108,
-        109 => 109,
-        110 => 110,
-        111 => 111,
-        112 => 112,
-        114 => 114,
-        172 => 114,
-        115 => 115,
-        116 => 116,
-        117 => 117,
-        118 => 118,
-        119 => 119,
-        120 => 120,
-        128 => 120,
-        121 => 121,
-        122 => 122,
-        123 => 123,
-        124 => 123,
-        126 => 123,
-        127 => 123,
-        125 => 125,
-        129 => 129,
-        130 => 130,
-        131 => 131,
-        176 => 131,
-        132 => 132,
-        134 => 134,
-        135 => 135,
-        136 => 136,
-        137 => 137,
-        138 => 138,
-        139 => 139,
-        140 => 140,
-        141 => 141,
-        142 => 142,
-        143 => 143,
-        144 => 144,
-        145 => 145,
-        146 => 146,
-        147 => 147,
-        150 => 150,
-        151 => 151,
-        153 => 153,
-        154 => 154,
-        157 => 157,
-        159 => 159,
-        160 => 160,
-        161 => 161,
-        162 => 162,
-        163 => 163,
-        164 => 164,
-        165 => 165,
-        166 => 166,
-        167 => 167,
-        168 => 168,
-        169 => 168,
-        171 => 171,
-        173 => 173,
-        174 => 174,
-        177 => 177,
-        178 => 178,
-        179 => 179,
-        180 => 180,
-        183 => 180,
-        181 => 181,
-        184 => 181,
-        182 => 182,
-        185 => 185,
-        186 => 186,
-    );
-
-    /**
-     * result status
-     *
-     * @var bool
-     */
-    public $successful = true;
-
-    /**
-     * return value
-     *
-     * @var mixed
-     */
-    public $retvalue = 0;
-
-    /**
-     * @var
-     */
-    public $yymajor;
-
-    /**
-     * last index of array variable
-     *
-     * @var mixed
-     */
-    public $last_index;
-
-    /**
-     * last variable name
-     *
-     * @var string
-     */
-    public $last_variable;
-
-    /**
-     * root parse tree buffer
-     *
-     * @var Smarty_Internal_ParseTree_Template
-     */
-    public $root_buffer;
-
-    /**
-     * current parse tree object
-     *
-     * @var Smarty_Internal_ParseTree
-     */
-    public $current_buffer;
-
-    /**
-     * lexer object
-     *
-     * @var Smarty_Internal_Templatelexer
-     */
-    public $lex;
-
-    /**
-     * {strip} status
-     *
-     * @var bool
-     */
-    public $strip = false;
-
-    /**
-     * compiler object
-     *
-     * @var Smarty_Internal_TemplateCompilerBase
-     */
-    public $compiler = null;
-
-    /**
-     * smarty object
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * template object
-     *
-     * @var Smarty_Internal_Template
-     */
-    public $template = null;
-
-    /**
-     * block nesting level
-     *
-     * @var int
-     */
-    public $block_nesting_level = 0;
-
-    /**
-     * security object
-     *
-     * @var Smarty_Security
-     */
-    public $security = null;
-
-    /**
-     * template prefix array
-     *
-     * @var \Smarty_Internal_ParseTree[]
-     */
-    public $template_prefix = array();
-
-    /**
-     * template prefix array
-     *
-     * @var \Smarty_Internal_ParseTree[]
-     */
-    public $template_postfix = array();
-
-    public $yyTraceFILE;
-
-    public $yyTracePrompt;
-
-    public $yyidx;
-
-    public $yyerrcnt;
-
-    public $yystack          = array();
-
-    public $yyTokenName      = array(
-        '$', 'VERT', 'COLON', 'PHP',
-        'TEXT', 'STRIPON', 'STRIPOFF', 'LITERALSTART',
-        'LITERALEND', 'LITERAL', 'SIMPELOUTPUT', 'SIMPLETAG',
-        'SMARTYBLOCKCHILDPARENT', 'LDEL', 'RDEL', 'DOLLARID',
-        'EQUAL', 'ID', 'PTR', 'LDELMAKENOCACHE',
-        'LDELIF', 'LDELFOR', 'SEMICOLON', 'INCDEC',
-        'TO', 'STEP', 'LDELFOREACH', 'SPACE',
-        'AS', 'APTR', 'LDELSETFILTER', 'CLOSETAG',
-        'LDELSLASH', 'ATTR', 'INTEGER', 'COMMA',
-        'OPENP', 'CLOSEP', 'MATH', 'UNIMATH',
-        'ISIN', 'QMARK', 'NOT', 'TYPECAST',
-        'HEX', 'DOT', 'INSTANCEOF', 'SINGLEQUOTESTRING',
-        'DOUBLECOLON', 'NAMESPACE', 'AT', 'HATCH',
-        'OPENB', 'CLOSEB', 'DOLLAR', 'LOGOP',
-        'SLOGOP', 'TLOGOP', 'SINGLECOND', 'ARRAYOPEN',
-        'QUOTE', 'BACKTICK', 'error', 'start',
-        'template', 'literal_e2', 'literal_e1', 'smartytag',
-        'tagbody', 'tag', 'outattr', 'eqoutattr',
-        'varindexed', 'output', 'attributes', 'variable',
-        'value', 'expr', 'modifierlist', 'statement',
-        'statements', 'foraction', 'varvar', 'modparameters',
-        'attribute', 'ternary', 'tlop', 'lop',
-        'scond', 'array', 'function', 'ns1',
-        'doublequoted_with_quotes', 'static_class_access', 'arraydef', 'object',
-        'arrayindex', 'indexdef', 'varvarele', 'objectchain',
-        'objectelement', 'method', 'params', 'modifier',
-        'modparameter', 'arrayelements', 'arrayelement', 'doublequoted',
-        'doublequotedcontent',
-    );
-
-    /**
-     * internal error flag
-     *
-     * @var bool
-     */
-    private $internalError = false;                    /* Index of top element in stack */
-    private $_retvalue;                 /* Shifts left before out of the error */
-    /**
-     * constructor
-     *
-     * @param Smarty_Internal_Templatelexer        $lex
-     * @param Smarty_Internal_TemplateCompilerBase $compiler
-     */
-    public function __construct(Smarty_Internal_Templatelexer $lex, Smarty_Internal_TemplateCompilerBase $compiler)
-    {
-        $this->lex = $lex;
-        $this->compiler = $compiler;
-        $this->template = $this->compiler->template;
-        $this->smarty = $this->template->smarty;
-        $this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false;
-        $this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template();
-    }  /* The parser's stack */
-    public static function yy_destructor($yymajor, $yypminor)
-    {
-        switch ($yymajor) {
-            default:
-                break;   /* If no destructor action specified: do nothing */
-        }
-    }
-
-    /**
-     * insert PHP code in current buffer
-     *
-     * @param string $code
-     */
-    public function insertPhpCode($code)
-    {
-        $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Tag($this, $code));
-    }
-
-    /**
-     * error rundown
-     *
-     */
-    public function errorRunDown()
-    {
-        while ($this->yystack !== array()) {
-            $this->yy_pop_parser_stack();
-        }
-        if (is_resource($this->yyTraceFILE)) {
-            fclose($this->yyTraceFILE);
-        }
-    }
-
-    /**
-     *  merge PHP code with prefix code and return parse tree tag object
-     *
-     * @param string $code
-     *
-     * @return Smarty_Internal_ParseTree_Tag
-     */
-    public function mergePrefixCode($code)
-    {
-        $tmp = '';
-        foreach ($this->compiler->prefix_code as $preCode) {
-            $tmp .= $preCode;
-        }
-        $this->compiler->prefix_code = array();
-        $tmp .= $code;
-        return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true));
-    }
-
-    public function Trace($TraceFILE, $zTracePrompt)
-    {
-        if (!$TraceFILE) {
-            $zTracePrompt = 0;
-        } elseif (!$zTracePrompt) {
-            $TraceFILE = 0;
-        }
-        $this->yyTraceFILE = $TraceFILE;
-        $this->yyTracePrompt = $zTracePrompt;
-    }
-
-    public function PrintTrace()
-    {
-        $this->yyTraceFILE = fopen('php://output', 'w');
-        $this->yyTracePrompt = '<br>';
-    }
-
-    public function tokenName($tokenType)
-    {
-        if ($tokenType === 0) {
-            return 'End of Input';
-        }
-        if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
-            return $this->yyTokenName[ $tokenType ];
-        } else {
-            return 'Unknown';
-        }
-    }
-
-    public function yy_pop_parser_stack()
-    {
-        if (empty($this->yystack)) {
-            return;
-        }
-        $yytos = array_pop($this->yystack);
-        if ($this->yyTraceFILE && $this->yyidx >= 0) {
-            fwrite($this->yyTraceFILE,
-                $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] .
-                "\n");
-        }
-        $yymajor = $yytos->major;
-        self::yy_destructor($yymajor, $yytos->minor);
-        $this->yyidx--;
-        return $yymajor;
-    }
-
-    public function __destruct()
-    {
-        while ($this->yystack !== array()) {
-            $this->yy_pop_parser_stack();
-        }
-        if (is_resource($this->yyTraceFILE)) {
-            fclose($this->yyTraceFILE);
-        }
-    }
-
-    public function yy_get_expected_tokens($token)
-    {
-        static $res3 = array();
-        static $res4 = array();
-        $state = $this->yystack[ $this->yyidx ]->stateno;
-        $expected = self::$yyExpectedTokens[ $state ];
-        if (isset($res3[ $state ][ $token ])) {
-            if ($res3[ $state ][ $token ]) {
-                return $expected;
-            }
-        } else {
-            if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
-                return $expected;
-            }
-        }
-        $stack = $this->yystack;
-        $yyidx = $this->yyidx;
-        do {
-            $yyact = $this->yy_find_shift_action($token);
-            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
-                // reduce action
-                $done = 0;
-                do {
-                    if ($done++ === 100) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // too much recursion prevents proper detection
-                        // so give up
-                        return array_unique($expected);
-                    }
-                    $yyruleno = $yyact - self::YYNSTATE;
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
-                    $nextstate = $this->yy_find_reduce_action(
-                        $this->yystack[ $this->yyidx ]->stateno,
-                        self::$yyRuleInfo[ $yyruleno ][ 0 ]);
-                    if (isset(self::$yyExpectedTokens[ $nextstate ])) {
-                        $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
-                        if (isset($res4[ $nextstate ][ $token ])) {
-                            if ($res4[ $nextstate ][ $token ]) {
-                                $this->yyidx = $yyidx;
-                                $this->yystack = $stack;
-                                return array_unique($expected);
-                            }
-                        } else {
-                            if ($res4[ $nextstate ][ $token ] =
-                                in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) {
-                                $this->yyidx = $yyidx;
-                                $this->yystack = $stack;
-                                return array_unique($expected);
-                            }
-                        }
-                    }
-                    if ($nextstate < self::YYNSTATE) {
-                        // we need to shift a non-terminal
-                        $this->yyidx++;
-                        $x = new TP_yyStackEntry;
-                        $x->stateno = $nextstate;
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
-                        $this->yystack[ $this->yyidx ] = $x;
-                        continue 2;
-                    } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // the last token was just ignored, we can't accept
-                        // by ignoring input, this is in essence ignoring a
-                        // syntax error!
-                        return array_unique($expected);
-                    } elseif ($nextstate === self::YY_NO_ACTION) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // input accepted, but not shifted (I guess)
-                        return $expected;
-                    } else {
-                        $yyact = $nextstate;
-                    }
-                } while (true);
-            }
-            break;
-        } while (true);
-        $this->yyidx = $yyidx;
-        $this->yystack = $stack;
-        return array_unique($expected);
-    }
-
-    public function yy_is_expected_token($token)
-    {
-        static $res = array();
-        static $res2 = array();
-        if ($token === 0) {
-            return true; // 0 is not part of this
-        }
-        $state = $this->yystack[ $this->yyidx ]->stateno;
-        if (isset($res[ $state ][ $token ])) {
-            if ($res[ $state ][ $token ]) {
-                return true;
-            }
-        } else {
-            if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
-                return true;
-            }
-        }
-        $stack = $this->yystack;
-        $yyidx = $this->yyidx;
-        do {
-            $yyact = $this->yy_find_shift_action($token);
-            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
-                // reduce action
-                $done = 0;
-                do {
-                    if ($done++ === 100) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // too much recursion prevents proper detection
-                        // so give up
-                        return true;
-                    }
-                    $yyruleno = $yyact - self::YYNSTATE;
-                    $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
-                    $nextstate = $this->yy_find_reduce_action(
-                        $this->yystack[ $this->yyidx ]->stateno,
-                        self::$yyRuleInfo[ $yyruleno ][ 0 ]);
-                    if (isset($res2[ $nextstate ][ $token ])) {
-                        if ($res2[ $nextstate ][ $token ]) {
-                            $this->yyidx = $yyidx;
-                            $this->yystack = $stack;
-                            return true;
-                        }
-                    } else {
-                        if ($res2[ $nextstate ][ $token ] =
-                            (isset(self::$yyExpectedTokens[ $nextstate ]) &&
-                             in_array($token, self::$yyExpectedTokens[ $nextstate ], true))) {
-                            $this->yyidx = $yyidx;
-                            $this->yystack = $stack;
-                            return true;
-                        }
-                    }
-                    if ($nextstate < self::YYNSTATE) {
-                        // we need to shift a non-terminal
-                        $this->yyidx++;
-                        $x = new TP_yyStackEntry;
-                        $x->stateno = $nextstate;
-                        $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
-                        $this->yystack[ $this->yyidx ] = $x;
-                        continue 2;
-                    } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        if (!$token) {
-                            // end of input: this is valid
-                            return true;
-                        }
-                        // the last token was just ignored, we can't accept
-                        // by ignoring input, this is in essence ignoring a
-                        // syntax error!
-                        return false;
-                    } elseif ($nextstate === self::YY_NO_ACTION) {
-                        $this->yyidx = $yyidx;
-                        $this->yystack = $stack;
-                        // input accepted, but not shifted (I guess)
-                        return true;
-                    } else {
-                        $yyact = $nextstate;
-                    }
-                } while (true);
-            }
-            break;
-        } while (true);
-        $this->yyidx = $yyidx;
-        $this->yystack = $stack;
-        return true;
-    }
-
-    public function yy_find_shift_action($iLookAhead)
-    {
-        $stateno = $this->yystack[ $this->yyidx ]->stateno;
-        /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
-        if (!isset(self::$yy_shift_ofst[ $stateno ])) {
-            // no shift actions
-            return self::$yy_default[ $stateno ];
-        }
-        $i = self::$yy_shift_ofst[ $stateno ];
-        if ($i === self::YY_SHIFT_USE_DFLT) {
-            return self::$yy_default[ $stateno ];
-        }
-        if ($iLookAhead === self::YYNOCODE) {
-            return self::YY_NO_ACTION;
-        }
-        $i += $iLookAhead;
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
-            self::$yy_lookahead[ $i ] != $iLookAhead) {
-            if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
-                && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) {
-                if ($this->yyTraceFILE) {
-                    fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' .
-                                               $this->yyTokenName[ $iLookAhead ] . ' => ' .
-                                               $this->yyTokenName[ $iFallback ] . "\n");
-                }
-                return $this->yy_find_shift_action($iFallback);
-            }
-            return self::$yy_default[ $stateno ];
-        } else {
-            return self::$yy_action[ $i ];
-        }
-    }
-
-    public function yy_find_reduce_action($stateno, $iLookAhead)
-    {
-        /* $stateno = $this->yystack[$this->yyidx]->stateno; */
-        if (!isset(self::$yy_reduce_ofst[ $stateno ])) {
-            return self::$yy_default[ $stateno ];
-        }
-        $i = self::$yy_reduce_ofst[ $stateno ];
-        if ($i === self::YY_REDUCE_USE_DFLT) {
-            return self::$yy_default[ $stateno ];
-        }
-        if ($iLookAhead === self::YYNOCODE) {
-            return self::YY_NO_ACTION;
-        }
-        $i += $iLookAhead;
-        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
-            self::$yy_lookahead[ $i ] != $iLookAhead) {
-            return self::$yy_default[ $stateno ];
-        } else {
-            return self::$yy_action[ $i ];
-        }
-    }
-
-    // line 234 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_shift($yyNewState, $yyMajor, $yypMinor)
-    {
-        $this->yyidx++;
-        if ($this->yyidx >= self::YYSTACKDEPTH) {
-            $this->yyidx--;
-            if ($this->yyTraceFILE) {
-                fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
-            }
-            while ($this->yyidx >= 0) {
-                $this->yy_pop_parser_stack();
-            }
-            // line 221 "../smarty/lexer/smarty_internal_templateparser.y"
-            $this->internalError = true;
-            $this->compiler->trigger_template_error('Stack overflow in template parser');
-            return;
-        }
-        $yytos = new TP_yyStackEntry;
-        $yytos->stateno = $yyNewState;
-        $yytos->major = $yyMajor;
-        $yytos->minor = $yypMinor;
-        $this->yystack[] = $yytos;
-        if ($this->yyTraceFILE && $this->yyidx > 0) {
-            fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt,
-                $yyNewState);
-            fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
-            for ($i = 1; $i <= $this->yyidx; $i++) {
-                fprintf($this->yyTraceFILE, " %s",
-                    $this->yyTokenName[ $this->yystack[ $i ]->major ]);
-            }
-            fwrite($this->yyTraceFILE, "\n");
-        }
-    }
-
-    // line 242 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r0()
-    {
-        $this->root_buffer->prepend_array($this, $this->template_prefix);
-        $this->root_buffer->append_array($this, $this->template_postfix);
-        $this->_retvalue = $this->root_buffer->to_smarty_php($this);
-    }
-
-    // line 251 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r1()
-    {
-        $code =
-            $this->compiler->compileTag('private_php',
-                array(array('code' => $this->yystack[ $this->yyidx + 0 ]->minor), array('type' => $this->lex->phpType)),
-                array());
-        if ($this->compiler->has_code && !empty($code)) {
-            $tmp = '';
-            foreach ($this->compiler->prefix_code as $code) {
-                $tmp .= $code;
-            }
-            $this->compiler->prefix_code = array();
-            $this->current_buffer->append_subtree($this,
-                new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp . $code, true)));
-        }
-    }
-
-    // line 255 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r2()
-    {
-    	$text = $this->yystack[ $this->yyidx + 0 ]->minor;
-
-	    if ((string)$text == '') {
-	    	$this->current_buffer->append_subtree($this, null);
-	    }
-
-	    $this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text($text, $this->strip));
-    }
-
-    // line 259 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r3()
-    {
-        $this->strip = true;
-    }
-
-    // line 264 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r4()
-    {
-        $this->strip = false;
-    }
-
-    // line 269 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r5()
-    {
-        $this->current_buffer->append_subtree($this,
-            new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + -1 ]->minor));
-    }
-
-    // line 272 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r6()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor;
-    }
-
-    // line 276 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r7()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 281 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r8()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 285 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r9()
-    {
-        $this->_retvalue = '';
-    }
-
-    // line 297 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r10()
-    {
-        if ($this->compiler->has_code) {
-            $this->current_buffer->append_subtree($this,
-                $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor));
-        }
-        $this->compiler->has_variable_string = false;
-        $this->block_nesting_level = count($this->compiler->_tag_stack);
-    }
-
-    // line 307 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r12()
-    {
-        $var =
-            trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(),
-                -$this->compiler->getRdelLength()), ' $');
-        if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
-            $this->_retvalue =
-                $this->compiler->compileTag('private_print_expression', array('nocache'),
-                    array('value' => $this->compiler->compileVariable('\'' . $match[ 1 ] . '\'')));
-        } else {
-            $this->_retvalue =
-                $this->compiler->compileTag('private_print_expression', array(),
-                    array('value' => $this->compiler->compileVariable('\'' . $var . '\'')));
-        }
-    }
-
-    // line 328 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r13()
-    {
-        $tag =
-            trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(),
-                -$this->compiler->getRdelLength()));
-        if ($tag == 'strip') {
-            $this->strip = true;
-            $this->_retvalue = null;
-        } else {
-            if (defined($tag)) {
-                if ($this->security) {
-                    $this->security->isTrustedConstant($tag, $this->compiler);
-                }
-                $this->_retvalue =
-                    $this->compiler->compileTag('private_print_expression', array(), array('value' => $tag));
-            } else {
-                if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
-                    $this->_retvalue = $this->compiler->compileTag($match[ 1 ], array('\'nocache\''));
-                } else {
-                    $this->_retvalue = $this->compiler->compileTag($tag, array());
-                }
-            }
-        }
-    }
-
-    // line 339 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r14()
-    {
-        $j = strrpos($this->yystack[ $this->yyidx + 0 ]->minor, '.');
-        if ($this->yystack[ $this->yyidx + 0 ]->minor[ $j + 1 ] == 'c') {
-            // {$smarty.block.child}
-            $this->_retvalue =
-                $this->compiler->compileTag('child', array(), array($this->yystack[ $this->yyidx + 0 ]->minor));
-        } else {
-            // {$smarty.block.parent}
-            $this->_retvalue =
-                $this->compiler->compileTag('parent', array(), array($this->yystack[ $this->yyidx + 0 ]->minor));
-        }
-    }
-
-    // line 343 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r15()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
-    }
-
-    // line 347 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r16()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
-    }
-
-    // line 356 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r17()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ],
-                array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]));
-    }
-
-    // line 360 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r18()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('assign', array_merge(array(
-                array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]),
-                array('var' => '\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'')
-            ), $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]));
-    }
-
-    // line 364 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r19()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('assign', array_merge(array(
-                array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]),
-                array('var' => $this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ])
-            ), $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]), array(
-                'smarty_internal_index' => $this->yystack[ $this->yyidx +
-                                                           -1 ]->minor[ 'smarty_internal_index' ]
-            ));
-    }
-
-    // line 368 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r20()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 383 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r21()
-    {
-        $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 393 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r25()
-    {
-        if (defined($this->yystack[ $this->yyidx + -1 ]->minor)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler);
-            }
-            $this->_retvalue =
-                $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor,
-                    array('value' => $this->yystack[ $this->yyidx + -1 ]->minor));
-        } else {
-            $this->_retvalue =
-                $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor,
-                    $this->yystack[ $this->yyidx + 0 ]->minor);
-        }
-    }
-
-    // line 406 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r26()
-    {
-        if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler);
-            }
-            $this->_retvalue =
-                $this->compiler->compileTag('private_print_expression', array(),
-                    array('value' => $this->yystack[ $this->yyidx + 0 ]->minor));
-        } else {
-            $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor, array());
-        }
-    }
-
-    // line 418 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r27()
-    {
-        if (defined($this->yystack[ $this->yyidx + -2 ]->minor)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler);
-            }
-            $this->_retvalue =
-                $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor,
-                    array(
-                        'value'        => $this->yystack[ $this->yyidx + -2 ]->minor,
-                        'modifierlist' => $this->yystack[ $this->yyidx + -1 ]->minor
-                    ));
-        } else {
-            $this->_retvalue =
-                $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor,
-                    $this->yystack[ $this->yyidx + 0 ]->minor,
-                    array('modifierlist' => $this->yystack[ $this->yyidx + -1 ]->minor));
-        }
-    }
-
-    // line 423 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r28()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor,
-                $this->yystack[ $this->yyidx + 0 ]->minor,
-                array('object_method' => $this->yystack[ $this->yyidx + -1 ]->minor));
-    }
-
-    // line 428 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r29()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag($this->yystack[ $this->yyidx + -4 ]->minor,
-                $this->yystack[ $this->yyidx + 0 ]->minor, array(
-                    'modifierlist'  => $this->yystack[ $this->yyidx + -1 ]->minor,
-                    'object_method' => $this->yystack[ $this->yyidx + -2 ]->minor
-                ));
-    }
-
-    // line 433 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r30()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('make_nocache',
-                array(array('var' => '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'')));
-    }
-
-    // line 438 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r31()
-    {
-        $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength()));
-        $this->_retvalue =
-            $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, array(),
-                array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 443 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r32()
-    {
-        $tag = trim(substr($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler->getLdelLength()));
-        $this->_retvalue =
-            $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag,
-                $this->yystack[ $this->yyidx + 0 ]->minor,
-                array('if condition' => $this->yystack[ $this->yyidx + -1 ]->minor));
-    }
-
-    // line 454 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r33()
-    {
-        $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength()));
-        $this->_retvalue =
-            $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, array(),
-                array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 458 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r35()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array(
-                array('start' => $this->yystack[ $this->yyidx + -6 ]->minor),
-                array('ifexp' => $this->yystack[ $this->yyidx + -4 ]->minor),
-                array('var' => $this->yystack[ $this->yyidx + -2 ]->minor),
-                array('step' => $this->yystack[ $this->yyidx + -1 ]->minor)
-            )), 1);
-    }
-
-    // line 466 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r36()
-    {
-        $this->_retvalue = '=' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 470 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r38()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array(
-                array('start' => $this->yystack[ $this->yyidx + -3 ]->minor),
-                array('to' => $this->yystack[ $this->yyidx + -1 ]->minor)
-            )), 0);
-    }
-
-    // line 475 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r39()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array(
-                array('start' => $this->yystack[ $this->yyidx + -5 ]->minor),
-                array('to' => $this->yystack[ $this->yyidx + -3 ]->minor),
-                array('step' => $this->yystack[ $this->yyidx + -1 ]->minor)
-            )), 0);
-    }
-
-    // line 479 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r40()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('foreach', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array(
-                array('from' => $this->yystack[ $this->yyidx + -3 ]->minor),
-                array('item' => $this->yystack[ $this->yyidx + -1 ]->minor)
-            )));
-    }
-
-    // line 482 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r41()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('foreach', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array(
-                array('from' => $this->yystack[ $this->yyidx + -5 ]->minor),
-                array('item' => $this->yystack[ $this->yyidx + -1 ]->minor),
-                array('key' => $this->yystack[ $this->yyidx + -3 ]->minor)
-            )));
-    }
-
-    // line 487 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r42()
-    {
-        $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 491 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r43()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('setfilter', array(), array(
-                'modifier_list' => array(
-                    array_merge(array($this->yystack[ $this->yyidx + -1 ]->minor),
-                        $this->yystack[ $this->yyidx + 0 ]->minor)
-                )
-            ));
-    }
-
-    // line 497 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r44()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('setfilter', array(), array(
-                'modifier_list' => array_merge(array(
-                    array_merge(array(
-                        $this->yystack[ $this->yyidx +
-                                        -2 ]->minor
-                    ), $this->yystack[ $this->yyidx + -1 ]->minor)
-                ), $this->yystack[ $this->yyidx + 0 ]->minor)
-            ));
-    }
-
-    // line 506 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r45()
-    {
-        $tag =
-            trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(),
-                -$this->compiler->getRdelLength()), ' /');
-        if ($tag === 'strip') {
-            $this->strip = false;
-            $this->_retvalue = null;
-        } else {
-            $this->_retvalue = $this->compiler->compileTag($tag . 'close', array());
-        }
-    }
-
-    // line 510 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r46()
-    {
-        $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor . 'close', array());
-    }
-
-    // line 515 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r47()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor . 'close', array(),
-                array('modifier_list' => $this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 519 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r48()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor . 'close', array(),
-                array('object_method' => $this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 527 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r49()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor . 'close', array(), array(
-                'object_method' => $this->yystack[ $this->yyidx + -1 ]->minor,
-                'modifier_list' => $this->yystack[ $this->yyidx + 0 ]->minor
-            ));
-    }
-
-    // line 533 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r50()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
-        $this->_retvalue[] = $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 538 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r51()
-    {
-        $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 543 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r52()
-    {
-        $this->_retvalue = array();
-    }
-
-    // line 554 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r53()
-    {
-        if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler);
-            }
-            $this->_retvalue =
-                array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor);
-        } else {
-            $this->_retvalue =
-                array(
-                    $this->yystack[ $this->yyidx + -2 ]->minor => '\'' .
-                                                                  $this->yystack[ $this->yyidx + 0 ]->minor .
-                                                                  '\''
-                );
-        }
-    }
-
-    // line 562 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r54()
-    {
-        $this->_retvalue =
-            array(
-                trim($this->yystack[ $this->yyidx + -1 ]->minor, " =\n\r\t") => $this->yystack[ $this->yyidx +
-                                                                                                0 ]->minor
-            );
-    }
-
-    // line 574 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r56()
-    {
-        $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\'';
-    }
-
-    // line 587 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r59()
-    {
-        $this->_retvalue =
-            array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 592 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r61()
-    {
-        $this->yystack[ $this->yyidx + -2 ]->minor[] = $this->yystack[ $this->yyidx + 0 ]->minor;
-        $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor;
-    }
-
-    // line 599 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r62()
-    {
-        $this->_retvalue =
-            array(
-                'var'   => '\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'',
-                'value' => $this->yystack[ $this->yyidx + 0 ]->minor
-            );
-    }
-
-    // line 603 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r64()
-    {
-        $this->_retvalue =
-            array(
-                'var'   => $this->yystack[ $this->yyidx + -2 ]->minor,
-                'value' => $this->yystack[ $this->yyidx + 0 ]->minor
-            );
-    }
-
-    // line 623 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r65()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
-    }
-
-    // line 628 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r68()
-    {
-        $this->_retvalue =
-            '$_smarty_tpl->getStreamVariable(\'' .
-            substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) .
-            '://' .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            '\')';
-    }
-
-    // line 638 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r69()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            trim($this->yystack[ $this->yyidx + -1 ]->minor) .
-            $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 642 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r71()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -1 ]->minor[ 'pre' ] .
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            $this->yystack[ $this->yyidx + -1 ]->minor[ 'op' ] .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            ')';
-    }
-
-    // line 646 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r72()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            $this->yystack[ $this->yyidx + -1 ]->minor .
-            $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 650 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r73()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . ')';
-    }
-
-    // line 654 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r74()
-    {
-        $this->_retvalue =
-            'in_array(' .
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            ',' .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            ')';
-    }
-
-    // line 662 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r75()
-    {
-        $this->_retvalue =
-            'in_array(' .
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            ',(array)' .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            ')';
-    }
-
-    // line 666 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r76()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -5 ]->minor .
-            ' ? ' .
-            $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'') .
-            ' : ' .
-            $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 676 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r77()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -5 ]->minor .
-            ' ? ' .
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            ' : ' .
-            $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 681 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r79()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 702 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r80()
-    {
-        $this->_retvalue = '!' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 706 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r85()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 710 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r86()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.';
-    }
-
-    // line 715 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r87()
-    {
-        $this->_retvalue = '.' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 732 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r88()
-    {
-        if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) {
-            if ($this->security) {
-                $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler);
-            }
-            $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
-        } else {
-            $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\'';
-        }
-    }
-
-    // line 736 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r90()
-    {
-        $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')';
-    }
-
-    // line 754 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r91()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            $this->yystack[ $this->yyidx + -1 ]->minor .
-            $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 765 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r95()
-    {
-        $prefixVar = $this->compiler->getNewPrefixVariable();
-        if ($this->yystack[ $this->yyidx + -2 ]->minor[ 'var' ] === '\'smarty\'') {
-            $this->compiler->appendPrefixCode("<?php {$prefixVar} = " .
-                                              $this->compiler->compileTag('private_special_variable', array(),
-                                                  $this->yystack[ $this->yyidx +
-                                                                  -2 ]->minor[ 'smarty_internal_index' ]) .
-                                              ';?>');
-        } else {
-            $this->compiler->appendPrefixCode("<?php  {$prefixVar} = " .
-                                              $this->compiler->compileVariable($this->yystack[ $this->yyidx +
-                                                                                               -2 ]->minor[ 'var' ]) .
-                                              $this->yystack[ $this->yyidx + -2 ]->minor[ 'smarty_internal_index' ] .
-                                              ';?>');
-        }
-        $this->_retvalue =
-            $prefixVar .
-            '::' .
-            $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] .
-            $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ];
-    }
-
-    // line 772 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r96()
-    {
-        $prefixVar = $this->compiler->getNewPrefixVariable();
-        $tmp = $this->compiler->appendCode('<?php ob_start();?>', $this->yystack[ $this->yyidx + 0 ]->minor);
-        $this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php {$prefixVar} = ob_get_clean();?>"));
-        $this->_retvalue = $prefixVar;
-    }
-
-    // line 785 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r97()
-    {
-        $this->_retvalue =
-            $this->compiler->compileTag('private_modifier', array(), array(
-                'value'        => $this->yystack[ $this->yyidx + -1 ]->minor,
-                'modifierlist' => $this->yystack[ $this->yyidx + 0 ]->minor
-            ));
-    }
-
-    // line 804 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r100()
-    {
-        if (!in_array(strtolower($this->yystack[ $this->yyidx + -2 ]->minor), array('self', 'parent')) &&
-            (!$this->security ||
-             $this->security->isTrustedStaticClassAccess($this->yystack[ $this->yyidx + -2 ]->minor,
-                 $this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler))) {
-            if (isset($this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ])) {
-                $this->_retvalue =
-                    $this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ] .
-                    '::' .
-                    $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] .
-                    $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ];
-            } else {
-                $this->_retvalue =
-                    $this->yystack[ $this->yyidx + -2 ]->minor .
-                    '::' .
-                    $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] .
-                    $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ];
-            }
-        } else {
-            $this->compiler->trigger_template_error('static class \'' .
-                                                    $this->yystack[ $this->yyidx + -2 ]->minor .
-                                                    '\' is undefined or not allowed by security setting');
-        }
-    }
-
-    // line 815 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r102()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 818 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r103()
-    {
-        $this->_retvalue =
-            $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'');
-    }
-
-    // line 831 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r104()
-    {
-        if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] === '\'smarty\'') {
-            $smarty_var =
-                $this->compiler->compileTag('private_special_variable', array(),
-                    $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ]);
-            $this->_retvalue = $smarty_var;
-        } else {
-            // used for array reset,next,prev,end,current
-            $this->last_variable = $this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ];
-            $this->last_index = $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ];
-            $this->_retvalue =
-                $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ]) .
-                $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ];
-        }
-    }
-
-    // line 841 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r105()
-    {
-        $this->_retvalue =
-            '$_smarty_tpl->tpl_vars[' .
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            ']->' .
-            $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 845 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r107()
-    {
-        $this->_retvalue =
-            $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -1 ]->minor . '\'');
-    }
-
-    // line 849 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r108()
-    {
-        $this->_retvalue =
-            '(is_array($tmp = ' .
-            $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'') .
-            ') ? $tmp' .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            ' :null)';
-    }
-
-    // line 853 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r109()
-    {
-        $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -1 ]->minor);
-    }
-
-    // line 857 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r110()
-    {
-        $this->_retvalue =
-            '(is_array($tmp = ' .
-            $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -2 ]->minor) .
-            ') ? $tmp' .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            ' : null)';
-    }
-
-    // line 860 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r111()
-    {
-        $this->_retvalue =
-            array(
-                'var'                   => '\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'',
-                'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor
-            );
-    }
-
-    // line 873 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r112()
-    {
-        $this->_retvalue =
-            array(
-                'var'                   => $this->yystack[ $this->yyidx + -1 ]->minor,
-                'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor
-            );
-    }
-
-    // line 879 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r114()
-    {
-        return;
-    }
-
-    // line 882 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r115()
-    {
-        $this->_retvalue =
-            '[' .
-            $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'') .
-            ']';
-    }
-
-    // line 886 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r116()
-    {
-        $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor) . ']';
-    }
-
-    // line 890 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r117()
-    {
-        $this->_retvalue =
-            '[' .
-            $this->compiler->compileVariable($this->yystack[ $this->yyidx + -2 ]->minor) .
-            '->' .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            ']';
-    }
-
-    // line 894 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r118()
-    {
-        $this->_retvalue = '[\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\']';
-    }
-
-    // line 899 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r119()
-    {
-        $this->_retvalue = '[' . $this->yystack[ $this->yyidx + 0 ]->minor . ']';
-    }
-
-    // line 904 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r120()
-    {
-        $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']';
-    }
-
-    // line 908 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r121()
-    {
-        $this->_retvalue =
-            '[' .
-            $this->compiler->compileTag('private_special_variable', array(),
-                '[\'section\'][\'' . $this->yystack[ $this->yyidx + -1 ]->minor . '\'][\'index\']') .
-            ']';
-    }
-
-    // line 911 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r122()
-    {
-        $this->_retvalue =
-            '[' .
-            $this->compiler->compileTag('private_special_variable', array(), '[\'section\'][\'' .
-                                                                             $this->yystack[ $this->yyidx +
-                                                                                             -3 ]->minor .
-                                                                             '\'][\'' .
-                                                                             $this->yystack[ $this->yyidx +
-                                                                                             -1 ]->minor .
-                                                                             '\']') .
-            ']';
-    }
-
-    // line 917 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r123()
-    {
-        $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']';
-    }
-
-    // line 933 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r125()
-    {
-        $this->_retvalue =
-            '[' .
-            $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'') .
-            ']';
-    }
-
-    // line 943 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r129()
-    {
-        $this->_retvalue = '[]';
-    }
-
-    // line 947 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r130()
-    {
-        $this->_retvalue = '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'';
-    }
-
-    // line 952 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r131()
-    {
-        $this->_retvalue = '\'\'';
-    }
-
-    // line 960 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r132()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 966 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r134()
-    {
-        $var =
-            trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(),
-                -$this->compiler->getRdelLength()), ' $');
-        $this->_retvalue = $this->compiler->compileVariable('\'' . $var . '\'');
-    }
-
-    // line 973 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r135()
-    {
-        $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')';
-    }
-
-    // line 982 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r136()
-    {
-        if ($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ] === '\'smarty\'') {
-            $this->_retvalue =
-                $this->compiler->compileTag('private_special_variable', array(),
-                    $this->yystack[ $this->yyidx + -1 ]->minor[ 'smarty_internal_index' ]) .
-                $this->yystack[ $this->yyidx + 0 ]->minor;
-        } else {
-            $this->_retvalue =
-                $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ]) .
-                $this->yystack[ $this->yyidx + -1 ]->minor[ 'smarty_internal_index' ] .
-                $this->yystack[ $this->yyidx + 0 ]->minor;
-        }
-    }
-
-    // line 987 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r137()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 992 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r138()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 999 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r139()
-    {
-        if ($this->security && substr($this->yystack[ $this->yyidx + -1 ]->minor, 0, 1) === '_') {
-            $this->compiler->trigger_template_error(self::ERR1);
-        }
-        $this->_retvalue =
-            '->' . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 1006 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r140()
-    {
-        if ($this->security) {
-            $this->compiler->trigger_template_error(self::ERR2);
-        }
-        $this->_retvalue =
-            '->{' .
-            $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor) .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            '}';
-    }
-
-    // line 1013 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r141()
-    {
-        if ($this->security) {
-            $this->compiler->trigger_template_error(self::ERR2);
-        }
-        $this->_retvalue =
-            '->{' . $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . '}';
-    }
-
-    // line 1021 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r142()
-    {
-        if ($this->security) {
-            $this->compiler->trigger_template_error(self::ERR2);
-        }
-        $this->_retvalue =
-            '->{\'' .
-            $this->yystack[ $this->yyidx + -4 ]->minor .
-            '\'.' .
-            $this->yystack[ $this->yyidx + -2 ]->minor .
-            $this->yystack[ $this->yyidx + 0 ]->minor .
-            '}';
-    }
-
-    // line 1029 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r143()
-    {
-        $this->_retvalue = '->' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 1037 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r144()
-    {
-        $this->_retvalue =
-            $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + -3 ]->minor,
-                $this->yystack[ $this->yyidx + -1 ]->minor);
-    }
-
-    // line 1044 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r145()
-    {
-        if ($this->security && substr($this->yystack[ $this->yyidx + -3 ]->minor, 0, 1) === '_') {
-            $this->compiler->trigger_template_error(self::ERR1);
-        }
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -3 ]->minor .
-            '(' .
-            implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) .
-            ')';
-    }
-
-    // line 1055 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r146()
-    {
-        if ($this->security) {
-            $this->compiler->trigger_template_error(self::ERR2);
-        }
-        $prefixVar = $this->compiler->getNewPrefixVariable();
-        $this->compiler->appendPrefixCode("<?php {$prefixVar} = " .
-                                          $this->compiler->compileVariable('\'' .
-                                                                           substr($this->yystack[ $this->yyidx +
-                                                                                                  -3 ]->minor, 1) .
-                                                                           '\'') .
-                                          ';?>');
-        $this->_retvalue = $prefixVar . '(' . implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')';
-    }
-
-    // line 1072 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r147()
-    {
-        $this->_retvalue =
-            array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 1076 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r150()
-    {
-        $this->_retvalue =
-            array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array(
-                array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor)
-            ));
-    }
-
-    // line 1084 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r151()
-    {
-        $this->_retvalue =
-            array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor));
-    }
-
-    // line 1092 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r153()
-    {
-        $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 1105 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r154()
-    {
-        $this->_retvalue =
-            array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 1114 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r157()
-    {
-        $this->_retvalue =
-            array(trim($this->yystack[ $this->yyidx + -1 ]->minor) . $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 1119 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r159()
-    {
-        $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, '', 'method');
-    }
-
-    // line 1124 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r160()
-    {
-        $this->_retvalue =
-            array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'method');
-    }
-
-    // line 1129 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r161()
-    {
-        $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, '');
-    }
-
-    // line 1134 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r162()
-    {
-        $this->_retvalue =
-            array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'property');
-    }
-
-    // line 1140 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r163()
-    {
-        $this->_retvalue =
-            array(
-                $this->yystack[ $this->yyidx + -2 ]->minor,
-                $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor, 'property'
-            );
-    }
-
-    // line 1144 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r164()
-    {
-        $this->_retvalue = ' ' . trim($this->yystack[ $this->yyidx + 0 ]->minor) . ' ';
-    }
-
-    // line 1163 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r165()
-    {
-        static $lops = array(
-            'eq'  => ' == ',
-            'ne'  => ' != ',
-            'neq' => ' != ',
-            'gt'  => ' > ',
-            'ge'  => ' >= ',
-            'gte' => ' >= ',
-            'lt'  => ' < ',
-            'le'  => ' <= ',
-            'lte' => ' <= ',
-            'mod' => ' % ',
-            'and' => ' && ',
-            'or'  => ' || ',
-            'xor' => ' xor ',
-        );
-        $op = strtolower(preg_replace('/\s*/', '', $this->yystack[ $this->yyidx + 0 ]->minor));
-        $this->_retvalue = $lops[ $op ];
-    }
-
-    // line 1176 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r166()
-    {
-        static $tlops = array(
-            'isdivby'     => array('op' => ' % ', 'pre' => '!('),
-            'isnotdivby'  => array('op' => ' % ', 'pre' => '('),
-            'isevenby'    => array('op' => ' / ', 'pre' => '!(1 & '),
-            'isnotevenby' => array('op' => ' / ', 'pre' => '(1 & '),
-            'isoddby'     => array('op' => ' / ', 'pre' => '(1 & '),
-            'isnotoddby'  => array('op' => ' / ', 'pre' => '!(1 & '),
-        );
-        $op = strtolower(preg_replace('/\s*/', '', $this->yystack[ $this->yyidx + 0 ]->minor));
-        $this->_retvalue = $tlops[ $op ];
-    }
-
-    // line 1190 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r167()
-    {
-        static $scond = array(
-            'iseven'    => '!(1 & ',
-            'isnoteven' => '(1 & ',
-            'isodd'     => '(1 & ',
-            'isnotodd'  => '!(1 & ',
-        );
-        $op = strtolower(str_replace(' ', '', $this->yystack[ $this->yyidx + 0 ]->minor));
-        $this->_retvalue = $scond[ $op ];
-    }
-
-    // line 1201 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r168()
-    {
-        $this->_retvalue = 'array(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')';
-    }
-
-    // line 1209 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r171()
-    {
-        $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 1213 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r173()
-    {
-        $this->_retvalue =
-            $this->yystack[ $this->yyidx + -2 ]->minor . '=>' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 1229 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r174()
-    {
-        $this->_retvalue =
-            '\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'=>' . $this->yystack[ $this->yyidx + 0 ]->minor;
-    }
-
-    // line 1235 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r177()
-    {
-        $this->compiler->leaveDoubleQuote();
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor->to_smarty_php($this);
-    }
-
-    // line 1240 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r178()
-    {
-        $this->yystack[ $this->yyidx + -1 ]->minor->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor);
-        $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
-    }
-
-    // line 1244 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r179()
-    {
-        $this->_retvalue = new Smarty_Internal_ParseTree_Dq($this, $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    // line 1248 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r180()
-    {
-        $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + -1 ]->minor);
-    }
-
-    // line 1252 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r181()
-    {
-        $this->_retvalue =
-            new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')');
-    }
-
-    // line 1264 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r182()
-    {
-        $this->_retvalue =
-            new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' .
-                                               substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) .
-                                               '\']->value');
-    }
-
-    // line 1268 "../smarty/lexer/smarty_internal_templateparser.y"
-    public function yy_r185()
-    {
-        $this->_retvalue = new Smarty_Internal_ParseTree_Tag($this, $this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    public function yy_r186()
-    {
-        $this->_retvalue = new Smarty_Internal_ParseTree_DqContent($this->yystack[ $this->yyidx + 0 ]->minor);
-    }
-
-    public function yy_reduce($yyruleno)
-    {
-        if ($this->yyTraceFILE && $yyruleno >= 0
-            && $yyruleno < count(self::$yyRuleName)) {
-            fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n",
-                $this->yyTracePrompt, $yyruleno,
-                self::$yyRuleName[ $yyruleno ]);
-        }
-        $this->_retvalue = $yy_lefthand_side = null;
-        if (isset(self::$yyReduceMap[ $yyruleno ])) {
-            // call the action
-            $this->_retvalue = null;
-            $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}();
-            $yy_lefthand_side = $this->_retvalue;
-        }
-        $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ];
-        $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ];
-        $this->yyidx -= $yysize;
-        for ($i = $yysize; $i; $i--) {
-            // pop all of the right-hand side parameters
-            array_pop($this->yystack);
-        }
-        $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto);
-        if ($yyact < self::YYNSTATE) {
-            if (!$this->yyTraceFILE && $yysize) {
-                $this->yyidx++;
-                $x = new TP_yyStackEntry;
-                $x->stateno = $yyact;
-                $x->major = $yygoto;
-                $x->minor = $yy_lefthand_side;
-                $this->yystack[ $this->yyidx ] = $x;
-            } else {
-                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
-            }
-        } elseif ($yyact === self::YYNSTATE + self::YYNRULE + 1) {
-            $this->yy_accept();
-        }
-    }
-
-    public function yy_parse_failed()
-    {
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
-        }
-        while ($this->yyidx >= 0) {
-            $this->yy_pop_parser_stack();
-        }
-    }
-
-    public function yy_syntax_error($yymajor, $TOKEN)
-    {
-        // line 214 "../smarty/lexer/smarty_internal_templateparser.y"
-        $this->internalError = true;
-        $this->yymajor = $yymajor;
-        $this->compiler->trigger_template_error();
-    }
-
-    public function yy_accept()
-    {
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
-        }
-        while ($this->yyidx >= 0) {
-            $this->yy_pop_parser_stack();
-        }
-        // line 207 "../smarty/lexer/smarty_internal_templateparser.y"
-        $this->successful = !$this->internalError;
-        $this->internalError = false;
-        $this->retvalue = $this->_retvalue;
-    }
-
-    public function doParse($yymajor, $yytokenvalue)
-    {
-        $yyerrorhit = 0;   /* True if yymajor has invoked an error */
-        if ($this->yyidx === null || $this->yyidx < 0) {
-            $this->yyidx = 0;
-            $this->yyerrcnt = -1;
-            $x = new TP_yyStackEntry;
-            $x->stateno = 0;
-            $x->major = 0;
-            $this->yystack = array();
-            $this->yystack[] = $x;
-        }
-        $yyendofinput = ($yymajor == 0);
-        if ($this->yyTraceFILE) {
-            fprintf($this->yyTraceFILE, "%sInput %s\n",
-                $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
-        }
-        do {
-            $yyact = $this->yy_find_shift_action($yymajor);
-            if ($yymajor < self::YYERRORSYMBOL &&
-                !$this->yy_is_expected_token($yymajor)) {
-                // force a syntax error
-                $yyact = self::YY_ERROR_ACTION;
-            }
-            if ($yyact < self::YYNSTATE) {
-                $this->yy_shift($yyact, $yymajor, $yytokenvalue);
-                $this->yyerrcnt--;
-                if ($yyendofinput && $this->yyidx >= 0) {
-                    $yymajor = 0;
-                } else {
-                    $yymajor = self::YYNOCODE;
-                }
-            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
-                $this->yy_reduce($yyact - self::YYNSTATE);
-            } elseif ($yyact === self::YY_ERROR_ACTION) {
-                if ($this->yyTraceFILE) {
-                    fprintf($this->yyTraceFILE, "%sSyntax Error!\n",
-                        $this->yyTracePrompt);
-                }
-                if (self::YYERRORSYMBOL) {
-                    if ($this->yyerrcnt < 0) {
-                        $this->yy_syntax_error($yymajor, $yytokenvalue);
-                    }
-                    $yymx = $this->yystack[ $this->yyidx ]->major;
-                    if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) {
-                        if ($this->yyTraceFILE) {
-                            fprintf($this->yyTraceFILE, "%sDiscard input token %s\n",
-                                $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
-                        }
-                        $this->yy_destructor($yymajor, $yytokenvalue);
-                        $yymajor = self::YYNOCODE;
-                    } else {
-                        while ($this->yyidx >= 0 &&
-                               $yymx !== self::YYERRORSYMBOL &&
-                               ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
-                        ) {
-                            $this->yy_pop_parser_stack();
-                        }
-                        if ($this->yyidx < 0 || $yymajor == 0) {
-                            $this->yy_destructor($yymajor, $yytokenvalue);
-                            $this->yy_parse_failed();
-                            $yymajor = self::YYNOCODE;
-                        } elseif ($yymx !== self::YYERRORSYMBOL) {
-                            $u2 = 0;
-                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
-                        }
-                    }
-                    $this->yyerrcnt = 3;
-                    $yyerrorhit = 1;
-                } else {
-                    if ($this->yyerrcnt <= 0) {
-                        $this->yy_syntax_error($yymajor, $yytokenvalue);
-                    }
-                    $this->yyerrcnt = 3;
-                    $this->yy_destructor($yymajor, $yytokenvalue);
-                    if ($yyendofinput) {
-                        $this->yy_parse_failed();
-                    }
-                    $yymajor = self::YYNOCODE;
-                }
-            } else {
-                $this->yy_accept();
-                $yymajor = self::YYNOCODE;
-            }
-        } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0);
-    }
-}
-
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_testinstall.php b/libraries/Smarty/libs/sysplugins/smarty_internal_testinstall.php
deleted file mode 100644
index 504a4582c..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_testinstall.php
+++ /dev/null
@@ -1,609 +0,0 @@
-<?php
-/**
- * Smarty Internal TestInstall
- * Test Smarty installation
- *
- * @package    Smarty
- * @subpackage Utilities
- * @author     Uwe Tews
- */
-
-/**
- * TestInstall class
- *
- * @package    Smarty
- * @subpackage Utilities
- */
-class Smarty_Internal_TestInstall
-{
-    /**
-     * diagnose Smarty setup
-     * If $errors is secified, the diagnostic report will be appended to the array, rather than being output.
-     *
-     * @param \Smarty $smarty
-     * @param array   $errors array to push results into rather than outputting them
-     *
-     * @return bool status, true if everything is fine, false else
-     */
-    public static function testInstall(Smarty $smarty, &$errors = null)
-    {
-        $status = true;
-        if ($errors === null) {
-            echo "<PRE>\n";
-            echo "Smarty Installation test...\n";
-            echo "Testing template directory...\n";
-        }
-        $_stream_resolve_include_path = function_exists('stream_resolve_include_path');
-        // test if all registered template_dir are accessible
-        foreach ($smarty->getTemplateDir() as $template_dir) {
-            $_template_dir = $template_dir;
-            $template_dir = realpath($template_dir);
-            // resolve include_path or fail existence
-            if (!$template_dir) {
-                if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_template_dir)) {
-                    // try PHP include_path
-                    if ($_stream_resolve_include_path) {
-                        $template_dir = stream_resolve_include_path($_template_dir);
-                    } else {
-                        $template_dir = $smarty->ext->_getIncludePath->getIncludePath($_template_dir, null, $smarty);
-                    }
-                    if ($template_dir !== false) {
-                        if ($errors === null) {
-                            echo "$template_dir is OK.\n";
-                        }
-                        continue;
-                    } else {
-                        $status = false;
-                        $message =
-                            "FAILED: $_template_dir does not exist (and couldn't be found in include_path either)";
-                        if ($errors === null) {
-                            echo $message . ".\n";
-                        } else {
-                            $errors[ 'template_dir' ] = $message;
-                        }
-                        continue;
-                    }
-                } else {
-                    $status = false;
-                    $message = "FAILED: $_template_dir does not exist";
-                    if ($errors === null) {
-                        echo $message . ".\n";
-                    } else {
-                        $errors[ 'template_dir' ] = $message;
-                    }
-                    continue;
-                }
-            }
-            if (!is_dir($template_dir)) {
-                $status = false;
-                $message = "FAILED: $template_dir is not a directory";
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'template_dir' ] = $message;
-                }
-            } elseif (!is_readable($template_dir)) {
-                $status = false;
-                $message = "FAILED: $template_dir is not readable";
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'template_dir' ] = $message;
-                }
-            } else {
-                if ($errors === null) {
-                    echo "$template_dir is OK.\n";
-                }
-            }
-        }
-        if ($errors === null) {
-            echo "Testing compile directory...\n";
-        }
-        // test if registered compile_dir is accessible
-        $__compile_dir = $smarty->getCompileDir();
-        $_compile_dir = realpath($__compile_dir);
-        if (!$_compile_dir) {
-            $status = false;
-            $message = "FAILED: {$__compile_dir} does not exist";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'compile_dir' ] = $message;
-            }
-        } elseif (!is_dir($_compile_dir)) {
-            $status = false;
-            $message = "FAILED: {$_compile_dir} is not a directory";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'compile_dir' ] = $message;
-            }
-        } elseif (!is_readable($_compile_dir)) {
-            $status = false;
-            $message = "FAILED: {$_compile_dir} is not readable";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'compile_dir' ] = $message;
-            }
-        } elseif (!is_writable($_compile_dir)) {
-            $status = false;
-            $message = "FAILED: {$_compile_dir} is not writable";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'compile_dir' ] = $message;
-            }
-        } else {
-            if ($errors === null) {
-                echo "{$_compile_dir} is OK.\n";
-            }
-        }
-        if ($errors === null) {
-            echo "Testing plugins directory...\n";
-        }
-        // test if all registered plugins_dir are accessible
-        // and if core plugins directory is still registered
-        $_core_plugins_dir = realpath(dirname(__FILE__) . '/../plugins');
-        $_core_plugins_available = false;
-        foreach ($smarty->getPluginsDir() as $plugin_dir) {
-            $_plugin_dir = $plugin_dir;
-            $plugin_dir = realpath($plugin_dir);
-            // resolve include_path or fail existence
-            if (!$plugin_dir) {
-                if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
-                    // try PHP include_path
-                    if ($_stream_resolve_include_path) {
-                        $plugin_dir = stream_resolve_include_path($_plugin_dir);
-                    } else {
-                        $plugin_dir = $smarty->ext->_getIncludePath->getIncludePath($_plugin_dir, null, $smarty);
-                    }
-                    if ($plugin_dir !== false) {
-                        if ($errors === null) {
-                            echo "$plugin_dir is OK.\n";
-                        }
-                        continue;
-                    } else {
-                        $status = false;
-                        $message = "FAILED: $_plugin_dir does not exist (and couldn't be found in include_path either)";
-                        if ($errors === null) {
-                            echo $message . ".\n";
-                        } else {
-                            $errors[ 'plugins_dir' ] = $message;
-                        }
-                        continue;
-                    }
-                } else {
-                    $status = false;
-                    $message = "FAILED: $_plugin_dir does not exist";
-                    if ($errors === null) {
-                        echo $message . ".\n";
-                    } else {
-                        $errors[ 'plugins_dir' ] = $message;
-                    }
-                    continue;
-                }
-            }
-            if (!is_dir($plugin_dir)) {
-                $status = false;
-                $message = "FAILED: $plugin_dir is not a directory";
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'plugins_dir' ] = $message;
-                }
-            } elseif (!is_readable($plugin_dir)) {
-                $status = false;
-                $message = "FAILED: $plugin_dir is not readable";
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'plugins_dir' ] = $message;
-                }
-            } elseif ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) {
-                $_core_plugins_available = true;
-                if ($errors === null) {
-                    echo "$plugin_dir is OK.\n";
-                }
-            } else {
-                if ($errors === null) {
-                    echo "$plugin_dir is OK.\n";
-                }
-            }
-        }
-        if (!$_core_plugins_available) {
-            $status = false;
-            $message = "WARNING: Smarty's own libs/plugins is not available";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } elseif (!isset($errors[ 'plugins_dir' ])) {
-                $errors[ 'plugins_dir' ] = $message;
-            }
-        }
-        if ($errors === null) {
-            echo "Testing cache directory...\n";
-        }
-        // test if all registered cache_dir is accessible
-        $__cache_dir = $smarty->getCacheDir();
-        $_cache_dir = realpath($__cache_dir);
-        if (!$_cache_dir) {
-            $status = false;
-            $message = "FAILED: {$__cache_dir} does not exist";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'cache_dir' ] = $message;
-            }
-        } elseif (!is_dir($_cache_dir)) {
-            $status = false;
-            $message = "FAILED: {$_cache_dir} is not a directory";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'cache_dir' ] = $message;
-            }
-        } elseif (!is_readable($_cache_dir)) {
-            $status = false;
-            $message = "FAILED: {$_cache_dir} is not readable";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'cache_dir' ] = $message;
-            }
-        } elseif (!is_writable($_cache_dir)) {
-            $status = false;
-            $message = "FAILED: {$_cache_dir} is not writable";
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'cache_dir' ] = $message;
-            }
-        } else {
-            if ($errors === null) {
-                echo "{$_cache_dir} is OK.\n";
-            }
-        }
-        if ($errors === null) {
-            echo "Testing configs directory...\n";
-        }
-        // test if all registered config_dir are accessible
-        foreach ($smarty->getConfigDir() as $config_dir) {
-            $_config_dir = $config_dir;
-            // resolve include_path or fail existence
-            if (!$config_dir) {
-                if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_config_dir)) {
-                    // try PHP include_path
-                    if ($_stream_resolve_include_path) {
-                        $config_dir = stream_resolve_include_path($_config_dir);
-                    } else {
-                        $config_dir = $smarty->ext->_getIncludePath->getIncludePath($_config_dir, null, $smarty);
-                    }
-                    if ($config_dir !== false) {
-                        if ($errors === null) {
-                            echo "$config_dir is OK.\n";
-                        }
-                        continue;
-                    } else {
-                        $status = false;
-                        $message = "FAILED: $_config_dir does not exist (and couldn't be found in include_path either)";
-                        if ($errors === null) {
-                            echo $message . ".\n";
-                        } else {
-                            $errors[ 'config_dir' ] = $message;
-                        }
-                        continue;
-                    }
-                } else {
-                    $status = false;
-                    $message = "FAILED: $_config_dir does not exist";
-                    if ($errors === null) {
-                        echo $message . ".\n";
-                    } else {
-                        $errors[ 'config_dir' ] = $message;
-                    }
-                    continue;
-                }
-            }
-            if (!is_dir($config_dir)) {
-                $status = false;
-                $message = "FAILED: $config_dir is not a directory";
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'config_dir' ] = $message;
-                }
-            } elseif (!is_readable($config_dir)) {
-                $status = false;
-                $message = "FAILED: $config_dir is not readable";
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'config_dir' ] = $message;
-                }
-            } else {
-                if ($errors === null) {
-                    echo "$config_dir is OK.\n";
-                }
-            }
-        }
-        if ($errors === null) {
-            echo "Testing sysplugin files...\n";
-        }
-        // test if sysplugins are available
-        $source = SMARTY_SYSPLUGINS_DIR;
-        if (is_dir($source)) {
-            $expectedSysplugins = array(
-                'smartycompilerexception.php'                               => true,
-                'smartyexception.php'                                       => true,
-                'smarty_cacheresource.php'                                  => true,
-                'smarty_cacheresource_custom.php'                           => true,
-                'smarty_cacheresource_keyvaluestore.php'                    => true,
-                'smarty_data.php'                                           => true,
-                'smarty_internal_block.php'                                 => true,
-                'smarty_internal_cacheresource_file.php'                    => true,
-                'smarty_internal_compilebase.php'                           => true,
-                'smarty_internal_compile_append.php'                        => true,
-                'smarty_internal_compile_assign.php'                        => true,
-                'smarty_internal_compile_block.php'                         => true,
-                'smarty_internal_compile_block_child.php'                   => true,
-                'smarty_internal_compile_block_parent.php'                  => true,
-                'smarty_internal_compile_child.php'                         => true,
-                'smarty_internal_compile_parent.php'                        => true,
-                'smarty_internal_compile_break.php'                         => true,
-                'smarty_internal_compile_call.php'                          => true,
-                'smarty_internal_compile_capture.php'                       => true,
-                'smarty_internal_compile_config_load.php'                   => true,
-                'smarty_internal_compile_continue.php'                      => true,
-                'smarty_internal_compile_debug.php'                         => true,
-                'smarty_internal_compile_eval.php'                          => true,
-                'smarty_internal_compile_extends.php'                       => true,
-                'smarty_internal_compile_for.php'                           => true,
-                'smarty_internal_compile_foreach.php'                       => true,
-                'smarty_internal_compile_function.php'                      => true,
-                'smarty_internal_compile_if.php'                            => true,
-                'smarty_internal_compile_include.php'                       => true,
-                'smarty_internal_compile_include_php.php'                   => true,
-                'smarty_internal_compile_insert.php'                        => true,
-                'smarty_internal_compile_ldelim.php'                        => true,
-                'smarty_internal_compile_make_nocache.php'                  => true,
-                'smarty_internal_compile_nocache.php'                       => true,
-                'smarty_internal_compile_private_block_plugin.php'          => true,
-                'smarty_internal_compile_private_foreachsection.php'        => true,
-                'smarty_internal_compile_private_function_plugin.php'       => true,
-                'smarty_internal_compile_private_modifier.php'              => true,
-                'smarty_internal_compile_private_object_block_function.php' => true,
-                'smarty_internal_compile_private_object_function.php'       => true,
-                'smarty_internal_compile_private_php.php'                   => true,
-                'smarty_internal_compile_private_print_expression.php'      => true,
-                'smarty_internal_compile_private_registered_block.php'      => true,
-                'smarty_internal_compile_private_registered_function.php'   => true,
-                'smarty_internal_compile_private_special_variable.php'      => true,
-                'smarty_internal_compile_rdelim.php'                        => true,
-                'smarty_internal_compile_section.php'                       => true,
-                'smarty_internal_compile_setfilter.php'                     => true,
-                'smarty_internal_compile_shared_inheritance.php'            => true,
-                'smarty_internal_compile_while.php'                         => true,
-                'smarty_internal_configfilelexer.php'                       => true,
-                'smarty_internal_configfileparser.php'                      => true,
-                'smarty_internal_config_file_compiler.php'                  => true,
-                'smarty_internal_data.php'                                  => true,
-                'smarty_internal_debug.php'                                 => true,
-                'smarty_internal_errorhandler.php'                          => true,
-                'smarty_internal_extension_handler.php'                     => true,
-                'smarty_internal_method_addautoloadfilters.php'             => true,
-                'smarty_internal_method_adddefaultmodifiers.php'            => true,
-                'smarty_internal_method_append.php'                         => true,
-                'smarty_internal_method_appendbyref.php'                    => true,
-                'smarty_internal_method_assignbyref.php'                    => true,
-                'smarty_internal_method_assignglobal.php'                   => true,
-                'smarty_internal_method_clearallassign.php'                 => true,
-                'smarty_internal_method_clearallcache.php'                  => true,
-                'smarty_internal_method_clearassign.php'                    => true,
-                'smarty_internal_method_clearcache.php'                     => true,
-                'smarty_internal_method_clearcompiledtemplate.php'          => true,
-                'smarty_internal_method_clearconfig.php'                    => true,
-                'smarty_internal_method_compileallconfig.php'               => true,
-                'smarty_internal_method_compilealltemplates.php'            => true,
-                'smarty_internal_method_configload.php'                     => true,
-                'smarty_internal_method_createdata.php'                     => true,
-                'smarty_internal_method_getautoloadfilters.php'             => true,
-                'smarty_internal_method_getconfigvariable.php'              => true,
-                'smarty_internal_method_getconfigvars.php'                  => true,
-                'smarty_internal_method_getdebugtemplate.php'               => true,
-                'smarty_internal_method_getdefaultmodifiers.php'            => true,
-                'smarty_internal_method_getglobal.php'                      => true,
-                'smarty_internal_method_getregisteredobject.php'            => true,
-                'smarty_internal_method_getstreamvariable.php'              => true,
-                'smarty_internal_method_gettags.php'                        => true,
-                'smarty_internal_method_gettemplatevars.php'                => true,
-                'smarty_internal_method_literals.php'                       => true,
-                'smarty_internal_method_loadfilter.php'                     => true,
-                'smarty_internal_method_loadplugin.php'                     => true,
-                'smarty_internal_method_mustcompile.php'                    => true,
-                'smarty_internal_method_registercacheresource.php'          => true,
-                'smarty_internal_method_registerclass.php'                  => true,
-                'smarty_internal_method_registerdefaultconfighandler.php'   => true,
-                'smarty_internal_method_registerdefaultpluginhandler.php'   => true,
-                'smarty_internal_method_registerdefaulttemplatehandler.php' => true,
-                'smarty_internal_method_registerfilter.php'                 => true,
-                'smarty_internal_method_registerobject.php'                 => true,
-                'smarty_internal_method_registerplugin.php'                 => true,
-                'smarty_internal_method_registerresource.php'               => true,
-                'smarty_internal_method_setautoloadfilters.php'             => true,
-                'smarty_internal_method_setdebugtemplate.php'               => true,
-                'smarty_internal_method_setdefaultmodifiers.php'            => true,
-                'smarty_internal_method_unloadfilter.php'                   => true,
-                'smarty_internal_method_unregistercacheresource.php'        => true,
-                'smarty_internal_method_unregisterfilter.php'               => true,
-                'smarty_internal_method_unregisterobject.php'               => true,
-                'smarty_internal_method_unregisterplugin.php'               => true,
-                'smarty_internal_method_unregisterresource.php'             => true,
-                'smarty_internal_nocache_insert.php'                        => true,
-                'smarty_internal_parsetree.php'                             => true,
-                'smarty_internal_parsetree_code.php'                        => true,
-                'smarty_internal_parsetree_dq.php'                          => true,
-                'smarty_internal_parsetree_dqcontent.php'                   => true,
-                'smarty_internal_parsetree_tag.php'                         => true,
-                'smarty_internal_parsetree_template.php'                    => true,
-                'smarty_internal_parsetree_text.php'                        => true,
-                'smarty_internal_resource_eval.php'                         => true,
-                'smarty_internal_resource_extends.php'                      => true,
-                'smarty_internal_resource_file.php'                         => true,
-                'smarty_internal_resource_php.php'                          => true,
-                'smarty_internal_resource_registered.php'                   => true,
-                'smarty_internal_resource_stream.php'                       => true,
-                'smarty_internal_resource_string.php'                       => true,
-                'smarty_internal_runtime_cachemodify.php'                   => true,
-                'smarty_internal_runtime_cacheresourcefile.php'             => true,
-                'smarty_internal_runtime_capture.php'                       => true,
-                'smarty_internal_runtime_codeframe.php'                     => true,
-                'smarty_internal_runtime_filterhandler.php'                 => true,
-                'smarty_internal_runtime_foreach.php'                       => true,
-                'smarty_internal_runtime_getincludepath.php'                => true,
-                'smarty_internal_runtime_inheritance.php'                   => true,
-                'smarty_internal_runtime_make_nocache.php'                  => true,
-                'smarty_internal_runtime_tplfunction.php'                   => true,
-                'smarty_internal_runtime_updatecache.php'                   => true,
-                'smarty_internal_runtime_updatescope.php'                   => true,
-                'smarty_internal_runtime_writefile.php'                     => true,
-                'smarty_internal_smartytemplatecompiler.php'                => true,
-                'smarty_internal_template.php'                              => true,
-                'smarty_internal_templatebase.php'                          => true,
-                'smarty_internal_templatecompilerbase.php'                  => true,
-                'smarty_internal_templatelexer.php'                         => true,
-                'smarty_internal_templateparser.php'                        => true,
-                'smarty_internal_testinstall.php'                           => true,
-                'smarty_internal_undefined.php'                             => true,
-                'smarty_resource.php'                                       => true,
-                'smarty_resource_custom.php'                                => true,
-                'smarty_resource_recompiled.php'                            => true,
-                'smarty_resource_uncompiled.php'                            => true,
-                'smarty_security.php'                                       => true,
-                'smarty_template_cached.php'                                => true,
-                'smarty_template_compiled.php'                              => true,
-                'smarty_template_config.php'                                => true,
-                'smarty_template_resource_base.php'                         => true,
-                'smarty_template_source.php'                                => true,
-                'smarty_undefined_variable.php'                             => true,
-                'smarty_variable.php'                                       => true,
-            );
-            $iterator = new DirectoryIterator($source);
-            foreach ($iterator as $file) {
-                if (!$file->isDot()) {
-                    $filename = $file->getFilename();
-                    if (isset($expectedSysplugins[ $filename ])) {
-                        unset($expectedSysplugins[ $filename ]);
-                    }
-                }
-            }
-            if ($expectedSysplugins) {
-                $status = false;
-                $message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expectedSysplugins));
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'sysplugins' ] = $message;
-                }
-            } elseif ($errors === null) {
-                echo "... OK\n";
-            }
-        } else {
-            $status = false;
-            $message = "FAILED: " . SMARTY_SYSPLUGINS_DIR . ' is not a directory';
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'sysplugins_dir_constant' ] = $message;
-            }
-        }
-        if ($errors === null) {
-            echo "Testing plugin files...\n";
-        }
-        // test if core plugins are available
-        $source = SMARTY_PLUGINS_DIR;
-        if (is_dir($source)) {
-            $expectedPlugins = array(
-                'block.textformat.php'                  => true,
-                'function.counter.php'                  => true,
-                'function.cycle.php'                    => true,
-                'function.fetch.php'                    => true,
-                'function.html_checkboxes.php'          => true,
-                'function.html_image.php'               => true,
-                'function.html_options.php'             => true,
-                'function.html_radios.php'              => true,
-                'function.html_select_date.php'         => true,
-                'function.html_select_time.php'         => true,
-                'function.html_table.php'               => true,
-                'function.mailto.php'                   => true,
-                'function.math.php'                     => true,
-                'modifier.capitalize.php'               => true,
-                'modifier.date_format.php'              => true,
-                'modifier.debug_print_var.php'          => true,
-                'modifier.escape.php'                   => true,
-                'modifier.mb_wordwrap.php'              => true,
-                'modifier.regex_replace.php'            => true,
-                'modifier.replace.php'                  => true,
-                'modifier.spacify.php'                  => true,
-                'modifier.truncate.php'                 => true,
-                'modifiercompiler.cat.php'              => true,
-                'modifiercompiler.count_characters.php' => true,
-                'modifiercompiler.count_paragraphs.php' => true,
-                'modifiercompiler.count_sentences.php'  => true,
-                'modifiercompiler.count_words.php'      => true,
-                'modifiercompiler.default.php'          => true,
-                'modifiercompiler.escape.php'           => true,
-                'modifiercompiler.from_charset.php'     => true,
-                'modifiercompiler.indent.php'           => true,
-                'modifiercompiler.lower.php'            => true,
-                'modifiercompiler.noprint.php'          => true,
-                'modifiercompiler.string_format.php'    => true,
-                'modifiercompiler.strip.php'            => true,
-                'modifiercompiler.strip_tags.php'       => true,
-                'modifiercompiler.to_charset.php'       => true,
-                'modifiercompiler.unescape.php'         => true,
-                'modifiercompiler.upper.php'            => true,
-                'modifiercompiler.wordwrap.php'         => true,
-                'outputfilter.trimwhitespace.php'       => true,
-                'shared.escape_special_chars.php'       => true,
-                'shared.literal_compiler_param.php'     => true,
-                'shared.make_timestamp.php'             => true,
-                'shared.mb_str_replace.php'             => true,
-                'shared.mb_unicode.php'                 => true,
-                'variablefilter.htmlspecialchars.php'   => true,
-            );
-            $iterator = new DirectoryIterator($source);
-            foreach ($iterator as $file) {
-                if (!$file->isDot()) {
-                    $filename = $file->getFilename();
-                    if (isset($expectedPlugins[ $filename ])) {
-                        unset($expectedPlugins[ $filename ]);
-                    }
-                }
-            }
-            if ($expectedPlugins) {
-                $status = false;
-                $message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expectedPlugins));
-                if ($errors === null) {
-                    echo $message . ".\n";
-                } else {
-                    $errors[ 'plugins' ] = $message;
-                }
-            } elseif ($errors === null) {
-                echo "... OK\n";
-            }
-        } else {
-            $status = false;
-            $message = "FAILED: " . SMARTY_PLUGINS_DIR . ' is not a directory';
-            if ($errors === null) {
-                echo $message . ".\n";
-            } else {
-                $errors[ 'plugins_dir_constant' ] = $message;
-            }
-        }
-        if ($errors === null) {
-            echo "Tests complete.\n";
-            echo "</PRE>\n";
-        }
-        return $status;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_internal_undefined.php b/libraries/Smarty/libs/sysplugins/smarty_internal_undefined.php
deleted file mode 100644
index 7df0acc2d..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_internal_undefined.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * Smarty Internal Undefined
- *
- * Class to handle undefined method calls or calls to obsolete runtime extensions
- *
- * @package    Smarty
- * @subpackage PluginsInternal
- * @author     Uwe Tews
- */
-class Smarty_Internal_Undefined
-{
-    /**
-     * Name of undefined extension class
-     *
-     * @var string|null
-     */
-    public $class = null;
-
-    /**
-     * Smarty_Internal_Undefined constructor.
-     *
-     * @param null|string $class name of undefined extension class
-     */
-    public function __construct($class = null)
-    {
-        $this->class = $class;
-    }
-
-    /**
-     * Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled
-     *
-     * @param \Smarty_Internal_Template $tpl
-     * @param array                     $properties special template properties
-     * @param bool                      $cache      flag if called from cache file
-     *
-     * @return bool false
-     */
-    public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
-    {
-        if ($cache) {
-            $tpl->cached->valid = false;
-        } else {
-            $tpl->mustCompile = true;
-        }
-        return false;
-    }
-
-    /**
-     * Call error handler for undefined method
-     *
-     * @param string $name unknown method-name
-     * @param array  $args argument array
-     *
-     * @return mixed
-     * @throws SmartyException
-     */
-    public function __call($name, $args)
-    {
-        if (isset($this->class)) {
-            throw new SmartyException("undefined extension class '{$this->class}'");
-        } else {
-            throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_resource.php b/libraries/Smarty/libs/sysplugins/smarty_resource.php
deleted file mode 100644
index aae7e42f7..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_resource.php
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-/**
- * Smarty Resource Plugin
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Resource Plugin
- * Base implementation for resource plugins
- *
- * @package    Smarty
- * @subpackage TemplateResources
- *
- * @method renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
- * @method populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
- * @method process(Smarty_Internal_Template $_smarty_tpl)
- */
-abstract class Smarty_Resource
-{
-    /**
-     * resource types provided by the core
-     *
-     * @var array
-     */
-    public static $sysplugins = array(
-        'file'    => 'smarty_internal_resource_file.php',
-        'string'  => 'smarty_internal_resource_string.php',
-        'extends' => 'smarty_internal_resource_extends.php',
-        'stream'  => 'smarty_internal_resource_stream.php',
-        'eval'    => 'smarty_internal_resource_eval.php',
-        'php'     => 'smarty_internal_resource_php.php'
-    );
-
-    /**
-     * Source is bypassing compiler
-     *
-     * @var boolean
-     */
-    public $uncompiled = false;
-
-    /**
-     * Source must be recompiled on every occasion
-     *
-     * @var boolean
-     */
-    public $recompiled = false;
-
-    /**
-     * Flag if resource does implement populateCompiledFilepath() method
-     *
-     * @var bool
-     */
-    public $hasCompiledHandler = false;
-
-    /**
-     * Load Resource Handler
-     *
-     * @param Smarty $smarty smarty object
-     * @param string $type   name of the resource
-     *
-     * @throws SmartyException
-     * @return Smarty_Resource Resource Handler
-     */
-    public static function load(Smarty $smarty, $type)
-    {
-        // try smarty's cache
-        if (isset($smarty->_cache[ 'resource_handlers' ][ $type ])) {
-            return $smarty->_cache[ 'resource_handlers' ][ $type ];
-        }
-        // try registered resource
-        if (isset($smarty->registered_resources[ $type ])) {
-            return $smarty->_cache[ 'resource_handlers' ][ $type ] =
-                $smarty->registered_resources[ $type ] instanceof Smarty_Resource ?
-                    $smarty->registered_resources[ $type ] : new Smarty_Internal_Resource_Registered();
-        }
-        // try sysplugins dir
-        if (isset(self::$sysplugins[ $type ])) {
-            $_resource_class = 'Smarty_Internal_Resource_' . ucfirst($type);
-            return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class();
-        }
-        // try plugins dir
-        $_resource_class = 'Smarty_Resource_' . ucfirst($type);
-        if ($smarty->loadPlugin($_resource_class)) {
-            if (class_exists($_resource_class, false)) {
-                return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class();
-            } else {
-                $smarty->registerResource(
-                    $type,
-                    array(
-                        "smarty_resource_{$type}_source", "smarty_resource_{$type}_timestamp",
-                        "smarty_resource_{$type}_secure", "smarty_resource_{$type}_trusted"
-                    )
-                );
-                // give it another try, now that the resource is registered properly
-                return self::load($smarty, $type);
-            }
-        }
-        // try streams
-        $_known_stream = stream_get_wrappers();
-        if (in_array($type, $_known_stream)) {
-            // is known stream
-            if (is_object($smarty->security_policy)) {
-                $smarty->security_policy->isTrustedStream($type);
-            }
-            return $smarty->_cache[ 'resource_handlers' ][ $type ] = new Smarty_Internal_Resource_Stream();
-        }
-        // TODO: try default_(template|config)_handler
-        // give up
-        throw new SmartyException("Unknown resource type '{$type}'");
-    }
-
-    /**
-     * extract resource_type and resource_name from template_resource and config_resource
-     *
-     * @note "C:/foo.tpl" was forced to file resource up till Smarty 3.1.3 (including).
-     *
-     * @param string $resource_name    template_resource or config_resource to parse
-     * @param string $default_resource the default resource_type defined in $smarty
-     *
-     * @return array with parsed resource name and type
-     */
-    public static function parseResourceName($resource_name, $default_resource)
-    {
-        if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]/', $resource_name, $match)) {
-            $type = $match[ 1 ];
-            $name = substr($resource_name, strlen($match[ 0 ]));
-        } else {
-            // no resource given, use default
-            // or single character before the colon is not a resource type, but part of the filepath
-            $type = $default_resource;
-            $name = $resource_name;
-        }
-        return array($name, $type);
-    }
-
-    /**
-     * modify template_resource according to resource handlers specifications
-     *
-     * @param \Smarty_Internal_Template|\Smarty $obj               Smarty instance
-     * @param string                            $template_resource template_resource to extract resource handler and
-     *                                                             name of
-     *
-     * @return string unique resource name
-     * @throws \SmartyException
-     */
-    public static function getUniqueTemplateName($obj, $template_resource)
-    {
-        $smarty = $obj->_getSmartyObj();
-        list($name, $type) = self::parseResourceName($template_resource, $smarty->default_resource_type);
-        // TODO: optimize for Smarty's internal resource types
-        $resource = Smarty_Resource::load($smarty, $type);
-        // go relative to a given template?
-        $_file_is_dotted = $name[ 0 ] === '.' && ($name[ 1 ] === '.' || $name[ 1 ] === '/');
-        if ($obj->_isTplObj() && $_file_is_dotted
-            && ($obj->source->type === 'file' || $obj->parent->source->type === 'extends')
-        ) {
-            $name = $smarty->_realpath(dirname($obj->parent->source->filepath) . DIRECTORY_SEPARATOR . $name);
-        }
-        return $resource->buildUniqueResourceName($smarty, $name);
-    }
-
-    /**
-     * initialize Source Object for given resource
-     * wrapper for backward compatibility to versions < 3.1.22
-     * Either [$_template] or [$smarty, $template_resource] must be specified
-     *
-     * @param Smarty_Internal_Template $_template         template object
-     * @param Smarty                   $smarty            smarty object
-     * @param string                   $template_resource resource identifier
-     *
-     * @return \Smarty_Template_Source Source Object
-     * @throws \SmartyException
-     */
-    public static function source(
-        Smarty_Internal_Template $_template = null,
-        Smarty $smarty = null,
-        $template_resource = null
-    ) {
-        return Smarty_Template_Source::load($_template, $smarty, $template_resource);
-    }
-
-    /**
-     * Load template's source into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     * @throws SmartyException        if source cannot be loaded
-     */
-    abstract public function getContent(Smarty_Template_Source $source);
-
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     */
-    abstract public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null);
-
-    /**
-     * populate Source Object with timestamp and exists from Resource
-     *
-     * @param Smarty_Template_Source $source source object
-     */
-    public function populateTimestamp(Smarty_Template_Source $source)
-    {
-        // intentionally left blank
-    }
-
-    /**
-     * modify resource_name according to resource handlers specifications
-     *
-     * @param Smarty  $smarty        Smarty instance
-     * @param string  $resource_name resource_name to make unique
-     * @param boolean $isConfig      flag for config resource
-     *
-     * @return string unique resource name
-     */
-    public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false)
-    {
-        if ($isConfig) {
-            if (!isset($smarty->_joined_config_dir)) {
-                $smarty->getTemplateDir(null, true);
-            }
-            return get_class($this) . '#' . $smarty->_joined_config_dir . '#' . $resource_name;
-        } else {
-            if (!isset($smarty->_joined_template_dir)) {
-                $smarty->getTemplateDir();
-            }
-            return get_class($this) . '#' . $smarty->_joined_template_dir . '#' . $resource_name;
-        }
-    }
-
-    /*
-     * Check if resource must check time stamps when when loading complied or cached templates.
-     * Resources like 'extends' which use source components my disable timestamp checks on own resource.
-     *
-     * @return bool
-     */
-    /**
-     * Determine basename for compiled filename
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return basename(preg_replace('![^\w]+!', '_', $source->name));
-    }
-
-    /**
-     * @return bool
-     */
-    public function checkTimestamps()
-    {
-        return true;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_resource_custom.php b/libraries/Smarty/libs/sysplugins/smarty_resource_custom.php
deleted file mode 100644
index 8d66be3ae..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_resource_custom.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/**
- * Smarty Resource Plugin
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Resource Plugin
- * Wrapper Implementation for custom resource plugins
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-abstract class Smarty_Resource_Custom extends Smarty_Resource
-{
-    /**
-     * fetch template and its modification time from data source
-     *
-     * @param string  $name    template name
-     * @param string  &$source template source
-     * @param integer &$mtime  template modification timestamp (epoch)
-     */
-    abstract protected function fetch($name, &$source, &$mtime);
-
-    /**
-     * Fetch template's modification timestamp from data source
-     * {@internal implementing this method is optional.
-     *  Only implement it if modification times can be accessed faster than loading the complete template source.}}
-     *
-     * @param string $name template name
-     *
-     * @return integer|boolean timestamp (epoch) the template was modified, or false if not found
-     */
-    protected function fetchTimestamp($name)
-    {
-        return null;
-    }
-
-    /**
-     * populate Source Object with meta data from Resource
-     *
-     * @param Smarty_Template_Source   $source    source object
-     * @param Smarty_Internal_Template $_template template object
-     */
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
-    {
-        $source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25);
-        $source->uid = sha1($source->type . ':' . $source->name);
-        $mtime = $this->fetchTimestamp($source->name);
-        if ($mtime !== null) {
-            $source->timestamp = $mtime;
-        } else {
-            $this->fetch($source->name, $content, $timestamp);
-            $source->timestamp = isset($timestamp) ? $timestamp : false;
-            if (isset($content)) {
-                $source->content = $content;
-            }
-        }
-        $source->exists = !!$source->timestamp;
-    }
-
-    /**
-     * Load template's source into current template object
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 template source
-     * @throws SmartyException        if source cannot be loaded
-     */
-    public function getContent(Smarty_Template_Source $source)
-    {
-        $this->fetch($source->name, $content, $timestamp);
-        if (isset($content)) {
-            return $content;
-        }
-        throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
-    }
-
-    /**
-     * Determine basename for compiled filename
-     *
-     * @param Smarty_Template_Source $source source object
-     *
-     * @return string                 resource's basename
-     */
-    public function getBasename(Smarty_Template_Source $source)
-    {
-        return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25));
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_resource_recompiled.php b/libraries/Smarty/libs/sysplugins/smarty_resource_recompiled.php
deleted file mode 100644
index 760c4dd33..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_resource_recompiled.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * Smarty Resource Plugin
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Resource Plugin
- * Base implementation for resource plugins that don't compile cache
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-abstract class Smarty_Resource_Recompiled extends Smarty_Resource
-{
-    /**
-     * Flag that it's an recompiled resource
-     *
-     * @var bool
-     */
-    public $recompiled = true;
-
-    /**
-     * Resource does implement populateCompiledFilepath() method
-     *
-     * @var bool
-     */
-    public $hasCompiledHandler = true;
-
-    /**
-     * compile template from source
-     *
-     * @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
-     *
-     * @throws Exception
-     */
-    public function process(Smarty_Internal_Template $_smarty_tpl)
-    {
-        $compiled = &$_smarty_tpl->compiled;
-        $compiled->file_dependency = array();
-        $compiled->includes = array();
-        $compiled->nocache_hash = null;
-        $compiled->unifunc = null;
-        $level = ob_get_level();
-        ob_start();
-        $_smarty_tpl->loadCompiler();
-        // call compiler
-        try {
-            eval('?>' . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl));
-        } catch (Exception $e) {
-            unset($_smarty_tpl->compiler);
-            while (ob_get_level() > $level) {
-                ob_end_clean();
-            }
-            throw $e;
-        }
-        // release compiler object to free memory
-        unset($_smarty_tpl->compiler);
-        ob_get_clean();
-        $compiled->timestamp = time();
-        $compiled->exists = true;
-    }
-
-    /**
-     * populate Compiled Object with compiled filepath
-     *
-     * @param Smarty_Template_Compiled $compiled  compiled object
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return void
-     */
-    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
-    {
-        $compiled->filepath = false;
-        $compiled->timestamp = false;
-        $compiled->exists = false;
-    }
-
-    /*
-       * Disable timestamp checks for recompiled resource.
-       *
-       * @return bool
-       */
-    /**
-     * @return bool
-     */
-    public function checkTimestamps()
-    {
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_resource_uncompiled.php b/libraries/Smarty/libs/sysplugins/smarty_resource_uncompiled.php
deleted file mode 100644
index a11e2c14c..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_resource_uncompiled.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Smarty Resource Plugin
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-
-/**
- * Smarty Resource Plugin
- * Base implementation for resource plugins that don't use the compiler
- *
- * @package    Smarty
- * @subpackage TemplateResources
- */
-abstract class Smarty_Resource_Uncompiled extends Smarty_Resource
-{
-    /**
-     * Flag that it's an uncompiled resource
-     *
-     * @var bool
-     */
-    public $uncompiled = true;
-
-    /**
-     * Resource does implement populateCompiledFilepath() method
-     *
-     * @var bool
-     */
-    public $hasCompiledHandler = true;
-
-    /**
-     * populate compiled object with compiled filepath
-     *
-     * @param Smarty_Template_Compiled $compiled  compiled object
-     * @param Smarty_Internal_Template $_template template object
-     */
-    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
-    {
-        $compiled->filepath = $_template->source->filepath;
-        $compiled->timestamp = $_template->source->timestamp;
-        $compiled->exists = $_template->source->exists;
-        if ($_template->smarty->merge_compiled_includes || $_template->source->handler->checkTimestamps()) {
-            $compiled->file_dependency[ $_template->source->uid ] =
-                array($compiled->filepath, $compiled->timestamp, $_template->source->type,);
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_security.php b/libraries/Smarty/libs/sysplugins/smarty_security.php
deleted file mode 100644
index 441a7e284..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_security.php
+++ /dev/null
@@ -1,721 +0,0 @@
-<?php
-/**
- * Smarty plugin
- *
- * @package    Smarty
- * @subpackage Security
- * @author     Uwe Tews
- */
-/**
- * FIXME: Smarty_Security API
- *      - getter and setter instead of public properties would allow cultivating an internal cache properly
- *      - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir
- *      are immutable the cache is killed every time either of the variables change. That means that two distinct
- *      Smarty objects with differing
- *        $template_dir or $config_dir should NOT share the same Smarty_Security instance,
- *        as this would lead to (severe) performance penalty! how should this be handled?
- */
-
-/**
- * This class does contain the security settings
- */
-class Smarty_Security
-{
-    /**
-     * This determines how Smarty handles "<?php ... ?>" tags in templates.
-     * possible values:
-     * <ul>
-     *   <li>Smarty::PHP_PASSTHRU -> echo PHP tags as they are</li>
-     *   <li>Smarty::PHP_QUOTE    -> escape tags as entities</li>
-     *   <li>Smarty::PHP_REMOVE   -> remove php tags</li>
-     *   <li>Smarty::PHP_ALLOW    -> execute php tags</li>
-     * </ul>
-     *
-     * @var integer
-     */
-    public $php_handling = Smarty::PHP_PASSTHRU;
-
-    /**
-     * This is the list of template directories that are considered secure.
-     * $template_dir is in this list implicitly.
-     *
-     * @var array
-     */
-    public $secure_dir = array();
-
-    /**
-     * This is an array of directories where trusted php scripts reside.
-     * {@link $security} is disabled during their inclusion/execution.
-     *
-     * @var array
-     */
-    public $trusted_dir = array();
-
-    /**
-     * List of regular expressions (PCRE) that include trusted URIs
-     *
-     * @var array
-     */
-    public $trusted_uri = array();
-
-    /**
-     * List of trusted constants names
-     *
-     * @var array
-     */
-    public $trusted_constants = array();
-
-    /**
-     * This is an array of trusted static classes.
-     * If empty access to all static classes is allowed.
-     * If set to 'none' none is allowed.
-     *
-     * @var array
-     */
-    public $static_classes = array();
-
-    /**
-     * This is an nested array of trusted classes and static methods.
-     * If empty access to all static classes and methods is allowed.
-     * Format:
-     * array (
-     *         'class_1' => array('method_1', 'method_2'), // allowed methods listed
-     *         'class_2' => array(),                       // all methods of class allowed
-     *       )
-     * If set to null none is allowed.
-     *
-     * @var array
-     */
-    public $trusted_static_methods = array();
-
-    /**
-     * This is an array of trusted static properties.
-     * If empty access to all static classes and properties is allowed.
-     * Format:
-     * array (
-     *         'class_1' => array('prop_1', 'prop_2'), // allowed properties listed
-     *         'class_2' => array(),                   // all properties of class allowed
-     *       )
-     * If set to null none is allowed.
-     *
-     * @var array
-     */
-    public $trusted_static_properties = array();
-
-    /**
-     * This is an array of trusted PHP functions.
-     * If empty all functions are allowed.
-     * To disable all PHP functions set $php_functions = null.
-     *
-     * @var array
-     */
-    public $php_functions = array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time',);
-
-    /**
-     * This is an array of trusted PHP modifiers.
-     * If empty all modifiers are allowed.
-     * To disable all modifier set $php_modifiers = null.
-     *
-     * @var array
-     */
-    public $php_modifiers = array('escape', 'count', 'nl2br',);
-
-    /**
-     * This is an array of allowed tags.
-     * If empty no restriction by allowed_tags.
-     *
-     * @var array
-     */
-    public $allowed_tags = array();
-
-    /**
-     * This is an array of disabled tags.
-     * If empty no restriction by disabled_tags.
-     *
-     * @var array
-     */
-    public $disabled_tags = array();
-
-    /**
-     * This is an array of allowed modifier plugins.
-     * If empty no restriction by allowed_modifiers.
-     *
-     * @var array
-     */
-    public $allowed_modifiers = array();
-
-    /**
-     * This is an array of disabled modifier plugins.
-     * If empty no restriction by disabled_modifiers.
-     *
-     * @var array
-     */
-    public $disabled_modifiers = array();
-
-    /**
-     * This is an array of disabled special $smarty variables.
-     *
-     * @var array
-     */
-    public $disabled_special_smarty_vars = array();
-
-    /**
-     * This is an array of trusted streams.
-     * If empty all streams are allowed.
-     * To disable all streams set $streams = null.
-     *
-     * @var array
-     */
-    public $streams = array('file');
-
-    /**
-     * + flag if constants can be accessed from template
-     *
-     * @var boolean
-     */
-    public $allow_constants = true;
-
-    /**
-     * + flag if super globals can be accessed from template
-     *
-     * @var boolean
-     */
-    public $allow_super_globals = true;
-
-    /**
-     * max template nesting level
-     *
-     * @var int
-     */
-    public $max_template_nesting = 0;
-
-    /**
-     * current template nesting level
-     *
-     * @var int
-     */
-    private $_current_template_nesting = 0;
-
-    /**
-     * Cache for $resource_dir lookup
-     *
-     * @var array
-     */
-    protected $_resource_dir = array();
-
-    /**
-     * Cache for $template_dir lookup
-     *
-     * @var array
-     */
-    protected $_template_dir = array();
-
-    /**
-     * Cache for $config_dir lookup
-     *
-     * @var array
-     */
-    protected $_config_dir = array();
-
-    /**
-     * Cache for $secure_dir lookup
-     *
-     * @var array
-     */
-    protected $_secure_dir = array();
-
-    /**
-     * Cache for $php_resource_dir lookup
-     *
-     * @var array
-     */
-    protected $_php_resource_dir = null;
-
-    /**
-     * Cache for $trusted_dir lookup
-     *
-     * @var array
-     */
-    protected $_trusted_dir = null;
-
-    /**
-     * Cache for include path status
-     *
-     * @var bool
-     */
-    protected $_include_path_status = false;
-
-    /**
-     * Cache for $_include_array lookup
-     *
-     * @var array
-     */
-    protected $_include_dir = array();
-
-    /**
-     * @param Smarty $smarty
-     */
-    public function __construct($smarty)
-    {
-        $this->smarty = $smarty;
-    }
-
-    /**
-     * Check if PHP function is trusted.
-     *
-     * @param string $function_name
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if function is trusted
-     */
-    public function isTrustedPhpFunction($function_name, $compiler)
-    {
-        if (isset($this->php_functions)
-            && (empty($this->php_functions) || in_array($function_name, $this->php_functions))
-        ) {
-            return true;
-        }
-        $compiler->trigger_template_error("PHP function '{$function_name}' not allowed by security setting");
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if static class is trusted.
-     *
-     * @param string $class_name
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if class is trusted
-     */
-    public function isTrustedStaticClass($class_name, $compiler)
-    {
-        if (isset($this->static_classes)
-            && (empty($this->static_classes) || in_array($class_name, $this->static_classes))
-        ) {
-            return true;
-        }
-        $compiler->trigger_template_error("access to static class '{$class_name}' not allowed by security setting");
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if static class method/property is trusted.
-     *
-     * @param string $class_name
-     * @param string $params
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if class method is trusted
-     */
-    public function isTrustedStaticClassAccess($class_name, $params, $compiler)
-    {
-        if (!isset($params[ 2 ])) {
-            // fall back
-            return $this->isTrustedStaticClass($class_name, $compiler);
-        }
-        if ($params[ 2 ] === 'method') {
-            $allowed = $this->trusted_static_methods;
-            $name = substr($params[ 0 ], 0, strpos($params[ 0 ], '('));
-        } else {
-            $allowed = $this->trusted_static_properties;
-            // strip '$'
-            $name = substr($params[ 0 ], 1);
-        }
-        if (isset($allowed)) {
-            if (empty($allowed)) {
-                // fall back
-                return $this->isTrustedStaticClass($class_name, $compiler);
-            }
-            if (isset($allowed[ $class_name ])
-                && (empty($allowed[ $class_name ]) || in_array($name, $allowed[ $class_name ]))
-            ) {
-                return true;
-            }
-        }
-        $compiler->trigger_template_error("access to static class '{$class_name}' {$params[2]} '{$name}' not allowed by security setting");
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if PHP modifier is trusted.
-     *
-     * @param string $modifier_name
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if modifier is trusted
-     */
-    public function isTrustedPhpModifier($modifier_name, $compiler)
-    {
-        if (isset($this->php_modifiers)
-            && (empty($this->php_modifiers) || in_array($modifier_name, $this->php_modifiers))
-        ) {
-            return true;
-        }
-        $compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting");
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if tag is trusted.
-     *
-     * @param string $tag_name
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if tag is trusted
-     */
-    public function isTrustedTag($tag_name, $compiler)
-    {
-        // check for internal always required tags
-        if (in_array(
-            $tag_name,
-            array(
-                'assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin',
-                'private_object_block_function', 'private_object_function', 'private_registered_function',
-                'private_registered_block', 'private_special_variable', 'private_print_expression',
-                'private_modifier'
-            )
-        )
-        ) {
-            return true;
-        }
-        // check security settings
-        if (empty($this->allowed_tags)) {
-            if (empty($this->disabled_tags) || !in_array($tag_name, $this->disabled_tags)) {
-                return true;
-            } else {
-                $compiler->trigger_template_error("tag '{$tag_name}' disabled by security setting", null, true);
-            }
-        } elseif (in_array($tag_name, $this->allowed_tags) && !in_array($tag_name, $this->disabled_tags)) {
-            return true;
-        } else {
-            $compiler->trigger_template_error("tag '{$tag_name}' not allowed by security setting", null, true);
-        }
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if special $smarty variable is trusted.
-     *
-     * @param string $var_name
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if tag is trusted
-     */
-    public function isTrustedSpecialSmartyVar($var_name, $compiler)
-    {
-        if (!in_array($var_name, $this->disabled_special_smarty_vars)) {
-            return true;
-        } else {
-            $compiler->trigger_template_error(
-                "special variable '\$smarty.{$var_name}' not allowed by security setting",
-                null,
-                true
-            );
-        }
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if modifier plugin is trusted.
-     *
-     * @param string $modifier_name
-     * @param object $compiler compiler object
-     *
-     * @return boolean                 true if tag is trusted
-     */
-    public function isTrustedModifier($modifier_name, $compiler)
-    {
-        // check for internal always allowed modifier
-        if (in_array($modifier_name, array('default'))) {
-            return true;
-        }
-        // check security settings
-        if (empty($this->allowed_modifiers)) {
-            if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) {
-                return true;
-            } else {
-                $compiler->trigger_template_error(
-                    "modifier '{$modifier_name}' disabled by security setting",
-                    null,
-                    true
-                );
-            }
-        } elseif (in_array($modifier_name, $this->allowed_modifiers)
-                  && !in_array($modifier_name, $this->disabled_modifiers)
-        ) {
-            return true;
-        } else {
-            $compiler->trigger_template_error(
-                "modifier '{$modifier_name}' not allowed by security setting",
-                null,
-                true
-            );
-        }
-        return false; // should not, but who knows what happens to the compiler in the future?
-    }
-
-    /**
-     * Check if constants are enabled or trusted
-     *
-     * @param string $const    constant name
-     * @param object $compiler compiler object
-     *
-     * @return bool
-     */
-    public function isTrustedConstant($const, $compiler)
-    {
-        if (in_array($const, array('true', 'false', 'null'))) {
-            return true;
-        }
-        if (!empty($this->trusted_constants)) {
-            if (!in_array(strtolower($const), $this->trusted_constants)) {
-                $compiler->trigger_template_error("Security: access to constant '{$const}' not permitted");
-                return false;
-            }
-            return true;
-        }
-        if ($this->allow_constants) {
-            return true;
-        }
-        $compiler->trigger_template_error("Security: access to constants not permitted");
-        return false;
-    }
-
-    /**
-     * Check if stream is trusted.
-     *
-     * @param string $stream_name
-     *
-     * @return boolean         true if stream is trusted
-     * @throws SmartyException if stream is not trusted
-     */
-    public function isTrustedStream($stream_name)
-    {
-        if (isset($this->streams) && (empty($this->streams) || in_array($stream_name, $this->streams))) {
-            return true;
-        }
-        throw new SmartyException("stream '{$stream_name}' not allowed by security setting");
-    }
-
-    /**
-     * Check if directory of file resource is trusted.
-     *
-     * @param string    $filepath
-     * @param null|bool $isConfig
-     *
-     * @return bool true if directory is trusted
-     * @throws \SmartyException if directory is not trusted
-     */
-    public function isTrustedResourceDir($filepath, $isConfig = null)
-    {
-        if ($this->_include_path_status !== $this->smarty->use_include_path) {
-            $_dir =
-                $this->smarty->use_include_path ? $this->smarty->ext->_getIncludePath->getIncludePathDirs($this->smarty) : array();
-            if ($this->_include_dir !== $_dir) {
-                $this->_updateResourceDir($this->_include_dir, $_dir);
-                $this->_include_dir = $_dir;
-            }
-            $this->_include_path_status = $this->smarty->use_include_path;
-        }
-        $_dir = $this->smarty->getTemplateDir();
-        if ($this->_template_dir !== $_dir) {
-            $this->_updateResourceDir($this->_template_dir, $_dir);
-            $this->_template_dir = $_dir;
-        }
-        $_dir = $this->smarty->getConfigDir();
-        if ($this->_config_dir !== $_dir) {
-            $this->_updateResourceDir($this->_config_dir, $_dir);
-            $this->_config_dir = $_dir;
-        }
-        if ($this->_secure_dir !== $this->secure_dir) {
-            $this->secure_dir = (array)$this->secure_dir;
-            foreach ($this->secure_dir as $k => $d) {
-                $this->secure_dir[ $k ] = $this->smarty->_realpath($d . DIRECTORY_SEPARATOR, true);
-            }
-            $this->_updateResourceDir($this->_secure_dir, $this->secure_dir);
-            $this->_secure_dir = $this->secure_dir;
-        }
-        $addPath = $this->_checkDir($filepath, $this->_resource_dir);
-        if ($addPath !== false) {
-            $this->_resource_dir = array_merge($this->_resource_dir, $addPath);
-        }
-        return true;
-    }
-
-    /**
-     * Check if URI (e.g. {fetch} or {html_image}) is trusted
-     * To simplify things, isTrustedUri() resolves all input to "{$PROTOCOL}://{$HOSTNAME}".
-     * So "http://username:password@hello.world.example.org:8080/some-path?some=query-string"
-     * is reduced to "http://hello.world.example.org" prior to applying the patters from {@link $trusted_uri}.
-     *
-     * @param string $uri
-     *
-     * @return boolean         true if URI is trusted
-     * @throws SmartyException if URI is not trusted
-     * @uses   $trusted_uri for list of patterns to match against $uri
-     */
-    public function isTrustedUri($uri)
-    {
-        $_uri = parse_url($uri);
-        if (!empty($_uri[ 'scheme' ]) && !empty($_uri[ 'host' ])) {
-            $_uri = $_uri[ 'scheme' ] . '://' . $_uri[ 'host' ];
-            foreach ($this->trusted_uri as $pattern) {
-                if (preg_match($pattern, $_uri)) {
-                    return true;
-                }
-            }
-        }
-        throw new SmartyException("URI '{$uri}' not allowed by security setting");
-    }
-
-    /**
-     * Check if directory of file resource is trusted.
-     *
-     * @param string $filepath
-     *
-     * @return boolean         true if directory is trusted
-     * @throws SmartyException if PHP directory is not trusted
-     */
-    public function isTrustedPHPDir($filepath)
-    {
-        if (empty($this->trusted_dir)) {
-            throw new SmartyException("directory '{$filepath}' not allowed by security setting (no trusted_dir specified)");
-        }
-        // check if index is outdated
-        if (!$this->_trusted_dir || $this->_trusted_dir !== $this->trusted_dir) {
-            $this->_php_resource_dir = array();
-            $this->_trusted_dir = $this->trusted_dir;
-            foreach ((array)$this->trusted_dir as $directory) {
-                $directory = $this->smarty->_realpath($directory . '/', true);
-                $this->_php_resource_dir[ $directory ] = true;
-            }
-        }
-        $addPath = $this->_checkDir($filepath, $this->_php_resource_dir);
-        if ($addPath !== false) {
-            $this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath);
-        }
-        return true;
-    }
-
-    /**
-     * Remove old directories and its sub folders, add new directories
-     *
-     * @param array $oldDir
-     * @param array $newDir
-     */
-    private function _updateResourceDir($oldDir, $newDir)
-    {
-        foreach ($oldDir as $directory) {
-            //           $directory = $this->smarty->_realpath($directory, true);
-            $length = strlen($directory);
-            foreach ($this->_resource_dir as $dir) {
-                if (substr($dir, 0, $length) === $directory) {
-                    unset($this->_resource_dir[ $dir ]);
-                }
-            }
-        }
-        foreach ($newDir as $directory) {
-            //           $directory = $this->smarty->_realpath($directory, true);
-            $this->_resource_dir[ $directory ] = true;
-        }
-    }
-
-    /**
-     * Check if file is inside a valid directory
-     *
-     * @param string $filepath
-     * @param array  $dirs valid directories
-     *
-     * @return array|bool
-     * @throws \SmartyException
-     */
-    private function _checkDir($filepath, $dirs)
-    {
-        $directory = dirname($this->smarty->_realpath($filepath, true)) . DIRECTORY_SEPARATOR;
-        $_directory = array();
-        if (!preg_match('#[\\\\/][.][.][\\\\/]#', $directory)) {
-            while (true) {
-                // test if the directory is trusted
-                if (isset($dirs[ $directory ])) {
-                    return $_directory;
-                }
-                // abort if we've reached root
-                if (!preg_match('#[\\\\/][^\\\\/]+[\\\\/]$#', $directory)) {
-                    // give up
-                    break;
-                }
-                // remember the directory to add it to _resource_dir in case we're successful
-                $_directory[ $directory ] = true;
-                // bubble up one level
-                $directory = preg_replace('#[\\\\/][^\\\\/]+[\\\\/]$#', DIRECTORY_SEPARATOR, $directory);
-            }
-        }
-        // give up
-        throw new SmartyException(sprintf('Smarty Security: not trusted file path \'%s\' ', $filepath));
-    }
-
-    /**
-     * Loads security class and enables security
-     *
-     * @param \Smarty                $smarty
-     * @param string|Smarty_Security $security_class if a string is used, it must be class-name
-     *
-     * @return \Smarty current Smarty instance for chaining
-     * @throws \SmartyException when an invalid class name is provided
-     */
-    public static function enableSecurity(Smarty $smarty, $security_class)
-    {
-        if ($security_class instanceof Smarty_Security) {
-            $smarty->security_policy = $security_class;
-            return $smarty;
-        } elseif (is_object($security_class)) {
-            throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security.");
-        }
-        if ($security_class === null) {
-            $security_class = $smarty->security_class;
-        }
-        if (!class_exists($security_class)) {
-            throw new SmartyException("Security class '$security_class' is not defined");
-        } elseif ($security_class !== 'Smarty_Security' && !is_subclass_of($security_class, 'Smarty_Security')) {
-            throw new SmartyException("Class '$security_class' must extend Smarty_Security.");
-        } else {
-            $smarty->security_policy = new $security_class($smarty);
-        }
-        return $smarty;
-    }
-
-    /**
-     * Start template processing
-     *
-     * @param $template
-     *
-     * @throws SmartyException
-     */
-    public function startTemplate($template)
-    {
-        if ($this->max_template_nesting > 0 && $this->_current_template_nesting++ >= $this->max_template_nesting) {
-            throw new SmartyException("maximum template nesting level of '{$this->max_template_nesting}' exceeded when calling '{$template->template_resource}'");
-        }
-    }
-
-    /**
-     * Exit template processing
-     */
-    public function endTemplate()
-    {
-        if ($this->max_template_nesting > 0) {
-            $this->_current_template_nesting--;
-        }
-    }
-
-    /**
-     * Register callback functions call at start/end of template rendering
-     *
-     * @param \Smarty_Internal_Template $template
-     */
-    public function registerCallBacks(Smarty_Internal_Template $template)
-    {
-        $template->startRenderCallbacks[] = array($this, 'startTemplate');
-        $template->endRenderCallbacks[] = array($this, 'endTemplate');
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_template_cached.php b/libraries/Smarty/libs/sysplugins/smarty_template_cached.php
deleted file mode 100644
index 508d27f36..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_template_cached.php
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: Uwe Tews
- * Date: 04.12.2014
- * Time: 06:08
- */
-
-/**
- * Smarty Resource Data Object
- * Cache Data Container for Template Files
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-class Smarty_Template_Cached extends Smarty_Template_Resource_Base
-{
-    /**
-     * Cache Is Valid
-     *
-     * @var boolean
-     */
-    public $valid = null;
-
-    /**
-     * CacheResource Handler
-     *
-     * @var Smarty_CacheResource
-     */
-    public $handler = null;
-
-    /**
-     * Template Cache Id (Smarty_Internal_Template::$cache_id)
-     *
-     * @var string
-     */
-    public $cache_id = null;
-
-    /**
-     * saved cache lifetime in seconds
-     *
-     * @var integer
-     */
-    public $cache_lifetime = 0;
-
-    /**
-     * Id for cache locking
-     *
-     * @var string
-     */
-    public $lock_id = null;
-
-    /**
-     * flag that cache is locked by this instance
-     *
-     * @var bool
-     */
-    public $is_locked = false;
-
-    /**
-     * Source Object
-     *
-     * @var Smarty_Template_Source
-     */
-    public $source = null;
-
-    /**
-     * Nocache hash codes of processed compiled templates
-     *
-     * @var array
-     */
-    public $hashes = array();
-
-    /**
-     * Flag if this is a cache resource
-     *
-     * @var bool
-     */
-    public $isCache = true;
-
-    /**
-     * create Cached Object container
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @throws \SmartyException
-     */
-    public function __construct(Smarty_Internal_Template $_template)
-    {
-        $this->compile_id = $_template->compile_id;
-        $this->cache_id = $_template->cache_id;
-        $this->source = $_template->source;
-        if (!class_exists('Smarty_CacheResource', false)) {
-            include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
-        }
-        $this->handler = Smarty_CacheResource::load($_template->smarty);
-    }
-
-    /**
-     * @param Smarty_Internal_Template $_template
-     *
-     * @return Smarty_Template_Cached
-     */
-    public static function load(Smarty_Internal_Template $_template)
-    {
-        $_template->cached = new Smarty_Template_Cached($_template);
-        $_template->cached->handler->populate($_template->cached, $_template);
-        // caching enabled ?
-        if (!$_template->caching || $_template->source->handler->recompiled
-        ) {
-            $_template->cached->valid = false;
-        }
-        return $_template->cached;
-    }
-
-    /**
-     * Render cache template
-     *
-     * @param \Smarty_Internal_Template $_template
-     * @param bool                      $no_output_filter
-     *
-     * @throws \Exception
-     */
-    public function render(Smarty_Internal_Template $_template, $no_output_filter = true)
-    {
-        if ($this->isCached($_template)) {
-            if ($_template->smarty->debugging) {
-                if (!isset($_template->smarty->_debug)) {
-                    $_template->smarty->_debug = new Smarty_Internal_Debug();
-                }
-                $_template->smarty->_debug->start_cache($_template);
-            }
-            if (!$this->processed) {
-                $this->process($_template);
-            }
-            $this->getRenderedTemplateCode($_template);
-            if ($_template->smarty->debugging) {
-                $_template->smarty->_debug->end_cache($_template);
-            }
-            return;
-        } else {
-            $_template->smarty->ext->_updateCache->updateCache($this, $_template, $no_output_filter);
-        }
-    }
-
-    /**
-     * Check if cache is valid, lock cache if required
-     *
-     * @param \Smarty_Internal_Template $_template
-     *
-     * @return bool flag true if cache is valid
-     */
-    public function isCached(Smarty_Internal_Template $_template)
-    {
-        if ($this->valid !== null) {
-            return $this->valid;
-        }
-        while (true) {
-            while (true) {
-                if ($this->exists === false || $_template->smarty->force_compile || $_template->smarty->force_cache) {
-                    $this->valid = false;
-                } else {
-                    $this->valid = true;
-                }
-                if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT
-                    && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)
-                ) {
-                    // lifetime expired
-                    $this->valid = false;
-                }
-                if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON
-                    && $_template->source->getTimeStamp() > $this->timestamp
-                ) {
-                    $this->valid = false;
-                }
-                if ($this->valid || !$_template->smarty->cache_locking) {
-                    break;
-                }
-                if (!$this->handler->locked($_template->smarty, $this)) {
-                    $this->handler->acquireLock($_template->smarty, $this);
-                    break 2;
-                }
-                $this->handler->populate($this, $_template);
-            }
-            if ($this->valid) {
-                if (!$_template->smarty->cache_locking || $this->handler->locked($_template->smarty, $this) === null) {
-                    // load cache file for the following checks
-                    if ($_template->smarty->debugging) {
-                        $_template->smarty->_debug->start_cache($_template);
-                    }
-                    if ($this->handler->process($_template, $this) === false) {
-                        $this->valid = false;
-                    } else {
-                        $this->processed = true;
-                    }
-                    if ($_template->smarty->debugging) {
-                        $_template->smarty->_debug->end_cache($_template);
-                    }
-                } else {
-                    $this->is_locked = true;
-                    continue;
-                }
-            } else {
-                return $this->valid;
-            }
-            if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED
-                && $_template->cached->cache_lifetime >= 0
-                && (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime))
-            ) {
-                $this->valid = false;
-            }
-            if ($_template->smarty->cache_locking) {
-                if (!$this->valid) {
-                    $this->handler->acquireLock($_template->smarty, $this);
-                } elseif ($this->is_locked) {
-                    $this->handler->releaseLock($_template->smarty, $this);
-                }
-            }
-            return $this->valid;
-        }
-        return $this->valid;
-    }
-
-    /**
-     * Process cached template
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param bool                     $update    flag if called because cache update
-     */
-    public function process(Smarty_Internal_Template $_template, $update = false)
-    {
-        if ($this->handler->process($_template, $this, $update) === false) {
-            $this->valid = false;
-        }
-        if ($this->valid) {
-            $this->processed = true;
-        } else {
-            $this->processed = false;
-        }
-    }
-
-    /**
-     * Read cache content from handler
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string|false content
-     */
-    public function read(Smarty_Internal_Template $_template)
-    {
-        if (!$_template->source->handler->recompiled) {
-            return $this->handler->readCachedContent($_template);
-        }
-        return false;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_template_compiled.php b/libraries/Smarty/libs/sysplugins/smarty_template_compiled.php
deleted file mode 100644
index 37d8f0a9e..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_template_compiled.php
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-
-/**
- * Smarty Resource Data Object
- * Meta Data Container for Template Files
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- * @property   string $content compiled content
- */
-class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
-{
-    /**
-     * nocache hash
-     *
-     * @var string|null
-     */
-    public $nocache_hash = null;
-
-    /**
-     * get a Compiled Object of this source
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return Smarty_Template_Compiled compiled object
-     */
-    public static function load($_template)
-    {
-        $compiled = new Smarty_Template_Compiled();
-        if ($_template->source->handler->hasCompiledHandler) {
-            $_template->source->handler->populateCompiledFilepath($compiled, $_template);
-        } else {
-            $compiled->populateCompiledFilepath($_template);
-        }
-        return $compiled;
-    }
-
-    /**
-     * populate Compiled Object with compiled filepath
-     *
-     * @param Smarty_Internal_Template $_template template object
-     **/
-    public function populateCompiledFilepath(Smarty_Internal_Template $_template)
-    {
-        $source = &$_template->source;
-        $smarty = &$_template->smarty;
-        $this->filepath = $smarty->getCompileDir();
-        if (isset($_template->compile_id)) {
-            $this->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) .
-                               ($smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^');
-        }
-        // if use_sub_dirs, break file into directories
-        if ($smarty->use_sub_dirs) {
-            $this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . DIRECTORY_SEPARATOR . $source->uid[ 2 ] .
-                               $source->uid[ 3 ] . DIRECTORY_SEPARATOR . $source->uid[ 4 ] . $source->uid[ 5 ] .
-                               DIRECTORY_SEPARATOR;
-        }
-        $this->filepath .= $source->uid . '_';
-        if ($source->isConfig) {
-            $this->filepath .= (int)$smarty->config_read_hidden + (int)$smarty->config_booleanize * 2 +
-                               (int)$smarty->config_overwrite * 4;
-        } else {
-            $this->filepath .= (int)$smarty->merge_compiled_includes + (int)$smarty->escape_html * 2 +
-                               (($smarty->merge_compiled_includes && $source->type === 'extends') ?
-                                   (int)$smarty->extends_recursion * 4 : 0);
-        }
-        $this->filepath .= '.' . $source->type;
-        $basename = $source->handler->getBasename($source);
-        if (!empty($basename)) {
-            $this->filepath .= '.' . $basename;
-        }
-        if ($_template->caching) {
-            $this->filepath .= '.cache';
-        }
-        $this->filepath .= '.php';
-        $this->timestamp = $this->exists = is_file($this->filepath);
-        if ($this->exists) {
-            $this->timestamp = filemtime($this->filepath);
-        }
-    }
-
-    /**
-     * render compiled template code
-     *
-     * @param Smarty_Internal_Template $_template
-     *
-     * @return string
-     * @throws Exception
-     */
-    public function render(Smarty_Internal_Template $_template)
-    {
-        // checks if template exists
-        if (!$_template->source->exists) {
-            $type = $_template->source->isConfig ? 'config' : 'template';
-            throw new SmartyException("Unable to load {$type} '{$_template->source->type}:{$_template->source->name}'");
-        }
-        if ($_template->smarty->debugging) {
-            if (!isset($_template->smarty->_debug)) {
-                $_template->smarty->_debug = new Smarty_Internal_Debug();
-            }
-            $_template->smarty->_debug->start_render($_template);
-        }
-        if (!$this->processed) {
-            $this->process($_template);
-        }
-        if (isset($_template->cached)) {
-            $_template->cached->file_dependency =
-                array_merge($_template->cached->file_dependency, $this->file_dependency);
-        }
-        if ($_template->source->handler->uncompiled) {
-            $_template->source->handler->renderUncompiled($_template->source, $_template);
-        } else {
-            $this->getRenderedTemplateCode($_template);
-        }
-        if ($_template->caching && $this->has_nocache_code) {
-            $_template->cached->hashes[ $this->nocache_hash ] = true;
-        }
-        if ($_template->smarty->debugging) {
-            $_template->smarty->_debug->end_render($_template);
-        }
-    }
-
-    /**
-     * load compiled template or compile from source
-     *
-     * @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
-     *
-     * @throws Exception
-     */
-    public function process(Smarty_Internal_Template $_smarty_tpl)
-    {
-        $source = &$_smarty_tpl->source;
-        $smarty = &$_smarty_tpl->smarty;
-        if ($source->handler->recompiled) {
-            $source->handler->process($_smarty_tpl);
-        } elseif (!$source->handler->uncompiled) {
-            if (!$this->exists || $smarty->force_compile
-                || ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp())
-            ) {
-                $this->compileTemplateSource($_smarty_tpl);
-                $compileCheck = $_smarty_tpl->compile_check;
-                $_smarty_tpl->compile_check = Smarty::COMPILECHECK_OFF;
-                $this->loadCompiledTemplate($_smarty_tpl);
-                $_smarty_tpl->compile_check = $compileCheck;
-            } else {
-                $_smarty_tpl->mustCompile = true;
-                @include $this->filepath;
-                if ($_smarty_tpl->mustCompile) {
-                    $this->compileTemplateSource($_smarty_tpl);
-                    $compileCheck = $_smarty_tpl->compile_check;
-                    $_smarty_tpl->compile_check = Smarty::COMPILECHECK_OFF;
-                    $this->loadCompiledTemplate($_smarty_tpl);
-                    $_smarty_tpl->compile_check = $compileCheck;
-                }
-            }
-            $_smarty_tpl->_subTemplateRegister();
-            $this->processed = true;
-        }
-    }
-
-    /**
-     * compile template from source
-     *
-     * @param Smarty_Internal_Template $_template
-     *
-     * @throws Exception
-     */
-    public function compileTemplateSource(Smarty_Internal_Template $_template)
-    {
-        $this->file_dependency = array();
-        $this->includes = array();
-        $this->nocache_hash = null;
-        $this->unifunc = null;
-        // compile locking
-        if ($saved_timestamp = (!$_template->source->handler->recompiled && is_file($this->filepath))) {
-            $saved_timestamp = $this->getTimeStamp();
-            touch($this->filepath);
-        }
-        // compile locking
-        try {
-            // call compiler
-            $_template->loadCompiler();
-            $this->write($_template, $_template->compiler->compileTemplate($_template));
-        } catch (Exception $e) {
-            // restore old timestamp in case of error
-            if ($saved_timestamp && is_file($this->filepath)) {
-                touch($this->filepath, $saved_timestamp);
-            }
-            unset($_template->compiler);
-            throw $e;
-        }
-        // release compiler object to free memory
-        unset($_template->compiler);
-    }
-
-    /**
-     * Write compiled code by handler
-     *
-     * @param Smarty_Internal_Template $_template template object
-     * @param string                   $code      compiled code
-     *
-     * @return bool success
-     * @throws \SmartyException
-     */
-    public function write(Smarty_Internal_Template $_template, $code)
-    {
-        if (!$_template->source->handler->recompiled) {
-            if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
-                $this->timestamp = $this->exists = is_file($this->filepath);
-                if ($this->exists) {
-                    $this->timestamp = filemtime($this->filepath);
-                    return true;
-                }
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Read compiled content from handler
-     *
-     * @param Smarty_Internal_Template $_template template object
-     *
-     * @return string content
-     */
-    public function read(Smarty_Internal_Template $_template)
-    {
-        if (!$_template->source->handler->recompiled) {
-            return file_get_contents($this->filepath);
-        }
-        return isset($this->content) ? $this->content : false;
-    }
-
-    /**
-     * Load fresh compiled template by including the PHP file
-     * HHVM requires a work around because of a PHP incompatibility
-     *
-     * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
-     */
-    private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl)
-    {
-        if (function_exists('opcache_invalidate')
-            && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
-        ) {
-            opcache_invalidate($this->filepath, true);
-        } elseif (function_exists('apc_compile_file')) {
-            apc_compile_file($this->filepath);
-        }
-        if (defined('HHVM_VERSION')) {
-            eval('?>' . file_get_contents($this->filepath));
-        } else {
-            include $this->filepath;
-        }
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_template_config.php b/libraries/Smarty/libs/sysplugins/smarty_template_config.php
deleted file mode 100644
index 850ae32e7..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_template_config.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/**
- * Smarty Config Source Plugin
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- */
-
-/**
- * Smarty Config Resource Data Object
- * Meta Data Container for Template Files
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Uwe Tews
- */
-class Smarty_Template_Config extends Smarty_Template_Source
-{
-    /**
-     * array of section names, single section or null
-     *
-     * @var null|string|array
-     */
-    public $config_sections = null;
-
-    /**
-     * scope into which the config variables shall be loaded
-     *
-     * @var int
-     */
-    public $scope = 0;
-
-    /**
-     * Flag that source is a config file
-     *
-     * @var bool
-     */
-    public $isConfig = true;
-
-    /**
-     * Name of the Class to compile this resource's contents with
-     *
-     * @var string
-     */
-    public $compiler_class = 'Smarty_Internal_Config_File_Compiler';
-
-    /**
-     * Name of the Class to tokenize this resource's contents with
-     *
-     * @var string
-     */
-    public $template_lexer_class = 'Smarty_Internal_Configfilelexer';
-
-    /**
-     * Name of the Class to parse this resource's contents with
-     *
-     * @var string
-     */
-    public $template_parser_class = 'Smarty_Internal_Configfileparser';
-
-    /**
-     * initialize Source Object for given resource
-     * Either [$_template] or [$smarty, $template_resource] must be specified
-     *
-     * @param Smarty_Internal_Template $_template         template object
-     * @param Smarty                   $smarty            smarty object
-     * @param string                   $template_resource resource identifier
-     *
-     * @return Smarty_Template_Config Source Object
-     * @throws SmartyException
-     */
-    public static function load(
-        Smarty_Internal_Template $_template = null,
-        Smarty $smarty = null,
-        $template_resource = null
-    ) {
-        static $_incompatible_resources = array('extends' => true, 'php' => true);
-        if ($_template) {
-            $smarty = $_template->smarty;
-            $template_resource = $_template->template_resource;
-        }
-        if (empty($template_resource)) {
-            throw new SmartyException('Source: Missing  name');
-        }
-        // parse resource_name, load resource handler
-        list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_config_type);
-        // make sure configs are not loaded via anything smarty can't handle
-        if (isset($_incompatible_resources[ $type ])) {
-            throw new SmartyException("Unable to use resource '{$type}' for config");
-        }
-        $source = new Smarty_Template_Config($smarty, $template_resource, $type, $name);
-        $source->handler->populate($source, $_template);
-        if (!$source->exists && isset($smarty->default_config_handler_func)) {
-            Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
-            $source->handler->populate($source, $_template);
-        }
-        return $source;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_template_resource_base.php b/libraries/Smarty/libs/sysplugins/smarty_template_resource_base.php
deleted file mode 100644
index 52bfba252..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_template_resource_base.php
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-
-/**
- * Smarty Template Resource Base Object
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-abstract class Smarty_Template_Resource_Base
-{
-    /**
-     * Compiled Filepath
-     *
-     * @var string
-     */
-    public $filepath = null;
-
-    /**
-     * Compiled Timestamp
-     *
-     * @var integer|bool
-     */
-    public $timestamp = false;
-
-    /**
-     * Compiled Existence
-     *
-     * @var boolean
-     */
-    public $exists = false;
-
-    /**
-     * Template Compile Id (Smarty_Internal_Template::$compile_id)
-     *
-     * @var string
-     */
-    public $compile_id = null;
-
-    /**
-     * Compiled Content Loaded
-     *
-     * @var boolean
-     */
-    public $processed = false;
-
-    /**
-     * unique function name for compiled template code
-     *
-     * @var string
-     */
-    public $unifunc = '';
-
-    /**
-     * flag if template does contain nocache code sections
-     *
-     * @var bool
-     */
-    public $has_nocache_code = false;
-
-    /**
-     * resource file dependency
-     *
-     * @var array
-     */
-    public $file_dependency = array();
-
-    /**
-     * Content buffer
-     *
-     * @var string
-     */
-    public $content = null;
-
-    /**
-     * Included sub templates
-     * - index name
-     * - value use count
-     *
-     * @var int[]
-     */
-    public $includes = array();
-
-    /**
-     * Flag if this is a cache resource
-     *
-     * @var bool
-     */
-    public $isCache = false;
-
-    /**
-     * Process resource
-     *
-     * @param Smarty_Internal_Template $_template template object
-     */
-    abstract public function process(Smarty_Internal_Template $_template);
-
-    /**
-     * get rendered template content by calling compiled or cached template code
-     *
-     * @param \Smarty_Internal_Template $_template
-     * @param string                    $unifunc function with template code
-     *
-     * @throws \Exception
-     */
-    public function getRenderedTemplateCode(Smarty_Internal_Template $_template, $unifunc = null)
-    {
-        $smarty = &$_template->smarty;
-        $_template->isRenderingCache = $this->isCache;
-        $level = ob_get_level();
-        try {
-            if (!isset($unifunc)) {
-                $unifunc = $this->unifunc;
-            }
-            if (empty($unifunc) || !function_exists($unifunc)) {
-                throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");
-            }
-            if ($_template->startRenderCallbacks) {
-                foreach ($_template->startRenderCallbacks as $callback) {
-                    call_user_func($callback, $_template);
-                }
-            }
-            $unifunc($_template);
-            foreach ($_template->endRenderCallbacks as $callback) {
-                call_user_func($callback, $_template);
-            }
-            $_template->isRenderingCache = false;
-        } catch (Exception $e) {
-            $_template->isRenderingCache = false;
-            while (ob_get_level() > $level) {
-                ob_end_clean();
-            }
-            if (isset($smarty->security_policy)) {
-                $smarty->security_policy->endTemplate();
-            }
-            throw $e;
-        }
-    }
-
-    /**
-     * Get compiled time stamp
-     *
-     * @return int
-     */
-    public function getTimeStamp()
-    {
-        if ($this->exists && !$this->timestamp) {
-            $this->timestamp = filemtime($this->filepath);
-        }
-        return $this->timestamp;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_template_source.php b/libraries/Smarty/libs/sysplugins/smarty_template_source.php
deleted file mode 100644
index 16b47f23c..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_template_source.php
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-
-/**
- * Smarty Resource Data Object
- * Meta Data Container for Template Files
- *
- * @package    Smarty
- * @subpackage TemplateResources
- * @author     Rodney Rehm
- */
-class Smarty_Template_Source
-{
-    /**
-     * Unique Template ID
-     *
-     * @var string
-     */
-    public $uid = null;
-
-    /**
-     * Template Resource (Smarty_Internal_Template::$template_resource)
-     *
-     * @var string
-     */
-    public $resource = null;
-
-    /**
-     * Resource Type
-     *
-     * @var string
-     */
-    public $type = null;
-
-    /**
-     * Resource Name
-     *
-     * @var string
-     */
-    public $name = null;
-
-    /**
-     * Source Filepath
-     *
-     * @var string
-     */
-    public $filepath = null;
-
-    /**
-     * Source Timestamp
-     *
-     * @var integer
-     */
-    public $timestamp = null;
-
-    /**
-     * Source Existence
-     *
-     * @var boolean
-     */
-    public $exists = false;
-
-    /**
-     * Source File Base name
-     *
-     * @var string
-     */
-    public $basename = null;
-
-    /**
-     * The Components an extended template is made of
-     *
-     * @var \Smarty_Template_Source[]
-     */
-    public $components = null;
-
-    /**
-     * Resource Handler
-     *
-     * @var \Smarty_Resource
-     */
-    public $handler = null;
-
-    /**
-     * Smarty instance
-     *
-     * @var Smarty
-     */
-    public $smarty = null;
-
-    /**
-     * Resource is source
-     *
-     * @var bool
-     */
-    public $isConfig = false;
-
-    /**
-     * Template source content eventually set by default handler
-     *
-     * @var string
-     */
-    public $content = null;
-
-    /**
-     * Name of the Class to compile this resource's contents with
-     *
-     * @var string
-     */
-    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
-
-    /**
-     * Name of the Class to tokenize this resource's contents with
-     *
-     * @var string
-     */
-    public $template_lexer_class = 'Smarty_Internal_Templatelexer';
-
-    /**
-     * Name of the Class to parse this resource's contents with
-     *
-     * @var string
-     */
-    public $template_parser_class = 'Smarty_Internal_Templateparser';
-
-    /**
-     * create Source Object container
-     *
-     * @param Smarty $smarty   Smarty instance this source object belongs to
-     * @param string $resource full template_resource
-     * @param string $type     type of resource
-     * @param string $name     resource name
-     *
-     * @throws   \SmartyException
-     * @internal param \Smarty_Resource $handler Resource Handler this source object communicates with
-     */
-    public function __construct(Smarty $smarty, $resource, $type, $name)
-    {
-        $this->handler =
-            isset($smarty->_cache[ 'resource_handlers' ][ $type ]) ? $smarty->_cache[ 'resource_handlers' ][ $type ] :
-                Smarty_Resource::load($smarty, $type);
-        $this->smarty = $smarty;
-        $this->resource = $resource;
-        $this->type = $type;
-        $this->name = $name;
-    }
-
-    /**
-     * initialize Source Object for given resource
-     * Either [$_template] or [$smarty, $template_resource] must be specified
-     *
-     * @param Smarty_Internal_Template $_template         template object
-     * @param Smarty                   $smarty            smarty object
-     * @param string                   $template_resource resource identifier
-     *
-     * @return Smarty_Template_Source Source Object
-     * @throws SmartyException
-     */
-    public static function load(
-        Smarty_Internal_Template $_template = null,
-        Smarty $smarty = null,
-        $template_resource = null
-    ) {
-        if ($_template) {
-            $smarty = $_template->smarty;
-            $template_resource = $_template->template_resource;
-        }
-        if (empty($template_resource)) {
-            throw new SmartyException('Source: Missing  name');
-        }
-        // parse resource_name, load resource handler, identify unique resource name
-        if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]([\s\S]*)$/', $template_resource, $match)) {
-            $type = $match[ 1 ];
-            $name = $match[ 2 ];
-        } else {
-            // no resource given, use default
-            // or single character before the colon is not a resource type, but part of the filepath
-            $type = $smarty->default_resource_type;
-            $name = $template_resource;
-        }
-        // create new source  object
-        $source = new Smarty_Template_Source($smarty, $template_resource, $type, $name);
-        $source->handler->populate($source, $_template);
-        if (!$source->exists && isset($_template->smarty->default_template_handler_func)) {
-            Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
-            $source->handler->populate($source, $_template);
-        }
-        return $source;
-    }
-
-    /**
-     * Get source time stamp
-     *
-     * @return int
-     */
-    public function getTimeStamp()
-    {
-        if (!isset($this->timestamp)) {
-            $this->handler->populateTimestamp($this);
-        }
-        return $this->timestamp;
-    }
-
-    /**
-     * Get source content
-     *
-     * @return string
-     * @throws \SmartyException
-     */
-    public function getContent()
-    {
-        return isset($this->content) ? $this->content : $this->handler->getContent($this);
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_undefined_variable.php b/libraries/Smarty/libs/sysplugins/smarty_undefined_variable.php
deleted file mode 100644
index 6d31a8a05..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_undefined_variable.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * class for undefined variable object
- * This class defines an object for undefined variable handling
- *
- * @package    Smarty
- * @subpackage Template
- */
-class Smarty_Undefined_Variable extends Smarty_Variable
-{
-    /**
-     * Returns null for not existing properties
-     *
-     * @param string $name
-     *
-     * @return null
-     */
-    public function __get($name)
-    {
-        return null;
-    }
-
-    /**
-     * Always returns an empty string.
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return '';
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smarty_variable.php b/libraries/Smarty/libs/sysplugins/smarty_variable.php
deleted file mode 100644
index 914d99bd7..000000000
--- a/libraries/Smarty/libs/sysplugins/smarty_variable.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * class for the Smarty variable object
- * This class defines the Smarty variable object
- *
- * @package    Smarty
- * @subpackage Template
- */
-class Smarty_Variable
-{
-    /**
-     * template variable
-     *
-     * @var mixed
-     */
-    public $value = null;
-
-    /**
-     * if true any output of this variable will be not cached
-     *
-     * @var boolean
-     */
-    public $nocache = false;
-
-    /**
-     * create Smarty variable object
-     *
-     * @param mixed   $value   the value to assign
-     * @param boolean $nocache if true any output of this variable will be not cached
-     */
-    public function __construct($value = null, $nocache = false)
-    {
-        $this->value = $value;
-        $this->nocache = $nocache;
-    }
-
-    /**
-     * <<magic>> String conversion
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return (string)$this->value;
-    }
-}
diff --git a/libraries/Smarty/libs/sysplugins/smartycompilerexception.php b/libraries/Smarty/libs/sysplugins/smartycompilerexception.php
deleted file mode 100644
index c7ef93e87..000000000
--- a/libraries/Smarty/libs/sysplugins/smartycompilerexception.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Smarty compiler exception class
- *
- * @package Smarty
- */
-class SmartyCompilerException extends SmartyException
-{
-    /**
-     * @return string
-     */
-    public function __toString()
-    {
-        return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
-    }
-
-    /**
-     * The line number of the template error
-     *
-     * @type int|null
-     */
-    public int $line = 0;
-
-    /**
-     * The template source snippet relating to the error
-     *
-     * @type string|null
-     */
-    public $source = null;
-
-    /**
-     * The raw text of the error message
-     *
-     * @type string|null
-     */
-    public $desc = null;
-
-    /**
-     * The resource identifier or template name
-     *
-     * @type string|null
-     */
-    public $template = null;
-}
diff --git a/libraries/Smarty/libs/sysplugins/smartyexception.php b/libraries/Smarty/libs/sysplugins/smartyexception.php
deleted file mode 100644
index 7f7b9aa43..000000000
--- a/libraries/Smarty/libs/sysplugins/smartyexception.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-/**
- * Smarty exception class
- *
- * @package Smarty
- */
-class SmartyException extends Exception
-{
-    public static $escape = false;
-
-    /**
-     * @return string
-     */
-    public function __toString()
-    {
-        return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
-    }
-}
diff --git a/libraries/adodb/LICENSE.md b/libraries/adodb_vtigerfix/LICENSE.md
similarity index 100%
rename from libraries/adodb/LICENSE.md
rename to libraries/adodb_vtigerfix/LICENSE.md
diff --git a/libraries/adodb/README.md b/libraries/adodb_vtigerfix/README.md
similarity index 100%
rename from libraries/adodb/README.md
rename to libraries/adodb_vtigerfix/README.md
diff --git a/libraries/adodb_vtigerfix/VTIGERFIX.md b/libraries/adodb_vtigerfix/VTIGERFIX.md
new file mode 100644
index 000000000..5b480e5dd
--- /dev/null
+++ b/libraries/adodb_vtigerfix/VTIGERFIX.md
@@ -0,0 +1,6 @@
+Library version: v5.21.2
+
+Fix to add custom constraint and changes to table.
+
+* adodb-xmlschema.inc.php
+* adodb-datadict.inc.php
\ No newline at end of file
diff --git a/libraries/adodb/adodb-active-record.inc.php b/libraries/adodb_vtigerfix/adodb-active-record.inc.php
similarity index 100%
rename from libraries/adodb/adodb-active-record.inc.php
rename to libraries/adodb_vtigerfix/adodb-active-record.inc.php
diff --git a/libraries/adodb/adodb-active-recordx.inc.php b/libraries/adodb_vtigerfix/adodb-active-recordx.inc.php
similarity index 100%
rename from libraries/adodb/adodb-active-recordx.inc.php
rename to libraries/adodb_vtigerfix/adodb-active-recordx.inc.php
diff --git a/libraries/adodb/adodb-csvlib.inc.php b/libraries/adodb_vtigerfix/adodb-csvlib.inc.php
similarity index 100%
rename from libraries/adodb/adodb-csvlib.inc.php
rename to libraries/adodb_vtigerfix/adodb-csvlib.inc.php
diff --git a/libraries/adodb/adodb-datadict.inc.php b/libraries/adodb_vtigerfix/adodb-datadict.inc.php
similarity index 100%
rename from libraries/adodb/adodb-datadict.inc.php
rename to libraries/adodb_vtigerfix/adodb-datadict.inc.php
diff --git a/libraries/adodb/adodb-error.inc.php b/libraries/adodb_vtigerfix/adodb-error.inc.php
similarity index 100%
rename from libraries/adodb/adodb-error.inc.php
rename to libraries/adodb_vtigerfix/adodb-error.inc.php
diff --git a/libraries/adodb/adodb-errorhandler.inc.php b/libraries/adodb_vtigerfix/adodb-errorhandler.inc.php
similarity index 100%
rename from libraries/adodb/adodb-errorhandler.inc.php
rename to libraries/adodb_vtigerfix/adodb-errorhandler.inc.php
diff --git a/libraries/adodb/adodb-errorpear.inc.php b/libraries/adodb_vtigerfix/adodb-errorpear.inc.php
similarity index 100%
rename from libraries/adodb/adodb-errorpear.inc.php
rename to libraries/adodb_vtigerfix/adodb-errorpear.inc.php
diff --git a/libraries/adodb/adodb-exceptions.inc.php b/libraries/adodb_vtigerfix/adodb-exceptions.inc.php
similarity index 100%
rename from libraries/adodb/adodb-exceptions.inc.php
rename to libraries/adodb_vtigerfix/adodb-exceptions.inc.php
diff --git a/libraries/adodb/adodb-lib.inc.php b/libraries/adodb_vtigerfix/adodb-lib.inc.php
similarity index 100%
rename from libraries/adodb/adodb-lib.inc.php
rename to libraries/adodb_vtigerfix/adodb-lib.inc.php
diff --git a/libraries/adodb/adodb-loadbalancer.inc.php b/libraries/adodb_vtigerfix/adodb-loadbalancer.inc.php
similarity index 100%
rename from libraries/adodb/adodb-loadbalancer.inc.php
rename to libraries/adodb_vtigerfix/adodb-loadbalancer.inc.php
diff --git a/libraries/adodb/adodb-memcache.lib.inc.php b/libraries/adodb_vtigerfix/adodb-memcache.lib.inc.php
similarity index 100%
rename from libraries/adodb/adodb-memcache.lib.inc.php
rename to libraries/adodb_vtigerfix/adodb-memcache.lib.inc.php
diff --git a/libraries/adodb/adodb-pager.inc.php b/libraries/adodb_vtigerfix/adodb-pager.inc.php
similarity index 100%
rename from libraries/adodb/adodb-pager.inc.php
rename to libraries/adodb_vtigerfix/adodb-pager.inc.php
diff --git a/libraries/adodb/adodb-pear.inc.php b/libraries/adodb_vtigerfix/adodb-pear.inc.php
similarity index 100%
rename from libraries/adodb/adodb-pear.inc.php
rename to libraries/adodb_vtigerfix/adodb-pear.inc.php
diff --git a/libraries/adodb/adodb-perf.inc.php b/libraries/adodb_vtigerfix/adodb-perf.inc.php
similarity index 100%
rename from libraries/adodb/adodb-perf.inc.php
rename to libraries/adodb_vtigerfix/adodb-perf.inc.php
diff --git a/libraries/adodb/adodb-time.inc.php b/libraries/adodb_vtigerfix/adodb-time.inc.php
similarity index 100%
rename from libraries/adodb/adodb-time.inc.php
rename to libraries/adodb_vtigerfix/adodb-time.inc.php
diff --git a/libraries/adodb/adodb-xmlschema.inc.php b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php
similarity index 100%
rename from libraries/adodb/adodb-xmlschema.inc.php
rename to libraries/adodb_vtigerfix/adodb-xmlschema.inc.php
diff --git a/libraries/adodb/adodb-xmlschema03.inc.php b/libraries/adodb_vtigerfix/adodb-xmlschema03.inc.php
similarity index 100%
rename from libraries/adodb/adodb-xmlschema03.inc.php
rename to libraries/adodb_vtigerfix/adodb-xmlschema03.inc.php
diff --git a/libraries/adodb/adodb.inc.php b/libraries/adodb_vtigerfix/adodb.inc.php
similarity index 100%
rename from libraries/adodb/adodb.inc.php
rename to libraries/adodb_vtigerfix/adodb.inc.php
diff --git a/libraries/adodb/composer.json b/libraries/adodb_vtigerfix/composer.json
similarity index 100%
rename from libraries/adodb/composer.json
rename to libraries/adodb_vtigerfix/composer.json
diff --git a/libraries/adodb/datadict/datadict-access.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-access.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-access.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-access.inc.php
diff --git a/libraries/adodb/datadict/datadict-db2.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-db2.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-db2.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-db2.inc.php
diff --git a/libraries/adodb/datadict/datadict-firebird.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-firebird.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-firebird.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-firebird.inc.php
diff --git a/libraries/adodb/datadict/datadict-generic.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-generic.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-generic.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-generic.inc.php
diff --git a/libraries/adodb/datadict/datadict-ibase.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-ibase.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-ibase.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-ibase.inc.php
diff --git a/libraries/adodb/datadict/datadict-informix.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-informix.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-informix.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-informix.inc.php
diff --git a/libraries/adodb/datadict/datadict-mssql.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-mssql.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-mssql.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-mssql.inc.php
diff --git a/libraries/adodb/datadict/datadict-mssqlnative.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-mssqlnative.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-mssqlnative.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-mssqlnative.inc.php
diff --git a/libraries/adodb/datadict/datadict-mysql.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-mysql.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php
diff --git a/libraries/adodb/datadict/datadict-oci8.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-oci8.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-oci8.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-oci8.inc.php
diff --git a/libraries/adodb/datadict/datadict-postgres.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-postgres.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-postgres.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-postgres.inc.php
diff --git a/libraries/adodb/datadict/datadict-sapdb.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-sapdb.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-sapdb.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-sapdb.inc.php
diff --git a/libraries/adodb/datadict/datadict-sqlite.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-sqlite.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-sqlite.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-sqlite.inc.php
diff --git a/libraries/adodb/datadict/datadict-sybase.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-sybase.inc.php
similarity index 100%
rename from libraries/adodb/datadict/datadict-sybase.inc.php
rename to libraries/adodb_vtigerfix/datadict/datadict-sybase.inc.php
diff --git a/libraries/adodb/docs/README.md b/libraries/adodb_vtigerfix/docs/README.md
similarity index 100%
rename from libraries/adodb/docs/README.md
rename to libraries/adodb_vtigerfix/docs/README.md
diff --git a/libraries/adodb/docs/adodb.gif b/libraries/adodb_vtigerfix/docs/adodb.gif
similarity index 100%
rename from libraries/adodb/docs/adodb.gif
rename to libraries/adodb_vtigerfix/docs/adodb.gif
diff --git a/libraries/adodb/docs/adodb2.gif b/libraries/adodb_vtigerfix/docs/adodb2.gif
similarity index 100%
rename from libraries/adodb/docs/adodb2.gif
rename to libraries/adodb_vtigerfix/docs/adodb2.gif
diff --git a/libraries/adodb/docs/changelog.md b/libraries/adodb_vtigerfix/docs/changelog.md
similarity index 100%
rename from libraries/adodb/docs/changelog.md
rename to libraries/adodb_vtigerfix/docs/changelog.md
diff --git a/libraries/adodb/docs/changelog_v2.x.md b/libraries/adodb_vtigerfix/docs/changelog_v2.x.md
similarity index 100%
rename from libraries/adodb/docs/changelog_v2.x.md
rename to libraries/adodb_vtigerfix/docs/changelog_v2.x.md
diff --git a/libraries/adodb/docs/changelog_v3.x.md b/libraries/adodb_vtigerfix/docs/changelog_v3.x.md
similarity index 100%
rename from libraries/adodb/docs/changelog_v3.x.md
rename to libraries/adodb_vtigerfix/docs/changelog_v3.x.md
diff --git a/libraries/adodb/docs/changelog_v4+5.md b/libraries/adodb_vtigerfix/docs/changelog_v4+5.md
similarity index 100%
rename from libraries/adodb/docs/changelog_v4+5.md
rename to libraries/adodb_vtigerfix/docs/changelog_v4+5.md
diff --git a/libraries/adodb/docs/changelog_v4.x.md b/libraries/adodb_vtigerfix/docs/changelog_v4.x.md
similarity index 100%
rename from libraries/adodb/docs/changelog_v4.x.md
rename to libraries/adodb_vtigerfix/docs/changelog_v4.x.md
diff --git a/libraries/adodb/drivers/adodb-access.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-access.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-access.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-access.inc.php
diff --git a/libraries/adodb/drivers/adodb-ado.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ado.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ado.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ado.inc.php
diff --git a/libraries/adodb/drivers/adodb-ado5.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ado5.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ado5.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ado5.inc.php
diff --git a/libraries/adodb/drivers/adodb-ado_access.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ado_access.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ado_access.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ado_access.inc.php
diff --git a/libraries/adodb/drivers/adodb-ado_mssql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ado_mssql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ado_mssql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ado_mssql.inc.php
diff --git a/libraries/adodb/drivers/adodb-ads.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ads.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ads.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ads.inc.php
diff --git a/libraries/adodb/drivers/adodb-borland_ibase.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-borland_ibase.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-borland_ibase.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-borland_ibase.inc.php
diff --git a/libraries/adodb/drivers/adodb-csv.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-csv.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-csv.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-csv.inc.php
diff --git a/libraries/adodb/drivers/adodb-db2.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-db2.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-db2.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-db2.inc.php
diff --git a/libraries/adodb/drivers/adodb-db2oci.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-db2oci.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-db2oci.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-db2oci.inc.php
diff --git a/libraries/adodb/drivers/adodb-db2ora.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-db2ora.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-db2ora.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-db2ora.inc.php
diff --git a/libraries/adodb/drivers/adodb-fbsql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-fbsql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-fbsql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-fbsql.inc.php
diff --git a/libraries/adodb/drivers/adodb-firebird.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-firebird.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-firebird.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-firebird.inc.php
diff --git a/libraries/adodb/drivers/adodb-ibase.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ibase.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ibase.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ibase.inc.php
diff --git a/libraries/adodb/drivers/adodb-informix.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-informix.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-informix.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-informix.inc.php
diff --git a/libraries/adodb/drivers/adodb-informix72.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-informix72.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-informix72.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-informix72.inc.php
diff --git a/libraries/adodb/drivers/adodb-ldap.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-ldap.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-ldap.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-ldap.inc.php
diff --git a/libraries/adodb/drivers/adodb-mssql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mssql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mssql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mssql.inc.php
diff --git a/libraries/adodb/drivers/adodb-mssql_n.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mssql_n.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mssql_n.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mssql_n.inc.php
diff --git a/libraries/adodb/drivers/adodb-mssqlnative.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mssqlnative.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mssqlnative.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mssqlnative.inc.php
diff --git a/libraries/adodb/drivers/adodb-mssqlpo.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mssqlpo.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mssqlpo.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mssqlpo.inc.php
diff --git a/libraries/adodb/drivers/adodb-mysql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mysql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mysql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mysql.inc.php
diff --git a/libraries/adodb/drivers/adodb-mysqli.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mysqli.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mysqli.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mysqli.inc.php
diff --git a/libraries/adodb/drivers/adodb-mysqlpo.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mysqlpo.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mysqlpo.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mysqlpo.inc.php
diff --git a/libraries/adodb/drivers/adodb-mysqlt.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mysqlt.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-mysqlt.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-mysqlt.inc.php
diff --git a/libraries/adodb/drivers/adodb-netezza.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-netezza.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-netezza.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-netezza.inc.php
diff --git a/libraries/adodb/drivers/adodb-oci8.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-oci8.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-oci8.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-oci8.inc.php
diff --git a/libraries/adodb/drivers/adodb-oci805.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-oci805.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-oci805.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-oci805.inc.php
diff --git a/libraries/adodb/drivers/adodb-oci8po.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-oci8po.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-oci8po.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-oci8po.inc.php
diff --git a/libraries/adodb/drivers/adodb-oci8quercus.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-oci8quercus.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-oci8quercus.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-oci8quercus.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbc.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbc.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbc.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbc.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbc_db2.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbc_db2.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbc_db2.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbc_db2.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbc_mssql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbc_mssql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbc_mssql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbc_mssql.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbc_mssql2012.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbc_mssql2012.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbc_mssql2012.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbc_mssql2012.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbc_oracle.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbc_oracle.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbc_oracle.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbc_oracle.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbtp.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbtp.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbtp.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbtp.inc.php
diff --git a/libraries/adodb/drivers/adodb-odbtp_unicode.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-odbtp_unicode.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-odbtp_unicode.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-odbtp_unicode.inc.php
diff --git a/libraries/adodb/drivers/adodb-oracle.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-oracle.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-oracle.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-oracle.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_dblib.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_dblib.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_dblib.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_dblib.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_firebird.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_firebird.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_firebird.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_firebird.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_mssql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_mssql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_mssql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_mssql.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_mysql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_mysql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_mysql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_mysql.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_oci.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_oci.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_oci.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_oci.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_pgsql.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_pgsql.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_pgsql.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_pgsql.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_sqlite.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_sqlite.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_sqlite.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_sqlite.inc.php
diff --git a/libraries/adodb/drivers/adodb-pdo_sqlsrv.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-pdo_sqlsrv.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-pdo_sqlsrv.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-pdo_sqlsrv.inc.php
diff --git a/libraries/adodb/drivers/adodb-postgres.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-postgres.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-postgres.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-postgres.inc.php
diff --git a/libraries/adodb/drivers/adodb-postgres64.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-postgres64.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-postgres64.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-postgres64.inc.php
diff --git a/libraries/adodb/drivers/adodb-postgres7.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-postgres7.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-postgres7.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-postgres7.inc.php
diff --git a/libraries/adodb/drivers/adodb-postgres8.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-postgres8.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-postgres8.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-postgres8.inc.php
diff --git a/libraries/adodb/drivers/adodb-postgres9.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-postgres9.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-postgres9.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-postgres9.inc.php
diff --git a/libraries/adodb/drivers/adodb-proxy.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-proxy.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-proxy.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-proxy.inc.php
diff --git a/libraries/adodb/drivers/adodb-sapdb.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sapdb.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sapdb.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sapdb.inc.php
diff --git a/libraries/adodb/drivers/adodb-sqlanywhere.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sqlanywhere.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sqlanywhere.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sqlanywhere.inc.php
diff --git a/libraries/adodb/drivers/adodb-sqlite.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sqlite.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sqlite.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sqlite.inc.php
diff --git a/libraries/adodb/drivers/adodb-sqlite3.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sqlite3.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sqlite3.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sqlite3.inc.php
diff --git a/libraries/adodb/drivers/adodb-sqlitepo.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sqlitepo.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sqlitepo.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sqlitepo.inc.php
diff --git a/libraries/adodb/drivers/adodb-sybase.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sybase.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sybase.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sybase.inc.php
diff --git a/libraries/adodb/drivers/adodb-sybase_ase.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-sybase_ase.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-sybase_ase.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-sybase_ase.inc.php
diff --git a/libraries/adodb/drivers/adodb-text.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-text.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-text.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-text.inc.php
diff --git a/libraries/adodb/drivers/adodb-vfp.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-vfp.inc.php
similarity index 100%
rename from libraries/adodb/drivers/adodb-vfp.inc.php
rename to libraries/adodb_vtigerfix/drivers/adodb-vfp.inc.php
diff --git a/libraries/adodb/lang/adodb-ar.inc.php b/libraries/adodb_vtigerfix/lang/adodb-ar.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-ar.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-ar.inc.php
diff --git a/libraries/adodb/lang/adodb-bg.inc.php b/libraries/adodb_vtigerfix/lang/adodb-bg.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-bg.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-bg.inc.php
diff --git a/libraries/adodb/lang/adodb-ca.inc.php b/libraries/adodb_vtigerfix/lang/adodb-ca.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-ca.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-ca.inc.php
diff --git a/libraries/adodb/lang/adodb-cn.inc.php b/libraries/adodb_vtigerfix/lang/adodb-cn.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-cn.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-cn.inc.php
diff --git a/libraries/adodb/lang/adodb-cz.inc.php b/libraries/adodb_vtigerfix/lang/adodb-cz.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-cz.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-cz.inc.php
diff --git a/libraries/adodb/lang/adodb-da.inc.php b/libraries/adodb_vtigerfix/lang/adodb-da.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-da.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-da.inc.php
diff --git a/libraries/adodb/lang/adodb-de.inc.php b/libraries/adodb_vtigerfix/lang/adodb-de.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-de.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-de.inc.php
diff --git a/libraries/adodb/lang/adodb-en.inc.php b/libraries/adodb_vtigerfix/lang/adodb-en.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-en.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-en.inc.php
diff --git a/libraries/adodb/lang/adodb-eo.inc.php b/libraries/adodb_vtigerfix/lang/adodb-eo.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-eo.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-eo.inc.php
diff --git a/libraries/adodb/lang/adodb-es.inc.php b/libraries/adodb_vtigerfix/lang/adodb-es.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-es.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-es.inc.php
diff --git a/libraries/adodb/lang/adodb-fa.inc.php b/libraries/adodb_vtigerfix/lang/adodb-fa.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-fa.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-fa.inc.php
diff --git a/libraries/adodb/lang/adodb-fr.inc.php b/libraries/adodb_vtigerfix/lang/adodb-fr.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-fr.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-fr.inc.php
diff --git a/libraries/adodb/lang/adodb-hu.inc.php b/libraries/adodb_vtigerfix/lang/adodb-hu.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-hu.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-hu.inc.php
diff --git a/libraries/adodb/lang/adodb-id.inc.php b/libraries/adodb_vtigerfix/lang/adodb-id.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-id.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-id.inc.php
diff --git a/libraries/adodb/lang/adodb-it.inc.php b/libraries/adodb_vtigerfix/lang/adodb-it.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-it.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-it.inc.php
diff --git a/libraries/adodb/lang/adodb-nl.inc.php b/libraries/adodb_vtigerfix/lang/adodb-nl.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-nl.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-nl.inc.php
diff --git a/libraries/adodb/lang/adodb-oc.inc.php b/libraries/adodb_vtigerfix/lang/adodb-oc.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-oc.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-oc.inc.php
diff --git a/libraries/adodb/lang/adodb-pl.inc.php b/libraries/adodb_vtigerfix/lang/adodb-pl.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-pl.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-pl.inc.php
diff --git a/libraries/adodb/lang/adodb-pt-br.inc.php b/libraries/adodb_vtigerfix/lang/adodb-pt-br.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-pt-br.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-pt-br.inc.php
diff --git a/libraries/adodb/lang/adodb-ro.inc.php b/libraries/adodb_vtigerfix/lang/adodb-ro.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-ro.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-ro.inc.php
diff --git a/libraries/adodb/lang/adodb-ru.inc.php b/libraries/adodb_vtigerfix/lang/adodb-ru.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-ru.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-ru.inc.php
diff --git a/libraries/adodb/lang/adodb-sv.inc.php b/libraries/adodb_vtigerfix/lang/adodb-sv.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-sv.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-sv.inc.php
diff --git a/libraries/adodb/lang/adodb-th.inc.php b/libraries/adodb_vtigerfix/lang/adodb-th.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-th.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-th.inc.php
diff --git a/libraries/adodb/lang/adodb-uk.inc.php b/libraries/adodb_vtigerfix/lang/adodb-uk.inc.php
similarity index 100%
rename from libraries/adodb/lang/adodb-uk.inc.php
rename to libraries/adodb_vtigerfix/lang/adodb-uk.inc.php
diff --git a/libraries/adodb/pear/Auth/Container/ADOdb.php b/libraries/adodb_vtigerfix/pear/Auth/Container/ADOdb.php
similarity index 100%
rename from libraries/adodb/pear/Auth/Container/ADOdb.php
rename to libraries/adodb_vtigerfix/pear/Auth/Container/ADOdb.php
diff --git a/libraries/adodb/pear/auth_adodb_example.php b/libraries/adodb_vtigerfix/pear/auth_adodb_example.php
similarity index 100%
rename from libraries/adodb/pear/auth_adodb_example.php
rename to libraries/adodb_vtigerfix/pear/auth_adodb_example.php
diff --git a/libraries/adodb/pear/readme.Auth.txt b/libraries/adodb_vtigerfix/pear/readme.Auth.txt
similarity index 100%
rename from libraries/adodb/pear/readme.Auth.txt
rename to libraries/adodb_vtigerfix/pear/readme.Auth.txt
diff --git a/libraries/adodb/perf/perf-db2.inc.php b/libraries/adodb_vtigerfix/perf/perf-db2.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-db2.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-db2.inc.php
diff --git a/libraries/adodb/perf/perf-informix.inc.php b/libraries/adodb_vtigerfix/perf/perf-informix.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-informix.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-informix.inc.php
diff --git a/libraries/adodb/perf/perf-mssql.inc.php b/libraries/adodb_vtigerfix/perf/perf-mssql.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-mssql.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-mssql.inc.php
diff --git a/libraries/adodb/perf/perf-mssqlnative.inc.php b/libraries/adodb_vtigerfix/perf/perf-mssqlnative.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-mssqlnative.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-mssqlnative.inc.php
diff --git a/libraries/adodb/perf/perf-mysql.inc.php b/libraries/adodb_vtigerfix/perf/perf-mysql.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-mysql.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-mysql.inc.php
diff --git a/libraries/adodb/perf/perf-oci8.inc.php b/libraries/adodb_vtigerfix/perf/perf-oci8.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-oci8.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-oci8.inc.php
diff --git a/libraries/adodb/perf/perf-postgres.inc.php b/libraries/adodb_vtigerfix/perf/perf-postgres.inc.php
similarity index 100%
rename from libraries/adodb/perf/perf-postgres.inc.php
rename to libraries/adodb_vtigerfix/perf/perf-postgres.inc.php
diff --git a/libraries/adodb/phpdoc b/libraries/adodb_vtigerfix/phpdoc
similarity index 100%
rename from libraries/adodb/phpdoc
rename to libraries/adodb_vtigerfix/phpdoc
diff --git a/libraries/adodb/pivottable.inc.php b/libraries/adodb_vtigerfix/pivottable.inc.php
similarity index 100%
rename from libraries/adodb/pivottable.inc.php
rename to libraries/adodb_vtigerfix/pivottable.inc.php
diff --git a/libraries/adodb/rsfilter.inc.php b/libraries/adodb_vtigerfix/rsfilter.inc.php
similarity index 100%
rename from libraries/adodb/rsfilter.inc.php
rename to libraries/adodb_vtigerfix/rsfilter.inc.php
diff --git a/libraries/adodb/server.php b/libraries/adodb_vtigerfix/server.php
similarity index 100%
rename from libraries/adodb/server.php
rename to libraries/adodb_vtigerfix/server.php
diff --git a/libraries/adodb/session/adodb-compress-bzip2.php b/libraries/adodb_vtigerfix/session/adodb-compress-bzip2.php
similarity index 100%
rename from libraries/adodb/session/adodb-compress-bzip2.php
rename to libraries/adodb_vtigerfix/session/adodb-compress-bzip2.php
diff --git a/libraries/adodb/session/adodb-compress-gzip.php b/libraries/adodb_vtigerfix/session/adodb-compress-gzip.php
similarity index 100%
rename from libraries/adodb/session/adodb-compress-gzip.php
rename to libraries/adodb_vtigerfix/session/adodb-compress-gzip.php
diff --git a/libraries/adodb/session/adodb-cryptsession.php b/libraries/adodb_vtigerfix/session/adodb-cryptsession.php
similarity index 100%
rename from libraries/adodb/session/adodb-cryptsession.php
rename to libraries/adodb_vtigerfix/session/adodb-cryptsession.php
diff --git a/libraries/adodb/session/adodb-cryptsession2.php b/libraries/adodb_vtigerfix/session/adodb-cryptsession2.php
similarity index 100%
rename from libraries/adodb/session/adodb-cryptsession2.php
rename to libraries/adodb_vtigerfix/session/adodb-cryptsession2.php
diff --git a/libraries/adodb/session/adodb-encrypt-mcrypt.php b/libraries/adodb_vtigerfix/session/adodb-encrypt-mcrypt.php
similarity index 100%
rename from libraries/adodb/session/adodb-encrypt-mcrypt.php
rename to libraries/adodb_vtigerfix/session/adodb-encrypt-mcrypt.php
diff --git a/libraries/adodb/session/adodb-encrypt-md5.php b/libraries/adodb_vtigerfix/session/adodb-encrypt-md5.php
similarity index 100%
rename from libraries/adodb/session/adodb-encrypt-md5.php
rename to libraries/adodb_vtigerfix/session/adodb-encrypt-md5.php
diff --git a/libraries/adodb/session/adodb-encrypt-secret.php b/libraries/adodb_vtigerfix/session/adodb-encrypt-secret.php
similarity index 100%
rename from libraries/adodb/session/adodb-encrypt-secret.php
rename to libraries/adodb_vtigerfix/session/adodb-encrypt-secret.php
diff --git a/libraries/adodb/session/adodb-encrypt-sha1.php b/libraries/adodb_vtigerfix/session/adodb-encrypt-sha1.php
similarity index 100%
rename from libraries/adodb/session/adodb-encrypt-sha1.php
rename to libraries/adodb_vtigerfix/session/adodb-encrypt-sha1.php
diff --git a/libraries/adodb/session/adodb-sess.txt b/libraries/adodb_vtigerfix/session/adodb-sess.txt
similarity index 100%
rename from libraries/adodb/session/adodb-sess.txt
rename to libraries/adodb_vtigerfix/session/adodb-sess.txt
diff --git a/libraries/adodb/session/adodb-session-clob.php b/libraries/adodb_vtigerfix/session/adodb-session-clob.php
similarity index 100%
rename from libraries/adodb/session/adodb-session-clob.php
rename to libraries/adodb_vtigerfix/session/adodb-session-clob.php
diff --git a/libraries/adodb/session/adodb-session-clob2.php b/libraries/adodb_vtigerfix/session/adodb-session-clob2.php
similarity index 100%
rename from libraries/adodb/session/adodb-session-clob2.php
rename to libraries/adodb_vtigerfix/session/adodb-session-clob2.php
diff --git a/libraries/adodb/session/adodb-session.php b/libraries/adodb_vtigerfix/session/adodb-session.php
similarity index 100%
rename from libraries/adodb/session/adodb-session.php
rename to libraries/adodb_vtigerfix/session/adodb-session.php
diff --git a/libraries/adodb/session/adodb-session2.php b/libraries/adodb_vtigerfix/session/adodb-session2.php
similarity index 100%
rename from libraries/adodb/session/adodb-session2.php
rename to libraries/adodb_vtigerfix/session/adodb-session2.php
diff --git a/libraries/adodb/session/adodb-sessions.mysql.sql b/libraries/adodb_vtigerfix/session/adodb-sessions.mysql.sql
similarity index 100%
rename from libraries/adodb/session/adodb-sessions.mysql.sql
rename to libraries/adodb_vtigerfix/session/adodb-sessions.mysql.sql
diff --git a/libraries/adodb/session/adodb-sessions.oracle.clob.sql b/libraries/adodb_vtigerfix/session/adodb-sessions.oracle.clob.sql
similarity index 100%
rename from libraries/adodb/session/adodb-sessions.oracle.clob.sql
rename to libraries/adodb_vtigerfix/session/adodb-sessions.oracle.clob.sql
diff --git a/libraries/adodb/session/adodb-sessions.oracle.sql b/libraries/adodb_vtigerfix/session/adodb-sessions.oracle.sql
similarity index 100%
rename from libraries/adodb/session/adodb-sessions.oracle.sql
rename to libraries/adodb_vtigerfix/session/adodb-sessions.oracle.sql
diff --git a/libraries/adodb/session/crypt.inc.php b/libraries/adodb_vtigerfix/session/crypt.inc.php
similarity index 100%
rename from libraries/adodb/session/crypt.inc.php
rename to libraries/adodb_vtigerfix/session/crypt.inc.php
diff --git a/libraries/adodb/session/old/adodb-cryptsession.php b/libraries/adodb_vtigerfix/session/old/adodb-cryptsession.php
similarity index 100%
rename from libraries/adodb/session/old/adodb-cryptsession.php
rename to libraries/adodb_vtigerfix/session/old/adodb-cryptsession.php
diff --git a/libraries/adodb/session/old/adodb-session-clob.php b/libraries/adodb_vtigerfix/session/old/adodb-session-clob.php
similarity index 100%
rename from libraries/adodb/session/old/adodb-session-clob.php
rename to libraries/adodb_vtigerfix/session/old/adodb-session-clob.php
diff --git a/libraries/adodb/session/old/adodb-session.php b/libraries/adodb_vtigerfix/session/old/adodb-session.php
similarity index 100%
rename from libraries/adodb/session/old/adodb-session.php
rename to libraries/adodb_vtigerfix/session/old/adodb-session.php
diff --git a/libraries/adodb/session/old/crypt.inc.php b/libraries/adodb_vtigerfix/session/old/crypt.inc.php
similarity index 100%
rename from libraries/adodb/session/old/crypt.inc.php
rename to libraries/adodb_vtigerfix/session/old/crypt.inc.php
diff --git a/libraries/adodb/session/session_schema.xml b/libraries/adodb_vtigerfix/session/session_schema.xml
similarity index 100%
rename from libraries/adodb/session/session_schema.xml
rename to libraries/adodb_vtigerfix/session/session_schema.xml
diff --git a/libraries/adodb/session/session_schema2.xml b/libraries/adodb_vtigerfix/session/session_schema2.xml
similarity index 100%
rename from libraries/adodb/session/session_schema2.xml
rename to libraries/adodb_vtigerfix/session/session_schema2.xml
diff --git a/libraries/adodb/toexport.inc.php b/libraries/adodb_vtigerfix/toexport.inc.php
similarity index 100%
rename from libraries/adodb/toexport.inc.php
rename to libraries/adodb_vtigerfix/toexport.inc.php
diff --git a/libraries/adodb/tohtml.inc.php b/libraries/adodb_vtigerfix/tohtml.inc.php
similarity index 100%
rename from libraries/adodb/tohtml.inc.php
rename to libraries/adodb_vtigerfix/tohtml.inc.php
diff --git a/libraries/adodb/xmlschema.dtd b/libraries/adodb_vtigerfix/xmlschema.dtd
similarity index 100%
rename from libraries/adodb/xmlschema.dtd
rename to libraries/adodb_vtigerfix/xmlschema.dtd
diff --git a/libraries/adodb/xmlschema03.dtd b/libraries/adodb_vtigerfix/xmlschema03.dtd
similarity index 100%
rename from libraries/adodb/xmlschema03.dtd
rename to libraries/adodb_vtigerfix/xmlschema03.dtd
diff --git a/libraries/adodb/xsl/convert-0.1-0.2.xsl b/libraries/adodb_vtigerfix/xsl/convert-0.1-0.2.xsl
similarity index 100%
rename from libraries/adodb/xsl/convert-0.1-0.2.xsl
rename to libraries/adodb_vtigerfix/xsl/convert-0.1-0.2.xsl
diff --git a/libraries/adodb/xsl/convert-0.1-0.3.xsl b/libraries/adodb_vtigerfix/xsl/convert-0.1-0.3.xsl
similarity index 100%
rename from libraries/adodb/xsl/convert-0.1-0.3.xsl
rename to libraries/adodb_vtigerfix/xsl/convert-0.1-0.3.xsl
diff --git a/libraries/adodb/xsl/convert-0.2-0.1.xsl b/libraries/adodb_vtigerfix/xsl/convert-0.2-0.1.xsl
similarity index 100%
rename from libraries/adodb/xsl/convert-0.2-0.1.xsl
rename to libraries/adodb_vtigerfix/xsl/convert-0.2-0.1.xsl
diff --git a/libraries/adodb/xsl/convert-0.2-0.3.xsl b/libraries/adodb_vtigerfix/xsl/convert-0.2-0.3.xsl
similarity index 100%
rename from libraries/adodb/xsl/convert-0.2-0.3.xsl
rename to libraries/adodb_vtigerfix/xsl/convert-0.2-0.3.xsl
diff --git a/libraries/adodb/xsl/remove-0.2.xsl b/libraries/adodb_vtigerfix/xsl/remove-0.2.xsl
similarity index 100%
rename from libraries/adodb/xsl/remove-0.2.xsl
rename to libraries/adodb_vtigerfix/xsl/remove-0.2.xsl
diff --git a/libraries/adodb/xsl/remove-0.3.xsl b/libraries/adodb_vtigerfix/xsl/remove-0.3.xsl
similarity index 100%
rename from libraries/adodb/xsl/remove-0.3.xsl
rename to libraries/adodb_vtigerfix/xsl/remove-0.3.xsl
diff --git a/libraries/htmlpurifier410/CREDITS b/libraries/htmlpurifier410/CREDITS
deleted file mode 100644
index d0cc45af8..000000000
--- a/libraries/htmlpurifier410/CREDITS
+++ /dev/null
@@ -1,9 +0,0 @@
-
-CREDITS
-
-Almost everything written by Edward Z. Yang (Ambush Commander).  Lots of thanks
-to the DevNetwork Community for their help (see docs/ref-devnetwork.html for
-more details), Feyd especially (namely IPv6 and optimization).  Thanks to RSnake
-for letting me package his fantastic XSS cheatsheet for a smoketest.
-
-    vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/INSTALL b/libraries/htmlpurifier410/INSTALL
deleted file mode 100644
index e77b51661..000000000
--- a/libraries/htmlpurifier410/INSTALL
+++ /dev/null
@@ -1,373 +0,0 @@
-
-Install
-    How to install HTML Purifier
-
-HTML Purifier is designed to run out of the box, so actually using the
-library is extremely easy.  (Although... if you were looking for a
-step-by-step installation GUI, you've downloaded the wrong software!)
-
-While the impatient can get going immediately with some of the sample
-code at the bottom of this library, it's well worth reading this entire
-document--most of the other documentation assumes that you are familiar
-with these contents.
-
-
----------------------------------------------------------------------------
-1.  Compatibility
-
-HTML Purifier is PHP 5 and PHP 7, and is actively tested from PHP 5.0.5
-and up. It has no core dependencies with other libraries.
-
-These optional extensions can enhance the capabilities of HTML Purifier:
-
-    * iconv  : Converts text to and from non-UTF-8 encodings
-    * bcmath : Used for unit conversion and imagecrash protection
-    * tidy   : Used for pretty-printing HTML
-
-These optional libraries can enhance the capabilities of HTML Purifier:
-
-    * CSSTidy : Clean CSS stylesheets using %Core.ExtractStyleBlocks
-        Note: You should use the modernized fork of CSSTidy available
-        at https://github.com/Cerdic/CSSTidy
-    * Net_IDNA2 (PEAR) : IRI support using %Core.EnableIDNA
-        Note: This is not necessary for PHP 5.3 or later
-
----------------------------------------------------------------------------
-2.  Reconnaissance
-
-A big plus of HTML Purifier is its inerrant support of standards, so
-your web-pages should be standards-compliant.  (They should also use
-semantic markup, but that's another issue altogether, one HTML Purifier
-cannot fix without reading your mind.)
-
-HTML Purifier can process these doctypes:
-
-* XHTML 1.0 Transitional (default)
-* XHTML 1.0 Strict
-* HTML 4.01 Transitional
-* HTML 4.01 Strict
-* XHTML 1.1
-
-...and these character encodings:
-
-* UTF-8 (default)
-* Any encoding iconv supports (with crippled internationalization support)
-
-These defaults reflect what my choices would be if I were authoring an
-HTML document, however, what you choose depends on the nature of your
-codebase.  If you don't know what doctype you are using, you can determine
-the doctype from this identifier at the top of your source code:
-
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-...and the character encoding from this code:
-
-    <meta http-equiv="Content-type" content="text/html;charset=ENCODING">
-
-If the character encoding declaration is missing, STOP NOW, and
-read 'docs/enduser-utf8.html' (web accessible at
-http://htmlpurifier.org/docs/enduser-utf8.html).  In fact, even if it is
-present, read this document anyway, as many websites specify their
-document's character encoding incorrectly.
-
-
----------------------------------------------------------------------------
-3.  Including the library
-
-The procedure is quite simple:
-
-    require_once '/path/to/library/HTMLPurifier.auto.php';
-
-This will setup an autoloader, so the library's files are only included
-when you use them.
-
-Only the contents in the library/ folder are necessary, so you can remove
-everything else when using HTML Purifier in a production environment.
-
-If you installed HTML Purifier via PEAR, all you need to do is:
-
-    require_once 'HTMLPurifier.auto.php';
-
-Please note that the usual PEAR practice of including just the classes you
-want will not work with HTML Purifier's autoloading scheme.
-
-Advanced users, read on; other users can skip to section 4.
-
-Autoload compatibility
-----------------------
-
-    HTML Purifier attempts to be as smart as possible when registering an
-    autoloader, but there are some cases where you will need to change
-    your own code to accomodate HTML Purifier. These are those cases:
-
-    PHP VERSION IS LESS THAN 5.1.2, AND YOU'VE DEFINED __autoload
-        Because spl_autoload_register() doesn't exist in early versions
-        of PHP 5, HTML Purifier has no way of adding itself to the autoload
-        stack. Modify your __autoload function to test
-        HTMLPurifier_Bootstrap::autoload($class)
-
-        For example, suppose your autoload function looks like this:
-
-            function __autoload($class) {
-                require str_replace('_', '/', $class) . '.php';
-                return true;
-            }
-
-        A modified version with HTML Purifier would look like this:
-
-            function __autoload($class) {
-                if (HTMLPurifier_Bootstrap::autoload($class)) return true;
-                require str_replace('_', '/', $class) . '.php';
-                return true;
-            }
-
-        Note that there *is* some custom behavior in our autoloader; the
-        original autoloader in our example would work for 99% of the time,
-        but would fail when including language files.
-
-    AN __autoload FUNCTION IS DECLARED AFTER OUR AUTOLOADER IS REGISTERED
-        spl_autoload_register() has the curious behavior of disabling
-        the existing __autoload() handler. Users need to explicitly
-        spl_autoload_register('__autoload'). Because we use SPL when it
-        is available, __autoload() will ALWAYS be disabled. If __autoload()
-        is declared before HTML Purifier is loaded, this is not a problem:
-        HTML Purifier will register the function for you. But if it is
-        declared afterwards, it will mysteriously not work. This
-        snippet of code (after your autoloader is defined) will fix it:
-
-            spl_autoload_register('__autoload')
-
-    Users should also be on guard if they use a version of PHP previous
-    to 5.1.2 without an autoloader--HTML Purifier will define __autoload()
-    for you, which can collide with an autoloader that was added by *you*
-    later.
-
-
-For better performance
-----------------------
-
-    Opcode caches, which greatly speed up PHP initialization for scripts
-    with large amounts of code (HTML Purifier included), don't like
-    autoloaders. We offer an include file that includes all of HTML Purifier's
-    files in one go in an opcode cache friendly manner:
-
-        // If /path/to/library isn't already in your include path, uncomment
-        // the below line:
-        // require '/path/to/library/HTMLPurifier.path.php';
-
-        require 'HTMLPurifier.includes.php';
-
-    Optional components still need to be included--you'll know if you try to
-    use a feature and you get a class doesn't exists error! The autoloader
-    can be used in conjunction with this approach to catch classes that are
-    missing. Simply add this afterwards:
-
-        require 'HTMLPurifier.autoload.php';
-
-Standalone version
-------------------
-
-    HTML Purifier has a standalone distribution; you can also generate
-    a standalone file from the full version by running the script
-    maintenance/generate-standalone.php . The standalone version has the
-    benefit of having most of its code in one file, so parsing is much
-    faster and the library is easier to manage.
-
-    If HTMLPurifier.standalone.php exists in the library directory, you
-    can use it like this:
-
-        require '/path/to/HTMLPurifier.standalone.php';
-
-    This is equivalent to including HTMLPurifier.includes.php, except that
-    the contents of standalone/ will be added to your path. To override this
-    behavior, specify a new HTMLPURIFIER_PREFIX where standalone files can
-    be found (usually, this will be one directory up, the "true" library
-    directory in full distributions). Don't forget to set your path too!
-
-    The autoloader can be added to the end to ensure the classes are
-    loaded when necessary; otherwise you can manually include them.
-    To use the autoloader, use this:
-
-        require 'HTMLPurifier.autoload.php';
-
-For advanced users
-------------------
-
-    HTMLPurifier.auto.php performs a number of operations that can be done
-    individually. These are:
-
-        HTMLPurifier.path.php
-            Puts /path/to/library in the include path. For high performance,
-            this should be done in php.ini.
-
-        HTMLPurifier.autoload.php
-            Registers our autoload handler HTMLPurifier_Bootstrap::autoload($class).
-
-    You can do these operations by yourself--in fact, you must modify your own
-    autoload handler if you are using a version of PHP earlier than PHP 5.1.2
-    (See "Autoload compatibility" above).
-
-
----------------------------------------------------------------------------
-4. Configuration
-
-HTML Purifier is designed to run out-of-the-box, but occasionally HTML
-Purifier needs to be told what to do.  If you answer no to any of these
-questions, read on; otherwise, you can skip to the next section (or, if you're
-into configuring things just for the heck of it, skip to 4.3).
-
-* Am I using UTF-8?
-* Am I using XHTML 1.0 Transitional?
-
-If you answered no to any of these questions, instantiate a configuration
-object and read on:
-
-    $config = HTMLPurifier_Config::createDefault();
-
-
-4.1. Setting a different character encoding
-
-You really shouldn't use any other encoding except UTF-8, especially if you
-plan to support multilingual websites (read section three for more details).
-However, switching to UTF-8 is not always immediately feasible, so we can
-adapt.
-
-HTML Purifier uses iconv to support other character encodings, as such,
-any encoding that iconv supports <http://www.gnu.org/software/libiconv/>
-HTML Purifier supports with this code:
-
-    $config->set('Core.Encoding', /* put your encoding here */);
-
-An example usage for Latin-1 websites (the most common encoding for English
-websites):
-
-    $config->set('Core.Encoding', 'ISO-8859-1');
-
-Note that HTML Purifier's support for non-Unicode encodings is crippled by the
-fact that any character not supported by that encoding will be silently
-dropped, EVEN if it is ampersand escaped.  If you want to work around
-this, you are welcome to read docs/enduser-utf8.html for a fix,
-but please be cognizant of the issues the "solution" creates (for this
-reason, I do not include the solution in this document).
-
-
-4.2. Setting a different doctype
-
-For those of you using HTML 4.01 Transitional, you can disable
-XHTML output like this:
-
-    $config->set('HTML.Doctype', 'HTML 4.01 Transitional');
-
-Other supported doctypes include:
-
-    * HTML 4.01 Strict
-    * HTML 4.01 Transitional
-    * XHTML 1.0 Strict
-    * XHTML 1.0 Transitional
-    * XHTML 1.1
-
-
-4.3. Other settings
-
-There are more configuration directives which can be read about
-here: <http://htmlpurifier.org/live/configdoc/plain.html>  They're a bit boring,
-but they can help out for those of you who like to exert maximum control over
-your code.  Some of the more interesting ones are configurable at the
-demo <http://htmlpurifier.org/demo.php> and are well worth looking into
-for your own system.
-
-For example, you can fine tune allowed elements and attributes, convert
-relative URLs to absolute ones, and even autoparagraph input text! These
-are, respectively, %HTML.Allowed, %URI.MakeAbsolute and %URI.Base, and
-%AutoFormat.AutoParagraph. The %Namespace.Directive naming convention
-translates to:
-
-    $config->set('Namespace.Directive', $value);
-
-E.g.
-
-    $config->set('HTML.Allowed', 'p,b,a[href],i');
-    $config->set('URI.Base', 'http://www.example.com');
-    $config->set('URI.MakeAbsolute', true);
-    $config->set('AutoFormat.AutoParagraph', true);
-
-
----------------------------------------------------------------------------
-5. Caching
-
-HTML Purifier generates some cache files (generally one or two) to speed up
-its execution. For maximum performance, make sure that
-library/HTMLPurifier/DefinitionCache/Serializer is writeable by the webserver.
-
-If you are in the library/ folder of HTML Purifier, you can set the
-appropriate permissions using:
-
-    chmod -R 0755 HTMLPurifier/DefinitionCache/Serializer
-
-If the above command doesn't work, you may need to assign write permissions
-to group:
-
-    chmod -R 0775 HTMLPurifier/DefinitionCache/Serializer
-
-You can also chmod files via your FTP client; this option
-is usually accessible by right clicking the corresponding directory and
-then selecting "chmod" or "file permissions".
-
-Starting with 2.0.1, HTML Purifier will generate friendly error messages
-that will tell you exactly what you have to chmod the directory to, if in doubt,
-follow its advice.
-
-If you are unable or unwilling to give write permissions to the cache
-directory, you can either disable the cache (and suffer a performance
-hit):
-
-    $config->set('Core.DefinitionCache', null);
-
-Or move the cache directory somewhere else (no trailing slash):
-
-    $config->set('Cache.SerializerPath', '/home/user/absolute/path');
-
-
----------------------------------------------------------------------------
-6.   Using the code
-
-The interface is mind-numbingly simple:
-
-    $purifier = new HTMLPurifier($config);
-    $clean_html = $purifier->purify( $dirty_html );
-
-That's it!  For more examples, check out docs/examples/ (they aren't very
-different though).  Also, docs/enduser-slow.html gives advice on what to
-do if HTML Purifier is slowing down your application.
-
-
----------------------------------------------------------------------------
-7.   Quick install
-
-First, make sure library/HTMLPurifier/DefinitionCache/Serializer is
-writable by the webserver (see Section 5: Caching above for details).
-If your website is in UTF-8 and XHTML Transitional, use this code:
-
-<?php
-    require_once '/path/to/htmlpurifier/library/HTMLPurifier.auto.php';
-
-    $config = HTMLPurifier_Config::createDefault();
-    $purifier = new HTMLPurifier($config);
-    $clean_html = $purifier->purify($dirty_html);
-?>
-
-If your website is in a different encoding or doctype, use this code:
-
-<?php
-    require_once '/path/to/htmlpurifier/library/HTMLPurifier.auto.php';
-
-    $config = HTMLPurifier_Config::createDefault();
-    $config->set('Core.Encoding', 'ISO-8859-1'); // replace with your encoding
-    $config->set('HTML.Doctype', 'HTML 4.01 Transitional'); // replace with your doctype
-    $purifier = new HTMLPurifier($config);
-
-    $clean_html = $purifier->purify($dirty_html);
-?>
-
-    vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/LICENSE b/libraries/htmlpurifier410/LICENSE
deleted file mode 100644
index 21ee8faa5..000000000
--- a/libraries/htmlpurifier410/LICENSE
+++ /dev/null
@@ -1,504 +0,0 @@
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-		  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-    vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.auto.php b/libraries/htmlpurifier410/library/HTMLPurifier.auto.php
deleted file mode 100644
index c810e87b6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.auto.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-/**
- * This is a stub include that automatically configures the include path.
- */
-
-set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
-require_once 'HTMLPurifier/Bootstrap.php';
-require_once 'HTMLPurifier.autoload.php';
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.autoload-legacy.php b/libraries/htmlpurifier410/library/HTMLPurifier.autoload-legacy.php
deleted file mode 100644
index fb6418d38..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.autoload-legacy.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-/**
- * @file
- * Legacy autoloader for systems lacking spl_autoload_register
- *
- * Must be separate to prevent deprecation warning on PHP 7.2
- */
-
-spl_autoload_register(function($class)
-{
-    return HTMLPurifier_Bootstrap::autoload($class);
-});
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.autoload.php b/libraries/htmlpurifier410/library/HTMLPurifier.autoload.php
deleted file mode 100644
index 722e76732..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.autoload.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Convenience file that registers autoload handler for HTML Purifier.
- * It also does some sanity checks.
- */
-
-if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) {
-    // We need unregister for our pre-registering functionality
-    HTMLPurifier_Bootstrap::registerAutoload();
-    if (function_exists('__autoload')) {
-        // Be polite and ensure that userland autoload gets retained
-        spl_autoload_register('__autoload');
-    }
-} elseif (!function_exists('__autoload')) {
-    require dirname(__FILE__) . '/HTMLPurifier.autoload-legacy.php';
-}
-
-if (ini_get('zend.ze1_compatibility_mode')) {
-    trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.composer.php b/libraries/htmlpurifier410/library/HTMLPurifier.composer.php
deleted file mode 100644
index 4d06ae4aa..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.composer.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-if (!defined('HTMLPURIFIER_PREFIX')) {
-    define('HTMLPURIFIER_PREFIX', dirname(__FILE__));
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.func.php b/libraries/htmlpurifier410/library/HTMLPurifier.func.php
deleted file mode 100644
index f26eed1fa..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.func.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * @file
- * Defines a function wrapper for HTML Purifier for quick use.
- * @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()''
- */
-
-/**
- * Purify HTML.
- * @param string $html String HTML to purify
- * @param mixed $config Configuration to use, can be any value accepted by
- *        HTMLPurifier_Config::create()
- * @return string
- */
-function HTMLPurifier($html, $config = null)
-{
-    static $purifier = false;
-    if (!$purifier) {
-        $purifier = new HTMLPurifier();
-    }
-    return $purifier->purify($html, $config);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.includes.php b/libraries/htmlpurifier410/library/HTMLPurifier.includes.php
deleted file mode 100644
index c3318b3ab..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.includes.php
+++ /dev/null
@@ -1,234 +0,0 @@
-<?php
-
-/**
- * @file
- * This file was auto-generated by generate-includes.php and includes all of
- * the core files required by HTML Purifier. Use this if performance is a
- * primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
- * FILE, changes will be overwritten the next time the script is run.
- *
- * @version 4.10.0
- *
- * @warning
- *      You must *not* include any other HTML Purifier files before this file,
- *      because 'require' not 'require_once' is used.
- *
- * @warning
- *      This file requires that the include path contains the HTML Purifier
- *      library directory; this is not auto-set.
- */
-
-require 'HTMLPurifier.php';
-require 'HTMLPurifier/Arborize.php';
-require 'HTMLPurifier/AttrCollections.php';
-require 'HTMLPurifier/AttrDef.php';
-require 'HTMLPurifier/AttrTransform.php';
-require 'HTMLPurifier/AttrTypes.php';
-require 'HTMLPurifier/AttrValidator.php';
-require 'HTMLPurifier/Bootstrap.php';
-require 'HTMLPurifier/Definition.php';
-require 'HTMLPurifier/CSSDefinition.php';
-require 'HTMLPurifier/ChildDef.php';
-require 'HTMLPurifier/Config.php';
-require 'HTMLPurifier/ConfigSchema.php';
-require 'HTMLPurifier/ContentSets.php';
-require 'HTMLPurifier/Context.php';
-require 'HTMLPurifier/DefinitionCache.php';
-require 'HTMLPurifier/DefinitionCacheFactory.php';
-require 'HTMLPurifier/Doctype.php';
-require 'HTMLPurifier/DoctypeRegistry.php';
-require 'HTMLPurifier/ElementDef.php';
-require 'HTMLPurifier/Encoder.php';
-require 'HTMLPurifier/EntityLookup.php';
-require 'HTMLPurifier/EntityParser.php';
-require 'HTMLPurifier/ErrorCollector.php';
-require 'HTMLPurifier/ErrorStruct.php';
-require 'HTMLPurifier/Exception.php';
-require 'HTMLPurifier/Filter.php';
-require 'HTMLPurifier/Generator.php';
-require 'HTMLPurifier/HTMLDefinition.php';
-require 'HTMLPurifier/HTMLModule.php';
-require 'HTMLPurifier/HTMLModuleManager.php';
-require 'HTMLPurifier/IDAccumulator.php';
-require 'HTMLPurifier/Injector.php';
-require 'HTMLPurifier/Language.php';
-require 'HTMLPurifier/LanguageFactory.php';
-require 'HTMLPurifier/Length.php';
-require 'HTMLPurifier/Lexer.php';
-require 'HTMLPurifier/Node.php';
-require 'HTMLPurifier/PercentEncoder.php';
-require 'HTMLPurifier/PropertyList.php';
-require 'HTMLPurifier/PropertyListIterator.php';
-require 'HTMLPurifier/Queue.php';
-require 'HTMLPurifier/Strategy.php';
-require 'HTMLPurifier/StringHash.php';
-require 'HTMLPurifier/StringHashParser.php';
-require 'HTMLPurifier/TagTransform.php';
-require 'HTMLPurifier/Token.php';
-require 'HTMLPurifier/TokenFactory.php';
-require 'HTMLPurifier/URI.php';
-require 'HTMLPurifier/URIDefinition.php';
-require 'HTMLPurifier/URIFilter.php';
-require 'HTMLPurifier/URIParser.php';
-require 'HTMLPurifier/URIScheme.php';
-require 'HTMLPurifier/URISchemeRegistry.php';
-require 'HTMLPurifier/UnitConverter.php';
-require 'HTMLPurifier/VarParser.php';
-require 'HTMLPurifier/VarParserException.php';
-require 'HTMLPurifier/Zipper.php';
-require 'HTMLPurifier/AttrDef/CSS.php';
-require 'HTMLPurifier/AttrDef/Clone.php';
-require 'HTMLPurifier/AttrDef/Enum.php';
-require 'HTMLPurifier/AttrDef/Integer.php';
-require 'HTMLPurifier/AttrDef/Lang.php';
-require 'HTMLPurifier/AttrDef/Switch.php';
-require 'HTMLPurifier/AttrDef/Text.php';
-require 'HTMLPurifier/AttrDef/URI.php';
-require 'HTMLPurifier/AttrDef/CSS/Number.php';
-require 'HTMLPurifier/AttrDef/CSS/AlphaValue.php';
-require 'HTMLPurifier/AttrDef/CSS/Background.php';
-require 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
-require 'HTMLPurifier/AttrDef/CSS/Border.php';
-require 'HTMLPurifier/AttrDef/CSS/Color.php';
-require 'HTMLPurifier/AttrDef/CSS/Composite.php';
-require 'HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
-require 'HTMLPurifier/AttrDef/CSS/Filter.php';
-require 'HTMLPurifier/AttrDef/CSS/Font.php';
-require 'HTMLPurifier/AttrDef/CSS/FontFamily.php';
-require 'HTMLPurifier/AttrDef/CSS/Ident.php';
-require 'HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
-require 'HTMLPurifier/AttrDef/CSS/Length.php';
-require 'HTMLPurifier/AttrDef/CSS/ListStyle.php';
-require 'HTMLPurifier/AttrDef/CSS/Multiple.php';
-require 'HTMLPurifier/AttrDef/CSS/Percentage.php';
-require 'HTMLPurifier/AttrDef/CSS/TextDecoration.php';
-require 'HTMLPurifier/AttrDef/CSS/URI.php';
-require 'HTMLPurifier/AttrDef/HTML/Bool.php';
-require 'HTMLPurifier/AttrDef/HTML/Nmtokens.php';
-require 'HTMLPurifier/AttrDef/HTML/Class.php';
-require 'HTMLPurifier/AttrDef/HTML/Color.php';
-require 'HTMLPurifier/AttrDef/HTML/FrameTarget.php';
-require 'HTMLPurifier/AttrDef/HTML/ID.php';
-require 'HTMLPurifier/AttrDef/HTML/Pixels.php';
-require 'HTMLPurifier/AttrDef/HTML/Length.php';
-require 'HTMLPurifier/AttrDef/HTML/LinkTypes.php';
-require 'HTMLPurifier/AttrDef/HTML/MultiLength.php';
-require 'HTMLPurifier/AttrDef/URI/Email.php';
-require 'HTMLPurifier/AttrDef/URI/Host.php';
-require 'HTMLPurifier/AttrDef/URI/IPv4.php';
-require 'HTMLPurifier/AttrDef/URI/IPv6.php';
-require 'HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
-require 'HTMLPurifier/AttrTransform/Background.php';
-require 'HTMLPurifier/AttrTransform/BdoDir.php';
-require 'HTMLPurifier/AttrTransform/BgColor.php';
-require 'HTMLPurifier/AttrTransform/BoolToCSS.php';
-require 'HTMLPurifier/AttrTransform/Border.php';
-require 'HTMLPurifier/AttrTransform/EnumToCSS.php';
-require 'HTMLPurifier/AttrTransform/ImgRequired.php';
-require 'HTMLPurifier/AttrTransform/ImgSpace.php';
-require 'HTMLPurifier/AttrTransform/Input.php';
-require 'HTMLPurifier/AttrTransform/Lang.php';
-require 'HTMLPurifier/AttrTransform/Length.php';
-require 'HTMLPurifier/AttrTransform/Name.php';
-require 'HTMLPurifier/AttrTransform/NameSync.php';
-require 'HTMLPurifier/AttrTransform/Nofollow.php';
-require 'HTMLPurifier/AttrTransform/SafeEmbed.php';
-require 'HTMLPurifier/AttrTransform/SafeObject.php';
-require 'HTMLPurifier/AttrTransform/SafeParam.php';
-require 'HTMLPurifier/AttrTransform/ScriptRequired.php';
-require 'HTMLPurifier/AttrTransform/TargetBlank.php';
-require 'HTMLPurifier/AttrTransform/TargetNoopener.php';
-require 'HTMLPurifier/AttrTransform/TargetNoreferrer.php';
-require 'HTMLPurifier/AttrTransform/Textarea.php';
-require 'HTMLPurifier/ChildDef/Chameleon.php';
-require 'HTMLPurifier/ChildDef/Custom.php';
-require 'HTMLPurifier/ChildDef/Empty.php';
-require 'HTMLPurifier/ChildDef/List.php';
-require 'HTMLPurifier/ChildDef/Required.php';
-require 'HTMLPurifier/ChildDef/Optional.php';
-require 'HTMLPurifier/ChildDef/StrictBlockquote.php';
-require 'HTMLPurifier/ChildDef/Table.php';
-require 'HTMLPurifier/DefinitionCache/Decorator.php';
-require 'HTMLPurifier/DefinitionCache/Null.php';
-require 'HTMLPurifier/DefinitionCache/Serializer.php';
-require 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
-require 'HTMLPurifier/DefinitionCache/Decorator/Memory.php';
-require 'HTMLPurifier/HTMLModule/Bdo.php';
-require 'HTMLPurifier/HTMLModule/CommonAttributes.php';
-require 'HTMLPurifier/HTMLModule/Edit.php';
-require 'HTMLPurifier/HTMLModule/Forms.php';
-require 'HTMLPurifier/HTMLModule/Hypertext.php';
-require 'HTMLPurifier/HTMLModule/Iframe.php';
-require 'HTMLPurifier/HTMLModule/Image.php';
-require 'HTMLPurifier/HTMLModule/Legacy.php';
-require 'HTMLPurifier/HTMLModule/List.php';
-require 'HTMLPurifier/HTMLModule/Name.php';
-require 'HTMLPurifier/HTMLModule/Nofollow.php';
-require 'HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
-require 'HTMLPurifier/HTMLModule/Object.php';
-require 'HTMLPurifier/HTMLModule/Presentation.php';
-require 'HTMLPurifier/HTMLModule/Proprietary.php';
-require 'HTMLPurifier/HTMLModule/Ruby.php';
-require 'HTMLPurifier/HTMLModule/SafeEmbed.php';
-require 'HTMLPurifier/HTMLModule/SafeObject.php';
-require 'HTMLPurifier/HTMLModule/SafeScripting.php';
-require 'HTMLPurifier/HTMLModule/Scripting.php';
-require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
-require 'HTMLPurifier/HTMLModule/Tables.php';
-require 'HTMLPurifier/HTMLModule/Target.php';
-require 'HTMLPurifier/HTMLModule/TargetBlank.php';
-require 'HTMLPurifier/HTMLModule/TargetNoopener.php';
-require 'HTMLPurifier/HTMLModule/TargetNoreferrer.php';
-require 'HTMLPurifier/HTMLModule/Text.php';
-require 'HTMLPurifier/HTMLModule/Tidy.php';
-require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Name.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
-require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Strict.php';
-require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php';
-require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php';
-require 'HTMLPurifier/Injector/AutoParagraph.php';
-require 'HTMLPurifier/Injector/DisplayLinkURI.php';
-require 'HTMLPurifier/Injector/Linkify.php';
-require 'HTMLPurifier/Injector/PurifierLinkify.php';
-require 'HTMLPurifier/Injector/RemoveEmpty.php';
-require 'HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
-require 'HTMLPurifier/Injector/SafeObject.php';
-require 'HTMLPurifier/Lexer/DOMLex.php';
-require 'HTMLPurifier/Lexer/DirectLex.php';
-require 'HTMLPurifier/Node/Comment.php';
-require 'HTMLPurifier/Node/Element.php';
-require 'HTMLPurifier/Node/Text.php';
-require 'HTMLPurifier/Strategy/Composite.php';
-require 'HTMLPurifier/Strategy/Core.php';
-require 'HTMLPurifier/Strategy/FixNesting.php';
-require 'HTMLPurifier/Strategy/MakeWellFormed.php';
-require 'HTMLPurifier/Strategy/RemoveForeignElements.php';
-require 'HTMLPurifier/Strategy/ValidateAttributes.php';
-require 'HTMLPurifier/TagTransform/Font.php';
-require 'HTMLPurifier/TagTransform/Simple.php';
-require 'HTMLPurifier/Token/Comment.php';
-require 'HTMLPurifier/Token/Tag.php';
-require 'HTMLPurifier/Token/Empty.php';
-require 'HTMLPurifier/Token/End.php';
-require 'HTMLPurifier/Token/Start.php';
-require 'HTMLPurifier/Token/Text.php';
-require 'HTMLPurifier/URIFilter/DisableExternal.php';
-require 'HTMLPurifier/URIFilter/DisableExternalResources.php';
-require 'HTMLPurifier/URIFilter/DisableResources.php';
-require 'HTMLPurifier/URIFilter/HostBlacklist.php';
-require 'HTMLPurifier/URIFilter/MakeAbsolute.php';
-require 'HTMLPurifier/URIFilter/Munge.php';
-require 'HTMLPurifier/URIFilter/SafeIframe.php';
-require 'HTMLPurifier/URIScheme/data.php';
-require 'HTMLPurifier/URIScheme/file.php';
-require 'HTMLPurifier/URIScheme/ftp.php';
-require 'HTMLPurifier/URIScheme/http.php';
-require 'HTMLPurifier/URIScheme/https.php';
-require 'HTMLPurifier/URIScheme/mailto.php';
-require 'HTMLPurifier/URIScheme/news.php';
-require 'HTMLPurifier/URIScheme/nntp.php';
-require 'HTMLPurifier/URIScheme/tel.php';
-require 'HTMLPurifier/VarParser/Flexible.php';
-require 'HTMLPurifier/VarParser/Native.php';
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.kses.php b/libraries/htmlpurifier410/library/HTMLPurifier.kses.php
deleted file mode 100644
index cf0c322f0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.kses.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * @file
- * Emulation layer for code that used kses(), substituting in HTML Purifier.
- */
-
-require_once dirname(__FILE__) . '/HTMLPurifier.auto.php';
-
-function kses($string, $allowed_html, $allowed_protocols = null)
-{
-    $config = HTMLPurifier_Config::createDefault();
-    $allowed_elements = array();
-    $allowed_attributes = array();
-    foreach ($allowed_html as $element => $attributes) {
-        $allowed_elements[$element] = true;
-        foreach ($attributes as $attribute => $x) {
-            $allowed_attributes["$element.$attribute"] = true;
-        }
-    }
-    $config->set('HTML.AllowedElements', $allowed_elements);
-    $config->set('HTML.AllowedAttributes', $allowed_attributes);
-    if ($allowed_protocols !== null) {
-        $config->set('URI.AllowedSchemes', $allowed_protocols);
-    }
-    $purifier = new HTMLPurifier($config);
-    return $purifier->purify($string);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.path.php b/libraries/htmlpurifier410/library/HTMLPurifier.path.php
deleted file mode 100644
index 353492a1c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.path.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-/**
- * @file
- * Convenience stub file that adds HTML Purifier's library file to the path
- * without any other side-effects.
- */
-
-set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.php b/libraries/htmlpurifier410/library/HTMLPurifier.php
deleted file mode 100644
index 6f0fa811a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-
-/*! @mainpage
- *
- * HTML Purifier is an HTML filter that will take an arbitrary snippet of
- * HTML and rigorously test, validate and filter it into a version that
- * is safe for output onto webpages. It achieves this by:
- *
- *  -# Lexing (parsing into tokens) the document,
- *  -# Executing various strategies on the tokens:
- *      -# Removing all elements not in the whitelist,
- *      -# Making the tokens well-formed,
- *      -# Fixing the nesting of the nodes, and
- *      -# Validating attributes of the nodes; and
- *  -# Generating HTML from the purified tokens.
- *
- * However, most users will only need to interface with the HTMLPurifier
- * and HTMLPurifier_Config.
- */
-
-/*
-    HTML Purifier 4.10.0 - Standards Compliant HTML Filtering
-    Copyright (C) 2006-2008 Edward Z. Yang
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
- *
- * @note There are several points in which configuration can be specified
- *       for HTML Purifier.  The precedence of these (from lowest to
- *       highest) is as follows:
- *          -# Instance: new HTMLPurifier($config)
- *          -# Invocation: purify($html, $config)
- *       These configurations are entirely independent of each other and
- *       are *not* merged (this behavior may change in the future).
- *
- * @todo We need an easier way to inject strategies using the configuration
- *       object.
- */
-class HTMLPurifier
-{
-
-    /**
-     * Version of HTML Purifier.
-     * @type string
-     */
-    public $version = '4.10.0';
-
-    /**
-     * Constant with version of HTML Purifier.
-     */
-    const VERSION = '4.10.0';
-
-    /**
-     * Global configuration object.
-     * @type HTMLPurifier_Config
-     */
-    public $config;
-
-    /**
-     * Array of extra filter objects to run on HTML,
-     * for backwards compatibility.
-     * @type HTMLPurifier_Filter[]
-     */
-    private $filters = array();
-
-    /**
-     * Single instance of HTML Purifier.
-     * @type HTMLPurifier
-     */
-    private static $instance;
-
-    /**
-     * @type HTMLPurifier_Strategy_Core
-     */
-    protected $strategy;
-
-    /**
-     * @type HTMLPurifier_Generator
-     */
-    protected $generator;
-
-    /**
-     * Resultant context of last run purification.
-     * Is an array of contexts if the last called method was purifyArray().
-     * @type HTMLPurifier_Context
-     */
-    public $context;
-
-    /**
-     * Initializes the purifier.
-     *
-     * @param HTMLPurifier_Config|mixed $config Optional HTMLPurifier_Config object
-     *                for all instances of the purifier, if omitted, a default
-     *                configuration is supplied (which can be overridden on a
-     *                per-use basis).
-     *                The parameter can also be any type that
-     *                HTMLPurifier_Config::create() supports.
-     */
-    public function __construct($config = null)
-    {
-        $this->config = HTMLPurifier_Config::create($config);
-        $this->strategy = new HTMLPurifier_Strategy_Core();
-    }
-
-    /**
-     * Adds a filter to process the output. First come first serve
-     *
-     * @param HTMLPurifier_Filter $filter HTMLPurifier_Filter object
-     */
-    public function addFilter($filter)
-    {
-        trigger_error(
-            'HTMLPurifier->addFilter() is deprecated, use configuration directives' .
-            ' in the Filter namespace or Filter.Custom',
-            E_USER_WARNING
-        );
-        $this->filters[] = $filter;
-    }
-
-    /**
-     * Filters an HTML snippet/document to be XSS-free and standards-compliant.
-     *
-     * @param string $html String of HTML to purify
-     * @param HTMLPurifier_Config $config Config object for this operation,
-     *                if omitted, defaults to the config object specified during this
-     *                object's construction. The parameter can also be any type
-     *                that HTMLPurifier_Config::create() supports.
-     *
-     * @return string Purified HTML
-     */
-    public function purify($html, $config = null)
-    {
-        // :TODO: make the config merge in, instead of replace
-        $config = $config ? HTMLPurifier_Config::create($config) : $this->config;
-
-        // implementation is partially environment dependant, partially
-        // configuration dependant
-        $lexer = HTMLPurifier_Lexer::create($config);
-
-        $context = new HTMLPurifier_Context();
-
-        // setup HTML generator
-        $this->generator = new HTMLPurifier_Generator($config, $context);
-        $context->register('Generator', $this->generator);
-
-        // set up global context variables
-        if ($config->get('Core.CollectErrors')) {
-            // may get moved out if other facilities use it
-            $language_factory = HTMLPurifier_LanguageFactory::instance();
-            $language = $language_factory->create($config, $context);
-            $context->register('Locale', $language);
-
-            $error_collector = new HTMLPurifier_ErrorCollector($context);
-            $context->register('ErrorCollector', $error_collector);
-        }
-
-        // setup id_accumulator context, necessary due to the fact that
-        // AttrValidator can be called from many places
-        $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
-        $context->register('IDAccumulator', $id_accumulator);
-
-        $html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
-
-        // setup filters
-        $filter_flags = $config->getBatch('Filter');
-        $custom_filters = $filter_flags['Custom'];
-        unset($filter_flags['Custom']);
-        $filters = array();
-        foreach ($filter_flags as $filter => $flag) {
-            if (!$flag) {
-                continue;
-            }
-            if (strpos($filter, '.') !== false) {
-                continue;
-            }
-            $class = "HTMLPurifier_Filter_$filter";
-            $filters[] = new $class;
-        }
-        foreach ($custom_filters as $filter) {
-            // maybe "HTMLPurifier_Filter_$filter", but be consistent with AutoFormat
-            $filters[] = $filter;
-        }
-        $filters = array_merge($filters, $this->filters);
-        // maybe prepare(), but later
-
-        for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) {
-            $html = $filters[$i]->preFilter($html, $config, $context);
-        }
-
-        // purified HTML
-        $html =
-            $this->generator->generateFromTokens(
-                // list of tokens
-                $this->strategy->execute(
-                    // list of un-purified tokens
-                    $lexer->tokenizeHTML(
-                        // un-purified HTML
-                        $html,
-                        $config,
-                        $context
-                    ),
-                    $config,
-                    $context
-                )
-            );
-
-        for ($i = $filter_size - 1; $i >= 0; $i--) {
-            $html = $filters[$i]->postFilter($html, $config, $context);
-        }
-
-        $html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context);
-        $this->context =& $context;
-        return $html;
-    }
-
-    /**
-     * Filters an array of HTML snippets
-     *
-     * @param string[] $array_of_html Array of html snippets
-     * @param HTMLPurifier_Config $config Optional config object for this operation.
-     *                See HTMLPurifier::purify() for more details.
-     *
-     * @return string[] Array of purified HTML
-     */
-    public function purifyArray($array_of_html, $config = null)
-    {
-        $context_array = array();
-        foreach ($array_of_html as $key => $html) {
-            $array_of_html[$key] = $this->purify($html, $config);
-            $context_array[$key] = $this->context;
-        }
-        $this->context = $context_array;
-        return $array_of_html;
-    }
-
-    /**
-     * Singleton for enforcing just one HTML Purifier in your system
-     *
-     * @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
-     *                   HTMLPurifier instance to overload singleton with,
-     *                   or HTMLPurifier_Config instance to configure the
-     *                   generated version with.
-     *
-     * @return HTMLPurifier
-     */
-    public static function instance($prototype = null)
-    {
-        if (!self::$instance || $prototype) {
-            if ($prototype instanceof HTMLPurifier) {
-                self::$instance = $prototype;
-            } elseif ($prototype) {
-                self::$instance = new HTMLPurifier($prototype);
-            } else {
-                self::$instance = new HTMLPurifier();
-            }
-        }
-        return self::$instance;
-    }
-
-    /**
-     * Singleton for enforcing just one HTML Purifier in your system
-     *
-     * @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
-     *                   HTMLPurifier instance to overload singleton with,
-     *                   or HTMLPurifier_Config instance to configure the
-     *                   generated version with.
-     *
-     * @return HTMLPurifier
-     * @note Backwards compatibility, see instance()
-     */
-    public static function getInstance($prototype = null)
-    {
-        return HTMLPurifier::instance($prototype);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier.safe-includes.php b/libraries/htmlpurifier410/library/HTMLPurifier.safe-includes.php
deleted file mode 100644
index 852a0b853..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier.safe-includes.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-
-/**
- * @file
- * This file was auto-generated by generate-includes.php and includes all of
- * the core files required by HTML Purifier. This is a convenience stub that
- * includes all files using dirname(__FILE__) and require_once. PLEASE DO NOT
- * EDIT THIS FILE, changes will be overwritten the next time the script is run.
- *
- * Changes to include_path are not necessary.
- */
-
-$__dir = dirname(__FILE__);
-
-require_once $__dir . '/HTMLPurifier.php';
-require_once $__dir . '/HTMLPurifier/Arborize.php';
-require_once $__dir . '/HTMLPurifier/AttrCollections.php';
-require_once $__dir . '/HTMLPurifier/AttrDef.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform.php';
-require_once $__dir . '/HTMLPurifier/AttrTypes.php';
-require_once $__dir . '/HTMLPurifier/AttrValidator.php';
-require_once $__dir . '/HTMLPurifier/Bootstrap.php';
-require_once $__dir . '/HTMLPurifier/Definition.php';
-require_once $__dir . '/HTMLPurifier/CSSDefinition.php';
-require_once $__dir . '/HTMLPurifier/ChildDef.php';
-require_once $__dir . '/HTMLPurifier/Config.php';
-require_once $__dir . '/HTMLPurifier/ConfigSchema.php';
-require_once $__dir . '/HTMLPurifier/ContentSets.php';
-require_once $__dir . '/HTMLPurifier/Context.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCacheFactory.php';
-require_once $__dir . '/HTMLPurifier/Doctype.php';
-require_once $__dir . '/HTMLPurifier/DoctypeRegistry.php';
-require_once $__dir . '/HTMLPurifier/ElementDef.php';
-require_once $__dir . '/HTMLPurifier/Encoder.php';
-require_once $__dir . '/HTMLPurifier/EntityLookup.php';
-require_once $__dir . '/HTMLPurifier/EntityParser.php';
-require_once $__dir . '/HTMLPurifier/ErrorCollector.php';
-require_once $__dir . '/HTMLPurifier/ErrorStruct.php';
-require_once $__dir . '/HTMLPurifier/Exception.php';
-require_once $__dir . '/HTMLPurifier/Filter.php';
-require_once $__dir . '/HTMLPurifier/Generator.php';
-require_once $__dir . '/HTMLPurifier/HTMLDefinition.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule.php';
-require_once $__dir . '/HTMLPurifier/HTMLModuleManager.php';
-require_once $__dir . '/HTMLPurifier/IDAccumulator.php';
-require_once $__dir . '/HTMLPurifier/Injector.php';
-require_once $__dir . '/HTMLPurifier/Language.php';
-require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
-require_once $__dir . '/HTMLPurifier/Length.php';
-require_once $__dir . '/HTMLPurifier/Lexer.php';
-require_once $__dir . '/HTMLPurifier/Node.php';
-require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
-require_once $__dir . '/HTMLPurifier/PropertyList.php';
-require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
-require_once $__dir . '/HTMLPurifier/Queue.php';
-require_once $__dir . '/HTMLPurifier/Strategy.php';
-require_once $__dir . '/HTMLPurifier/StringHash.php';
-require_once $__dir . '/HTMLPurifier/StringHashParser.php';
-require_once $__dir . '/HTMLPurifier/TagTransform.php';
-require_once $__dir . '/HTMLPurifier/Token.php';
-require_once $__dir . '/HTMLPurifier/TokenFactory.php';
-require_once $__dir . '/HTMLPurifier/URI.php';
-require_once $__dir . '/HTMLPurifier/URIDefinition.php';
-require_once $__dir . '/HTMLPurifier/URIFilter.php';
-require_once $__dir . '/HTMLPurifier/URIParser.php';
-require_once $__dir . '/HTMLPurifier/URIScheme.php';
-require_once $__dir . '/HTMLPurifier/URISchemeRegistry.php';
-require_once $__dir . '/HTMLPurifier/UnitConverter.php';
-require_once $__dir . '/HTMLPurifier/VarParser.php';
-require_once $__dir . '/HTMLPurifier/VarParserException.php';
-require_once $__dir . '/HTMLPurifier/Zipper.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Clone.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Enum.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Integer.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Lang.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Switch.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/Text.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Number.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/AlphaValue.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Background.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Border.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Color.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Composite.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Filter.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Font.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/FontFamily.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Ident.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Length.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ListStyle.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Multiple.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Percentage.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/TextDecoration.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/CSS/URI.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Bool.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Nmtokens.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Class.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Color.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/FrameTarget.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ID.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Pixels.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Length.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/LinkTypes.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/HTML/MultiLength.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/Host.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv4.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv6.php';
-require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Background.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/BdoDir.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/BgColor.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/BoolToCSS.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Border.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/EnumToCSS.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/ImgRequired.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/ImgSpace.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Input.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Lang.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Length.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Name.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/NameSync.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Nofollow.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/SafeEmbed.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/SafeObject.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/SafeParam.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/ScriptRequired.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/TargetBlank.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoopener.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoreferrer.php';
-require_once $__dir . '/HTMLPurifier/AttrTransform/Textarea.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Chameleon.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Custom.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Empty.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/List.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Required.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Optional.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/StrictBlockquote.php';
-require_once $__dir . '/HTMLPurifier/ChildDef/Table.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Null.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Serializer.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
-require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Memory.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Bdo.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/CommonAttributes.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Edit.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Forms.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Hypertext.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Iframe.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Image.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Legacy.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/List.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Name.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Nofollow.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Object.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/SafeScripting.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/TargetBlank.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoopener.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoreferrer.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Text.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Name.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Strict.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Transitional.php';
-require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTML.php';
-require_once $__dir . '/HTMLPurifier/Injector/AutoParagraph.php';
-require_once $__dir . '/HTMLPurifier/Injector/DisplayLinkURI.php';
-require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
-require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
-require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
-require_once $__dir . '/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
-require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
-require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
-require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
-require_once $__dir . '/HTMLPurifier/Node/Comment.php';
-require_once $__dir . '/HTMLPurifier/Node/Element.php';
-require_once $__dir . '/HTMLPurifier/Node/Text.php';
-require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
-require_once $__dir . '/HTMLPurifier/Strategy/Core.php';
-require_once $__dir . '/HTMLPurifier/Strategy/FixNesting.php';
-require_once $__dir . '/HTMLPurifier/Strategy/MakeWellFormed.php';
-require_once $__dir . '/HTMLPurifier/Strategy/RemoveForeignElements.php';
-require_once $__dir . '/HTMLPurifier/Strategy/ValidateAttributes.php';
-require_once $__dir . '/HTMLPurifier/TagTransform/Font.php';
-require_once $__dir . '/HTMLPurifier/TagTransform/Simple.php';
-require_once $__dir . '/HTMLPurifier/Token/Comment.php';
-require_once $__dir . '/HTMLPurifier/Token/Tag.php';
-require_once $__dir . '/HTMLPurifier/Token/Empty.php';
-require_once $__dir . '/HTMLPurifier/Token/End.php';
-require_once $__dir . '/HTMLPurifier/Token/Start.php';
-require_once $__dir . '/HTMLPurifier/Token/Text.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternalResources.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/DisableResources.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/HostBlacklist.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/MakeAbsolute.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/Munge.php';
-require_once $__dir . '/HTMLPurifier/URIFilter/SafeIframe.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/data.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/file.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/ftp.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/http.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/https.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/mailto.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/news.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/nntp.php';
-require_once $__dir . '/HTMLPurifier/URIScheme/tel.php';
-require_once $__dir . '/HTMLPurifier/VarParser/Flexible.php';
-require_once $__dir . '/HTMLPurifier/VarParser/Native.php';
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Arborize.php b/libraries/htmlpurifier410/library/HTMLPurifier/Arborize.php
deleted file mode 100644
index b31f2afb3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Arborize.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * Converts a stream of HTMLPurifier_Token into an HTMLPurifier_Node,
- * and back again.
- *
- * @note This transformation is not an equivalence.  We mutate the input
- * token stream to make it so; see all [MUT] markers in code.
- */
-class HTMLPurifier_Arborize
-{
-    public static function arborize($tokens, $config, $context) {
-        $definition = $config->getHTMLDefinition();
-        $parent = new HTMLPurifier_Token_Start($definition->info_parent);
-        $stack = array($parent->toNode());
-        foreach ($tokens as $token) {
-            $token->skip = null; // [MUT]
-            $token->carryover = null; // [MUT]
-            if ($token instanceof HTMLPurifier_Token_End) {
-                $token->start = null; // [MUT]
-                $r = array_pop($stack);
-                //assert($r->name === $token->name);
-                //assert(empty($token->attr));
-                $r->endCol = $token->col;
-                $r->endLine = $token->line;
-                $r->endArmor = $token->armor;
-                continue;
-            }
-            $node = $token->toNode();
-            $stack[count($stack)-1]->children[] = $node;
-            if ($token instanceof HTMLPurifier_Token_Start) {
-                $stack[] = $node;
-            }
-        }
-        //assert(count($stack) == 1);
-        return $stack[0];
-    }
-
-    public static function flatten($node, $config, $context) {
-        $level = 0;
-        $nodes = array($level => new HTMLPurifier_Queue(array($node)));
-        $closingTokens = array();
-        $tokens = array();
-        do {
-            while (!$nodes[$level]->isEmpty()) {
-                $node = $nodes[$level]->shift(); // FIFO
-                list($start, $end) = $node->toTokenPair();
-                if ($level > 0) {
-                    $tokens[] = $start;
-                }
-                if ($end !== NULL) {
-                    $closingTokens[$level][] = $end;
-                }
-                if ($node instanceof HTMLPurifier_Node_Element) {
-                    $level++;
-                    $nodes[$level] = new HTMLPurifier_Queue();
-                    foreach ($node->children as $childNode) {
-                        $nodes[$level]->push($childNode);
-                    }
-                }
-            }
-            $level--;
-            if ($level && isset($closingTokens[$level])) {
-                while ($token = array_pop($closingTokens[$level])) {
-                    $tokens[] = $token;
-                }
-            }
-        } while ($level > 0);
-        return $tokens;
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrCollections.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrCollections.php
deleted file mode 100644
index 6e58663ac..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrCollections.php
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-
-/**
- * Defines common attribute collections that modules reference
- */
-
-class HTMLPurifier_AttrCollections
-{
-
-    /**
-     * Associative array of attribute collections, indexed by name.
-     * @type array
-     */
-    public $info = array();
-
-    /**
-     * Performs all expansions on internal data for use by other inclusions
-     * It also collects all attribute collection extensions from
-     * modules
-     * @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
-     * @param HTMLPurifier_HTMLModule[] $modules Hash array of HTMLPurifier_HTMLModule members
-     */
-    public function __construct($attr_types, $modules)
-    {
-        $this->doConstruct($attr_types, $modules);
-    }
-
-    public function doConstruct($attr_types, $modules)
-    {
-        // load extensions from the modules
-        foreach ($modules as $module) {
-            foreach ($module->attr_collections as $coll_i => $coll) {
-                if (!isset($this->info[$coll_i])) {
-                    $this->info[$coll_i] = array();
-                }
-                foreach ($coll as $attr_i => $attr) {
-                    if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) {
-                        // merge in includes
-                        $this->info[$coll_i][$attr_i] = array_merge(
-                            $this->info[$coll_i][$attr_i],
-                            $attr
-                        );
-                        continue;
-                    }
-                    $this->info[$coll_i][$attr_i] = $attr;
-                }
-            }
-        }
-        // perform internal expansions and inclusions
-        foreach ($this->info as $name => $attr) {
-            // merge attribute collections that include others
-            $this->performInclusions($this->info[$name]);
-            // replace string identifiers with actual attribute objects
-            $this->expandIdentifiers($this->info[$name], $attr_types);
-        }
-    }
-
-    /**
-     * Takes a reference to an attribute associative array and performs
-     * all inclusions specified by the zero index.
-     * @param array &$attr Reference to attribute array
-     */
-    public function performInclusions(&$attr)
-    {
-        if (!isset($attr[0])) {
-            return;
-        }
-        $merge = $attr[0];
-        $seen  = array(); // recursion guard
-        // loop through all the inclusions
-        for ($i = 0; isset($merge[$i]); $i++) {
-            if (isset($seen[$merge[$i]])) {
-                continue;
-            }
-            $seen[$merge[$i]] = true;
-            // foreach attribute of the inclusion, copy it over
-            if (!isset($this->info[$merge[$i]])) {
-                continue;
-            }
-            foreach ($this->info[$merge[$i]] as $key => $value) {
-                if (isset($attr[$key])) {
-                    continue;
-                } // also catches more inclusions
-                $attr[$key] = $value;
-            }
-            if (isset($this->info[$merge[$i]][0])) {
-                // recursion
-                $merge = array_merge($merge, $this->info[$merge[$i]][0]);
-            }
-        }
-        unset($attr[0]);
-    }
-
-    /**
-     * Expands all string identifiers in an attribute array by replacing
-     * them with the appropriate values inside HTMLPurifier_AttrTypes
-     * @param array &$attr Reference to attribute array
-     * @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
-     */
-    public function expandIdentifiers(&$attr, $attr_types)
-    {
-        // because foreach will process new elements we add, make sure we
-        // skip duplicates
-        $processed = array();
-
-        foreach ($attr as $def_i => $def) {
-            // skip inclusions
-            if ($def_i === 0) {
-                continue;
-            }
-
-            if (isset($processed[$def_i])) {
-                continue;
-            }
-
-            // determine whether or not attribute is required
-            if ($required = (strpos($def_i, '*') !== false)) {
-                // rename the definition
-                unset($attr[$def_i]);
-                $def_i = trim($def_i, '*');
-                $attr[$def_i] = $def;
-            }
-
-            $processed[$def_i] = true;
-
-            // if we've already got a literal object, move on
-            if (is_object($def)) {
-                // preserve previous required
-                $attr[$def_i]->required = ($required || $attr[$def_i]->required);
-                continue;
-            }
-
-            if ($def === false) {
-                unset($attr[$def_i]);
-                continue;
-            }
-
-            if ($t = $attr_types->get($def)) {
-                $attr[$def_i] = $t;
-                $attr[$def_i]->required = $required;
-            } else {
-                unset($attr[$def_i]);
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef.php
deleted file mode 100644
index 3e30d1e3b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-
-/**
- * Base class for all validating attribute definitions.
- *
- * This family of classes forms the core for not only HTML attribute validation,
- * but also any sort of string that needs to be validated or cleaned (which
- * means CSS properties and composite definitions are defined here too).
- * Besides defining (through code) what precisely makes the string valid,
- * subclasses are also responsible for cleaning the code if possible.
- */
-
-abstract class HTMLPurifier_AttrDef
-{
-
-    /**
-     * Tells us whether or not an HTML attribute is minimized.
-     * Has no meaning in other contexts.
-     * @type bool
-     */
-    public $minimized = false;
-
-    /**
-     * Tells us whether or not an HTML attribute is required.
-     * Has no meaning in other contexts
-     * @type bool
-     */
-    public $required = false;
-
-    /**
-     * Validates and cleans passed string according to a definition.
-     *
-     * @param string $string String to be validated and cleaned.
-     * @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
-     * @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object.
-     */
-    abstract public function validate($string, $config, $context);
-
-    /**
-     * Convenience method that parses a string as if it were CDATA.
-     *
-     * This method process a string in the manner specified at
-     * <http://www.w3.org/TR/html4/types.html#h-6.2> by removing
-     * leading and trailing whitespace, ignoring line feeds, and replacing
-     * carriage returns and tabs with spaces.  While most useful for HTML
-     * attributes specified as CDATA, it can also be applied to most CSS
-     * values.
-     *
-     * @note This method is not entirely standards compliant, as trim() removes
-     *       more types of whitespace than specified in the spec. In practice,
-     *       this is rarely a problem, as those extra characters usually have
-     *       already been removed by HTMLPurifier_Encoder.
-     *
-     * @warning This processing is inconsistent with XML's whitespace handling
-     *          as specified by section 3.3.3 and referenced XHTML 1.0 section
-     *          4.7.  However, note that we are NOT necessarily
-     *          parsing XML, thus, this behavior may still be correct. We
-     *          assume that newlines have been normalized.
-     */
-    public function parseCDATA($string)
-    {
-        $string = trim($string);
-        $string = str_replace(array("\n", "\t", "\r"), ' ', $string);
-        return $string;
-    }
-
-    /**
-     * Factory method for creating this class from a string.
-     * @param string $string String construction info
-     * @return HTMLPurifier_AttrDef Created AttrDef object corresponding to $string
-     */
-    public function make($string)
-    {
-        // default implementation, return a flyweight of this object.
-        // If $string has an effect on the returned object (i.e. you
-        // need to overload this method), it is best
-        // to clone or instantiate new copies. (Instantiation is safer.)
-        return $this;
-    }
-
-    /**
-     * Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
-     * properly. THIS IS A HACK!
-     * @param string $string a CSS colour definition
-     * @return string
-     */
-    protected function mungeRgb($string)
-    {
-        $p = '\s*(\d+(\.\d+)?([%]?))\s*';
-
-        if (preg_match('/(rgba|hsla)\(/', $string)) {
-            return preg_replace('/(rgba|hsla)\('.$p.','.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8,\11)', $string);
-        }
-
-        return preg_replace('/(rgb|hsl)\('.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8)', $string);
-    }
-
-    /**
-     * Parses a possibly escaped CSS string and returns the "pure"
-     * version of it.
-     */
-    protected function expandCSSEscape($string)
-    {
-        // flexibly parse it
-        $ret = '';
-        for ($i = 0, $c = strlen($string); $i < $c; $i++) {
-            if ($string[$i] === '\\') {
-                $i++;
-                if ($i >= $c) {
-                    $ret .= '\\';
-                    break;
-                }
-                if (ctype_xdigit($string[$i])) {
-                    $code = $string[$i];
-                    for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) {
-                        if (!ctype_xdigit($string[$i])) {
-                            break;
-                        }
-                        $code .= $string[$i];
-                    }
-                    // We have to be extremely careful when adding
-                    // new characters, to make sure we're not breaking
-                    // the encoding.
-                    $char = HTMLPurifier_Encoder::unichr(hexdec($code));
-                    if (HTMLPurifier_Encoder::cleanUTF8($char) === '') {
-                        continue;
-                    }
-                    $ret .= $char;
-                    if ($i < $c && trim($string[$i]) !== '') {
-                        $i--;
-                    }
-                    continue;
-                }
-                if ($string[$i] === "\n") {
-                    continue;
-                }
-            }
-            $ret .= $string[$i];
-        }
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS.php
deleted file mode 100644
index 369db1e76..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute style, otherwise known as CSS.
- * @note We don't implement the whole CSS specification, so it might be
- *       difficult to reuse this component in the context of validating
- *       actual stylesheet declarations.
- * @note If we were really serious about validating the CSS, we would
- *       tokenize the styles and then parse the tokens. Obviously, we
- *       are not doing that. Doing that could seriously harm performance,
- *       but would make these components a lot more viable for a CSS
- *       filtering solution.
- */
-class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $css
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($css, $config, $context)
-    {
-        $css = $this->parseCDATA($css);
-
-        $definition = $config->getCSSDefinition();
-        $allow_duplicates = $config->get("CSS.AllowDuplicates");
-
-
-        // According to the CSS2.1 spec, the places where a
-        // non-delimiting semicolon can appear are in strings
-        // escape sequences.   So here is some dumb hack to
-        // handle quotes.
-        $len = strlen($css);
-        $accum = "";
-        $declarations = array();
-        $quoted = false;
-        for ($i = 0; $i < $len; $i++) {
-            $c = strcspn($css, ";'\"", $i);
-            $accum .= substr($css, $i, $c);
-            $i += $c;
-            if ($i == $len) break;
-            $d = $css[$i];
-            if ($quoted) {
-                $accum .= $d;
-                if ($d == $quoted) {
-                    $quoted = false;
-                }
-            } else {
-                if ($d == ";") {
-                    $declarations[] = $accum;
-                    $accum = "";
-                } else {
-                    $accum .= $d;
-                    $quoted = $d;
-                }
-            }
-        }
-        if ($accum != "") $declarations[] = $accum;
-
-        $propvalues = array();
-        $new_declarations = '';
-
-        /**
-         * Name of the current CSS property being validated.
-         */
-        $property = false;
-        $context->register('CurrentCSSProperty', $property);
-
-        foreach ($declarations as $declaration) {
-            if (!$declaration) {
-                continue;
-            }
-            if (!strpos($declaration, ':')) {
-                continue;
-            }
-            list($property, $value) = explode(':', $declaration, 2);
-            $property = trim($property);
-            $value = trim($value);
-            $ok = false;
-            do {
-                if (isset($definition->info[$property])) {
-                    $ok = true;
-                    break;
-                }
-                if (ctype_lower($property)) {
-                    break;
-                }
-                $property = strtolower($property);
-                if (isset($definition->info[$property])) {
-                    $ok = true;
-                    break;
-                }
-            } while (0);
-            if (!$ok) {
-                continue;
-            }
-            // inefficient call, since the validator will do this again
-            if (strtolower(trim($value)) !== 'inherit') {
-                // inherit works for everything (but only on the base property)
-                $result = $definition->info[$property]->validate(
-                    $value,
-                    $config,
-                    $context
-                );
-            } else {
-                $result = 'inherit';
-            }
-            if ($result === false) {
-                continue;
-            }
-            if ($allow_duplicates) {
-                $new_declarations .= "$property:$result;";
-            } else {
-                $propvalues[$property] = $result;
-            }
-        }
-
-        $context->destroy('CurrentCSSProperty');
-
-        // procedure does not write the new CSS simultaneously, so it's
-        // slightly inefficient, but it's the only way of getting rid of
-        // duplicates. Perhaps config to optimize it, but not now.
-
-        foreach ($propvalues as $prop => $value) {
-            $new_declarations .= "$prop:$value;";
-        }
-
-        return $new_declarations ? $new_declarations : false;
-
-    }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
deleted file mode 100644
index 1a30e8fe0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
-{
-
-    public function __construct()
-    {
-        parent::__construct(false); // opacity is non-negative, but we will clamp it
-    }
-
-    /**
-     * @param string $number
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function validate($number, $config, $context)
-    {
-        $result = parent::validate($number, $config, $context);
-        if ($result === false) {
-            return $result;
-        }
-        $float = (float)$result;
-        if ($float < 0.0) {
-            $result = '0';
-        }
-        if ($float > 1.0) {
-            $result = '1';
-        }
-        return $result;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Background.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Background.php
deleted file mode 100644
index ecd6e276e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Background.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property background.
- * @warning Does not support url tokens that have internal spaces.
- */
-class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of component validators.
-     * @type HTMLPurifier_AttrDef[]
-     * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
-     */
-    protected $info;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function __construct($config)
-    {
-        $def = $config->getCSSDefinition();
-        $this->info['background-color'] = $def->info['background-color'];
-        $this->info['background-image'] = $def->info['background-image'];
-        $this->info['background-repeat'] = $def->info['background-repeat'];
-        $this->info['background-attachment'] = $def->info['background-attachment'];
-        $this->info['background-position'] = $def->info['background-position'];
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        // regular pre-processing
-        $string = $this->parseCDATA($string);
-        if ($string === '') {
-            return false;
-        }
-
-        // munge rgb() decl if necessary
-        $string = $this->mungeRgb($string);
-
-        // assumes URI doesn't have spaces in it
-        $bits = explode(' ', $string); // bits to process
-
-        $caught = array();
-        $caught['color'] = false;
-        $caught['image'] = false;
-        $caught['repeat'] = false;
-        $caught['attachment'] = false;
-        $caught['position'] = false;
-
-        $i = 0; // number of catches
-
-        foreach ($bits as $bit) {
-            if ($bit === '') {
-                continue;
-            }
-            foreach ($caught as $key => $status) {
-                if ($key != 'position') {
-                    if ($status !== false) {
-                        continue;
-                    }
-                    $r = $this->info['background-' . $key]->validate($bit, $config, $context);
-                } else {
-                    $r = $bit;
-                }
-                if ($r === false) {
-                    continue;
-                }
-                if ($key == 'position') {
-                    if ($caught[$key] === false) {
-                        $caught[$key] = '';
-                    }
-                    $caught[$key] .= $r . ' ';
-                } else {
-                    $caught[$key] = $r;
-                }
-                $i++;
-                break;
-            }
-        }
-
-        if (!$i) {
-            return false;
-        }
-        if ($caught['position'] !== false) {
-            $caught['position'] = $this->info['background-position']->
-                validate($caught['position'], $config, $context);
-        }
-
-        $ret = array();
-        foreach ($caught as $value) {
-            if ($value === false) {
-                continue;
-            }
-            $ret[] = $value;
-        }
-
-        if (empty($ret)) {
-            return false;
-        }
-        return implode(' ', $ret);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
deleted file mode 100644
index f95de5bbf..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-
-/* W3C says:
-    [ // adjective and number must be in correct order, even if
-      // you could switch them without introducing ambiguity.
-      // some browsers support that syntax
-        [
-            <percentage> | <length> | left | center | right
-        ]
-        [
-            <percentage> | <length> | top | center | bottom
-        ]?
-    ] |
-    [ // this signifies that the vertical and horizontal adjectives
-      // can be arbitrarily ordered, however, there can only be two,
-      // one of each, or none at all
-        [
-            left | center | right
-        ] ||
-        [
-            top | center | bottom
-        ]
-    ]
-    top, left = 0%
-    center, (none) = 50%
-    bottom, right = 100%
-*/
-
-/* QuirksMode says:
-    keyword + length/percentage must be ordered correctly, as per W3C
-
-    Internet Explorer and Opera, however, support arbitrary ordering. We
-    should fix it up.
-
-    Minor issue though, not strictly necessary.
-*/
-
-// control freaks may appreciate the ability to convert these to
-// percentages or something, but it's not necessary
-
-/**
- * Validates the value of background-position.
- */
-class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @type HTMLPurifier_AttrDef_CSS_Length
-     */
-    protected $length;
-
-    /**
-     * @type HTMLPurifier_AttrDef_CSS_Percentage
-     */
-    protected $percentage;
-
-    public function __construct()
-    {
-        $this->length = new HTMLPurifier_AttrDef_CSS_Length();
-        $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = $this->parseCDATA($string);
-        $bits = explode(' ', $string);
-
-        $keywords = array();
-        $keywords['h'] = false; // left, right
-        $keywords['v'] = false; // top, bottom
-        $keywords['ch'] = false; // center (first word)
-        $keywords['cv'] = false; // center (second word)
-        $measures = array();
-
-        $i = 0;
-
-        $lookup = array(
-            'top' => 'v',
-            'bottom' => 'v',
-            'left' => 'h',
-            'right' => 'h',
-            'center' => 'c'
-        );
-
-        foreach ($bits as $bit) {
-            if ($bit === '') {
-                continue;
-            }
-
-            // test for keyword
-            $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
-            if (isset($lookup[$lbit])) {
-                $status = $lookup[$lbit];
-                if ($status == 'c') {
-                    if ($i == 0) {
-                        $status = 'ch';
-                    } else {
-                        $status = 'cv';
-                    }
-                }
-                $keywords[$status] = $lbit;
-                $i++;
-            }
-
-            // test for length
-            $r = $this->length->validate($bit, $config, $context);
-            if ($r !== false) {
-                $measures[] = $r;
-                $i++;
-            }
-
-            // test for percentage
-            $r = $this->percentage->validate($bit, $config, $context);
-            if ($r !== false) {
-                $measures[] = $r;
-                $i++;
-            }
-        }
-
-        if (!$i) {
-            return false;
-        } // no valid values were caught
-
-        $ret = array();
-
-        // first keyword
-        if ($keywords['h']) {
-            $ret[] = $keywords['h'];
-        } elseif ($keywords['ch']) {
-            $ret[] = $keywords['ch'];
-            $keywords['cv'] = false; // prevent re-use: center = center center
-        } elseif (count($measures)) {
-            $ret[] = array_shift($measures);
-        }
-
-        if ($keywords['v']) {
-            $ret[] = $keywords['v'];
-        } elseif ($keywords['cv']) {
-            $ret[] = $keywords['cv'];
-        } elseif (count($measures)) {
-            $ret[] = array_shift($measures);
-        }
-
-        if (empty($ret)) {
-            return false;
-        }
-        return implode(' ', $ret);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Border.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Border.php
deleted file mode 100644
index bd310ff23..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Border.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Validates the border property as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of properties this property is shorthand for.
-     * @type HTMLPurifier_AttrDef[]
-     */
-    protected $info = array();
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function __construct($config)
-    {
-        $def = $config->getCSSDefinition();
-        $this->info['border-width'] = $def->info['border-width'];
-        $this->info['border-style'] = $def->info['border-style'];
-        $this->info['border-top-color'] = $def->info['border-top-color'];
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = $this->parseCDATA($string);
-        $string = $this->mungeRgb($string);
-        $bits = explode(' ', $string);
-        $done = array(); // segments we've finished
-        $ret = ''; // return value
-        foreach ($bits as $bit) {
-            foreach ($this->info as $propname => $validator) {
-                if (isset($done[$propname])) {
-                    continue;
-                }
-                $r = $validator->validate($bit, $config, $context);
-                if ($r !== false) {
-                    $ret .= $r . ' ';
-                    $done[$propname] = true;
-                    break;
-                }
-            }
-        }
-        return rtrim($ret);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Color.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Color.php
deleted file mode 100644
index d1b1b3c19..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Color.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-/**
- * Validates Color as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @type HTMLPurifier_AttrDef_CSS_AlphaValue
-     */
-    protected $alpha;
-
-    public function __construct()
-    {
-        $this->alpha = new HTMLPurifier_AttrDef_CSS_AlphaValue();
-    }
-
-    /**
-     * @param string $color
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($color, $config, $context)
-    {
-        static $colors = null;
-        if ($colors === null) {
-            $colors = $config->get('Core.ColorKeywords');
-        }
-
-        $color = trim($color);
-        if ($color === '') {
-            return false;
-        }
-
-        $lower = strtolower($color);
-        if (isset($colors[$lower])) {
-            return $colors[$lower];
-        }
-
-        if (preg_match('#(rgb|rgba|hsl|hsla)\(#', $color, $matches) === 1) {
-            $length = strlen($color);
-            if (strpos($color, ')') !== $length - 1) {
-                return false;
-            }
-
-            // get used function : rgb, rgba, hsl or hsla
-            $function = $matches[1];
-
-            $parameters_size = 3;
-            $alpha_channel = false;
-            if (substr($function, -1) === 'a') {
-                $parameters_size = 4;
-                $alpha_channel = true;
-            }
-
-            /*
-             * Allowed types for values :
-             * parameter_position => [type => max_value]
-             */
-            $allowed_types = array(
-                1 => array('percentage' => 100, 'integer' => 255),
-                2 => array('percentage' => 100, 'integer' => 255),
-                3 => array('percentage' => 100, 'integer' => 255),
-            );
-            $allow_different_types = false;
-
-            if (strpos($function, 'hsl') !== false) {
-                $allowed_types = array(
-                    1 => array('integer' => 360),
-                    2 => array('percentage' => 100),
-                    3 => array('percentage' => 100),
-                );
-                $allow_different_types = true;
-            }
-
-            $values = trim(str_replace($function, '', $color), ' ()');
-
-            $parts = explode(',', $values);
-            if (count($parts) !== $parameters_size) {
-                return false;
-            }
-
-            $type = false;
-            $new_parts = array();
-            $i = 0;
-
-            foreach ($parts as $part) {
-                $i++;
-                $part = trim($part);
-
-                if ($part === '') {
-                    return false;
-                }
-
-                // different check for alpha channel
-                if ($alpha_channel === true && $i === count($parts)) {
-                    $result = $this->alpha->validate($part, $config, $context);
-
-                    if ($result === false) {
-                        return false;
-                    }
-
-                    $new_parts[] = (string)$result;
-                    continue;
-                }
-
-                if (substr($part, -1) === '%') {
-                    $current_type = 'percentage';
-                } else {
-                    $current_type = 'integer';
-                }
-
-                if (!array_key_exists($current_type, $allowed_types[$i])) {
-                    return false;
-                }
-
-                if (!$type) {
-                    $type = $current_type;
-                }
-
-                if ($allow_different_types === false && $type != $current_type) {
-                    return false;
-                }
-
-                $max_value = $allowed_types[$i][$current_type];
-
-                if ($current_type == 'integer') {
-                    // Return value between range 0 -> $max_value
-                    $new_parts[] = (int)max(min($part, $max_value), 0);
-                } elseif ($current_type == 'percentage') {
-                    $new_parts[] = (float)max(min(rtrim($part, '%'), $max_value), 0) . '%';
-                }
-            }
-
-            $new_values = implode(',', $new_parts);
-
-            $color = $function . '(' . $new_values . ')';
-        } else {
-            // hexadecimal handling
-            if ($color[0] === '#') {
-                $hex = substr($color, 1);
-            } else {
-                $hex = $color;
-                $color = '#' . $color;
-            }
-            $length = strlen($hex);
-            if ($length !== 3 && $length !== 6) {
-                return false;
-            }
-            if (!ctype_xdigit($hex)) {
-                return false;
-            }
-        }
-        return $color;
-    }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Composite.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Composite.php
deleted file mode 100644
index 389002322..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Composite.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Allows multiple validators to attempt to validate attribute.
- *
- * Composite is just what it sounds like: a composite of many validators.
- * This means that multiple HTMLPurifier_AttrDef objects will have a whack
- * at the string.  If one of them passes, that's what is returned.  This is
- * especially useful for CSS values, which often are a choice between
- * an enumerated set of predefined values or a flexible data type.
- */
-class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * List of objects that may process strings.
-     * @type HTMLPurifier_AttrDef[]
-     * @todo Make protected
-     */
-    public $defs;
-
-    /**
-     * @param HTMLPurifier_AttrDef[] $defs List of HTMLPurifier_AttrDef objects
-     */
-    public function __construct($defs)
-    {
-        $this->defs = $defs;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        foreach ($this->defs as $i => $def) {
-            $result = $this->defs[$i]->validate($string, $config, $context);
-            if ($result !== false) {
-                return $result;
-            }
-        }
-        return false;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
deleted file mode 100644
index ff0d897ed..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Decorator which enables CSS properties to be disabled for specific elements.
- */
-class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
-{
-    /**
-     * @type HTMLPurifier_AttrDef
-     */
-    public $def;
-    /**
-     * @type string
-     */
-    public $element;
-
-    /**
-     * @param HTMLPurifier_AttrDef $def Definition to wrap
-     * @param string $element Element to deny
-     */
-    public function __construct($def, $element)
-    {
-        $this->def = $def;
-        $this->element = $element;
-    }
-
-    /**
-     * Checks if CurrentToken is set and equal to $this->element
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $token = $context->get('CurrentToken', true);
-        if ($token && $token->name == $this->element) {
-            return false;
-        }
-        return $this->def->validate($string, $config, $context);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Filter.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Filter.php
deleted file mode 100644
index 019722a48..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Filter.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * Microsoft's proprietary filter: CSS property
- * @note Currently supports the alpha filter. In the future, this will
- *       probably need an extensible framework
- */
-class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
-{
-    /**
-     * @type HTMLPurifier_AttrDef_Integer
-     */
-    protected $intValidator;
-
-    public function __construct()
-    {
-        $this->intValidator = new HTMLPurifier_AttrDef_Integer();
-    }
-
-    /**
-     * @param string $value
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($value, $config, $context)
-    {
-        $value = $this->parseCDATA($value);
-        if ($value === 'none') {
-            return $value;
-        }
-        // if we looped this we could support multiple filters
-        $function_length = strcspn($value, '(');
-        $function = trim(substr($value, 0, $function_length));
-        if ($function !== 'alpha' &&
-            $function !== 'Alpha' &&
-            $function !== 'progid:DXImageTransform.Microsoft.Alpha'
-        ) {
-            return false;
-        }
-        $cursor = $function_length + 1;
-        $parameters_length = strcspn($value, ')', $cursor);
-        $parameters = substr($value, $cursor, $parameters_length);
-        $params = explode(',', $parameters);
-        $ret_params = array();
-        $lookup = array();
-        foreach ($params as $param) {
-            list($key, $value) = explode('=', $param);
-            $key = trim($key);
-            $value = trim($value);
-            if (isset($lookup[$key])) {
-                continue;
-            }
-            if ($key !== 'opacity') {
-                continue;
-            }
-            $value = $this->intValidator->validate($value, $config, $context);
-            if ($value === false) {
-                continue;
-            }
-            $int = (int)$value;
-            if ($int > 100) {
-                $value = '100';
-            }
-            if ($int < 0) {
-                $value = '0';
-            }
-            $ret_params[] = "$key=$value";
-            $lookup[$key] = true;
-        }
-        $ret_parameters = implode(',', $ret_params);
-        $ret_function = "$function($ret_parameters)";
-        return $ret_function;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Font.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Font.php
deleted file mode 100644
index b9b63f8ef..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Font.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property font.
- */
-class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of validators
-     * @type HTMLPurifier_AttrDef[]
-     * @note If we moved specific CSS property definitions to their own
-     *       classes instead of having them be assembled at run time by
-     *       CSSDefinition, this wouldn't be necessary.  We'd instantiate
-     *       our own copies.
-     */
-    protected $info = array();
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function __construct($config)
-    {
-        $def = $config->getCSSDefinition();
-        $this->info['font-style'] = $def->info['font-style'];
-        $this->info['font-variant'] = $def->info['font-variant'];
-        $this->info['font-weight'] = $def->info['font-weight'];
-        $this->info['font-size'] = $def->info['font-size'];
-        $this->info['line-height'] = $def->info['line-height'];
-        $this->info['font-family'] = $def->info['font-family'];
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        static $system_fonts = array(
-            'caption' => true,
-            'icon' => true,
-            'menu' => true,
-            'message-box' => true,
-            'small-caption' => true,
-            'status-bar' => true
-        );
-
-        // regular pre-processing
-        $string = $this->parseCDATA($string);
-        if ($string === '') {
-            return false;
-        }
-
-        // check if it's one of the keywords
-        $lowercase_string = strtolower($string);
-        if (isset($system_fonts[$lowercase_string])) {
-            return $lowercase_string;
-        }
-
-        $bits = explode(' ', $string); // bits to process
-        $stage = 0; // this indicates what we're looking for
-        $caught = array(); // which stage 0 properties have we caught?
-        $stage_1 = array('font-style', 'font-variant', 'font-weight');
-        $final = ''; // output
-
-        for ($i = 0, $size = count($bits); $i < $size; $i++) {
-            if ($bits[$i] === '') {
-                continue;
-            }
-            switch ($stage) {
-                case 0: // attempting to catch font-style, font-variant or font-weight
-                    foreach ($stage_1 as $validator_name) {
-                        if (isset($caught[$validator_name])) {
-                            continue;
-                        }
-                        $r = $this->info[$validator_name]->validate(
-                            $bits[$i],
-                            $config,
-                            $context
-                        );
-                        if ($r !== false) {
-                            $final .= $r . ' ';
-                            $caught[$validator_name] = true;
-                            break;
-                        }
-                    }
-                    // all three caught, continue on
-                    if (count($caught) >= 3) {
-                        $stage = 1;
-                    }
-                    if ($r !== false) {
-                        break;
-                    }
-                case 1: // attempting to catch font-size and perhaps line-height
-                    $found_slash = false;
-                    if (strpos($bits[$i], '/') !== false) {
-                        list($font_size, $line_height) =
-                            explode('/', $bits[$i]);
-                        if ($line_height === '') {
-                            // ooh, there's a space after the slash!
-                            $line_height = false;
-                            $found_slash = true;
-                        }
-                    } else {
-                        $font_size = $bits[$i];
-                        $line_height = false;
-                    }
-                    $r = $this->info['font-size']->validate(
-                        $font_size,
-                        $config,
-                        $context
-                    );
-                    if ($r !== false) {
-                        $final .= $r;
-                        // attempt to catch line-height
-                        if ($line_height === false) {
-                            // we need to scroll forward
-                            for ($j = $i + 1; $j < $size; $j++) {
-                                if ($bits[$j] === '') {
-                                    continue;
-                                }
-                                if ($bits[$j] === '/') {
-                                    if ($found_slash) {
-                                        return false;
-                                    } else {
-                                        $found_slash = true;
-                                        continue;
-                                    }
-                                }
-                                $line_height = $bits[$j];
-                                break;
-                            }
-                        } else {
-                            // slash already found
-                            $found_slash = true;
-                            $j = $i;
-                        }
-                        if ($found_slash) {
-                            $i = $j;
-                            $r = $this->info['line-height']->validate(
-                                $line_height,
-                                $config,
-                                $context
-                            );
-                            if ($r !== false) {
-                                $final .= '/' . $r;
-                            }
-                        }
-                        $final .= ' ';
-                        $stage = 2;
-                        break;
-                    }
-                    return false;
-                case 2: // attempting to catch font-family
-                    $font_family =
-                        implode(' ', array_slice($bits, $i, $size - $i));
-                    $r = $this->info['font-family']->validate(
-                        $font_family,
-                        $config,
-                        $context
-                    );
-                    if ($r !== false) {
-                        $final .= $r . ' ';
-                        // processing completed successfully
-                        return rtrim($final);
-                    }
-                    return false;
-            }
-        }
-        return false;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/FontFamily.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
deleted file mode 100644
index f9af36d79..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/FontFamily.php
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-
-/**
- * Validates a font family list according to CSS spec
- */
-class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
-{
-
-    protected $mask = null;
-
-    public function __construct()
-    {
-        $this->mask = '_- ';
-        for ($c = 'a'; $c <= 'z'; $c++) {
-            $this->mask .= $c;
-        }
-        for ($c = 'A'; $c <= 'Z'; $c++) {
-            $this->mask .= $c;
-        }
-        for ($c = '0'; $c <= '9'; $c++) {
-            $this->mask .= $c;
-        } // cast-y, but should be fine
-        // special bytes used by UTF-8
-        for ($i = 0x80; $i <= 0xFF; $i++) {
-            // We don't bother excluding invalid bytes in this range,
-            // because the our restriction of well-formed UTF-8 will
-            // prevent these from ever occurring.
-            $this->mask .= chr($i);
-        }
-
-        /*
-            PHP's internal strcspn implementation is
-            O(length of string * length of mask), making it inefficient
-            for large masks.  However, it's still faster than
-            preg_match 8)
-          for (p = s1;;) {
-            spanp = s2;
-            do {
-              if (*spanp == c || p == s1_end) {
-                return p - s1;
-              }
-            } while (spanp++ < (s2_end - 1));
-            c = *++p;
-          }
-         */
-        // possible optimization: invert the mask.
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        static $generic_names = array(
-            'serif' => true,
-            'sans-serif' => true,
-            'monospace' => true,
-            'fantasy' => true,
-            'cursive' => true
-        );
-        $allowed_fonts = $config->get('CSS.AllowedFonts');
-
-        // assume that no font names contain commas in them
-        $fonts = explode(',', $string);
-        $final = '';
-        foreach ($fonts as $font) {
-            $font = trim($font);
-            if ($font === '') {
-                continue;
-            }
-            // match a generic name
-            if (isset($generic_names[$font])) {
-                if ($allowed_fonts === null || isset($allowed_fonts[$font])) {
-                    $final .= $font . ', ';
-                }
-                continue;
-            }
-            // match a quoted name
-            if ($font[0] === '"' || $font[0] === "'") {
-                $length = strlen($font);
-                if ($length <= 2) {
-                    continue;
-                }
-                $quote = $font[0];
-                if ($font[$length - 1] !== $quote) {
-                    continue;
-                }
-                $font = substr($font, 1, $length - 2);
-            }
-
-            $font = $this->expandCSSEscape($font);
-
-            // $font is a pure representation of the font name
-
-            if ($allowed_fonts !== null && !isset($allowed_fonts[$font])) {
-                continue;
-            }
-
-            if (ctype_alnum($font) && $font !== '') {
-                // very simple font, allow it in unharmed
-                $final .= $font . ', ';
-                continue;
-            }
-
-            // bugger out on whitespace.  form feed (0C) really
-            // shouldn't show up regardless
-            $font = str_replace(array("\n", "\t", "\r", "\x0C"), ' ', $font);
-
-            // Here, there are various classes of characters which need
-            // to be treated differently:
-            //  - Alphanumeric characters are essentially safe.  We
-            //    handled these above.
-            //  - Spaces require quoting, though most parsers will do
-            //    the right thing if there aren't any characters that
-            //    can be misinterpreted
-            //  - Dashes rarely occur, but they fairly unproblematic
-            //    for parsing/rendering purposes.
-            //  The above characters cover the majority of Western font
-            //  names.
-            //  - Arbitrary Unicode characters not in ASCII.  Because
-            //    most parsers give little thought to Unicode, treatment
-            //    of these codepoints is basically uniform, even for
-            //    punctuation-like codepoints.  These characters can
-            //    show up in non-Western pages and are supported by most
-            //    major browsers, for example: "MS 明朝" is a
-            //    legitimate font-name
-            //    <http://ja.wikipedia.org/wiki/MS_明朝>.  See
-            //    the CSS3 spec for more examples:
-            //    <http://www.w3.org/TR/2011/WD-css3-fonts-20110324/localizedfamilynames.png>
-            //    You can see live samples of these on the Internet:
-            //    <http://www.google.co.jp/search?q=font-family+MS+明朝|ゴシック>
-            //    However, most of these fonts have ASCII equivalents:
-            //    for example, 'MS Mincho', and it's considered
-            //    professional to use ASCII font names instead of
-            //    Unicode font names.  Thanks Takeshi Terada for
-            //    providing this information.
-            //  The following characters, to my knowledge, have not been
-            //  used to name font names.
-            //  - Single quote.  While theoretically you might find a
-            //    font name that has a single quote in its name (serving
-            //    as an apostrophe, e.g. Dave's Scribble), I haven't
-            //    been able to find any actual examples of this.
-            //    Internet Explorer's cssText translation (which I
-            //    believe is invoked by innerHTML) normalizes any
-            //    quoting to single quotes, and fails to escape single
-            //    quotes.  (Note that this is not IE's behavior for all
-            //    CSS properties, just some sort of special casing for
-            //    font-family).  So a single quote *cannot* be used
-            //    safely in the font-family context if there will be an
-            //    innerHTML/cssText translation.  Note that Firefox 3.x
-            //    does this too.
-            //  - Double quote.  In IE, these get normalized to
-            //    single-quotes, no matter what the encoding.  (Fun
-            //    fact, in IE8, the 'content' CSS property gained
-            //    support, where they special cased to preserve encoded
-            //    double quotes, but still translate unadorned double
-            //    quotes into single quotes.)  So, because their
-            //    fixpoint behavior is identical to single quotes, they
-            //    cannot be allowed either.  Firefox 3.x displays
-            //    single-quote style behavior.
-            //  - Backslashes are reduced by one (so \\ -> \) every
-            //    iteration, so they cannot be used safely.  This shows
-            //    up in IE7, IE8 and FF3
-            //  - Semicolons, commas and backticks are handled properly.
-            //  - The rest of the ASCII punctuation is handled properly.
-            // We haven't checked what browsers do to unadorned
-            // versions, but this is not important as long as the
-            // browser doesn't /remove/ surrounding quotes (as IE does
-            // for HTML).
-            //
-            // With these results in hand, we conclude that there are
-            // various levels of safety:
-            //  - Paranoid: alphanumeric, spaces and dashes(?)
-            //  - International: Paranoid + non-ASCII Unicode
-            //  - Edgy: Everything except quotes, backslashes
-            //  - NoJS: Standards compliance, e.g. sod IE. Note that
-            //    with some judicious character escaping (since certain
-            //    types of escaping doesn't work) this is theoretically
-            //    OK as long as innerHTML/cssText is not called.
-            // We believe that international is a reasonable default
-            // (that we will implement now), and once we do more
-            // extensive research, we may feel comfortable with dropping
-            // it down to edgy.
-
-            // Edgy: alphanumeric, spaces, dashes, underscores and Unicode.  Use of
-            // str(c)spn assumes that the string was already well formed
-            // Unicode (which of course it is).
-            if (strspn($font, $this->mask) !== strlen($font)) {
-                continue;
-            }
-
-            // Historical:
-            // In the absence of innerHTML/cssText, these ugly
-            // transforms don't pose a security risk (as \\ and \"
-            // might--these escapes are not supported by most browsers).
-            // We could try to be clever and use single-quote wrapping
-            // when there is a double quote present, but I have choosen
-            // not to implement that.  (NOTE: you can reduce the amount
-            // of escapes by one depending on what quoting style you use)
-            // $font = str_replace('\\', '\\5C ', $font);
-            // $font = str_replace('"',  '\\22 ', $font);
-            // $font = str_replace("'",  '\\27 ', $font);
-
-            // font possibly with spaces, requires quoting
-            $final .= "'$font', ";
-        }
-        $final = rtrim($final, ', ');
-        if ($final === '') {
-            return false;
-        }
-        return $final;
-    }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Ident.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Ident.php
deleted file mode 100644
index 5f13edfd1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Ident.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Validates based on {ident} CSS grammar production
- */
-class HTMLPurifier_AttrDef_CSS_Ident extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-
-        // early abort: '' and '0' (strings that convert to false) are invalid
-        if (!$string) {
-            return false;
-        }
-
-        $pattern = '/^(-?[A-Za-z_][A-Za-z_\-0-9]*)$/';
-        if (!preg_match($pattern, $string)) {
-            return false;
-        }
-        return $string;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
deleted file mode 100644
index f48484944..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Decorator which enables !important to be used in CSS values.
- */
-class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef
-{
-    /**
-     * @type HTMLPurifier_AttrDef
-     */
-    public $def;
-    /**
-     * @type bool
-     */
-    public $allow;
-
-    /**
-     * @param HTMLPurifier_AttrDef $def Definition to wrap
-     * @param bool $allow Whether or not to allow !important
-     */
-    public function __construct($def, $allow = false)
-    {
-        $this->def = $def;
-        $this->allow = $allow;
-    }
-
-    /**
-     * Intercepts and removes !important if necessary
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        // test for ! and important tokens
-        $string = trim($string);
-        $is_important = false;
-        // :TODO: optimization: test directly for !important and ! important
-        if (strlen($string) >= 9 && substr($string, -9) === 'important') {
-            $temp = rtrim(substr($string, 0, -9));
-            // use a temp, because we might want to restore important
-            if (strlen($temp) >= 1 && substr($temp, -1) === '!') {
-                $string = rtrim(substr($temp, 0, -1));
-                $is_important = true;
-            }
-        }
-        $string = $this->def->validate($string, $config, $context);
-        if ($this->allow && $is_important) {
-            $string .= ' !important';
-        }
-        return $string;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Length.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Length.php
deleted file mode 100644
index 88da41d93..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Length.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * Represents a Length as defined by CSS.
- */
-class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @type HTMLPurifier_Length|string
-     */
-    protected $min;
-
-    /**
-     * @type HTMLPurifier_Length|string
-     */
-    protected $max;
-
-    /**
-     * @param HTMLPurifier_Length|string $min Minimum length, or null for no bound. String is also acceptable.
-     * @param HTMLPurifier_Length|string $max Maximum length, or null for no bound. String is also acceptable.
-     */
-    public function __construct($min = null, $max = null)
-    {
-        $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null;
-        $this->max = $max !== null ? HTMLPurifier_Length::make($max) : null;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = $this->parseCDATA($string);
-
-        // Optimizations
-        if ($string === '') {
-            return false;
-        }
-        if ($string === '0') {
-            return '0';
-        }
-        if (strlen($string) === 1) {
-            return false;
-        }
-
-        $length = HTMLPurifier_Length::make($string);
-        if (!$length->isValid()) {
-            return false;
-        }
-
-        if ($this->min) {
-            $c = $length->compareTo($this->min);
-            if ($c === false) {
-                return false;
-            }
-            if ($c < 0) {
-                return false;
-            }
-        }
-        if ($this->max) {
-            $c = $length->compareTo($this->max);
-            if ($c === false) {
-                return false;
-            }
-            if ($c > 0) {
-                return false;
-            }
-        }
-        return $length->toString();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ListStyle.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ListStyle.php
deleted file mode 100644
index b4cce9a9d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/ListStyle.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-/**
- * Validates shorthand CSS property list-style.
- * @warning Does not support url tokens that have internal spaces.
- */
-class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Local copy of validators.
-     * @type HTMLPurifier_AttrDef[]
-     * @note See HTMLPurifier_AttrDef_CSS_Font::$info for a similar impl.
-     */
-    protected $info;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function __construct($config)
-    {
-        $def = $config->getCSSDefinition();
-        $this->info['list-style-type'] = $def->info['list-style-type'];
-        $this->info['list-style-position'] = $def->info['list-style-position'];
-        $this->info['list-style-image'] = $def->info['list-style-image'];
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        // regular pre-processing
-        $string = $this->parseCDATA($string);
-        if ($string === '') {
-            return false;
-        }
-
-        // assumes URI doesn't have spaces in it
-        $bits = explode(' ', strtolower($string)); // bits to process
-
-        $caught = array();
-        $caught['type'] = false;
-        $caught['position'] = false;
-        $caught['image'] = false;
-
-        $i = 0; // number of catches
-        $none = false;
-
-        foreach ($bits as $bit) {
-            if ($i >= 3) {
-                return;
-            } // optimization bit
-            if ($bit === '') {
-                continue;
-            }
-            foreach ($caught as $key => $status) {
-                if ($status !== false) {
-                    continue;
-                }
-                $r = $this->info['list-style-' . $key]->validate($bit, $config, $context);
-                if ($r === false) {
-                    continue;
-                }
-                if ($r === 'none') {
-                    if ($none) {
-                        continue;
-                    } else {
-                        $none = true;
-                    }
-                    if ($key == 'image') {
-                        continue;
-                    }
-                }
-                $caught[$key] = $r;
-                $i++;
-                break;
-            }
-        }
-
-        if (!$i) {
-            return false;
-        }
-
-        $ret = array();
-
-        // construct type
-        if ($caught['type']) {
-            $ret[] = $caught['type'];
-        }
-
-        // construct image
-        if ($caught['image']) {
-            $ret[] = $caught['image'];
-        }
-
-        // construct position
-        if ($caught['position']) {
-            $ret[] = $caught['position'];
-        }
-
-        if (empty($ret)) {
-            return false;
-        }
-        return implode(' ', $ret);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Multiple.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Multiple.php
deleted file mode 100644
index 4efb6c04f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Multiple.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * Framework class for strings that involve multiple values.
- *
- * Certain CSS properties such as border-width and margin allow multiple
- * lengths to be specified.  This class can take a vanilla border-width
- * definition and multiply it, usually into a max of four.
- *
- * @note Even though the CSS specification isn't clear about it, inherit
- *       can only be used alone: it will never manifest as part of a multi
- *       shorthand declaration.  Thus, this class does not allow inherit.
- */
-class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
-{
-    /**
-     * Instance of component definition to defer validation to.
-     * @type HTMLPurifier_AttrDef
-     * @todo Make protected
-     */
-    public $single;
-
-    /**
-     * Max number of values allowed.
-     * @todo Make protected
-     */
-    public $max;
-
-    /**
-     * @param HTMLPurifier_AttrDef $single HTMLPurifier_AttrDef to multiply
-     * @param int $max Max number of values allowed (usually four)
-     */
-    public function __construct($single, $max = 4)
-    {
-        $this->single = $single;
-        $this->max = $max;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = $this->mungeRgb($this->parseCDATA($string));
-        if ($string === '') {
-            return false;
-        }
-        $parts = explode(' ', $string); // parseCDATA replaced \r, \t and \n
-        $length = count($parts);
-        $final = '';
-        for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) {
-            if (ctype_space($parts[$i])) {
-                continue;
-            }
-            $result = $this->single->validate($parts[$i], $config, $context);
-            if ($result !== false) {
-                $final .= $result . ' ';
-                $num++;
-            }
-        }
-        if ($final === '') {
-            return false;
-        }
-        return rtrim($final);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Number.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Number.php
deleted file mode 100644
index c78f6c9df..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Number.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * Validates a number as defined by the CSS spec.
- */
-class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Indicates whether or not only positive values are allowed.
-     * @type bool
-     */
-    protected $non_negative = false;
-
-    /**
-     * @param bool $non_negative indicates whether negatives are forbidden
-     */
-    public function __construct($non_negative = false)
-    {
-        $this->non_negative = $non_negative;
-    }
-
-    /**
-     * @param string $number
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string|bool
-     * @warning Some contexts do not pass $config, $context. These
-     *          variables should not be used without checking HTMLPurifier_Length
-     */
-    public function validate($number, $config, $context)
-    {
-        $number = $this->parseCDATA($number);
-
-        if ($number === '') {
-            return false;
-        }
-        if ($number === '0') {
-            return '0';
-        }
-
-        $sign = '';
-        switch ($number[0]) {
-            case '-':
-                if ($this->non_negative) {
-                    return false;
-                }
-                $sign = '-';
-            case '+':
-                $number = substr($number, 1);
-        }
-
-        if (ctype_digit($number)) {
-            $number = ltrim($number, '0');
-            return $number ? $sign . $number : '0';
-        }
-
-        // Period is the only non-numeric character allowed
-        if (strpos($number, '.') === false) {
-            return false;
-        }
-
-        list($left, $right) = explode('.', $number, 2);
-
-        if ($left === '' && $right === '') {
-            return false;
-        }
-        if ($left !== '' && !ctype_digit($left)) {
-            return false;
-        }
-
-        $left = ltrim($left, '0');
-        $right = rtrim($right, '0');
-
-        if ($right === '') {
-            return $left ? $sign . $left : '0';
-        } elseif (!ctype_digit($right)) {
-            return false;
-        }
-        return $sign . $left . '.' . $right;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Percentage.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Percentage.php
deleted file mode 100644
index aac1a6f5f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/Percentage.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * Validates a Percentage as defined by the CSS spec.
- */
-class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Instance to defer number validation to.
-     * @type HTMLPurifier_AttrDef_CSS_Number
-     */
-    protected $number_def;
-
-    /**
-     * @param bool $non_negative Whether to forbid negative values
-     */
-    public function __construct($non_negative = false)
-    {
-        $this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = $this->parseCDATA($string);
-
-        if ($string === '') {
-            return false;
-        }
-        $length = strlen($string);
-        if ($length === 1) {
-            return false;
-        }
-        if ($string[$length - 1] !== '%') {
-            return false;
-        }
-
-        $number = substr($string, 0, $length - 1);
-        $number = $this->number_def->validate($number, $config, $context);
-
-        if ($number === false) {
-            return false;
-        }
-        return "$number%";
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
deleted file mode 100644
index 3992de0e6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Validates the value for the CSS property text-decoration
- * @note This class could be generalized into a version that acts sort of
- *       like Enum except you can compound the allowed values.
- */
-class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        static $allowed_values = array(
-            'line-through' => true,
-            'overline' => true,
-            'underline' => true,
-        );
-
-        $string = strtolower($this->parseCDATA($string));
-
-        if ($string === 'none') {
-            return $string;
-        }
-
-        $parts = explode(' ', $string);
-        $final = '';
-        foreach ($parts as $part) {
-            if (isset($allowed_values[$part])) {
-                $final .= $part . ' ';
-            }
-        }
-        $final = rtrim($final);
-        if ($final === '') {
-            return false;
-        }
-        return $final;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/URI.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/URI.php
deleted file mode 100644
index 3d18b3289..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/CSS/URI.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * Validates a URI in CSS syntax, which uses url('http://example.com')
- * @note While theoretically speaking a URI in a CSS document could
- *       be non-embedded, as of CSS2 there is no such usage so we're
- *       generalizing it. This may need to be changed in the future.
- * @warning Since HTMLPurifier_AttrDef_CSS blindly uses semicolons as
- *          the separator, you cannot put a literal semicolon in
- *          in the URI. Try percent encoding it, in that case.
- */
-class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
-{
-
-    public function __construct()
-    {
-        parent::__construct(true); // always embedded
-    }
-
-    /**
-     * @param string $uri_string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($uri_string, $config, $context)
-    {
-        // parse the URI out of the string and then pass it onto
-        // the parent object
-
-        $uri_string = $this->parseCDATA($uri_string);
-        if (strpos($uri_string, 'url(') !== 0) {
-            return false;
-        }
-        $uri_string = substr($uri_string, 4);
-        if (strlen($uri_string) == 0) {
-            return false;
-        }
-        $new_length = strlen($uri_string) - 1;
-        if ($uri_string[$new_length] != ')') {
-            return false;
-        }
-        $uri = trim(substr($uri_string, 0, $new_length));
-
-        if (!empty($uri) && ($uri[0] == "'" || $uri[0] == '"')) {
-            $quote = $uri[0];
-            $new_length = strlen($uri) - 1;
-            if ($uri[$new_length] !== $quote) {
-                return false;
-            }
-            $uri = substr($uri, 1, $new_length - 1);
-        }
-
-        $uri = $this->expandCSSEscape($uri);
-
-        $result = parent::validate($uri, $config, $context);
-
-        if ($result === false) {
-            return false;
-        }
-
-        // extra sanity check; should have been done by URI
-        $result = str_replace(array('"', "\\", "\n", "\x0c", "\r"), "", $result);
-
-        // suspicious characters are ()'; we're going to percent encode
-        // them for safety.
-        $result = str_replace(array('(', ')', "'"), array('%28', '%29', '%27'), $result);
-
-        // there's an extra bug where ampersands lose their escaping on
-        // an innerHTML cycle, so a very unlucky query parameter could
-        // then change the meaning of the URL.  Unfortunately, there's
-        // not much we can do about that...
-        return "url(\"$result\")";
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Clone.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Clone.php
deleted file mode 100644
index b181d1bcd..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Clone.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Dummy AttrDef that mimics another AttrDef, BUT it generates clones
- * with make.
- */
-class HTMLPurifier_AttrDef_Clone extends HTMLPurifier_AttrDef
-{
-    /**
-     * What we're cloning.
-     * @type HTMLPurifier_AttrDef
-     */
-    protected $clone;
-
-    /**
-     * @param HTMLPurifier_AttrDef $clone
-     */
-    public function __construct($clone)
-    {
-        $this->clone = $clone;
-    }
-
-    /**
-     * @param string $v
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($v, $config, $context)
-    {
-        return $this->clone->validate($v, $config, $context);
-    }
-
-    /**
-     * @param string $string
-     * @return HTMLPurifier_AttrDef
-     */
-    public function make($string)
-    {
-        return clone $this->clone;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Enum.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Enum.php
deleted file mode 100644
index b40122b6c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Enum.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-// Enum = Enumerated
-/**
- * Validates a keyword against a list of valid values.
- * @warning The case-insensitive compare of this function uses PHP's
- *          built-in strtolower and ctype_lower functions, which may
- *          cause problems with international comparisons
- */
-class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Lookup table of valid values.
-     * @type array
-     * @todo Make protected
-     */
-    public $valid_values = array();
-
-    /**
-     * Bool indicating whether or not enumeration is case sensitive.
-     * @note In general this is always case insensitive.
-     */
-    protected $case_sensitive = false; // values according to W3C spec
-
-    /**
-     * @param array $valid_values List of valid values
-     * @param bool $case_sensitive Whether or not case sensitive
-     */
-    public function __construct($valid_values = array(), $case_sensitive = false)
-    {
-        $this->valid_values = array_flip($valid_values);
-        $this->case_sensitive = $case_sensitive;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-        if (!$this->case_sensitive) {
-            // we may want to do full case-insensitive libraries
-            $string = ctype_lower($string) ? $string : strtolower($string);
-        }
-        $result = isset($this->valid_values[$string]);
-
-        return $result ? $string : false;
-    }
-
-    /**
-     * @param string $string In form of comma-delimited list of case-insensitive
-     *      valid values. Example: "foo,bar,baz". Prepend "s:" to make
-     *      case sensitive
-     * @return HTMLPurifier_AttrDef_Enum
-     */
-    public function make($string)
-    {
-        if (strlen($string) > 2 && $string[0] == 's' && $string[1] == ':') {
-            $string = substr($string, 2);
-            $sensitive = true;
-        } else {
-            $sensitive = false;
-        }
-        $values = explode(',', $string);
-        return new HTMLPurifier_AttrDef_Enum($values, $sensitive);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Bool.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Bool.php
deleted file mode 100644
index 953a36a6c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Bool.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Validates a boolean attribute
- */
-class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @type bool
-     */
-    protected $name;
-
-    /**
-     * @type bool
-     */
-    public $minimized = true;
-
-    /**
-     * @param bool $name
-     */
-    public function __construct($name = false)
-    {
-        $this->name = $name;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        return $this->name;
-    }
-
-    /**
-     * @param string $string Name of attribute
-     * @return HTMLPurifier_AttrDef_HTML_Bool
-     */
-    public function make($string)
-    {
-        return new HTMLPurifier_AttrDef_HTML_Bool($string);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Class.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Class.php
deleted file mode 100644
index b874c7e1a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Class.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Implements special behavior for class attribute (normally NMTOKENS)
- */
-class HTMLPurifier_AttrDef_HTML_Class extends HTMLPurifier_AttrDef_HTML_Nmtokens
-{
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    protected function split($string, $config, $context)
-    {
-        // really, this twiddle should be lazy loaded
-        $name = $config->getDefinition('HTML')->doctype->name;
-        if ($name == "XHTML 1.1" || $name == "XHTML 2.0") {
-            return parent::split($string, $config, $context);
-        } else {
-            return preg_split('/\s+/', $string);
-        }
-    }
-
-    /**
-     * @param array $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    protected function filter($tokens, $config, $context)
-    {
-        $allowed = $config->get('Attr.AllowedClasses');
-        $forbidden = $config->get('Attr.ForbiddenClasses');
-        $ret = array();
-        foreach ($tokens as $token) {
-            if (($allowed === null || isset($allowed[$token])) &&
-                !isset($forbidden[$token]) &&
-                // We need this O(n) check because of PHP's array
-                // implementation that casts -0 to 0.
-                !in_array($token, $ret, true)
-            ) {
-                $ret[] = $token;
-            }
-        }
-        return $ret;
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Color.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Color.php
deleted file mode 100644
index 25c93fc6e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Color.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-/**
- * Validates a color according to the HTML spec.
- */
-class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        static $colors = null;
-        if ($colors === null) {
-            $colors = $config->get('Core.ColorKeywords');
-        }
-
-        $string = trim($string);
-
-        if (empty($string)) {
-            return false;
-        }
-        $lower = strtolower($string);
-        if (isset($colors[$lower])) {
-            return $colors[$lower];
-        }
-        if ($string[0] === '#') {
-            $hex = substr($string, 1);
-        } else {
-            $hex = $string;
-        }
-
-        $length = strlen($hex);
-        if ($length !== 3 && $length !== 6) {
-            return false;
-        }
-        if (!ctype_xdigit($hex)) {
-            return false;
-        }
-        if ($length === 3) {
-            $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
-        }
-        return "#$hex";
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php
deleted file mode 100644
index 7446b6da9..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Special-case enum attribute definition that lazy loads allowed frame targets
- */
-class HTMLPurifier_AttrDef_HTML_FrameTarget extends HTMLPurifier_AttrDef_Enum
-{
-
-    /**
-     * @type array
-     */
-    public $valid_values = false; // uninitialized value
-
-    /**
-     * @type bool
-     */
-    protected $case_sensitive = false;
-
-    public function __construct()
-    {
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        if ($this->valid_values === false) {
-            $this->valid_values = $config->get('Attr.AllowedFrameTargets');
-        }
-        return parent::validate($string, $config, $context);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/ID.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/ID.php
deleted file mode 100644
index 7e464ba54..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/ID.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute ID.
- * @warning Even though this is the id processor, it
- *          will ignore the directive Attr:IDBlacklist, since it will only
- *          go according to the ID accumulator. Since the accumulator is
- *          automatically generated, it will have already absorbed the
- *          blacklist. If you're hacking around, make sure you use load()!
- */
-
-class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
-{
-
-    // selector is NOT a valid thing to use for IDREFs, because IDREFs
-    // *must* target IDs that exist, whereas selector #ids do not.
-
-    /**
-     * Determines whether or not we're validating an ID in a CSS
-     * selector context.
-     * @type bool
-     */
-    protected $selector;
-
-    /**
-     * @param bool $selector
-     */
-    public function __construct($selector = false)
-    {
-        $this->selector = $selector;
-    }
-
-    /**
-     * @param string $id
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($id, $config, $context)
-    {
-        if (!$this->selector && !$config->get('Attr.EnableID')) {
-            return false;
-        }
-
-        $id = trim($id); // trim it first
-
-        if ($id === '') {
-            return false;
-        }
-
-        $prefix = $config->get('Attr.IDPrefix');
-        if ($prefix !== '') {
-            $prefix .= $config->get('Attr.IDPrefixLocal');
-            // prevent re-appending the prefix
-            if (strpos($id, $prefix) !== 0) {
-                $id = $prefix . $id;
-            }
-        } elseif ($config->get('Attr.IDPrefixLocal') !== '') {
-            trigger_error(
-                '%Attr.IDPrefixLocal cannot be used unless ' .
-                '%Attr.IDPrefix is set',
-                E_USER_WARNING
-            );
-        }
-
-        if (!$this->selector) {
-            $id_accumulator =& $context->get('IDAccumulator');
-            if (isset($id_accumulator->ids[$id])) {
-                return false;
-            }
-        }
-
-        // we purposely avoid using regex, hopefully this is faster
-
-        if ($config->get('Attr.ID.HTML5') === true) {
-            if (preg_match('/[\t\n\x0b\x0c ]/', $id)) {
-                return false;
-            }
-        } else {
-            if (ctype_alpha($id)) {
-                // OK
-            } else {
-                if (!ctype_alpha(@$id[0])) {
-                    return false;
-                }
-                // primitive style of regexps, I suppose
-                $trim = trim(
-                    $id,
-                    'A..Za..z0..9:-._'
-                );
-                if ($trim !== '') {
-                    return false;
-                }
-            }
-        }
-
-        $regexp = $config->get('Attr.IDBlacklistRegexp');
-        if ($regexp && preg_match($regexp, $id)) {
-            return false;
-        }
-
-        if (!$this->selector) {
-            $id_accumulator->add($id);
-        }
-
-        // if no change was made to the ID, return the result
-        // else, return the new id if stripping whitespace made it
-        //     valid, or return false.
-        return $id;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Length.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Length.php
deleted file mode 100644
index c8f518865..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Length.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Validates the HTML type length (not to be confused with CSS's length).
- *
- * This accepts integer pixels or percentages as lengths for certain
- * HTML attributes.
- */
-
-class HTMLPurifier_AttrDef_HTML_Length extends HTMLPurifier_AttrDef_HTML_Pixels
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-        if ($string === '') {
-            return false;
-        }
-
-        $parent_result = parent::validate($string, $config, $context);
-        if ($parent_result !== false) {
-            return $parent_result;
-        }
-
-        $length = strlen($string);
-        $last_char = $string[$length - 1];
-
-        if ($last_char !== '%') {
-            return false;
-        }
-
-        $points = substr($string, 0, $length - 1);
-
-        if (!is_numeric($points)) {
-            return false;
-        }
-
-        $points = (int)$points;
-
-        if ($points < 0) {
-            return '0%';
-        }
-        if ($points > 100) {
-            return '100%';
-        }
-        return ((string)$points) . '%';
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php
deleted file mode 100644
index 3f56934ff..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/LinkTypes.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * Validates a rel/rev link attribute against a directive of allowed values
- * @note We cannot use Enum because link types allow multiple
- *       values.
- * @note Assumes link types are ASCII text
- */
-class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Name config attribute to pull.
-     * @type string
-     */
-    protected $name;
-
-    /**
-     * @param string $name
-     */
-    public function __construct($name)
-    {
-        $configLookup = array(
-            'rel' => 'AllowedRel',
-            'rev' => 'AllowedRev'
-        );
-        if (!isset($configLookup[$name])) {
-            trigger_error(
-                'Unrecognized attribute name for link ' .
-                'relationship.',
-                E_USER_ERROR
-            );
-            return;
-        }
-        $this->name = $configLookup[$name];
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $allowed = $config->get('Attr.' . $this->name);
-        if (empty($allowed)) {
-            return false;
-        }
-
-        $string = $this->parseCDATA($string);
-        $parts = explode(' ', $string);
-
-        // lookup to prevent duplicates
-        $ret_lookup = array();
-        foreach ($parts as $part) {
-            $part = strtolower(trim($part));
-            if (!isset($allowed[$part])) {
-                continue;
-            }
-            $ret_lookup[$part] = true;
-        }
-
-        if (empty($ret_lookup)) {
-            return false;
-        }
-        $string = implode(' ', array_keys($ret_lookup));
-        return $string;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/MultiLength.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/MultiLength.php
deleted file mode 100644
index eb713e15b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/MultiLength.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-/**
- * Validates a MultiLength as defined by the HTML spec.
- *
- * A multilength is either a integer (pixel count), a percentage, or
- * a relative number.
- */
-class HTMLPurifier_AttrDef_HTML_MultiLength extends HTMLPurifier_AttrDef_HTML_Length
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-        if ($string === '') {
-            return false;
-        }
-
-        $parent_result = parent::validate($string, $config, $context);
-        if ($parent_result !== false) {
-            return $parent_result;
-        }
-
-        $length = strlen($string);
-        $last_char = $string[$length - 1];
-
-        if ($last_char !== '*') {
-            return false;
-        }
-
-        $int = substr($string, 0, $length - 1);
-
-        if ($int == '') {
-            return '*';
-        }
-        if (!is_numeric($int)) {
-            return false;
-        }
-
-        $int = (int)$int;
-        if ($int < 0) {
-            return false;
-        }
-        if ($int == 0) {
-            return '0';
-        }
-        if ($int == 1) {
-            return '*';
-        }
-        return ((string)$int) . '*';
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php
deleted file mode 100644
index ecb070c36..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Nmtokens.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/**
- * Validates contents based on NMTOKENS attribute type.
- */
-class HTMLPurifier_AttrDef_HTML_Nmtokens extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-
-        // early abort: '' and '0' (strings that convert to false) are invalid
-        if (!$string) {
-            return false;
-        }
-
-        $tokens = $this->split($string, $config, $context);
-        $tokens = $this->filter($tokens, $config, $context);
-        if (empty($tokens)) {
-            return false;
-        }
-        return implode(' ', $tokens);
-    }
-
-    /**
-     * Splits a space separated list of tokens into its constituent parts.
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    protected function split($string, $config, $context)
-    {
-        // OPTIMIZABLE!
-        // do the preg_match, capture all subpatterns for reformulation
-
-        // we don't support U+00A1 and up codepoints or
-        // escaping because I don't know how to do that with regexps
-        // and plus it would complicate optimization efforts (you never
-        // see that anyway).
-        $pattern = '/(?:(?<=\s)|\A)' . // look behind for space or string start
-            '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)' .
-            '(?:(?=\s)|\z)/'; // look ahead for space or string end
-        preg_match_all($pattern, $string, $matches);
-        return $matches[1];
-    }
-
-    /**
-     * Template method for removing certain tokens based on arbitrary criteria.
-     * @note If we wanted to be really functional, we'd do an array_filter
-     *       with a callback. But... we're not.
-     * @param array $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    protected function filter($tokens, $config, $context)
-    {
-        return $tokens;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Pixels.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Pixels.php
deleted file mode 100644
index 1a68f2385..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/HTML/Pixels.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * Validates an integer representation of pixels according to the HTML spec.
- */
-class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @type int
-     */
-    protected $max;
-
-    /**
-     * @param int $max
-     */
-    public function __construct($max = null)
-    {
-        $this->max = $max;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-        if ($string === '0') {
-            return $string;
-        }
-        if ($string === '') {
-            return false;
-        }
-        $length = strlen($string);
-        if (substr($string, $length - 2) == 'px') {
-            $string = substr($string, 0, $length - 2);
-        }
-        if (!is_numeric($string)) {
-            return false;
-        }
-        $int = (int)$string;
-
-        if ($int < 0) {
-            return '0';
-        }
-
-        // upper-bound value, extremely high values can
-        // crash operating systems, see <http://ha.ckers.org/imagecrash.html>
-        // WARNING, above link WILL crash you if you're using Windows
-
-        if ($this->max !== null && $int > $this->max) {
-            return (string)$this->max;
-        }
-        return (string)$int;
-    }
-
-    /**
-     * @param string $string
-     * @return HTMLPurifier_AttrDef
-     */
-    public function make($string)
-    {
-        if ($string === '') {
-            $max = null;
-        } else {
-            $max = (int)$string;
-        }
-        $class = get_class($this);
-        return new $class($max);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Integer.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Integer.php
deleted file mode 100644
index c98376d75..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Integer.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-
-/**
- * Validates an integer.
- * @note While this class was modeled off the CSS definition, no currently
- *       allowed CSS uses this type.  The properties that do are: widows,
- *       orphans, z-index, counter-increment, counter-reset.  Some of the
- *       HTML attributes, however, find use for a non-negative version of this.
- */
-class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Whether or not negative values are allowed.
-     * @type bool
-     */
-    protected $negative = true;
-
-    /**
-     * Whether or not zero is allowed.
-     * @type bool
-     */
-    protected $zero = true;
-
-    /**
-     * Whether or not positive values are allowed.
-     * @type bool
-     */
-    protected $positive = true;
-
-    /**
-     * @param $negative Bool indicating whether or not negative values are allowed
-     * @param $zero Bool indicating whether or not zero is allowed
-     * @param $positive Bool indicating whether or not positive values are allowed
-     */
-    public function __construct($negative = true, $zero = true, $positive = true)
-    {
-        $this->negative = $negative;
-        $this->zero = $zero;
-        $this->positive = $positive;
-    }
-
-    /**
-     * @param string $integer
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($integer, $config, $context)
-    {
-        $integer = $this->parseCDATA($integer);
-        if ($integer === '') {
-            return false;
-        }
-
-        // we could possibly simply typecast it to integer, but there are
-        // certain fringe cases that must not return an integer.
-
-        // clip leading sign
-        if ($this->negative && $integer[0] === '-') {
-            $digits = substr($integer, 1);
-            if ($digits === '0') {
-                $integer = '0';
-            } // rm minus sign for zero
-        } elseif ($this->positive && $integer[0] === '+') {
-            $digits = $integer = substr($integer, 1); // rm unnecessary plus
-        } else {
-            $digits = $integer;
-        }
-
-        // test if it's numeric
-        if (!ctype_digit($digits)) {
-            return false;
-        }
-
-        // perform scope tests
-        if (!$this->zero && $integer == 0) {
-            return false;
-        }
-        if (!$this->positive && $integer > 0) {
-            return false;
-        }
-        if (!$this->negative && $integer < 0) {
-            return false;
-        }
-
-        return $integer;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Lang.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Lang.php
deleted file mode 100644
index 6ad0f799d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Lang.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-
-/**
- * Validates the HTML attribute lang, effectively a language code.
- * @note Built according to RFC 3066, which obsoleted RFC 1766
- */
-class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $string = trim($string);
-        if (!$string) {
-            return false;
-        }
-
-        $subtags = explode('-', $string);
-        $num_subtags = count($subtags);
-
-        if ($num_subtags == 0) { // sanity check
-            return false;
-        }
-
-        // process primary subtag : $subtags[0]
-        $length = strlen($subtags[0]);
-        switch ($length) {
-            case 0:
-                return false;
-            case 1:
-                if (!($subtags[0] == 'x' || $subtags[0] == 'i')) {
-                    return false;
-                }
-                break;
-            case 2:
-            case 3:
-                if (!ctype_alpha($subtags[0])) {
-                    return false;
-                } elseif (!ctype_lower($subtags[0])) {
-                    $subtags[0] = strtolower($subtags[0]);
-                }
-                break;
-            default:
-                return false;
-        }
-
-        $new_string = $subtags[0];
-        if ($num_subtags == 1) {
-            return $new_string;
-        }
-
-        // process second subtag : $subtags[1]
-        $length = strlen($subtags[1]);
-        if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) {
-            return $new_string;
-        }
-        if (!ctype_lower($subtags[1])) {
-            $subtags[1] = strtolower($subtags[1]);
-        }
-
-        $new_string .= '-' . $subtags[1];
-        if ($num_subtags == 2) {
-            return $new_string;
-        }
-
-        // process all other subtags, index 2 and up
-        for ($i = 2; $i < $num_subtags; $i++) {
-            $length = strlen($subtags[$i]);
-            if ($length == 0 || $length > 8 || !ctype_alnum($subtags[$i])) {
-                return $new_string;
-            }
-            if (!ctype_lower($subtags[$i])) {
-                $subtags[$i] = strtolower($subtags[$i]);
-            }
-            $new_string .= '-' . $subtags[$i];
-        }
-        return $new_string;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Switch.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Switch.php
deleted file mode 100644
index 078291f58..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Switch.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/**
- * Decorator that, depending on a token, switches between two definitions.
- */
-class HTMLPurifier_AttrDef_Switch
-{
-
-    /**
-     * @type string
-     */
-    protected $tag;
-
-    /**
-     * @type HTMLPurifier_AttrDef
-     */
-    protected $withTag;
-
-    /**
-     * @type HTMLPurifier_AttrDef
-     */
-    protected $withoutTag;
-
-    /**
-     * @param string $tag Tag name to switch upon
-     * @param HTMLPurifier_AttrDef $with_tag Call if token matches tag
-     * @param HTMLPurifier_AttrDef $without_tag Call if token doesn't match, or there is no token
-     */
-    public function __construct($tag, $with_tag, $without_tag)
-    {
-        $this->tag = $tag;
-        $this->withTag = $with_tag;
-        $this->withoutTag = $without_tag;
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $token = $context->get('CurrentToken', true);
-        if (!$token || $token->name !== $this->tag) {
-            return $this->withoutTag->validate($string, $config, $context);
-        } else {
-            return $this->withTag->validate($string, $config, $context);
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Text.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Text.php
deleted file mode 100644
index 9f23bac4a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/Text.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * Validates arbitrary text according to the HTML spec.
- */
-class HTMLPurifier_AttrDef_Text extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        return $this->parseCDATA($string);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI.php
deleted file mode 100644
index a1097cd91..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * Validates a URI as defined by RFC 3986.
- * @note Scheme-specific mechanics deferred to HTMLPurifier_URIScheme
- */
-class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * @type HTMLPurifier_URIParser
-     */
-    protected $parser;
-
-    /**
-     * @type bool
-     */
-    protected $embedsResource;
-
-    /**
-     * @param bool $embeds_resource Does the URI here result in an extra HTTP request?
-     */
-    public function __construct($embeds_resource = false)
-    {
-        $this->parser = new HTMLPurifier_URIParser();
-        $this->embedsResource = (bool)$embeds_resource;
-    }
-
-    /**
-     * @param string $string
-     * @return HTMLPurifier_AttrDef_URI
-     */
-    public function make($string)
-    {
-        $embeds = ($string === 'embedded');
-        return new HTMLPurifier_AttrDef_URI($embeds);
-    }
-
-    /**
-     * @param string $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($uri, $config, $context)
-    {
-        if ($config->get('URI.Disable')) {
-            return false;
-        }
-
-        $uri = $this->parseCDATA($uri);
-
-        // parse the URI
-        $uri = $this->parser->parse($uri);
-        if ($uri === false) {
-            return false;
-        }
-
-        // add embedded flag to context for validators
-        $context->register('EmbeddedURI', $this->embedsResource);
-
-        $ok = false;
-        do {
-
-            // generic validation
-            $result = $uri->validate($config, $context);
-            if (!$result) {
-                break;
-            }
-
-            // chained filtering
-            $uri_def = $config->getDefinition('URI');
-            $result = $uri_def->filter($uri, $config, $context);
-            if (!$result) {
-                break;
-            }
-
-            // scheme-specific validation
-            $scheme_obj = $uri->getSchemeObj($config, $context);
-            if (!$scheme_obj) {
-                break;
-            }
-            if ($this->embedsResource && !$scheme_obj->browsable) {
-                break;
-            }
-            $result = $scheme_obj->validate($uri, $config, $context);
-            if (!$result) {
-                break;
-            }
-
-            // Post chained filtering
-            $result = $uri_def->postFilter($uri, $config, $context);
-            if (!$result) {
-                break;
-            }
-
-            // survived gauntlet
-            $ok = true;
-
-        } while (false);
-
-        $context->destroy('EmbeddedURI');
-        if (!$ok) {
-            return false;
-        }
-        // back to string
-        return $uri->toString();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email.php
deleted file mode 100644
index 846d38814..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-abstract class HTMLPurifier_AttrDef_URI_Email extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * Unpacks a mailbox into its display-name and address
-     * @param string $string
-     * @return mixed
-     */
-    public function unpack($string)
-    {
-        // needs to be implemented
-    }
-
-}
-
-// sub-implementations
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
deleted file mode 100644
index 3b041ce8c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/**
- * Primitive email validation class based on the regexp found at
- * http://www.regular-expressions.info/email.html
- */
-class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email
-{
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        // no support for named mailboxes i.e. "Bob <bob@example.com>"
-        // that needs more percent encoding to be done
-        if ($string == '') {
-            return false;
-        }
-        $string = trim($string);
-        $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
-        return $result ? $string : false;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Host.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Host.php
deleted file mode 100644
index c1e2e3c5d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/Host.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-
-/**
- * Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
- */
-class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * IPv4 sub-validator.
-     * @type HTMLPurifier_AttrDef_URI_IPv4
-     */
-    protected $ipv4;
-
-    /**
-     * IPv6 sub-validator.
-     * @type HTMLPurifier_AttrDef_URI_IPv6
-     */
-    protected $ipv6;
-
-    public function __construct()
-    {
-        $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
-        $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
-    }
-
-    /**
-     * @param string $string
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($string, $config, $context)
-    {
-        $length = strlen($string);
-        // empty hostname is OK; it's usually semantically equivalent:
-        // the default host as defined by a URI scheme is used:
-        //
-        //      If the URI scheme defines a default for host, then that
-        //      default applies when the host subcomponent is undefined
-        //      or when the registered name is empty (zero length).
-        if ($string === '') {
-            return '';
-        }
-        if ($length > 1 && $string[0] === '[' && $string[$length - 1] === ']') {
-            //IPv6
-            $ip = substr($string, 1, $length - 2);
-            $valid = $this->ipv6->validate($ip, $config, $context);
-            if ($valid === false) {
-                return false;
-            }
-            return '[' . $valid . ']';
-        }
-
-        // need to do checks on unusual encodings too
-        $ipv4 = $this->ipv4->validate($string, $config, $context);
-        if ($ipv4 !== false) {
-            return $ipv4;
-        }
-
-        // A regular domain name.
-
-        // This doesn't match I18N domain names, but we don't have proper IRI support,
-        // so force users to insert Punycode.
-
-        // There is not a good sense in which underscores should be
-        // allowed, since it's technically not! (And if you go as
-        // far to allow everything as specified by the DNS spec...
-        // well, that's literally everything, modulo some space limits
-        // for the components and the overall name (which, by the way,
-        // we are NOT checking!).  So we (arbitrarily) decide this:
-        // let's allow underscores wherever we would have allowed
-        // hyphens, if they are enabled.  This is a pretty good match
-        // for browser behavior, for example, a large number of browsers
-        // cannot handle foo_.example.com, but foo_bar.example.com is
-        // fairly well supported.
-        $underscore = $config->get('Core.AllowHostnameUnderscore') ? '_' : '';
-
-        // Based off of RFC 1738, but amended so that
-        // as per RFC 3696, the top label need only not be all numeric.
-        // The productions describing this are:
-        $a   = '[a-z]';     // alpha
-        $an  = '[a-z0-9]';  // alphanum
-        $and = "[a-z0-9-$underscore]"; // alphanum | "-"
-        // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
-        $domainlabel = "$an(?:$and*$an)?";
-        // AMENDED as per RFC 3696
-        // toplabel    = alphanum | alphanum *( alphanum | "-" ) alphanum
-        //      side condition: not all numeric
-        $toplabel = "$an(?:$and*$an)?";
-        // hostname    = *( domainlabel "." ) toplabel [ "." ]
-        if (preg_match("/^(?:$domainlabel\.)*($toplabel)\.?$/i", $string, $matches)) {
-            if (!ctype_digit($matches[1])) {
-                return $string;
-            }
-        }
-
-        // PHP 5.3 and later support this functionality natively
-        if (function_exists('idn_to_ascii')) {
-            $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
-
-        // If we have Net_IDNA2 support, we can support IRIs by
-        // punycoding them. (This is the most portable thing to do,
-        // since otherwise we have to assume browsers support
-        } elseif ($config->get('Core.EnableIDNA')) {
-            $idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true));
-            // we need to encode each period separately
-            $parts = explode('.', $string);
-            try {
-                $new_parts = array();
-                foreach ($parts as $part) {
-                    $encodable = false;
-                    for ($i = 0, $c = strlen($part); $i < $c; $i++) {
-                        if (ord($part[$i]) > 0x7a) {
-                            $encodable = true;
-                            break;
-                        }
-                    }
-                    if (!$encodable) {
-                        $new_parts[] = $part;
-                    } else {
-                        $new_parts[] = $idna->encode($part);
-                    }
-                }
-                $string = implode('.', $new_parts);
-            } catch (Exception $e) {
-                // XXX error reporting
-            }
-        }
-        // Try again
-        if (preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string)) {
-            return $string;
-        }
-        return false;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv4.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv4.php
deleted file mode 100644
index bbc8a77e3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv4.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Validates an IPv4 address
- * @author Feyd @ forums.devnetwork.net (public domain)
- */
-class HTMLPurifier_AttrDef_URI_IPv4 extends HTMLPurifier_AttrDef
-{
-
-    /**
-     * IPv4 regex, protected so that IPv6 can reuse it.
-     * @type string
-     */
-    protected $ip4;
-
-    /**
-     * @param string $aIP
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($aIP, $config, $context)
-    {
-        if (!$this->ip4) {
-            $this->_loadRegex();
-        }
-
-        if (preg_match('#^' . $this->ip4 . '$#s', $aIP)) {
-            return $aIP;
-        }
-        return false;
-    }
-
-    /**
-     * Lazy load function to prevent regex from being stuffed in
-     * cache.
-     */
-    protected function _loadRegex()
-    {
-        $oct = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'; // 0-255
-        $this->ip4 = "(?:{$oct}\\.{$oct}\\.{$oct}\\.{$oct})";
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv6.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv6.php
deleted file mode 100644
index 67f148bd8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrDef/URI/IPv6.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/**
- * Validates an IPv6 address.
- * @author Feyd @ forums.devnetwork.net (public domain)
- * @note This function requires brackets to have been removed from address
- *       in URI.
- */
-class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
-{
-
-    /**
-     * @param string $aIP
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string
-     */
-    public function validate($aIP, $config, $context)
-    {
-        if (!$this->ip4) {
-            $this->_loadRegex();
-        }
-
-        $original = $aIP;
-
-        $hex = '[0-9a-fA-F]';
-        $blk = '(?:' . $hex . '{1,4})';
-        $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128
-
-        //      prefix check
-        if (strpos($aIP, '/') !== false) {
-            if (preg_match('#' . $pre . '$#s', $aIP, $find)) {
-                $aIP = substr($aIP, 0, 0 - strlen($find[0]));
-                unset($find);
-            } else {
-                return false;
-            }
-        }
-
-        //      IPv4-compatiblity check
-        if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) {
-            $aIP = substr($aIP, 0, 0 - strlen($find[0]));
-            $ip = explode('.', $find[0]);
-            $ip = array_map('dechex', $ip);
-            $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3];
-            unset($find, $ip);
-        }
-
-        //      compression check
-        $aIP = explode('::', $aIP);
-        $c = count($aIP);
-        if ($c > 2) {
-            return false;
-        } elseif ($c == 2) {
-            list($first, $second) = $aIP;
-            $first = explode(':', $first);
-            $second = explode(':', $second);
-
-            if (count($first) + count($second) > 8) {
-                return false;
-            }
-
-            while (count($first) < 8) {
-                array_push($first, '0');
-            }
-
-            array_splice($first, 8 - count($second), 8, $second);
-            $aIP = $first;
-            unset($first, $second);
-        } else {
-            $aIP = explode(':', $aIP[0]);
-        }
-        $c = count($aIP);
-
-        if ($c != 8) {
-            return false;
-        }
-
-        //      All the pieces should be 16-bit hex strings. Are they?
-        foreach ($aIP as $piece) {
-            if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) {
-                return false;
-            }
-        }
-        return $original;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform.php
deleted file mode 100644
index d9baaf394..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-/**
- * Processes an entire attribute array for corrections needing multiple values.
- *
- * Occasionally, a certain attribute will need to be removed and popped onto
- * another value.  Instead of creating a complex return syntax for
- * HTMLPurifier_AttrDef, we just pass the whole attribute array to a
- * specialized object and have that do the special work.  That is the
- * family of HTMLPurifier_AttrTransform.
- *
- * An attribute transformation can be assigned to run before or after
- * HTMLPurifier_AttrDef validation.  See HTMLPurifier_HTMLDefinition for
- * more details.
- */
-
-abstract class HTMLPurifier_AttrTransform
-{
-
-    /**
-     * Abstract: makes changes to the attributes dependent on multiple values.
-     *
-     * @param array $attr Assoc array of attributes, usually from
-     *              HTMLPurifier_Token_Tag::$attr
-     * @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
-     * @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object
-     * @return array Processed attribute array.
-     */
-    abstract public function transform($attr, $config, $context);
-
-    /**
-     * Prepends CSS properties to the style attribute, creating the
-     * attribute if it doesn't exist.
-     * @param array &$attr Attribute array to process (passed by reference)
-     * @param string $css CSS to prepend
-     */
-    public function prependCSS(&$attr, $css)
-    {
-        $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
-        $attr['style'] = $css . $attr['style'];
-    }
-
-    /**
-     * Retrieves and removes an attribute
-     * @param array &$attr Attribute array to process (passed by reference)
-     * @param mixed $key Key of attribute to confiscate
-     * @return mixed
-     */
-    public function confiscateAttr(&$attr, $key)
-    {
-        if (!isset($attr[$key])) {
-            return null;
-        }
-        $value = $attr[$key];
-        unset($attr[$key]);
-        return $value;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Background.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Background.php
deleted file mode 100644
index f0f00068f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Background.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes proprietary background attribute to CSS.
- */
-class HTMLPurifier_AttrTransform_Background extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['background'])) {
-            return $attr;
-        }
-
-        $background = $this->confiscateAttr($attr, 'background');
-        // some validation should happen here
-
-        $this->prependCSS($attr, "background-image:url($background);");
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BdoDir.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BdoDir.php
deleted file mode 100644
index 86dcb17e4..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BdoDir.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-// this MUST be placed in post, as it assumes that any value in dir is valid
-
-/**
- * Post-trasnform that ensures that bdo tags have the dir attribute set.
- */
-class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
-{
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (isset($attr['dir'])) {
-            return $attr;
-        }
-        $attr['dir'] = $config->get('Attr.DefaultTextDir');
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BgColor.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BgColor.php
deleted file mode 100644
index e45e9ba37..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BgColor.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes deprecated bgcolor attribute to CSS.
- */
-class HTMLPurifier_AttrTransform_BgColor extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['bgcolor'])) {
-            return $attr;
-        }
-
-        $bgcolor = $this->confiscateAttr($attr, 'bgcolor');
-        // some validation should happen here
-
-        $this->prependCSS($attr, "background-color:$bgcolor;");
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BoolToCSS.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BoolToCSS.php
deleted file mode 100644
index 29d7ff269..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/BoolToCSS.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes converts a boolean attribute to fixed CSS
- */
-class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform
-{
-    /**
-     * Name of boolean attribute that is trigger.
-     * @type string
-     */
-    protected $attr;
-
-    /**
-     * CSS declarations to add to style, needs trailing semicolon.
-     * @type string
-     */
-    protected $css;
-
-    /**
-     * @param string $attr attribute name to convert from
-     * @param string $css CSS declarations to add to style (needs semicolon)
-     */
-    public function __construct($attr, $css)
-    {
-        $this->attr = $attr;
-        $this->css = $css;
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr[$this->attr])) {
-            return $attr;
-        }
-        unset($attr[$this->attr]);
-        $this->prependCSS($attr, $this->css);
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Border.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Border.php
deleted file mode 100644
index 90a8dea87..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Border.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes deprecated border attribute to CSS.
- */
-class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['border'])) {
-            return $attr;
-        }
-        $border_width = $this->confiscateAttr($attr, 'border');
-        // some validation should happen here
-        $this->prependCSS($attr, "border:{$border_width}px solid;");
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/EnumToCSS.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/EnumToCSS.php
deleted file mode 100644
index e2bfbf007..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/EnumToCSS.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Generic pre-transform that converts an attribute with a fixed number of
- * values (enumerated) to CSS.
- */
-class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform
-{
-    /**
-     * Name of attribute to transform from.
-     * @type string
-     */
-    protected $attr;
-
-    /**
-     * Lookup array of attribute values to CSS.
-     * @type array
-     */
-    protected $enumToCSS = array();
-
-    /**
-     * Case sensitivity of the matching.
-     * @type bool
-     * @warning Currently can only be guaranteed to work with ASCII
-     *          values.
-     */
-    protected $caseSensitive = false;
-
-    /**
-     * @param string $attr Attribute name to transform from
-     * @param array $enum_to_css Lookup array of attribute values to CSS
-     * @param bool $case_sensitive Case sensitivity indicator, default false
-     */
-    public function __construct($attr, $enum_to_css, $case_sensitive = false)
-    {
-        $this->attr = $attr;
-        $this->enumToCSS = $enum_to_css;
-        $this->caseSensitive = (bool)$case_sensitive;
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr[$this->attr])) {
-            return $attr;
-        }
-
-        $value = trim($attr[$this->attr]);
-        unset($attr[$this->attr]);
-
-        if (!$this->caseSensitive) {
-            $value = strtolower($value);
-        }
-
-        if (!isset($this->enumToCSS[$value])) {
-            return $attr;
-        }
-        $this->prependCSS($attr, $this->enumToCSS[$value]);
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgRequired.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgRequired.php
deleted file mode 100644
index 335f0033e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgRequired.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-// must be called POST validation
-
-/**
- * Transform that supplies default values for the src and alt attributes
- * in img tags, as well as prevents the img tag from being removed
- * because of a missing alt tag. This needs to be registered as both
- * a pre and post attribute transform.
- */
-class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
-{
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        $src = true;
-        if (!isset($attr['src'])) {
-            if ($config->get('Core.RemoveInvalidImg')) {
-                return $attr;
-            }
-            $attr['src'] = $config->get('Attr.DefaultInvalidImage');
-            $src = false;
-        }
-
-        if (!isset($attr['alt'])) {
-            if ($src) {
-                $alt = $config->get('Attr.DefaultImageAlt');
-                if ($alt === null) {
-                    $attr['alt'] = basename($attr['src']);
-                } else {
-                    $attr['alt'] = $alt;
-                }
-            } else {
-                $attr['alt'] = $config->get('Attr.DefaultInvalidImageAlt');
-            }
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgSpace.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgSpace.php
deleted file mode 100644
index aec42aea8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ImgSpace.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes deprecated hspace and vspace attributes to CSS
- */
-class HTMLPurifier_AttrTransform_ImgSpace extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type string
-     */
-    protected $attr;
-
-    /**
-     * @type array
-     */
-    protected $css = array(
-        'hspace' => array('left', 'right'),
-        'vspace' => array('top', 'bottom')
-    );
-
-    /**
-     * @param string $attr
-     */
-    public function __construct($attr)
-    {
-        $this->attr = $attr;
-        if (!isset($this->css[$attr])) {
-            trigger_error(htmlspecialchars($attr) . ' is not valid space attribute');
-        }
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr[$this->attr])) {
-            return $attr;
-        }
-
-        $width = $this->confiscateAttr($attr, $this->attr);
-        // some validation could happen here
-
-        if (!isset($this->css[$this->attr])) {
-            return $attr;
-        }
-
-        $style = '';
-        foreach ($this->css[$this->attr] as $suffix) {
-            $property = "margin-$suffix";
-            $style .= "$property:{$width}px;";
-        }
-        $this->prependCSS($attr, $style);
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Input.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Input.php
deleted file mode 100644
index 17a2ce4ce..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Input.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Performs miscellaneous cross attribute validation and filtering for
- * input elements. This is meant to be a post-transform.
- */
-class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type HTMLPurifier_AttrDef_HTML_Pixels
-     */
-    protected $pixels;
-
-    public function __construct()
-    {
-        $this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['type'])) {
-            $t = 'text';
-        } else {
-            $t = strtolower($attr['type']);
-        }
-        if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
-            unset($attr['checked']);
-        }
-        if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
-            unset($attr['maxlength']);
-        }
-        if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
-            $result = $this->pixels->validate($attr['size'], $config, $context);
-            if ($result === false) {
-                unset($attr['size']);
-            } else {
-                $attr['size'] = $result;
-            }
-        }
-        if (isset($attr['src']) && $t !== 'image') {
-            unset($attr['src']);
-        }
-        if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {
-            $attr['value'] = '';
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Lang.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Lang.php
deleted file mode 100644
index 591b8ca73..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Lang.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * Post-transform that copies lang's value to xml:lang (and vice-versa)
- * @note Theoretically speaking, this could be a pre-transform, but putting
- *       post is more efficient.
- */
-class HTMLPurifier_AttrTransform_Lang extends HTMLPurifier_AttrTransform
-{
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        $lang = isset($attr['lang']) ? $attr['lang'] : false;
-        $xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
-
-        if ($lang !== false && $xml_lang === false) {
-            $attr['xml:lang'] = $lang;
-        } elseif ($xml_lang !== false) {
-            $attr['lang'] = $xml_lang;
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Length.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Length.php
deleted file mode 100644
index c4bfd9760..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Length.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Class for handling width/height length attribute transformations to CSS
- */
-class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
-{
-
-    /**
-     * @type string
-     */
-    protected $name;
-
-    /**
-     * @type string
-     */
-    protected $cssName;
-
-    public function __construct($name, $css_name = null)
-    {
-        $this->name = $name;
-        $this->cssName = $css_name ? $css_name : $name;
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr[$this->name])) {
-            return $attr;
-        }
-        $length = $this->confiscateAttr($attr, $this->name);
-        if (ctype_digit($length)) {
-            $length .= 'px';
-        }
-        $this->prependCSS($attr, $this->cssName . ":$length;");
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Name.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Name.php
deleted file mode 100644
index a874d0f7a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Name.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * Pre-transform that changes deprecated name attribute to ID if necessary
- */
-class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
-{
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        // Abort early if we're using relaxed definition of name
-        if ($config->get('HTML.Attr.Name.UseCDATA')) {
-            return $attr;
-        }
-        if (!isset($attr['name'])) {
-            return $attr;
-        }
-        $id = $this->confiscateAttr($attr, 'name');
-        if (isset($attr['id'])) {
-            return $attr;
-        }
-        $attr['id'] = $id;
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/NameSync.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/NameSync.php
deleted file mode 100644
index 457f8110f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/NameSync.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * Post-transform that performs validation to the name attribute; if
- * it is present with an equivalent id attribute, it is passed through;
- * otherwise validation is performed.
- */
-class HTMLPurifier_AttrTransform_NameSync extends HTMLPurifier_AttrTransform
-{
-
-    public function __construct()
-    {
-        $this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['name'])) {
-            return $attr;
-        }
-        $name = $attr['name'];
-        if (isset($attr['id']) && $attr['id'] === $name) {
-            return $attr;
-        }
-        $result = $this->idDef->validate($name, $config, $context);
-        if ($result === false) {
-            unset($attr['name']);
-        } else {
-            $attr['name'] = $result;
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Nofollow.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Nofollow.php
deleted file mode 100644
index 25173c219..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Nofollow.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-// must be called POST validation
-
-/**
- * Adds rel="nofollow" to all outbound links.  This transform is
- * only attached if Attr.Nofollow is TRUE.
- */
-class HTMLPurifier_AttrTransform_Nofollow extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type HTMLPurifier_URIParser
-     */
-    private $parser;
-
-    public function __construct()
-    {
-        $this->parser = new HTMLPurifier_URIParser();
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['href'])) {
-            return $attr;
-        }
-
-        // XXX Kind of inefficient
-        $url = $this->parser->parse($attr['href']);
-        $scheme = $url->getSchemeObj($config, $context);
-
-        if ($scheme->browsable && !$url->isLocal($config, $context)) {
-            if (isset($attr['rel'])) {
-                $rels = explode(' ', $attr['rel']);
-                if (!in_array('nofollow', $rels)) {
-                    $rels[] = 'nofollow';
-                }
-                $attr['rel'] = implode(' ', $rels);
-            } else {
-                $attr['rel'] = 'nofollow';
-            }
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeEmbed.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeEmbed.php
deleted file mode 100644
index 98ebf49bf..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeEmbed.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-class HTMLPurifier_AttrTransform_SafeEmbed extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type string
-     */
-    public $name = "SafeEmbed";
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        $attr['allowscriptaccess'] = 'never';
-        $attr['allownetworking'] = 'internal';
-        $attr['type'] = 'application/x-shockwave-flash';
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeObject.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeObject.php
deleted file mode 100644
index b71a8f9a5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeObject.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Writes default type for all objects. Currently only supports flash.
- */
-class HTMLPurifier_AttrTransform_SafeObject extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type string
-     */
-    public $name = "SafeObject";
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['type'])) {
-            $attr['type'] = 'application/x-shockwave-flash';
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeParam.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeParam.php
deleted file mode 100644
index 206644144..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/SafeParam.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/**
- * Validates name/value pairs in param tags to be used in safe objects. This
- * will only allow name values it recognizes, and pre-fill certain attributes
- * with required values.
- *
- * @note
- *      This class only supports Flash. In the future, Quicktime support
- *      may be added.
- *
- * @warning
- *      This class expects an injector to add the necessary parameters tags.
- */
-class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type string
-     */
-    public $name = "SafeParam";
-
-    /**
-     * @type HTMLPurifier_AttrDef_URI
-     */
-    private $uri;
-
-    public function __construct()
-    {
-        $this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
-        $this->wmode = new HTMLPurifier_AttrDef_Enum(array('window', 'opaque', 'transparent'));
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        // If we add support for other objects, we'll need to alter the
-        // transforms.
-        switch ($attr['name']) {
-            // application/x-shockwave-flash
-            // Keep this synchronized with Injector/SafeObject.php
-            case 'allowScriptAccess':
-                $attr['value'] = 'never';
-                break;
-            case 'allowNetworking':
-                $attr['value'] = 'internal';
-                break;
-            case 'allowFullScreen':
-                if ($config->get('HTML.FlashAllowFullScreen')) {
-                    $attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false';
-                } else {
-                    $attr['value'] = 'false';
-                }
-                break;
-            case 'wmode':
-                $attr['value'] = $this->wmode->validate($attr['value'], $config, $context);
-                break;
-            case 'movie':
-            case 'src':
-                $attr['name'] = "movie";
-                $attr['value'] = $this->uri->validate($attr['value'], $config, $context);
-                break;
-            case 'flashvars':
-                // we're going to allow arbitrary inputs to the SWF, on
-                // the reasoning that it could only hack the SWF, not us.
-                break;
-            // add other cases to support other param name/value pairs
-            default:
-                $attr['name'] = $attr['value'] = null;
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ScriptRequired.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ScriptRequired.php
deleted file mode 100644
index 49445b43f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/ScriptRequired.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/**
- * Implements required attribute stipulation for <script>
- */
-class HTMLPurifier_AttrTransform_ScriptRequired extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['type'])) {
-            $attr['type'] = 'text/javascript';
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetBlank.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetBlank.php
deleted file mode 100644
index f66dcf8c4..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetBlank.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-// must be called POST validation
-
-/**
- * Adds target="blank" to all outbound links.  This transform is
- * only attached if Attr.TargetBlank is TRUE.  This works regardless
- * of whether or not Attr.AllowedFrameTargets
- */
-class HTMLPurifier_AttrTransform_TargetBlank extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @type HTMLPurifier_URIParser
-     */
-    private $parser;
-
-    public function __construct()
-    {
-        $this->parser = new HTMLPurifier_URIParser();
-    }
-
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (!isset($attr['href'])) {
-            return $attr;
-        }
-
-        // XXX Kind of inefficient
-        $url = $this->parser->parse($attr['href']);
-        $scheme = $url->getSchemeObj($config, $context);
-
-        if ($scheme->browsable && !$url->isBenign($config, $context)) {
-            $attr['target'] = '_blank';
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoopener.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoopener.php
deleted file mode 100644
index ab4c09721..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoopener.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-// must be called POST validation
-
-/**
- * Adds rel="noopener" to any links which target a different window
- * than the current one.  This is used to prevent malicious websites
- * from silently replacing the original window, which could be used
- * to do phishing.
- * This transform is controlled by %HTML.TargetNoopener.
- */
-class HTMLPurifier_AttrTransform_TargetNoopener extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (isset($attr['rel'])) {
-            $rels = explode(' ', $attr['rel']);
-        } else {
-            $rels = array();
-        }
-        if (isset($attr['target']) && !in_array('noopener', $rels)) {
-            $rels[] = 'noopener';
-        }
-        if (!empty($rels) || isset($attr['rel'])) {
-            $attr['rel'] = implode(' ', $rels);
-        }
-
-        return $attr;
-    }
-}
-
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php
deleted file mode 100644
index ec0030b94..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-// must be called POST validation
-
-/**
- * Adds rel="noreferrer" to any links which target a different window
- * than the current one.  This is used to prevent malicious websites
- * from silently replacing the original window, which could be used
- * to do phishing.
- * This transform is controlled by %HTML.TargetNoreferrer.
- */
-class HTMLPurifier_AttrTransform_TargetNoreferrer extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        if (isset($attr['rel'])) {
-            $rels = explode(' ', $attr['rel']);
-        } else {
-            $rels = array();
-        }
-        if (isset($attr['target']) && !in_array('noreferrer', $rels)) {
-            $rels[] = 'noreferrer';
-        }
-        if (!empty($rels) || isset($attr['rel'])) {
-            $attr['rel'] = implode(' ', $rels);
-        }
-
-        return $attr;
-    }
-}
-
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Textarea.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Textarea.php
deleted file mode 100644
index 182fdda74..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTransform/Textarea.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * Sets height/width defaults for <textarea>
- */
-class HTMLPurifier_AttrTransform_Textarea extends HTMLPurifier_AttrTransform
-{
-    /**
-     * @param array $attr
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function transform($attr, $config, $context)
-    {
-        // Calculated from Firefox
-        if (!isset($attr['cols'])) {
-            $attr['cols'] = '22';
-        }
-        if (!isset($attr['rows'])) {
-            $attr['rows'] = '3';
-        }
-        return $attr;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTypes.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrTypes.php
deleted file mode 100644
index 7e8019bd0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrTypes.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/**
- * Provides lookup array of attribute types to HTMLPurifier_AttrDef objects
- */
-class HTMLPurifier_AttrTypes
-{
-    /**
-     * Lookup array of attribute string identifiers to concrete implementations.
-     * @type HTMLPurifier_AttrDef[]
-     */
-    protected $info = array();
-
-    /**
-     * Constructs the info array, supplying default implementations for attribute
-     * types.
-     */
-    public function __construct()
-    {
-        // XXX This is kind of poor, since we don't actually /clone/
-        // instances; instead, we use the supplied make() attribute. So,
-        // the underlying class must know how to deal with arguments.
-        // With the old implementation of Enum, that ignored its
-        // arguments when handling a make dispatch, the IAlign
-        // definition wouldn't work.
-
-        // pseudo-types, must be instantiated via shorthand
-        $this->info['Enum']    = new HTMLPurifier_AttrDef_Enum();
-        $this->info['Bool']    = new HTMLPurifier_AttrDef_HTML_Bool();
-
-        $this->info['CDATA']    = new HTMLPurifier_AttrDef_Text();
-        $this->info['ID']       = new HTMLPurifier_AttrDef_HTML_ID();
-        $this->info['Length']   = new HTMLPurifier_AttrDef_HTML_Length();
-        $this->info['MultiLength'] = new HTMLPurifier_AttrDef_HTML_MultiLength();
-        $this->info['NMTOKENS'] = new HTMLPurifier_AttrDef_HTML_Nmtokens();
-        $this->info['Pixels']   = new HTMLPurifier_AttrDef_HTML_Pixels();
-        $this->info['Text']     = new HTMLPurifier_AttrDef_Text();
-        $this->info['URI']      = new HTMLPurifier_AttrDef_URI();
-        $this->info['LanguageCode'] = new HTMLPurifier_AttrDef_Lang();
-        $this->info['Color']    = new HTMLPurifier_AttrDef_HTML_Color();
-        $this->info['IAlign']   = self::makeEnum('top,middle,bottom,left,right');
-        $this->info['LAlign']   = self::makeEnum('top,bottom,left,right');
-        $this->info['FrameTarget'] = new HTMLPurifier_AttrDef_HTML_FrameTarget();
-
-        // unimplemented aliases
-        $this->info['ContentType'] = new HTMLPurifier_AttrDef_Text();
-        $this->info['ContentTypes'] = new HTMLPurifier_AttrDef_Text();
-        $this->info['Charsets'] = new HTMLPurifier_AttrDef_Text();
-        $this->info['Character'] = new HTMLPurifier_AttrDef_Text();
-
-        // "proprietary" types
-        $this->info['Class'] = new HTMLPurifier_AttrDef_HTML_Class();
-
-        // number is really a positive integer (one or more digits)
-        // FIXME: ^^ not always, see start and value of list items
-        $this->info['Number']   = new HTMLPurifier_AttrDef_Integer(false, false, true);
-    }
-
-    private static function makeEnum($in)
-    {
-        return new HTMLPurifier_AttrDef_Clone(new HTMLPurifier_AttrDef_Enum(explode(',', $in)));
-    }
-
-    /**
-     * Retrieves a type
-     * @param string $type String type name
-     * @return HTMLPurifier_AttrDef Object AttrDef for type
-     */
-    public function get($type)
-    {
-        // determine if there is any extra info tacked on
-        if (strpos($type, '#') !== false) {
-            list($type, $string) = explode('#', $type, 2);
-        } else {
-            $string = '';
-        }
-
-        if (!isset($this->info[$type])) {
-            trigger_error('Cannot retrieve undefined attribute type ' . $type, E_USER_ERROR);
-            return;
-        }
-        return $this->info[$type]->make($string);
-    }
-
-    /**
-     * Sets a new implementation for a type
-     * @param string $type String type name
-     * @param HTMLPurifier_AttrDef $impl Object AttrDef for type
-     */
-    public function set($type, $impl)
-    {
-        $this->info[$type] = $impl;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/AttrValidator.php b/libraries/htmlpurifier410/library/HTMLPurifier/AttrValidator.php
deleted file mode 100644
index 1a2b0b673..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/AttrValidator.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
-
-/**
- * Validates the attributes of a token. Doesn't manage required attributes
- * very well. The only reason we factored this out was because RemoveForeignElements
- * also needed it besides ValidateAttributes.
- */
-class HTMLPurifier_AttrValidator
-{
-
-    /**
-     * Validates the attributes of a token, mutating it as necessary.
-     * that has valid tokens
-     * @param HTMLPurifier_Token $token Token to validate.
-     * @param HTMLPurifier_Config $config Instance of HTMLPurifier_Config
-     * @param HTMLPurifier_Context $context Instance of HTMLPurifier_Context
-     */
-    public function validateToken($token, $config, $context)
-    {
-        $definition = $config->getHTMLDefinition();
-        $e =& $context->get('ErrorCollector', true);
-
-        // initialize IDAccumulator if necessary
-        $ok =& $context->get('IDAccumulator', true);
-        if (!$ok) {
-            $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
-            $context->register('IDAccumulator', $id_accumulator);
-        }
-
-        // initialize CurrentToken if necessary
-        $current_token =& $context->get('CurrentToken', true);
-        if (!$current_token) {
-            $context->register('CurrentToken', $token);
-        }
-
-        if (!$token instanceof HTMLPurifier_Token_Start &&
-            !$token instanceof HTMLPurifier_Token_Empty
-        ) {
-            return;
-        }
-
-        // create alias to global definition array, see also $defs
-        // DEFINITION CALL
-        $d_defs = $definition->info_global_attr;
-
-        // don't update token until the very end, to ensure an atomic update
-        $attr = $token->attr;
-
-        // do global transformations (pre)
-        // nothing currently utilizes this
-        foreach ($definition->info_attr_transform_pre as $transform) {
-            $attr = $transform->transform($o = $attr, $config, $context);
-            if ($e) {
-                if ($attr != $o) {
-                    $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
-                }
-            }
-        }
-
-        // do local transformations only applicable to this element (pre)
-        // ex. <p align="right"> to <p style="text-align:right;">
-        foreach ($definition->info[$token->name]->attr_transform_pre as $transform) {
-            $attr = $transform->transform($o = $attr, $config, $context);
-            if ($e) {
-                if ($attr != $o) {
-                    $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
-                }
-            }
-        }
-
-        // create alias to this element's attribute definition array, see
-        // also $d_defs (global attribute definition array)
-        // DEFINITION CALL
-        $defs = $definition->info[$token->name]->attr;
-
-        $attr_key = false;
-        $context->register('CurrentAttr', $attr_key);
-
-        // iterate through all the attribute keypairs
-        // Watch out for name collisions: $key has previously been used
-        foreach ($attr as $attr_key => $value) {
-
-            // call the definition
-            if (isset($defs[$attr_key])) {
-                // there is a local definition defined
-                if ($defs[$attr_key] === false) {
-                    // We've explicitly been told not to allow this element.
-                    // This is usually when there's a global definition
-                    // that must be overridden.
-                    // Theoretically speaking, we could have a
-                    // AttrDef_DenyAll, but this is faster!
-                    $result = false;
-                } else {
-                    // validate according to the element's definition
-                    $result = $defs[$attr_key]->validate(
-                        $value,
-                        $config,
-                        $context
-                    );
-                }
-            } elseif (isset($d_defs[$attr_key])) {
-                // there is a global definition defined, validate according
-                // to the global definition
-                $result = $d_defs[$attr_key]->validate(
-                    $value,
-                    $config,
-                    $context
-                );
-            } else {
-                // system never heard of the attribute? DELETE!
-                $result = false;
-            }
-
-            // put the results into effect
-            if ($result === false || $result === null) {
-                // this is a generic error message that should replaced
-                // with more specific ones when possible
-                if ($e) {
-                    $e->send(E_ERROR, 'AttrValidator: Attribute removed');
-                }
-
-                // remove the attribute
-                unset($attr[$attr_key]);
-            } elseif (is_string($result)) {
-                // generally, if a substitution is happening, there
-                // was some sort of implicit correction going on. We'll
-                // delegate it to the attribute classes to say exactly what.
-
-                // simple substitution
-                $attr[$attr_key] = $result;
-            } else {
-                // nothing happens
-            }
-
-            // we'd also want slightly more complicated substitution
-            // involving an array as the return value,
-            // although we're not sure how colliding attributes would
-            // resolve (certain ones would be completely overriden,
-            // others would prepend themselves).
-        }
-
-        $context->destroy('CurrentAttr');
-
-        // post transforms
-
-        // global (error reporting untested)
-        foreach ($definition->info_attr_transform_post as $transform) {
-            $attr = $transform->transform($o = $attr, $config, $context);
-            if ($e) {
-                if ($attr != $o) {
-                    $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
-                }
-            }
-        }
-
-        // local (error reporting untested)
-        foreach ($definition->info[$token->name]->attr_transform_post as $transform) {
-            $attr = $transform->transform($o = $attr, $config, $context);
-            if ($e) {
-                if ($attr != $o) {
-                    $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
-                }
-            }
-        }
-
-        $token->attr = $attr;
-
-        // destroy CurrentToken if we made it ourselves
-        if (!$current_token) {
-            $context->destroy('CurrentToken');
-        }
-
-    }
-
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Bootstrap.php b/libraries/htmlpurifier410/library/HTMLPurifier/Bootstrap.php
deleted file mode 100644
index 0ab0e341e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Bootstrap.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-// constants are slow, so we use as few as possible
-if (!defined('HTMLPURIFIER_PREFIX')) {
-    define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..'));
-}
-
-// accomodations for versions earlier than 5.0.2
-// borrowed from PHP_Compat, LGPL licensed, by Aidan Lister <aidan@php.net>
-if (!defined('PHP_EOL')) {
-    switch (strtoupper(substr(PHP_OS, 0, 3))) {
-        case 'WIN':
-            define('PHP_EOL', "\r\n");
-            break;
-        case 'DAR':
-            define('PHP_EOL', "\r");
-            break;
-        default:
-            define('PHP_EOL', "\n");
-    }
-}
-
-/**
- * Bootstrap class that contains meta-functionality for HTML Purifier such as
- * the autoload function.
- *
- * @note
- *      This class may be used without any other files from HTML Purifier.
- */
-class HTMLPurifier_Bootstrap
-{
-
-    /**
-     * Autoload function for HTML Purifier
-     * @param string $class Class to load
-     * @return bool
-     */
-    public static function autoload($class)
-    {
-        $file = HTMLPurifier_Bootstrap::getPath($class);
-        if (!$file) {
-            return false;
-        }
-        // Technically speaking, it should be ok and more efficient to
-        // just do 'require', but Antonio Parraga reports that with
-        // Zend extensions such as Zend debugger and APC, this invariant
-        // may be broken.  Since we have efficient alternatives, pay
-        // the cost here and avoid the bug.
-        require_once HTMLPURIFIER_PREFIX . '/' . $file;
-        return true;
-    }
-
-    /**
-     * Returns the path for a specific class.
-     * @param string $class Class path to get
-     * @return string
-     */
-    public static function getPath($class)
-    {
-        if (strncmp('HTMLPurifier', $class, 12) !== 0) {
-            return false;
-        }
-        // Custom implementations
-        if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) {
-            $code = str_replace('_', '-', substr($class, 22));
-            $file = 'HTMLPurifier/Language/classes/' . $code . '.php';
-        } else {
-            $file = str_replace('_', '/', $class) . '.php';
-        }
-        if (!file_exists(HTMLPURIFIER_PREFIX . '/' . $file)) {
-            return false;
-        }
-        return $file;
-    }
-
-    /**
-     * "Pre-registers" our autoloader on the SPL stack.
-     */
-    public static function registerAutoload()
-    {
-        $autoload = array('HTMLPurifier_Bootstrap', 'autoload');
-        if (($funcs = spl_autoload_functions()) === false) {
-            spl_autoload_register($autoload);
-        } elseif (function_exists('spl_autoload_unregister')) {
-            if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
-                // prepend flag exists, no need for shenanigans
-                spl_autoload_register($autoload, true, true);
-            } else {
-                $buggy  = version_compare(PHP_VERSION, '5.2.11', '<');
-                $compat = version_compare(PHP_VERSION, '5.1.2', '<=') &&
-                          version_compare(PHP_VERSION, '5.1.0', '>=');
-                foreach ($funcs as $func) {
-                    if ($buggy && is_array($func)) {
-                        // :TRICKY: There are some compatibility issues and some
-                        // places where we need to error out
-                        $reflector = new ReflectionMethod($func[0], $func[1]);
-                        if (!$reflector->isStatic()) {
-                            throw new Exception(
-                                'HTML Purifier autoloader registrar is not compatible
-                                with non-static object methods due to PHP Bug #44144;
-                                Please do not use HTMLPurifier.autoload.php (or any
-                                file that includes this file); instead, place the code:
-                                spl_autoload_register(array(\'HTMLPurifier_Bootstrap\', \'autoload\'))
-                                after your own autoloaders.'
-                            );
-                        }
-                        // Suprisingly, spl_autoload_register supports the
-                        // Class::staticMethod callback format, although call_user_func doesn't
-                        if ($compat) {
-                            $func = implode('::', $func);
-                        }
-                    }
-                    spl_autoload_unregister($func);
-                }
-                spl_autoload_register($autoload);
-                foreach ($funcs as $func) {
-                    spl_autoload_register($func);
-                }
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/CSSDefinition.php b/libraries/htmlpurifier410/library/HTMLPurifier/CSSDefinition.php
deleted file mode 100644
index 5e7490eb2..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/CSSDefinition.php
+++ /dev/null
@@ -1,491 +0,0 @@
-<?php
-
-/**
- * Defines allowed CSS attributes and what their values are.
- * @see HTMLPurifier_HTMLDefinition
- */
-class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
-{
-
-    public $type = 'CSS';
-
-    /**
-     * Assoc array of attribute name to definition object.
-     * @type HTMLPurifier_AttrDef[]
-     */
-    public $info = array();
-
-    /**
-     * Constructs the info array.  The meat of this class.
-     * @param HTMLPurifier_Config $config
-     */
-    protected function doSetup($config)
-    {
-        $this->info['text-align'] = new HTMLPurifier_AttrDef_Enum(
-            array('left', 'right', 'center', 'justify'),
-            false
-        );
-
-        $border_style =
-            $this->info['border-bottom-style'] =
-            $this->info['border-right-style'] =
-            $this->info['border-left-style'] =
-            $this->info['border-top-style'] = new HTMLPurifier_AttrDef_Enum(
-                array(
-                    'none',
-                    'hidden',
-                    'dotted',
-                    'dashed',
-                    'solid',
-                    'double',
-                    'groove',
-                    'ridge',
-                    'inset',
-                    'outset'
-                ),
-                false
-            );
-
-        $this->info['border-style'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_style);
-
-        $this->info['clear'] = new HTMLPurifier_AttrDef_Enum(
-            array('none', 'left', 'right', 'both'),
-            false
-        );
-        $this->info['float'] = new HTMLPurifier_AttrDef_Enum(
-            array('none', 'left', 'right'),
-            false
-        );
-        $this->info['font-style'] = new HTMLPurifier_AttrDef_Enum(
-            array('normal', 'italic', 'oblique'),
-            false
-        );
-        $this->info['font-variant'] = new HTMLPurifier_AttrDef_Enum(
-            array('normal', 'small-caps'),
-            false
-        );
-
-        $uri_or_none = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Enum(array('none')),
-                new HTMLPurifier_AttrDef_CSS_URI()
-            )
-        );
-
-        $this->info['list-style-position'] = new HTMLPurifier_AttrDef_Enum(
-            array('inside', 'outside'),
-            false
-        );
-        $this->info['list-style-type'] = new HTMLPurifier_AttrDef_Enum(
-            array(
-                'disc',
-                'circle',
-                'square',
-                'decimal',
-                'lower-roman',
-                'upper-roman',
-                'lower-alpha',
-                'upper-alpha',
-                'none'
-            ),
-            false
-        );
-        $this->info['list-style-image'] = $uri_or_none;
-
-        $this->info['list-style'] = new HTMLPurifier_AttrDef_CSS_ListStyle($config);
-
-        $this->info['text-transform'] = new HTMLPurifier_AttrDef_Enum(
-            array('capitalize', 'uppercase', 'lowercase', 'none'),
-            false
-        );
-        $this->info['color'] = new HTMLPurifier_AttrDef_CSS_Color();
-
-        $this->info['background-image'] = $uri_or_none;
-        $this->info['background-repeat'] = new HTMLPurifier_AttrDef_Enum(
-            array('repeat', 'repeat-x', 'repeat-y', 'no-repeat')
-        );
-        $this->info['background-attachment'] = new HTMLPurifier_AttrDef_Enum(
-            array('scroll', 'fixed')
-        );
-        $this->info['background-position'] = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
-
-        $border_color =
-            $this->info['border-top-color'] =
-            $this->info['border-bottom-color'] =
-            $this->info['border-left-color'] =
-            $this->info['border-right-color'] =
-            $this->info['background-color'] = new HTMLPurifier_AttrDef_CSS_Composite(
-                array(
-                    new HTMLPurifier_AttrDef_Enum(array('transparent')),
-                    new HTMLPurifier_AttrDef_CSS_Color()
-                )
-            );
-
-        $this->info['background'] = new HTMLPurifier_AttrDef_CSS_Background($config);
-
-        $this->info['border-color'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_color);
-
-        $border_width =
-            $this->info['border-top-width'] =
-            $this->info['border-bottom-width'] =
-            $this->info['border-left-width'] =
-            $this->info['border-right-width'] = new HTMLPurifier_AttrDef_CSS_Composite(
-                array(
-                    new HTMLPurifier_AttrDef_Enum(array('thin', 'medium', 'thick')),
-                    new HTMLPurifier_AttrDef_CSS_Length('0') //disallow negative
-                )
-            );
-
-        $this->info['border-width'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_width);
-
-        $this->info['letter-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Enum(array('normal')),
-                new HTMLPurifier_AttrDef_CSS_Length()
-            )
-        );
-
-        $this->info['word-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Enum(array('normal')),
-                new HTMLPurifier_AttrDef_CSS_Length()
-            )
-        );
-
-        $this->info['font-size'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Enum(
-                    array(
-                        'xx-small',
-                        'x-small',
-                        'small',
-                        'medium',
-                        'large',
-                        'x-large',
-                        'xx-large',
-                        'larger',
-                        'smaller'
-                    )
-                ),
-                new HTMLPurifier_AttrDef_CSS_Percentage(),
-                new HTMLPurifier_AttrDef_CSS_Length()
-            )
-        );
-
-        $this->info['line-height'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Enum(array('normal')),
-                new HTMLPurifier_AttrDef_CSS_Number(true), // no negatives
-                new HTMLPurifier_AttrDef_CSS_Length('0'),
-                new HTMLPurifier_AttrDef_CSS_Percentage(true)
-            )
-        );
-
-        $margin =
-            $this->info['margin-top'] =
-            $this->info['margin-bottom'] =
-            $this->info['margin-left'] =
-            $this->info['margin-right'] = new HTMLPurifier_AttrDef_CSS_Composite(
-                array(
-                    new HTMLPurifier_AttrDef_CSS_Length(),
-                    new HTMLPurifier_AttrDef_CSS_Percentage(),
-                    new HTMLPurifier_AttrDef_Enum(array('auto'))
-                )
-            );
-
-        $this->info['margin'] = new HTMLPurifier_AttrDef_CSS_Multiple($margin);
-
-        // non-negative
-        $padding =
-            $this->info['padding-top'] =
-            $this->info['padding-bottom'] =
-            $this->info['padding-left'] =
-            $this->info['padding-right'] = new HTMLPurifier_AttrDef_CSS_Composite(
-                array(
-                    new HTMLPurifier_AttrDef_CSS_Length('0'),
-                    new HTMLPurifier_AttrDef_CSS_Percentage(true)
-                )
-            );
-
-        $this->info['padding'] = new HTMLPurifier_AttrDef_CSS_Multiple($padding);
-
-        $this->info['text-indent'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_CSS_Length(),
-                new HTMLPurifier_AttrDef_CSS_Percentage()
-            )
-        );
-
-        $trusted_wh = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_CSS_Length('0'),
-                new HTMLPurifier_AttrDef_CSS_Percentage(true),
-                new HTMLPurifier_AttrDef_Enum(array('auto'))
-            )
-        );
-        $max = $config->get('CSS.MaxImgLength');
-
-        $this->info['min-width'] =
-        $this->info['max-width'] =
-        $this->info['min-height'] =
-        $this->info['max-height'] =
-        $this->info['width'] =
-        $this->info['height'] =
-            $max === null ?
-                $trusted_wh :
-                new HTMLPurifier_AttrDef_Switch(
-                    'img',
-                    // For img tags:
-                    new HTMLPurifier_AttrDef_CSS_Composite(
-                        array(
-                            new HTMLPurifier_AttrDef_CSS_Length('0', $max),
-                            new HTMLPurifier_AttrDef_Enum(array('auto'))
-                        )
-                    ),
-                    // For everyone else:
-                    $trusted_wh
-                );
-
-        $this->info['text-decoration'] = new HTMLPurifier_AttrDef_CSS_TextDecoration();
-
-        $this->info['font-family'] = new HTMLPurifier_AttrDef_CSS_FontFamily();
-
-        // this could use specialized code
-        $this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
-            array(
-                'normal',
-                'bold',
-                'bolder',
-                'lighter',
-                '100',
-                '200',
-                '300',
-                '400',
-                '500',
-                '600',
-                '700',
-                '800',
-                '900'
-            ),
-            false
-        );
-
-        // MUST be called after other font properties, as it references
-        // a CSSDefinition object
-        $this->info['font'] = new HTMLPurifier_AttrDef_CSS_Font($config);
-
-        // same here
-        $this->info['border'] =
-        $this->info['border-bottom'] =
-        $this->info['border-top'] =
-        $this->info['border-left'] =
-        $this->info['border-right'] = new HTMLPurifier_AttrDef_CSS_Border($config);
-
-        $this->info['border-collapse'] = new HTMLPurifier_AttrDef_Enum(
-            array('collapse', 'separate')
-        );
-
-        $this->info['caption-side'] = new HTMLPurifier_AttrDef_Enum(
-            array('top', 'bottom')
-        );
-
-        $this->info['table-layout'] = new HTMLPurifier_AttrDef_Enum(
-            array('auto', 'fixed')
-        );
-
-        $this->info['vertical-align'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Enum(
-                    array(
-                        'baseline',
-                        'sub',
-                        'super',
-                        'top',
-                        'text-top',
-                        'middle',
-                        'bottom',
-                        'text-bottom'
-                    )
-                ),
-                new HTMLPurifier_AttrDef_CSS_Length(),
-                new HTMLPurifier_AttrDef_CSS_Percentage()
-            )
-        );
-
-        $this->info['border-spacing'] = new HTMLPurifier_AttrDef_CSS_Multiple(new HTMLPurifier_AttrDef_CSS_Length(), 2);
-
-        // These CSS properties don't work on many browsers, but we live
-        // in THE FUTURE!
-        $this->info['white-space'] = new HTMLPurifier_AttrDef_Enum(
-            array('nowrap', 'normal', 'pre', 'pre-wrap', 'pre-line')
-        );
-
-        if ($config->get('CSS.Proprietary')) {
-            $this->doSetupProprietary($config);
-        }
-
-        if ($config->get('CSS.AllowTricky')) {
-            $this->doSetupTricky($config);
-        }
-
-        if ($config->get('CSS.Trusted')) {
-            $this->doSetupTrusted($config);
-        }
-
-        $allow_important = $config->get('CSS.AllowImportant');
-        // wrap all attr-defs with decorator that handles !important
-        foreach ($this->info as $k => $v) {
-            $this->info[$k] = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($v, $allow_important);
-        }
-
-        $this->setupConfigStuff($config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    protected function doSetupProprietary($config)
-    {
-        // Internet Explorer only scrollbar colors
-        $this->info['scrollbar-arrow-color'] = new HTMLPurifier_AttrDef_CSS_Color();
-        $this->info['scrollbar-base-color'] = new HTMLPurifier_AttrDef_CSS_Color();
-        $this->info['scrollbar-darkshadow-color'] = new HTMLPurifier_AttrDef_CSS_Color();
-        $this->info['scrollbar-face-color'] = new HTMLPurifier_AttrDef_CSS_Color();
-        $this->info['scrollbar-highlight-color'] = new HTMLPurifier_AttrDef_CSS_Color();
-        $this->info['scrollbar-shadow-color'] = new HTMLPurifier_AttrDef_CSS_Color();
-
-        // vendor specific prefixes of opacity
-        $this->info['-moz-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue();
-        $this->info['-khtml-opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue();
-
-        // only opacity, for now
-        $this->info['filter'] = new HTMLPurifier_AttrDef_CSS_Filter();
-
-        // more CSS3
-        $this->info['page-break-after'] =
-        $this->info['page-break-before'] = new HTMLPurifier_AttrDef_Enum(
-            array(
-                'auto',
-                'always',
-                'avoid',
-                'left',
-                'right'
-            )
-        );
-        $this->info['page-break-inside'] = new HTMLPurifier_AttrDef_Enum(array('auto', 'avoid'));
-
-        $border_radius = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_CSS_Percentage(true), // disallow negative
-                new HTMLPurifier_AttrDef_CSS_Length('0') // disallow negative
-            ));
-
-        $this->info['border-top-left-radius'] =
-        $this->info['border-top-right-radius'] =
-        $this->info['border-bottom-right-radius'] =
-        $this->info['border-bottom-left-radius'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_radius, 2);
-        // TODO: support SLASH syntax
-        $this->info['border-radius'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_radius, 4);
-
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    protected function doSetupTricky($config)
-    {
-        $this->info['display'] = new HTMLPurifier_AttrDef_Enum(
-            array(
-                'inline',
-                'block',
-                'list-item',
-                'run-in',
-                'compact',
-                'marker',
-                'table',
-                'inline-block',
-                'inline-table',
-                'table-row-group',
-                'table-header-group',
-                'table-footer-group',
-                'table-row',
-                'table-column-group',
-                'table-column',
-                'table-cell',
-                'table-caption',
-                'none'
-            )
-        );
-        $this->info['visibility'] = new HTMLPurifier_AttrDef_Enum(
-            array('visible', 'hidden', 'collapse')
-        );
-        $this->info['overflow'] = new HTMLPurifier_AttrDef_Enum(array('visible', 'hidden', 'auto', 'scroll'));
-        $this->info['opacity'] = new HTMLPurifier_AttrDef_CSS_AlphaValue();
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    protected function doSetupTrusted($config)
-    {
-        $this->info['position'] = new HTMLPurifier_AttrDef_Enum(
-            array('static', 'relative', 'absolute', 'fixed')
-        );
-        $this->info['top'] =
-        $this->info['left'] =
-        $this->info['right'] =
-        $this->info['bottom'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_CSS_Length(),
-                new HTMLPurifier_AttrDef_CSS_Percentage(),
-                new HTMLPurifier_AttrDef_Enum(array('auto')),
-            )
-        );
-        $this->info['z-index'] = new HTMLPurifier_AttrDef_CSS_Composite(
-            array(
-                new HTMLPurifier_AttrDef_Integer(),
-                new HTMLPurifier_AttrDef_Enum(array('auto')),
-            )
-        );
-    }
-
-    /**
-     * Performs extra config-based processing. Based off of
-     * HTMLPurifier_HTMLDefinition.
-     * @param HTMLPurifier_Config $config
-     * @todo Refactor duplicate elements into common class (probably using
-     *       composition, not inheritance).
-     */
-    protected function setupConfigStuff($config)
-    {
-        // setup allowed elements
-        $support = "(for information on implementing this, see the " .
-            "support forums) ";
-        $allowed_properties = $config->get('CSS.AllowedProperties');
-        if ($allowed_properties !== null) {
-            foreach ($this->info as $name => $d) {
-                if (!isset($allowed_properties[$name])) {
-                    unset($this->info[$name]);
-                }
-                unset($allowed_properties[$name]);
-            }
-            // emit errors
-            foreach ($allowed_properties as $name => $d) {
-                // :TODO: Is this htmlspecialchars() call really necessary?
-                $name = htmlspecialchars($name);
-                trigger_error("Style attribute '$name' is not supported $support", E_USER_WARNING);
-            }
-        }
-
-        $forbidden_properties = $config->get('CSS.ForbiddenProperties');
-        if ($forbidden_properties !== null) {
-            foreach ($this->info as $name => $d) {
-                if (isset($forbidden_properties[$name])) {
-                    unset($this->info[$name]);
-                }
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef.php
deleted file mode 100644
index 5d64cd41a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-/**
- * Defines allowed child nodes and validates nodes against it.
- */
-abstract class HTMLPurifier_ChildDef
-{
-    /**
-     * Type of child definition, usually right-most part of class name lowercase.
-     * Used occasionally in terms of context.
-     * @type string
-     */
-    public $type;
-
-    /**
-     * Indicates whether or not an empty array of children is okay.
-     *
-     * This is necessary for redundant checking when changes affecting
-     * a child node may cause a parent node to now be disallowed.
-     * @type bool
-     */
-    public $allow_empty;
-
-    /**
-     * Lookup array of all elements that this definition could possibly allow.
-     * @type array
-     */
-    public $elements = array();
-
-    /**
-     * Get lookup of tag names that should not close this element automatically.
-     * All other elements will do so.
-     * @param HTMLPurifier_Config $config HTMLPurifier_Config object
-     * @return array
-     */
-    public function getAllowedElements($config)
-    {
-        return $this->elements;
-    }
-
-    /**
-     * Validates nodes according to definition and returns modification.
-     *
-     * @param HTMLPurifier_Node[] $children Array of HTMLPurifier_Node
-     * @param HTMLPurifier_Config $config HTMLPurifier_Config object
-     * @param HTMLPurifier_Context $context HTMLPurifier_Context object
-     * @return bool|array true to leave nodes as is, false to remove parent node, array of replacement children
-     */
-    abstract public function validateChildren($children, $config, $context);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Chameleon.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Chameleon.php
deleted file mode 100644
index f6b2f22e5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Chameleon.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * Definition that uses different definitions depending on context.
- *
- * The del and ins tags are notable because they allow different types of
- * elements depending on whether or not they're in a block or inline context.
- * Chameleon allows this behavior to happen by using two different
- * definitions depending on context.  While this somewhat generalized,
- * it is specifically intended for those two tags.
- */
-class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
-{
-
-    /**
-     * Instance of the definition object to use when inline. Usually stricter.
-     * @type HTMLPurifier_ChildDef_Optional
-     */
-    public $inline;
-
-    /**
-     * Instance of the definition object to use when block.
-     * @type HTMLPurifier_ChildDef_Optional
-     */
-    public $block;
-
-    /**
-     * @type string
-     */
-    public $type = 'chameleon';
-
-    /**
-     * @param array $inline List of elements to allow when inline.
-     * @param array $block List of elements to allow when block.
-     */
-    public function __construct($inline, $block)
-    {
-        $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
-        $this->block = new HTMLPurifier_ChildDef_Optional($block);
-        $this->elements = $this->block->elements;
-    }
-
-    /**
-     * @param HTMLPurifier_Node[] $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        if ($context->get('IsInline') === false) {
-            return $this->block->validateChildren(
-                $children,
-                $config,
-                $context
-            );
-        } else {
-            return $this->inline->validateChildren(
-                $children,
-                $config,
-                $context
-            );
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Custom.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Custom.php
deleted file mode 100644
index cc84d8990..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Custom.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * Custom validation class, accepts DTD child definitions
- *
- * @warning Currently this class is an all or nothing proposition, that is,
- *          it will only give a bool return value.
- */
-class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
-{
-    /**
-     * @type string
-     */
-    public $type = 'custom';
-
-    /**
-     * @type bool
-     */
-    public $allow_empty = false;
-
-    /**
-     * Allowed child pattern as defined by the DTD.
-     * @type string
-     */
-    public $dtd_regex;
-
-    /**
-     * PCRE regex derived from $dtd_regex.
-     * @type string
-     */
-    private $_pcre_regex;
-
-    /**
-     * @param $dtd_regex Allowed child pattern from the DTD
-     */
-    public function __construct($dtd_regex)
-    {
-        $this->dtd_regex = $dtd_regex;
-        $this->_compileRegex();
-    }
-
-    /**
-     * Compiles the PCRE regex from a DTD regex ($dtd_regex to $_pcre_regex)
-     */
-    protected function _compileRegex()
-    {
-        $raw = str_replace(' ', '', $this->dtd_regex);
-        if ($raw[0] != '(') {
-            $raw = "($raw)";
-        }
-        $el = '[#a-zA-Z0-9_.-]+';
-        $reg = $raw;
-
-        // COMPLICATED! AND MIGHT BE BUGGY! I HAVE NO CLUE WHAT I'M
-        // DOING! Seriously: if there's problems, please report them.
-
-        // collect all elements into the $elements array
-        preg_match_all("/$el/", $reg, $matches);
-        foreach ($matches[0] as $match) {
-            $this->elements[$match] = true;
-        }
-
-        // setup all elements as parentheticals with leading commas
-        $reg = preg_replace("/$el/", '(,\\0)', $reg);
-
-        // remove commas when they were not solicited
-        $reg = preg_replace("/([^,(|]\(+),/", '\\1', $reg);
-
-        // remove all non-paranthetical commas: they are handled by first regex
-        $reg = preg_replace("/,\(/", '(', $reg);
-
-        $this->_pcre_regex = $reg;
-    }
-
-    /**
-     * @param HTMLPurifier_Node[] $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        $list_of_children = '';
-        $nesting = 0; // depth into the nest
-        foreach ($children as $node) {
-            if (!empty($node->is_whitespace)) {
-                continue;
-            }
-            $list_of_children .= $node->name . ',';
-        }
-        // add leading comma to deal with stray comma declarations
-        $list_of_children = ',' . rtrim($list_of_children, ',');
-        $okay =
-            preg_match(
-                '/^,?' . $this->_pcre_regex . '$/',
-                $list_of_children
-            );
-        return (bool)$okay;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Empty.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Empty.php
deleted file mode 100644
index bbcde56e8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Empty.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Definition that disallows all elements.
- * @warning validateChildren() in this class is actually never called, because
- *          empty elements are corrected in HTMLPurifier_Strategy_MakeWellFormed
- *          before child definitions are parsed in earnest by
- *          HTMLPurifier_Strategy_FixNesting.
- */
-class HTMLPurifier_ChildDef_Empty extends HTMLPurifier_ChildDef
-{
-    /**
-     * @type bool
-     */
-    public $allow_empty = true;
-
-    /**
-     * @type string
-     */
-    public $type = 'empty';
-
-    public function __construct()
-    {
-    }
-
-    /**
-     * @param HTMLPurifier_Node[] $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        return array();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/List.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/List.php
deleted file mode 100644
index 0ea90ac4b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/List.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-
-/**
- * Definition for list containers ul and ol.
- *
- * What does this do?  The big thing is to handle ol/ul at the top
- * level of list nodes, which should be handled specially by /folding/
- * them into the previous list node.  We generally shouldn't ever
- * see other disallowed elements, because the autoclose behavior
- * in MakeWellFormed handles it.
- */
-class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
-{
-    /**
-     * @type string
-     */
-    public $type = 'list';
-    /**
-     * @type array
-     */
-    // lying a little bit, so that we can handle ul and ol ourselves
-    // XXX: This whole business with 'wrap' is all a bit unsatisfactory
-    public $elements = array('li' => true, 'ul' => true, 'ol' => true);
-
-    /**
-     * @param array $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        // Flag for subclasses
-        $this->whitespace = false;
-
-        // if there are no tokens, delete parent node
-        if (empty($children)) {
-            return false;
-        }
-
-        // if li is not allowed, delete parent node
-        if (!isset($config->getHTMLDefinition()->info['li'])) {
-            trigger_error("Cannot allow ul/ol without allowing li", E_USER_WARNING);
-            return false;
-        }
-
-        // the new set of children
-        $result = array();
-
-        // a little sanity check to make sure it's not ALL whitespace
-        $all_whitespace = true;
-
-        $current_li = null;
-
-        foreach ($children as $node) {
-            if (!empty($node->is_whitespace)) {
-                $result[] = $node;
-                continue;
-            }
-            $all_whitespace = false; // phew, we're not talking about whitespace
-
-            if ($node->name === 'li') {
-                // good
-                $current_li = $node;
-                $result[] = $node;
-            } else {
-                // we want to tuck this into the previous li
-                // Invariant: we expect the node to be ol/ul
-                // ToDo: Make this more robust in the case of not ol/ul
-                // by distinguishing between existing li and li created
-                // to handle non-list elements; non-list elements should
-                // not be appended to an existing li; only li created
-                // for non-list. This distinction is not currently made.
-                if ($current_li === null) {
-                    $current_li = new HTMLPurifier_Node_Element('li');
-                    $result[] = $current_li;
-                }
-                $current_li->children[] = $node;
-                $current_li->empty = false; // XXX fascinating! Check for this error elsewhere ToDo
-            }
-        }
-        if (empty($result)) {
-            return false;
-        }
-        if ($all_whitespace) {
-            return false;
-        }
-        return $result;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Optional.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Optional.php
deleted file mode 100644
index 1db864d90..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Optional.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Definition that allows a set of elements, and allows no children.
- * @note This is a hack to reuse code from HTMLPurifier_ChildDef_Required,
- *       really, one shouldn't inherit from the other.  Only altered behavior
- *       is to overload a returned false with an array.  Thus, it will never
- *       return false.
- */
-class HTMLPurifier_ChildDef_Optional extends HTMLPurifier_ChildDef_Required
-{
-    /**
-     * @type bool
-     */
-    public $allow_empty = true;
-
-    /**
-     * @type string
-     */
-    public $type = 'optional';
-
-    /**
-     * @param array $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        $result = parent::validateChildren($children, $config, $context);
-        // we assume that $children is not modified
-        if ($result === false) {
-            if (empty($children)) {
-                return true;
-            } elseif ($this->whitespace) {
-                return $children;
-            } else {
-                return array();
-            }
-        }
-        return $result;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Required.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Required.php
deleted file mode 100644
index f6b8e8a2f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Required.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-
-/**
- * Definition that allows a set of elements, but disallows empty children.
- */
-class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
-{
-    /**
-     * Lookup table of allowed elements.
-     * @type array
-     */
-    public $elements = array();
-
-    /**
-     * Whether or not the last passed node was all whitespace.
-     * @type bool
-     */
-    protected $whitespace = false;
-
-    /**
-     * @param array|string $elements List of allowed element names (lowercase).
-     */
-    public function __construct($elements)
-    {
-        if (is_string($elements)) {
-            $elements = str_replace(' ', '', $elements);
-            $elements = explode('|', $elements);
-        }
-        $keys = array_keys($elements);
-        if ($keys == array_keys($keys)) {
-            $elements = array_flip($elements);
-            foreach ($elements as $i => $x) {
-                $elements[$i] = true;
-                if (empty($i)) {
-                    unset($elements[$i]);
-                } // remove blank
-            }
-        }
-        $this->elements = $elements;
-    }
-
-    /**
-     * @type bool
-     */
-    public $allow_empty = false;
-
-    /**
-     * @type string
-     */
-    public $type = 'required';
-
-    /**
-     * @param array $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        // Flag for subclasses
-        $this->whitespace = false;
-
-        // if there are no tokens, delete parent node
-        if (empty($children)) {
-            return false;
-        }
-
-        // the new set of children
-        $result = array();
-
-        // whether or not parsed character data is allowed
-        // this controls whether or not we silently drop a tag
-        // or generate escaped HTML from it
-        $pcdata_allowed = isset($this->elements['#PCDATA']);
-
-        // a little sanity check to make sure it's not ALL whitespace
-        $all_whitespace = true;
-
-        $stack = array_reverse($children);
-        while (!empty($stack)) {
-            $node = array_pop($stack);
-            if (!empty($node->is_whitespace)) {
-                $result[] = $node;
-                continue;
-            }
-            $all_whitespace = false; // phew, we're not talking about whitespace
-
-            if (!isset($this->elements[$node->name])) {
-                // special case text
-                // XXX One of these ought to be redundant or something
-                if ($pcdata_allowed && $node instanceof HTMLPurifier_Node_Text) {
-                    $result[] = $node;
-                    continue;
-                }
-                // spill the child contents in
-                // ToDo: Make configurable
-                if ($node instanceof HTMLPurifier_Node_Element) {
-                    for ($i = count($node->children) - 1; $i >= 0; $i--) {
-                        $stack[] = $node->children[$i];
-                    }
-                    continue;
-                }
-                continue;
-            }
-            $result[] = $node;
-        }
-        if (empty($result)) {
-            return false;
-        }
-        if ($all_whitespace) {
-            $this->whitespace = true;
-            return false;
-        }
-        return $result;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/StrictBlockquote.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/StrictBlockquote.php
deleted file mode 100644
index 38bf9533e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/StrictBlockquote.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/**
- * Takes the contents of blockquote when in strict and reformats for validation.
- */
-class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Required
-{
-    /**
-     * @type array
-     */
-    protected $real_elements;
-
-    /**
-     * @type array
-     */
-    protected $fake_elements;
-
-    /**
-     * @type bool
-     */
-    public $allow_empty = true;
-
-    /**
-     * @type string
-     */
-    public $type = 'strictblockquote';
-
-    /**
-     * @type bool
-     */
-    protected $init = false;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return array
-     * @note We don't want MakeWellFormed to auto-close inline elements since
-     *       they might be allowed.
-     */
-    public function getAllowedElements($config)
-    {
-        $this->init($config);
-        return $this->fake_elements;
-    }
-
-    /**
-     * @param array $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        $this->init($config);
-
-        // trick the parent class into thinking it allows more
-        $this->elements = $this->fake_elements;
-        $result = parent::validateChildren($children, $config, $context);
-        $this->elements = $this->real_elements;
-
-        if ($result === false) {
-            return array();
-        }
-        if ($result === true) {
-            $result = $children;
-        }
-
-        $def = $config->getHTMLDefinition();
-        $block_wrap_name = $def->info_block_wrapper;
-        $block_wrap = false;
-        $ret = array();
-
-        foreach ($result as $node) {
-            if ($block_wrap === false) {
-                if (($node instanceof HTMLPurifier_Node_Text && !$node->is_whitespace) ||
-                    ($node instanceof HTMLPurifier_Node_Element && !isset($this->elements[$node->name]))) {
-                        $block_wrap = new HTMLPurifier_Node_Element($def->info_block_wrapper);
-                        $ret[] = $block_wrap;
-                }
-            } else {
-                if ($node instanceof HTMLPurifier_Node_Element && isset($this->elements[$node->name])) {
-                    $block_wrap = false;
-
-                }
-            }
-            if ($block_wrap) {
-                $block_wrap->children[] = $node;
-            } else {
-                $ret[] = $node;
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    private function init($config)
-    {
-        if (!$this->init) {
-            $def = $config->getHTMLDefinition();
-            // allow all inline elements
-            $this->real_elements = $this->elements;
-            $this->fake_elements = $def->info_content_sets['Flow'];
-            $this->fake_elements['#PCDATA'] = true;
-            $this->init = true;
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Table.php b/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Table.php
deleted file mode 100644
index 9b12c9280..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ChildDef/Table.php
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-
-/**
- * Definition for tables.  The general idea is to extract out all of the
- * essential bits, and then reconstruct it later.
- *
- * This is a bit confusing, because the DTDs and the W3C
- * validators seem to disagree on the appropriate definition. The
- * DTD claims:
- *
- *      (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)
- *
- * But actually, the HTML4 spec then has this to say:
- *
- *      The TBODY start tag is always required except when the table
- *      contains only one table body and no table head or foot sections.
- *      The TBODY end tag may always be safely omitted.
- *
- * So the DTD is kind of wrong.  The validator is, unfortunately, kind
- * of on crack.
- *
- * The definition changed again in XHTML1.1; and in my opinion, this
- * formulation makes the most sense.
- *
- *      caption?, ( col* | colgroup* ), (( thead?, tfoot?, tbody+ ) | ( tr+ ))
- *
- * Essentially, we have two modes: thead/tfoot/tbody mode, and tr mode.
- * If we encounter a thead, tfoot or tbody, we are placed in the former
- * mode, and we *must* wrap any stray tr segments with a tbody. But if
- * we don't run into any of them, just have tr tags is OK.
- */
-class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
-{
-    /**
-     * @type bool
-     */
-    public $allow_empty = false;
-
-    /**
-     * @type string
-     */
-    public $type = 'table';
-
-    /**
-     * @type array
-     */
-    public $elements = array(
-        'tr' => true,
-        'tbody' => true,
-        'thead' => true,
-        'tfoot' => true,
-        'caption' => true,
-        'colgroup' => true,
-        'col' => true
-    );
-
-    public function __construct()
-    {
-    }
-
-    /**
-     * @param array $children
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array
-     */
-    public function validateChildren($children, $config, $context)
-    {
-        if (empty($children)) {
-            return false;
-        }
-
-        // only one of these elements is allowed in a table
-        $caption = false;
-        $thead = false;
-        $tfoot = false;
-
-        // whitespace
-        $initial_ws = array();
-        $after_caption_ws = array();
-        $after_thead_ws = array();
-        $after_tfoot_ws = array();
-
-        // as many of these as you want
-        $cols = array();
-        $content = array();
-
-        $tbody_mode = false; // if true, then we need to wrap any stray
-                             // <tr>s with a <tbody>.
-
-        $ws_accum =& $initial_ws;
-
-        foreach ($children as $node) {
-            if ($node instanceof HTMLPurifier_Node_Comment) {
-                $ws_accum[] = $node;
-                continue;
-            }
-            switch ($node->name) {
-            case 'tbody':
-                $tbody_mode = true;
-                // fall through
-            case 'tr':
-                $content[] = $node;
-                $ws_accum =& $content;
-                break;
-            case 'caption':
-                // there can only be one caption!
-                if ($caption !== false)  break;
-                $caption = $node;
-                $ws_accum =& $after_caption_ws;
-                break;
-            case 'thead':
-                $tbody_mode = true;
-                // XXX This breaks rendering properties with
-                // Firefox, which never floats a <thead> to
-                // the top. Ever. (Our scheme will float the
-                // first <thead> to the top.)  So maybe
-                // <thead>s that are not first should be
-                // turned into <tbody>? Very tricky, indeed.
-                if ($thead === false) {
-                    $thead = $node;
-                    $ws_accum =& $after_thead_ws;
-                } else {
-                    // Oops, there's a second one! What
-                    // should we do?  Current behavior is to
-                    // transmutate the first and last entries into
-                    // tbody tags, and then put into content.
-                    // Maybe a better idea is to *attach
-                    // it* to the existing thead or tfoot?
-                    // We don't do this, because Firefox
-                    // doesn't float an extra tfoot to the
-                    // bottom like it does for the first one.
-                    $node->name = 'tbody';
-                    $content[] = $node;
-                    $ws_accum =& $content;
-                }
-                break;
-            case 'tfoot':
-                // see above for some aveats
-                $tbody_mode = true;
-                if ($tfoot === false) {
-                    $tfoot = $node;
-                    $ws_accum =& $after_tfoot_ws;
-                } else {
-                    $node->name = 'tbody';
-                    $content[] = $node;
-                    $ws_accum =& $content;
-                }
-                break;
-            case 'colgroup':
-            case 'col':
-                $cols[] = $node;
-                $ws_accum =& $cols;
-                break;
-            case '#PCDATA':
-                // How is whitespace handled? We treat is as sticky to
-                // the *end* of the previous element. So all of the
-                // nonsense we have worked on is to keep things
-                // together.
-                if (!empty($node->is_whitespace)) {
-                    $ws_accum[] = $node;
-                }
-                break;
-            }
-        }
-
-        if (empty($content)) {
-            return false;
-        }
-
-        $ret = $initial_ws;
-        if ($caption !== false) {
-            $ret[] = $caption;
-            $ret = array_merge($ret, $after_caption_ws);
-        }
-        if ($cols !== false) {
-            $ret = array_merge($ret, $cols);
-        }
-        if ($thead !== false) {
-            $ret[] = $thead;
-            $ret = array_merge($ret, $after_thead_ws);
-        }
-        if ($tfoot !== false) {
-            $ret[] = $tfoot;
-            $ret = array_merge($ret, $after_tfoot_ws);
-        }
-
-        if ($tbody_mode) {
-            // we have to shuffle tr into tbody
-            $current_tr_tbody = null;
-
-            foreach($content as $node) {
-                switch ($node->name) {
-                case 'tbody':
-                    $current_tr_tbody = null;
-                    $ret[] = $node;
-                    break;
-                case 'tr':
-                    if ($current_tr_tbody === null) {
-                        $current_tr_tbody = new HTMLPurifier_Node_Element('tbody');
-                        $ret[] = $current_tr_tbody;
-                    }
-                    $current_tr_tbody->children[] = $node;
-                    break;
-                case '#PCDATA':
-                    //assert($node->is_whitespace);
-                    if ($current_tr_tbody === null) {
-                        $ret[] = $node;
-                    } else {
-                        $current_tr_tbody->children[] = $node;
-                    }
-                    break;
-                }
-            }
-        } else {
-            $ret = array_merge($ret, $content);
-        }
-
-        return $ret;
-
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Config.php b/libraries/htmlpurifier410/library/HTMLPurifier/Config.php
deleted file mode 100644
index 0d89bc208..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Config.php
+++ /dev/null
@@ -1,920 +0,0 @@
-<?php
-
-/**
- * Configuration object that triggers customizable behavior.
- *
- * @warning This class is strongly defined: that means that the class
- *          will fail if an undefined directive is retrieved or set.
- *
- * @note Many classes that could (although many times don't) use the
- *       configuration object make it a mandatory parameter.  This is
- *       because a configuration object should always be forwarded,
- *       otherwise, you run the risk of missing a parameter and then
- *       being stumped when a configuration directive doesn't work.
- *
- * @todo Reconsider some of the public member variables
- */
-class HTMLPurifier_Config
-{
-
-    /**
-     * HTML Purifier's version
-     * @type string
-     */
-    public $version = '4.10.0';
-
-    /**
-     * Whether or not to automatically finalize
-     * the object if a read operation is done.
-     * @type bool
-     */
-    public $autoFinalize = true;
-
-    // protected member variables
-
-    /**
-     * Namespace indexed array of serials for specific namespaces.
-     * @see getSerial() for more info.
-     * @type string[]
-     */
-    protected $serials = array();
-
-    /**
-     * Serial for entire configuration object.
-     * @type string
-     */
-    protected $serial;
-
-    /**
-     * Parser for variables.
-     * @type HTMLPurifier_VarParser_Flexible
-     */
-    protected $parser = null;
-
-    /**
-     * Reference HTMLPurifier_ConfigSchema for value checking.
-     * @type HTMLPurifier_ConfigSchema
-     * @note This is public for introspective purposes. Please don't
-     *       abuse!
-     */
-    public $def;
-
-    /**
-     * Indexed array of definitions.
-     * @type HTMLPurifier_Definition[]
-     */
-    protected $definitions;
-
-    /**
-     * Whether or not config is finalized.
-     * @type bool
-     */
-    protected $finalized = false;
-
-    /**
-     * Property list containing configuration directives.
-     * @type array
-     */
-    protected $plist;
-
-    /**
-     * Whether or not a set is taking place due to an alias lookup.
-     * @type bool
-     */
-    private $aliasMode;
-
-    /**
-     * Set to false if you do not want line and file numbers in errors.
-     * (useful when unit testing).  This will also compress some errors
-     * and exceptions.
-     * @type bool
-     */
-    public $chatty = true;
-
-    /**
-     * Current lock; only gets to this namespace are allowed.
-     * @type string
-     */
-    private $lock;
-
-    /**
-     * Constructor
-     * @param HTMLPurifier_ConfigSchema $definition ConfigSchema that defines
-     * what directives are allowed.
-     * @param HTMLPurifier_PropertyList $parent
-     */
-    public function __construct($definition, $parent = null)
-    {
-        $parent = $parent ? $parent : $definition->defaultPlist;
-        $this->plist = new HTMLPurifier_PropertyList($parent);
-        $this->def = $definition; // keep a copy around for checking
-        $this->parser = new HTMLPurifier_VarParser_Flexible();
-    }
-
-    /**
-     * Convenience constructor that creates a config object based on a mixed var
-     * @param mixed $config Variable that defines the state of the config
-     *                      object. Can be: a HTMLPurifier_Config() object,
-     *                      an array of directives based on loadArray(),
-     *                      or a string filename of an ini file.
-     * @param HTMLPurifier_ConfigSchema $schema Schema object
-     * @return HTMLPurifier_Config Configured object
-     */
-    public static function create($config, $schema = null)
-    {
-        if ($config instanceof HTMLPurifier_Config) {
-            // pass-through
-            return $config;
-        }
-        if (!$schema) {
-            $ret = HTMLPurifier_Config::createDefault();
-        } else {
-            $ret = new HTMLPurifier_Config($schema);
-        }
-        if (is_string($config)) {
-            $ret->loadIni($config);
-        } elseif (is_array($config)) $ret->loadArray($config);
-        return $ret;
-    }
-
-    /**
-     * Creates a new config object that inherits from a previous one.
-     * @param HTMLPurifier_Config $config Configuration object to inherit from.
-     * @return HTMLPurifier_Config object with $config as its parent.
-     */
-    public static function inherit(HTMLPurifier_Config $config)
-    {
-        return new HTMLPurifier_Config($config->def, $config->plist);
-    }
-
-    /**
-     * Convenience constructor that creates a default configuration object.
-     * @return HTMLPurifier_Config default object.
-     */
-    public static function createDefault()
-    {
-        $definition = HTMLPurifier_ConfigSchema::instance();
-        $config = new HTMLPurifier_Config($definition);
-        return $config;
-    }
-
-    /**
-     * Retrieves a value from the configuration.
-     *
-     * @param string $key String key
-     * @param mixed $a
-     *
-     * @return mixed
-     */
-    public function get($key, $a = null)
-    {
-        if ($a !== null) {
-            $this->triggerError(
-                "Using deprecated API: use \$config->get('$key.$a') instead",
-                E_USER_WARNING
-            );
-            $key = "$key.$a";
-        }
-        if (!$this->finalized) {
-            $this->autoFinalize();
-        }
-        if (!isset($this->def->info[$key])) {
-            // can't add % due to SimpleTest bug
-            $this->triggerError(
-                'Cannot retrieve value of undefined directive ' . htmlspecialchars($key),
-                E_USER_WARNING
-            );
-            return;
-        }
-        if (isset($this->def->info[$key]->isAlias)) {
-            $d = $this->def->info[$key];
-            $this->triggerError(
-                'Cannot get value from aliased directive, use real name ' . $d->key,
-                E_USER_ERROR
-            );
-            return;
-        }
-        if ($this->lock) {
-            list($ns) = explode('.', $key);
-            if ($ns !== $this->lock) {
-                $this->triggerError(
-                    'Cannot get value of namespace ' . $ns . ' when lock for ' .
-                    $this->lock .
-                    ' is active, this probably indicates a Definition setup method ' .
-                    'is accessing directives that are not within its namespace',
-                    E_USER_ERROR
-                );
-                return;
-            }
-        }
-        return $this->plist->get($key);
-    }
-
-    /**
-     * Retrieves an array of directives to values from a given namespace
-     *
-     * @param string $namespace String namespace
-     *
-     * @return array
-     */
-    public function getBatch($namespace)
-    {
-        if (!$this->finalized) {
-            $this->autoFinalize();
-        }
-        $full = $this->getAll();
-        if (!isset($full[$namespace])) {
-            $this->triggerError(
-                'Cannot retrieve undefined namespace ' .
-                htmlspecialchars($namespace),
-                E_USER_WARNING
-            );
-            return;
-        }
-        return $full[$namespace];
-    }
-
-    /**
-     * Returns a SHA-1 signature of a segment of the configuration object
-     * that uniquely identifies that particular configuration
-     *
-     * @param string $namespace Namespace to get serial for
-     *
-     * @return string
-     * @note Revision is handled specially and is removed from the batch
-     *       before processing!
-     */
-    public function getBatchSerial($namespace)
-    {
-        if (empty($this->serials[$namespace])) {
-            $batch = $this->getBatch($namespace);
-            unset($batch['DefinitionRev']);
-            $this->serials[$namespace] = sha1(serialize($batch));
-        }
-        return $this->serials[$namespace];
-    }
-
-    /**
-     * Returns a SHA-1 signature for the entire configuration object
-     * that uniquely identifies that particular configuration
-     *
-     * @return string
-     */
-    public function getSerial()
-    {
-        if (empty($this->serial)) {
-            $this->serial = sha1(serialize($this->getAll()));
-        }
-        return $this->serial;
-    }
-
-    /**
-     * Retrieves all directives, organized by namespace
-     *
-     * @warning This is a pretty inefficient function, avoid if you can
-     */
-    public function getAll()
-    {
-        if (!$this->finalized) {
-            $this->autoFinalize();
-        }
-        $ret = array();
-        foreach ($this->plist->squash() as $name => $value) {
-            list($ns, $key) = explode('.', $name, 2);
-            $ret[$ns][$key] = $value;
-        }
-        return $ret;
-    }
-
-    /**
-     * Sets a value to configuration.
-     *
-     * @param string $key key
-     * @param mixed $value value
-     * @param mixed $a
-     */
-    public function set($key, $value, $a = null)
-    {
-        if (strpos($key, '.') === false) {
-            $namespace = $key;
-            $directive = $value;
-            $value = $a;
-            $key = "$key.$directive";
-            $this->triggerError("Using deprecated API: use \$config->set('$key', ...) instead", E_USER_NOTICE);
-        } else {
-            list($namespace) = explode('.', $key);
-        }
-        if ($this->isFinalized('Cannot set directive after finalization')) {
-            return;
-        }
-        if (!isset($this->def->info[$key])) {
-            $this->triggerError(
-                'Cannot set undefined directive ' . htmlspecialchars($key) . ' to value',
-                E_USER_WARNING
-            );
-            return;
-        }
-        $def = $this->def->info[$key];
-
-        if (isset($def->isAlias)) {
-            if ($this->aliasMode) {
-                $this->triggerError(
-                    'Double-aliases not allowed, please fix '.
-                    'ConfigSchema bug with' . $key,
-                    E_USER_ERROR
-                );
-                return;
-            }
-            $this->aliasMode = true;
-            $this->set($def->key, $value);
-            $this->aliasMode = false;
-            $this->triggerError("$key is an alias, preferred directive name is {$def->key}", E_USER_NOTICE);
-            return;
-        }
-
-        // Raw type might be negative when using the fully optimized form
-        // of stdClass, which indicates allow_null == true
-        $rtype = is_int($def) ? $def : $def->type;
-        if ($rtype < 0) {
-            $type = -$rtype;
-            $allow_null = true;
-        } else {
-            $type = $rtype;
-            $allow_null = isset($def->allow_null);
-        }
-
-        try {
-            $value = $this->parser->parse($value, $type, $allow_null);
-        } catch (HTMLPurifier_VarParserException $e) {
-            $this->triggerError(
-                'Value for ' . $key . ' is of invalid type, should be ' .
-                HTMLPurifier_VarParser::getTypeName($type),
-                E_USER_WARNING
-            );
-            return;
-        }
-        if (is_string($value) && is_object($def)) {
-            // resolve value alias if defined
-            if (isset($def->aliases[$value])) {
-                $value = $def->aliases[$value];
-            }
-            // check to see if the value is allowed
-            if (isset($def->allowed) && !isset($def->allowed[$value])) {
-                $this->triggerError(
-                    'Value not supported, valid values are: ' .
-                    $this->_listify($def->allowed),
-                    E_USER_WARNING
-                );
-                return;
-            }
-        }
-        $this->plist->set($key, $value);
-
-        // reset definitions if the directives they depend on changed
-        // this is a very costly process, so it's discouraged
-        // with finalization
-        if ($namespace == 'HTML' || $namespace == 'CSS' || $namespace == 'URI') {
-            $this->definitions[$namespace] = null;
-        }
-
-        $this->serials[$namespace] = false;
-    }
-
-    /**
-     * Convenience function for error reporting
-     *
-     * @param array $lookup
-     *
-     * @return string
-     */
-    private function _listify($lookup)
-    {
-        $list = array();
-        foreach ($lookup as $name => $b) {
-            $list[] = $name;
-        }
-        return implode(', ', $list);
-    }
-
-    /**
-     * Retrieves object reference to the HTML definition.
-     *
-     * @param bool $raw Return a copy that has not been setup yet. Must be
-     *             called before it's been setup, otherwise won't work.
-     * @param bool $optimized If true, this method may return null, to
-     *             indicate that a cached version of the modified
-     *             definition object is available and no further edits
-     *             are necessary.  Consider using
-     *             maybeGetRawHTMLDefinition, which is more explicitly
-     *             named, instead.
-     *
-     * @return HTMLPurifier_HTMLDefinition
-     */
-    public function getHTMLDefinition($raw = false, $optimized = false)
-    {
-        return $this->getDefinition('HTML', $raw, $optimized);
-    }
-
-    /**
-     * Retrieves object reference to the CSS definition
-     *
-     * @param bool $raw Return a copy that has not been setup yet. Must be
-     *             called before it's been setup, otherwise won't work.
-     * @param bool $optimized If true, this method may return null, to
-     *             indicate that a cached version of the modified
-     *             definition object is available and no further edits
-     *             are necessary.  Consider using
-     *             maybeGetRawCSSDefinition, which is more explicitly
-     *             named, instead.
-     *
-     * @return HTMLPurifier_CSSDefinition
-     */
-    public function getCSSDefinition($raw = false, $optimized = false)
-    {
-        return $this->getDefinition('CSS', $raw, $optimized);
-    }
-
-    /**
-     * Retrieves object reference to the URI definition
-     *
-     * @param bool $raw Return a copy that has not been setup yet. Must be
-     *             called before it's been setup, otherwise won't work.
-     * @param bool $optimized If true, this method may return null, to
-     *             indicate that a cached version of the modified
-     *             definition object is available and no further edits
-     *             are necessary.  Consider using
-     *             maybeGetRawURIDefinition, which is more explicitly
-     *             named, instead.
-     *
-     * @return HTMLPurifier_URIDefinition
-     */
-    public function getURIDefinition($raw = false, $optimized = false)
-    {
-        return $this->getDefinition('URI', $raw, $optimized);
-    }
-
-    /**
-     * Retrieves a definition
-     *
-     * @param string $type Type of definition: HTML, CSS, etc
-     * @param bool $raw Whether or not definition should be returned raw
-     * @param bool $optimized Only has an effect when $raw is true.  Whether
-     *        or not to return null if the result is already present in
-     *        the cache.  This is off by default for backwards
-     *        compatibility reasons, but you need to do things this
-     *        way in order to ensure that caching is done properly.
-     *        Check out enduser-customize.html for more details.
-     *        We probably won't ever change this default, as much as the
-     *        maybe semantics is the "right thing to do."
-     *
-     * @throws HTMLPurifier_Exception
-     * @return HTMLPurifier_Definition
-     */
-    public function getDefinition($type, $raw = false, $optimized = false)
-    {
-        if ($optimized && !$raw) {
-            throw new HTMLPurifier_Exception("Cannot set optimized = true when raw = false");
-        }
-        if (!$this->finalized) {
-            $this->autoFinalize();
-        }
-        // temporarily suspend locks, so we can handle recursive definition calls
-        $lock = $this->lock;
-        $this->lock = null;
-        $factory = HTMLPurifier_DefinitionCacheFactory::instance();
-        $cache = $factory->create($type, $this);
-        $this->lock = $lock;
-        if (!$raw) {
-            // full definition
-            // ---------------
-            // check if definition is in memory
-            if (!empty($this->definitions[$type])) {
-                $def = $this->definitions[$type];
-                // check if the definition is setup
-                if ($def->setup) {
-                    return $def;
-                } else {
-                    $def->setup($this);
-                    if ($def->optimized) {
-                        $cache->add($def, $this);
-                    }
-                    return $def;
-                }
-            }
-            // check if definition is in cache
-            $def = $cache->get($this);
-            if ($def) {
-                // definition in cache, save to memory and return it
-                $this->definitions[$type] = $def;
-                return $def;
-            }
-            // initialize it
-            $def = $this->initDefinition($type);
-            // set it up
-            $this->lock = $type;
-            $def->setup($this);
-            $this->lock = null;
-            // save in cache
-            $cache->add($def, $this);
-            // return it
-            return $def;
-        } else {
-            // raw definition
-            // --------------
-            // check preconditions
-            $def = null;
-            if ($optimized) {
-                if (is_null($this->get($type . '.DefinitionID'))) {
-                    // fatally error out if definition ID not set
-                    throw new HTMLPurifier_Exception(
-                        "Cannot retrieve raw version without specifying %$type.DefinitionID"
-                    );
-                }
-            }
-            if (!empty($this->definitions[$type])) {
-                $def = $this->definitions[$type];
-                if ($def->setup && !$optimized) {
-                    $extra = $this->chatty ?
-                        " (try moving this code block earlier in your initialization)" :
-                        "";
-                    throw new HTMLPurifier_Exception(
-                        "Cannot retrieve raw definition after it has already been setup" .
-                        $extra
-                    );
-                }
-                if ($def->optimized === null) {
-                    $extra = $this->chatty ? " (try flushing your cache)" : "";
-                    throw new HTMLPurifier_Exception(
-                        "Optimization status of definition is unknown" . $extra
-                    );
-                }
-                if ($def->optimized !== $optimized) {
-                    $msg = $optimized ? "optimized" : "unoptimized";
-                    $extra = $this->chatty ?
-                        " (this backtrace is for the first inconsistent call, which was for a $msg raw definition)"
-                        : "";
-                    throw new HTMLPurifier_Exception(
-                        "Inconsistent use of optimized and unoptimized raw definition retrievals" . $extra
-                    );
-                }
-            }
-            // check if definition was in memory
-            if ($def) {
-                if ($def->setup) {
-                    // invariant: $optimized === true (checked above)
-                    return null;
-                } else {
-                    return $def;
-                }
-            }
-            // if optimized, check if definition was in cache
-            // (because we do the memory check first, this formulation
-            // is prone to cache slamming, but I think
-            // guaranteeing that either /all/ of the raw
-            // setup code or /none/ of it is run is more important.)
-            if ($optimized) {
-                // This code path only gets run once; once we put
-                // something in $definitions (which is guaranteed by the
-                // trailing code), we always short-circuit above.
-                $def = $cache->get($this);
-                if ($def) {
-                    // save the full definition for later, but don't
-                    // return it yet
-                    $this->definitions[$type] = $def;
-                    return null;
-                }
-            }
-            // check invariants for creation
-            if (!$optimized) {
-                if (!is_null($this->get($type . '.DefinitionID'))) {
-                    if ($this->chatty) {
-                        $this->triggerError(
-                            'Due to a documentation error in previous version of HTML Purifier, your ' .
-                            'definitions are not being cached.  If this is OK, you can remove the ' .
-                            '%$type.DefinitionRev and %$type.DefinitionID declaration.  Otherwise, ' .
-                            'modify your code to use maybeGetRawDefinition, and test if the returned ' .
-                            'value is null before making any edits (if it is null, that means that a ' .
-                            'cached version is available, and no raw operations are necessary).  See ' .
-                            '<a href="http://htmlpurifier.org/docs/enduser-customize.html#optimized">' .
-                            'Customize</a> for more details',
-                            E_USER_WARNING
-                        );
-                    } else {
-                        $this->triggerError(
-                            "Useless DefinitionID declaration",
-                            E_USER_WARNING
-                        );
-                    }
-                }
-            }
-            // initialize it
-            $def = $this->initDefinition($type);
-            $def->optimized = $optimized;
-            return $def;
-        }
-        throw new HTMLPurifier_Exception("The impossible happened!");
-    }
-
-    /**
-     * Initialise definition
-     *
-     * @param string $type What type of definition to create
-     *
-     * @return HTMLPurifier_CSSDefinition|HTMLPurifier_HTMLDefinition|HTMLPurifier_URIDefinition
-     * @throws HTMLPurifier_Exception
-     */
-    private function initDefinition($type)
-    {
-        // quick checks failed, let's create the object
-        if ($type == 'HTML') {
-            $def = new HTMLPurifier_HTMLDefinition();
-        } elseif ($type == 'CSS') {
-            $def = new HTMLPurifier_CSSDefinition();
-        } elseif ($type == 'URI') {
-            $def = new HTMLPurifier_URIDefinition();
-        } else {
-            throw new HTMLPurifier_Exception(
-                "Definition of $type type not supported"
-            );
-        }
-        $this->definitions[$type] = $def;
-        return $def;
-    }
-
-    public function maybeGetRawDefinition($name)
-    {
-        return $this->getDefinition($name, true, true);
-    }
-
-    /**
-     * @return HTMLPurifier_HTMLDefinition
-     */
-    public function maybeGetRawHTMLDefinition()
-    {
-        return $this->getDefinition('HTML', true, true);
-    }
-    
-    /**
-     * @return HTMLPurifier_CSSDefinition
-     */
-    public function maybeGetRawCSSDefinition()
-    {
-        return $this->getDefinition('CSS', true, true);
-    }
-    
-    /**
-     * @return HTMLPurifier_URIDefinition
-     */
-    public function maybeGetRawURIDefinition()
-    {
-        return $this->getDefinition('URI', true, true);
-    }
-
-    /**
-     * Loads configuration values from an array with the following structure:
-     * Namespace.Directive => Value
-     *
-     * @param array $config_array Configuration associative array
-     */
-    public function loadArray($config_array)
-    {
-        if ($this->isFinalized('Cannot load directives after finalization')) {
-            return;
-        }
-        foreach ($config_array as $key => $value) {
-            $key = str_replace('_', '.', $key);
-            if (strpos($key, '.') !== false) {
-                $this->set($key, $value);
-            } else {
-                $namespace = $key;
-                $namespace_values = $value;
-                foreach ($namespace_values as $directive => $value2) {
-                    $this->set($namespace .'.'. $directive, $value2);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns a list of array(namespace, directive) for all directives
-     * that are allowed in a web-form context as per an allowed
-     * namespaces/directives list.
-     *
-     * @param array $allowed List of allowed namespaces/directives
-     * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
-     *
-     * @return array
-     */
-    public static function getAllowedDirectivesForForm($allowed, $schema = null)
-    {
-        if (!$schema) {
-            $schema = HTMLPurifier_ConfigSchema::instance();
-        }
-        if ($allowed !== true) {
-            if (is_string($allowed)) {
-                $allowed = array($allowed);
-            }
-            $allowed_ns = array();
-            $allowed_directives = array();
-            $blacklisted_directives = array();
-            foreach ($allowed as $ns_or_directive) {
-                if (strpos($ns_or_directive, '.') !== false) {
-                    // directive
-                    if ($ns_or_directive[0] == '-') {
-                        $blacklisted_directives[substr($ns_or_directive, 1)] = true;
-                    } else {
-                        $allowed_directives[$ns_or_directive] = true;
-                    }
-                } else {
-                    // namespace
-                    $allowed_ns[$ns_or_directive] = true;
-                }
-            }
-        }
-        $ret = array();
-        foreach ($schema->info as $key => $def) {
-            list($ns, $directive) = explode('.', $key, 2);
-            if ($allowed !== true) {
-                if (isset($blacklisted_directives["$ns.$directive"])) {
-                    continue;
-                }
-                if (!isset($allowed_directives["$ns.$directive"]) && !isset($allowed_ns[$ns])) {
-                    continue;
-                }
-            }
-            if (isset($def->isAlias)) {
-                continue;
-            }
-            if ($directive == 'DefinitionID' || $directive == 'DefinitionRev') {
-                continue;
-            }
-            $ret[] = array($ns, $directive);
-        }
-        return $ret;
-    }
-
-    /**
-     * Loads configuration values from $_GET/$_POST that were posted
-     * via ConfigForm
-     *
-     * @param array $array $_GET or $_POST array to import
-     * @param string|bool $index Index/name that the config variables are in
-     * @param array|bool $allowed List of allowed namespaces/directives
-     * @param bool $mq_fix Boolean whether or not to enable magic quotes fix
-     * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
-     *
-     * @return mixed
-     */
-    public static function loadArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)
-    {
-        $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $schema);
-        $config = HTMLPurifier_Config::create($ret, $schema);
-        return $config;
-    }
-
-    /**
-     * Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
-     *
-     * @param array $array $_GET or $_POST array to import
-     * @param string|bool $index Index/name that the config variables are in
-     * @param array|bool $allowed List of allowed namespaces/directives
-     * @param bool $mq_fix Boolean whether or not to enable magic quotes fix
-     */
-    public function mergeArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true)
-    {
-         $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def);
-         $this->loadArray($ret);
-    }
-
-    /**
-     * Prepares an array from a form into something usable for the more
-     * strict parts of HTMLPurifier_Config
-     *
-     * @param array $array $_GET or $_POST array to import
-     * @param string|bool $index Index/name that the config variables are in
-     * @param array|bool $allowed List of allowed namespaces/directives
-     * @param bool $mq_fix Boolean whether or not to enable magic quotes fix
-     * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
-     *
-     * @return array
-     */
-    public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)
-    {
-        if ($index !== false) {
-            $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
-        }
-        $mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
-
-        $allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
-        $ret = array();
-        foreach ($allowed as $key) {
-            list($ns, $directive) = $key;
-            $skey = "$ns.$directive";
-            if (!empty($array["Null_$skey"])) {
-                $ret[$ns][$directive] = null;
-                continue;
-            }
-            if (!isset($array[$skey])) {
-                continue;
-            }
-            $value = $mq ? stripslashes($array[$skey]) : $array[$skey];
-            $ret[$ns][$directive] = $value;
-        }
-        return $ret;
-    }
-
-    /**
-     * Loads configuration values from an ini file
-     *
-     * @param string $filename Name of ini file
-     */
-    public function loadIni($filename)
-    {
-        if ($this->isFinalized('Cannot load directives after finalization')) {
-            return;
-        }
-        $array = parse_ini_file($filename, true);
-        $this->loadArray($array);
-    }
-
-    /**
-     * Checks whether or not the configuration object is finalized.
-     *
-     * @param string|bool $error String error message, or false for no error
-     *
-     * @return bool
-     */
-    public function isFinalized($error = false)
-    {
-        if ($this->finalized && $error) {
-            $this->triggerError($error, E_USER_ERROR);
-        }
-        return $this->finalized;
-    }
-
-    /**
-     * Finalizes configuration only if auto finalize is on and not
-     * already finalized
-     */
-    public function autoFinalize()
-    {
-        if ($this->autoFinalize) {
-            $this->finalize();
-        } else {
-            $this->plist->squash(true);
-        }
-    }
-
-    /**
-     * Finalizes a configuration object, prohibiting further change
-     */
-    public function finalize()
-    {
-        $this->finalized = true;
-        $this->parser = null;
-    }
-
-    /**
-     * Produces a nicely formatted error message by supplying the
-     * stack frame information OUTSIDE of HTMLPurifier_Config.
-     *
-     * @param string $msg An error message
-     * @param int $no An error number
-     */
-    protected function triggerError($msg, $no)
-    {
-        // determine previous stack frame
-        $extra = '';
-        if ($this->chatty) {
-            $trace = debug_backtrace();
-            // zip(tail(trace), trace) -- but PHP is not Haskell har har
-            for ($i = 0, $c = count($trace); $i < $c - 1; $i++) {
-                // XXX this is not correct on some versions of HTML Purifier
-                if ($trace[$i + 1]['class'] === 'HTMLPurifier_Config') {
-                    continue;
-                }
-                $frame = $trace[$i];
-                $extra = " invoked on line {$frame['line']} in file {$frame['file']}";
-                break;
-            }
-        }
-        trigger_error($msg . $extra, $no);
-    }
-
-    /**
-     * Returns a serialized form of the configuration object that can
-     * be reconstituted.
-     *
-     * @return string
-     */
-    public function serialize()
-    {
-        $this->getDefinition('HTML');
-        $this->getDefinition('CSS');
-        $this->getDefinition('URI');
-        return serialize($this);
-    }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema.php
deleted file mode 100644
index cc8f47166..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-/**
- * Configuration definition, defines directives and their defaults.
- */
-class HTMLPurifier_ConfigSchema
-{
-    /**
-     * Defaults of the directives and namespaces.
-     * @type array
-     * @note This shares the exact same structure as HTMLPurifier_Config::$conf
-     */
-    public $defaults = array();
-
-    /**
-     * The default property list. Do not edit this property list.
-     * @type array
-     */
-    public $defaultPlist;
-
-    /**
-     * Definition of the directives.
-     * The structure of this is:
-     *
-     *  array(
-     *      'Namespace' => array(
-     *          'Directive' => new stdClass(),
-     *      )
-     *  )
-     *
-     * The stdClass may have the following properties:
-     *
-     *  - If isAlias isn't set:
-     *      - type: Integer type of directive, see HTMLPurifier_VarParser for definitions
-     *      - allow_null: If set, this directive allows null values
-     *      - aliases: If set, an associative array of value aliases to real values
-     *      - allowed: If set, a lookup array of allowed (string) values
-     *  - If isAlias is set:
-     *      - namespace: Namespace this directive aliases to
-     *      - name: Directive name this directive aliases to
-     *
-     * In certain degenerate cases, stdClass will actually be an integer. In
-     * that case, the value is equivalent to an stdClass with the type
-     * property set to the integer. If the integer is negative, type is
-     * equal to the absolute value of integer, and allow_null is true.
-     *
-     * This class is friendly with HTMLPurifier_Config. If you need introspection
-     * about the schema, you're better of using the ConfigSchema_Interchange,
-     * which uses more memory but has much richer information.
-     * @type array
-     */
-    public $info = array();
-
-    /**
-     * Application-wide singleton
-     * @type HTMLPurifier_ConfigSchema
-     */
-    protected static $singleton;
-
-    public function __construct()
-    {
-        $this->defaultPlist = new HTMLPurifier_PropertyList();
-    }
-
-    /**
-     * Unserializes the default ConfigSchema.
-     * @return HTMLPurifier_ConfigSchema
-     */
-    public static function makeFromSerial()
-    {
-        $contents = file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser');
-        $r = unserialize($contents);
-        if (!$r) {
-            $hash = sha1($contents);
-            trigger_error("Unserialization of configuration schema failed, sha1 of file was $hash", E_USER_ERROR);
-        }
-        return $r;
-    }
-
-    /**
-     * Retrieves an instance of the application-wide configuration definition.
-     * @param HTMLPurifier_ConfigSchema $prototype
-     * @return HTMLPurifier_ConfigSchema
-     */
-    public static function instance($prototype = null)
-    {
-        if ($prototype !== null) {
-            HTMLPurifier_ConfigSchema::$singleton = $prototype;
-        } elseif (HTMLPurifier_ConfigSchema::$singleton === null || $prototype === true) {
-            HTMLPurifier_ConfigSchema::$singleton = HTMLPurifier_ConfigSchema::makeFromSerial();
-        }
-        return HTMLPurifier_ConfigSchema::$singleton;
-    }
-
-    /**
-     * Defines a directive for configuration
-     * @warning Will fail of directive's namespace is defined.
-     * @warning This method's signature is slightly different from the legacy
-     *          define() static method! Beware!
-     * @param string $key Name of directive
-     * @param mixed $default Default value of directive
-     * @param string $type Allowed type of the directive. See
-     *      HTMLPurifier_DirectiveDef::$type for allowed values
-     * @param bool $allow_null Whether or not to allow null values
-     */
-    public function add($key, $default, $type, $allow_null)
-    {
-        $obj = new stdClass();
-        $obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type];
-        if ($allow_null) {
-            $obj->allow_null = true;
-        }
-        $this->info[$key] = $obj;
-        $this->defaults[$key] = $default;
-        $this->defaultPlist->set($key, $default);
-    }
-
-    /**
-     * Defines a directive value alias.
-     *
-     * Directive value aliases are convenient for developers because it lets
-     * them set a directive to several values and get the same result.
-     * @param string $key Name of Directive
-     * @param array $aliases Hash of aliased values to the real alias
-     */
-    public function addValueAliases($key, $aliases)
-    {
-        if (!isset($this->info[$key]->aliases)) {
-            $this->info[$key]->aliases = array();
-        }
-        foreach ($aliases as $alias => $real) {
-            $this->info[$key]->aliases[$alias] = $real;
-        }
-    }
-
-    /**
-     * Defines a set of allowed values for a directive.
-     * @warning This is slightly different from the corresponding static
-     *          method definition.
-     * @param string $key Name of directive
-     * @param array $allowed Lookup array of allowed values
-     */
-    public function addAllowedValues($key, $allowed)
-    {
-        $this->info[$key]->allowed = $allowed;
-    }
-
-    /**
-     * Defines a directive alias for backwards compatibility
-     * @param string $key Directive that will be aliased
-     * @param string $new_key Directive that the alias will be to
-     */
-    public function addAlias($key, $new_key)
-    {
-        $obj = new stdClass;
-        $obj->key = $new_key;
-        $obj->isAlias = true;
-        $this->info[$key] = $obj;
-    }
-
-    /**
-     * Replaces any stdClass that only has the type property with type integer.
-     */
-    public function postProcess()
-    {
-        foreach ($this->info as $key => $v) {
-            if (count((array) $v) == 1) {
-                $this->info[$key] = $v->type;
-            } elseif (count((array) $v) == 2 && isset($v->allow_null)) {
-                $this->info[$key] = -$v->type;
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php
deleted file mode 100644
index 1174575ea..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
- * representation used to perform checks on user configuration.
- */
-class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
-{
-
-    /**
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange
-     * @return HTMLPurifier_ConfigSchema
-     */
-    public function build($interchange)
-    {
-        $schema = new HTMLPurifier_ConfigSchema();
-        foreach ($interchange->directives as $d) {
-            $schema->add(
-                $d->id->key,
-                $d->default,
-                $d->type,
-                $d->typeAllowsNull
-            );
-            if ($d->allowed !== null) {
-                $schema->addAllowedValues(
-                    $d->id->key,
-                    $d->allowed
-                );
-            }
-            foreach ($d->aliases as $alias) {
-                $schema->addAlias(
-                    $alias->key,
-                    $d->id->key
-                );
-            }
-            if ($d->valueAliases !== null) {
-                $schema->addValueAliases(
-                    $d->id->key,
-                    $d->valueAliases
-                );
-            }
-        }
-        $schema->postProcess();
-        return $schema;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/Xml.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/Xml.php
deleted file mode 100644
index 0d00bf1d1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Builder/Xml.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-
-/**
- * Converts HTMLPurifier_ConfigSchema_Interchange to an XML format,
- * which can be further processed to generate documentation.
- */
-class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
-{
-
-    /**
-     * @type HTMLPurifier_ConfigSchema_Interchange
-     */
-    protected $interchange;
-
-    /**
-     * @type string
-     */
-    private $namespace;
-
-    /**
-     * @param string $html
-     */
-    protected function writeHTMLDiv($html)
-    {
-        $this->startElement('div');
-
-        $purifier = HTMLPurifier::getInstance();
-        $html = $purifier->purify($html);
-        $this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
-        $this->writeRaw($html);
-
-        $this->endElement(); // div
-    }
-
-    /**
-     * @param mixed $var
-     * @return string
-     */
-    protected function export($var)
-    {
-        if ($var === array()) {
-            return 'array()';
-        }
-        return var_export($var, true);
-    }
-
-    /**
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange
-     */
-    public function build($interchange)
-    {
-        // global access, only use as last resort
-        $this->interchange = $interchange;
-
-        $this->setIndent(true);
-        $this->startDocument('1.0', 'UTF-8');
-        $this->startElement('configdoc');
-        $this->writeElement('title', $interchange->name);
-
-        foreach ($interchange->directives as $directive) {
-            $this->buildDirective($directive);
-        }
-
-        if ($this->namespace) {
-            $this->endElement();
-        } // namespace
-
-        $this->endElement(); // configdoc
-        $this->flush();
-    }
-
-    /**
-     * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
-     */
-    public function buildDirective($directive)
-    {
-        // Kludge, although I suppose having a notion of a "root namespace"
-        // certainly makes things look nicer when documentation is built.
-        // Depends on things being sorted.
-        if (!$this->namespace || $this->namespace !== $directive->id->getRootNamespace()) {
-            if ($this->namespace) {
-                $this->endElement();
-            } // namespace
-            $this->namespace = $directive->id->getRootNamespace();
-            $this->startElement('namespace');
-            $this->writeAttribute('id', $this->namespace);
-            $this->writeElement('name', $this->namespace);
-        }
-
-        $this->startElement('directive');
-        $this->writeAttribute('id', $directive->id->toString());
-
-        $this->writeElement('name', $directive->id->getDirective());
-
-        $this->startElement('aliases');
-        foreach ($directive->aliases as $alias) {
-            $this->writeElement('alias', $alias->toString());
-        }
-        $this->endElement(); // aliases
-
-        $this->startElement('constraints');
-        if ($directive->version) {
-            $this->writeElement('version', $directive->version);
-        }
-        $this->startElement('type');
-        if ($directive->typeAllowsNull) {
-            $this->writeAttribute('allow-null', 'yes');
-        }
-        $this->text($directive->type);
-        $this->endElement(); // type
-        if ($directive->allowed) {
-            $this->startElement('allowed');
-            foreach ($directive->allowed as $value => $x) {
-                $this->writeElement('value', $value);
-            }
-            $this->endElement(); // allowed
-        }
-        $this->writeElement('default', $this->export($directive->default));
-        $this->writeAttribute('xml:space', 'preserve');
-        if ($directive->external) {
-            $this->startElement('external');
-            foreach ($directive->external as $project) {
-                $this->writeElement('project', $project);
-            }
-            $this->endElement();
-        }
-        $this->endElement(); // constraints
-
-        if ($directive->deprecatedVersion) {
-            $this->startElement('deprecated');
-            $this->writeElement('version', $directive->deprecatedVersion);
-            $this->writeElement('use', $directive->deprecatedUse->toString());
-            $this->endElement(); // deprecated
-        }
-
-        $this->startElement('description');
-        $this->writeHTMLDiv($directive->description);
-        $this->endElement(); // description
-
-        $this->endElement(); // directive
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Exception.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Exception.php
deleted file mode 100644
index 1abdcfc06..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Exception.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-/**
- * Exceptions related to configuration schema
- */
-class HTMLPurifier_ConfigSchema_Exception extends HTMLPurifier_Exception
-{
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange.php
deleted file mode 100644
index c094fa0b8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Generic schema interchange format that can be converted to a runtime
- * representation (HTMLPurifier_ConfigSchema) or HTML documentation. Members
- * are completely validated.
- */
-class HTMLPurifier_ConfigSchema_Interchange
-{
-
-    /**
-     * Name of the application this schema is describing.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * Array of Directive ID => array(directive info)
-     * @type HTMLPurifier_ConfigSchema_Interchange_Directive[]
-     */
-    public $directives = array();
-
-    /**
-     * Adds a directive array to $directives
-     * @param HTMLPurifier_ConfigSchema_Interchange_Directive $directive
-     * @throws HTMLPurifier_ConfigSchema_Exception
-     */
-    public function addDirective($directive)
-    {
-        if (isset($this->directives[$i = $directive->id->toString()])) {
-            throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
-        }
-        $this->directives[$i] = $directive;
-    }
-
-    /**
-     * Convenience function to perform standard validation. Throws exception
-     * on failed validation.
-     */
-    public function validate()
-    {
-        $validator = new HTMLPurifier_ConfigSchema_Validator();
-        return $validator->validate($this);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Directive.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Directive.php
deleted file mode 100644
index 4c39c5c68..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Directive.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/**
- * Interchange component class describing configuration directives.
- */
-class HTMLPurifier_ConfigSchema_Interchange_Directive
-{
-
-    /**
-     * ID of directive.
-     * @type HTMLPurifier_ConfigSchema_Interchange_Id
-     */
-    public $id;
-
-    /**
-     * Type, e.g. 'integer' or 'istring'.
-     * @type string
-     */
-    public $type;
-
-    /**
-     * Default value, e.g. 3 or 'DefaultVal'.
-     * @type mixed
-     */
-    public $default;
-
-    /**
-     * HTML description.
-     * @type string
-     */
-    public $description;
-
-    /**
-     * Whether or not null is allowed as a value.
-     * @type bool
-     */
-    public $typeAllowsNull = false;
-
-    /**
-     * Lookup table of allowed scalar values.
-     * e.g. array('allowed' => true).
-     * Null if all values are allowed.
-     * @type array
-     */
-    public $allowed;
-
-    /**
-     * List of aliases for the directive.
-     * e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))).
-     * @type HTMLPurifier_ConfigSchema_Interchange_Id[]
-     */
-    public $aliases = array();
-
-    /**
-     * Hash of value aliases, e.g. array('alt' => 'real'). Null if value
-     * aliasing is disabled (necessary for non-scalar types).
-     * @type array
-     */
-    public $valueAliases;
-
-    /**
-     * Version of HTML Purifier the directive was introduced, e.g. '1.3.1'.
-     * Null if the directive has always existed.
-     * @type string
-     */
-    public $version;
-
-    /**
-     * ID of directive that supercedes this old directive.
-     * Null if not deprecated.
-     * @type HTMLPurifier_ConfigSchema_Interchange_Id
-     */
-    public $deprecatedUse;
-
-    /**
-     * Version of HTML Purifier this directive was deprecated. Null if not
-     * deprecated.
-     * @type string
-     */
-    public $deprecatedVersion;
-
-    /**
-     * List of external projects this directive depends on, e.g. array('CSSTidy').
-     * @type array
-     */
-    public $external = array();
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Id.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Id.php
deleted file mode 100644
index 3ee817114..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Interchange/Id.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Represents a directive ID in the interchange format.
- */
-class HTMLPurifier_ConfigSchema_Interchange_Id
-{
-
-    /**
-     * @type string
-     */
-    public $key;
-
-    /**
-     * @param string $key
-     */
-    public function __construct($key)
-    {
-        $this->key = $key;
-    }
-
-    /**
-     * @return string
-     * @warning This is NOT magic, to ensure that people don't abuse SPL and
-     *          cause problems for PHP 5.0 support.
-     */
-    public function toString()
-    {
-        return $this->key;
-    }
-
-    /**
-     * @return string
-     */
-    public function getRootNamespace()
-    {
-        return substr($this->key, 0, strpos($this->key, "."));
-    }
-
-    /**
-     * @return string
-     */
-    public function getDirective()
-    {
-        return substr($this->key, strpos($this->key, ".") + 1);
-    }
-
-    /**
-     * @param string $id
-     * @return HTMLPurifier_ConfigSchema_Interchange_Id
-     */
-    public static function make($id)
-    {
-        return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
deleted file mode 100644
index fe9b3268f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
+++ /dev/null
@@ -1,226 +0,0 @@
-<?php
-
-class HTMLPurifier_ConfigSchema_InterchangeBuilder
-{
-
-    /**
-     * Used for processing DEFAULT, nothing else.
-     * @type HTMLPurifier_VarParser
-     */
-    protected $varParser;
-
-    /**
-     * @param HTMLPurifier_VarParser $varParser
-     */
-    public function __construct($varParser = null)
-    {
-        $this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native();
-    }
-
-    /**
-     * @param string $dir
-     * @return HTMLPurifier_ConfigSchema_Interchange
-     */
-    public static function buildFromDirectory($dir = null)
-    {
-        $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
-        $interchange = new HTMLPurifier_ConfigSchema_Interchange();
-        return $builder->buildDir($interchange, $dir);
-    }
-
-    /**
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange
-     * @param string $dir
-     * @return HTMLPurifier_ConfigSchema_Interchange
-     */
-    public function buildDir($interchange, $dir = null)
-    {
-        if (!$dir) {
-            $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema';
-        }
-        if (file_exists($dir . '/info.ini')) {
-            $info = parse_ini_file($dir . '/info.ini');
-            $interchange->name = $info['name'];
-        }
-
-        $files = array();
-        $dh = opendir($dir);
-        while (false !== ($file = readdir($dh))) {
-            if (!$file || $file[0] == '.' || strrchr($file, '.') !== '.txt') {
-                continue;
-            }
-            $files[] = $file;
-        }
-        closedir($dh);
-
-        sort($files);
-        foreach ($files as $file) {
-            $this->buildFile($interchange, $dir . '/' . $file);
-        }
-        return $interchange;
-    }
-
-    /**
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange
-     * @param string $file
-     */
-    public function buildFile($interchange, $file)
-    {
-        $parser = new HTMLPurifier_StringHashParser();
-        $this->build(
-            $interchange,
-            new HTMLPurifier_StringHash($parser->parseFile($file))
-        );
-    }
-
-    /**
-     * Builds an interchange object based on a hash.
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange HTMLPurifier_ConfigSchema_Interchange object to build
-     * @param HTMLPurifier_StringHash $hash source data
-     * @throws HTMLPurifier_ConfigSchema_Exception
-     */
-    public function build($interchange, $hash)
-    {
-        if (!$hash instanceof HTMLPurifier_StringHash) {
-            $hash = new HTMLPurifier_StringHash($hash);
-        }
-        if (!isset($hash['ID'])) {
-            throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID');
-        }
-        if (strpos($hash['ID'], '.') === false) {
-            if (count($hash) == 2 && isset($hash['DESCRIPTION'])) {
-                $hash->offsetGet('DESCRIPTION'); // prevent complaining
-            } else {
-                throw new HTMLPurifier_ConfigSchema_Exception('All directives must have a namespace');
-            }
-        } else {
-            $this->buildDirective($interchange, $hash);
-        }
-        $this->_findUnused($hash);
-    }
-
-    /**
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange
-     * @param HTMLPurifier_StringHash $hash
-     * @throws HTMLPurifier_ConfigSchema_Exception
-     */
-    public function buildDirective($interchange, $hash)
-    {
-        $directive = new HTMLPurifier_ConfigSchema_Interchange_Directive();
-
-        // These are required elements:
-        $directive->id = $this->id($hash->offsetGet('ID'));
-        $id = $directive->id->toString(); // convenience
-
-        if (isset($hash['TYPE'])) {
-            $type = explode('/', $hash->offsetGet('TYPE'));
-            if (isset($type[1])) {
-                $directive->typeAllowsNull = true;
-            }
-            $directive->type = $type[0];
-        } else {
-            throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
-        }
-
-        if (isset($hash['DEFAULT'])) {
-            try {
-                $directive->default = $this->varParser->parse(
-                    $hash->offsetGet('DEFAULT'),
-                    $directive->type,
-                    $directive->typeAllowsNull
-                );
-            } catch (HTMLPurifier_VarParserException $e) {
-                throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'");
-            }
-        }
-
-        if (isset($hash['DESCRIPTION'])) {
-            $directive->description = $hash->offsetGet('DESCRIPTION');
-        }
-
-        if (isset($hash['ALLOWED'])) {
-            $directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED')));
-        }
-
-        if (isset($hash['VALUE-ALIASES'])) {
-            $directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
-        }
-
-        if (isset($hash['ALIASES'])) {
-            $raw_aliases = trim($hash->offsetGet('ALIASES'));
-            $aliases = preg_split('/\s*,\s*/', $raw_aliases);
-            foreach ($aliases as $alias) {
-                $directive->aliases[] = $this->id($alias);
-            }
-        }
-
-        if (isset($hash['VERSION'])) {
-            $directive->version = $hash->offsetGet('VERSION');
-        }
-
-        if (isset($hash['DEPRECATED-USE'])) {
-            $directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE'));
-        }
-
-        if (isset($hash['DEPRECATED-VERSION'])) {
-            $directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION');
-        }
-
-        if (isset($hash['EXTERNAL'])) {
-            $directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL')));
-        }
-
-        $interchange->addDirective($directive);
-    }
-
-    /**
-     * Evaluates an array PHP code string without array() wrapper
-     * @param string $contents
-     */
-    protected function evalArray($contents)
-    {
-        return eval('return array(' . $contents . ');');
-    }
-
-    /**
-     * Converts an array list into a lookup array.
-     * @param array $array
-     * @return array
-     */
-    protected function lookup($array)
-    {
-        $ret = array();
-        foreach ($array as $val) {
-            $ret[$val] = true;
-        }
-        return $ret;
-    }
-
-    /**
-     * Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id
-     * object based on a string Id.
-     * @param string $id
-     * @return HTMLPurifier_ConfigSchema_Interchange_Id
-     */
-    protected function id($id)
-    {
-        return HTMLPurifier_ConfigSchema_Interchange_Id::make($id);
-    }
-
-    /**
-     * Triggers errors for any unused keys passed in the hash; such keys
-     * may indicate typos, missing values, etc.
-     * @param HTMLPurifier_StringHash $hash Hash to check.
-     */
-    protected function _findUnused($hash)
-    {
-        $accessed = $hash->getAccessed();
-        foreach ($hash as $k => $v) {
-            if (!isset($accessed[$k])) {
-                trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE);
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Validator.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Validator.php
deleted file mode 100644
index 9f14444f3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/Validator.php
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-
-/**
- * Performs validations on HTMLPurifier_ConfigSchema_Interchange
- *
- * @note If you see '// handled by InterchangeBuilder', that means a
- *       design decision in that class would prevent this validation from
- *       ever being necessary. We have them anyway, however, for
- *       redundancy.
- */
-class HTMLPurifier_ConfigSchema_Validator
-{
-
-    /**
-     * @type HTMLPurifier_ConfigSchema_Interchange
-     */
-    protected $interchange;
-
-    /**
-     * @type array
-     */
-    protected $aliases;
-
-    /**
-     * Context-stack to provide easy to read error messages.
-     * @type array
-     */
-    protected $context = array();
-
-    /**
-     * to test default's type.
-     * @type HTMLPurifier_VarParser
-     */
-    protected $parser;
-
-    public function __construct()
-    {
-        $this->parser = new HTMLPurifier_VarParser();
-    }
-
-    /**
-     * Validates a fully-formed interchange object.
-     * @param HTMLPurifier_ConfigSchema_Interchange $interchange
-     * @return bool
-     */
-    public function validate($interchange)
-    {
-        $this->interchange = $interchange;
-        $this->aliases = array();
-        // PHP is a bit lax with integer <=> string conversions in
-        // arrays, so we don't use the identical !== comparison
-        foreach ($interchange->directives as $i => $directive) {
-            $id = $directive->id->toString();
-            if ($i != $id) {
-                $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
-            }
-            $this->validateDirective($directive);
-        }
-        return true;
-    }
-
-    /**
-     * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
-     * @param HTMLPurifier_ConfigSchema_Interchange_Id $id
-     */
-    public function validateId($id)
-    {
-        $id_string = $id->toString();
-        $this->context[] = "id '$id_string'";
-        if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
-            // handled by InterchangeBuilder
-            $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
-        }
-        // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
-        // we probably should check that it has at least one namespace
-        $this->with($id, 'key')
-            ->assertNotEmpty()
-            ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder
-        array_pop($this->context);
-    }
-
-    /**
-     * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
-     * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
-     */
-    public function validateDirective($d)
-    {
-        $id = $d->id->toString();
-        $this->context[] = "directive '$id'";
-        $this->validateId($d->id);
-
-        $this->with($d, 'description')
-            ->assertNotEmpty();
-
-        // BEGIN - handled by InterchangeBuilder
-        $this->with($d, 'type')
-            ->assertNotEmpty();
-        $this->with($d, 'typeAllowsNull')
-            ->assertIsBool();
-        try {
-            // This also tests validity of $d->type
-            $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
-        } catch (HTMLPurifier_VarParserException $e) {
-            $this->error('default', 'had error: ' . $e->getMessage());
-        }
-        // END - handled by InterchangeBuilder
-
-        if (!is_null($d->allowed) || !empty($d->valueAliases)) {
-            // allowed and valueAliases require that we be dealing with
-            // strings, so check for that early.
-            $d_int = HTMLPurifier_VarParser::$types[$d->type];
-            if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {
-                $this->error('type', 'must be a string type when used with allowed or value aliases');
-            }
-        }
-
-        $this->validateDirectiveAllowed($d);
-        $this->validateDirectiveValueAliases($d);
-        $this->validateDirectiveAliases($d);
-
-        array_pop($this->context);
-    }
-
-    /**
-     * Extra validation if $allowed member variable of
-     * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
-     * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
-     */
-    public function validateDirectiveAllowed($d)
-    {
-        if (is_null($d->allowed)) {
-            return;
-        }
-        $this->with($d, 'allowed')
-            ->assertNotEmpty()
-            ->assertIsLookup(); // handled by InterchangeBuilder
-        if (is_string($d->default) && !isset($d->allowed[$d->default])) {
-            $this->error('default', 'must be an allowed value');
-        }
-        $this->context[] = 'allowed';
-        foreach ($d->allowed as $val => $x) {
-            if (!is_string($val)) {
-                $this->error("value $val", 'must be a string');
-            }
-        }
-        array_pop($this->context);
-    }
-
-    /**
-     * Extra validation if $valueAliases member variable of
-     * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
-     * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
-     */
-    public function validateDirectiveValueAliases($d)
-    {
-        if (is_null($d->valueAliases)) {
-            return;
-        }
-        $this->with($d, 'valueAliases')
-            ->assertIsArray(); // handled by InterchangeBuilder
-        $this->context[] = 'valueAliases';
-        foreach ($d->valueAliases as $alias => $real) {
-            if (!is_string($alias)) {
-                $this->error("alias $alias", 'must be a string');
-            }
-            if (!is_string($real)) {
-                $this->error("alias target $real from alias '$alias'", 'must be a string');
-            }
-            if ($alias === $real) {
-                $this->error("alias '$alias'", "must not be an alias to itself");
-            }
-        }
-        if (!is_null($d->allowed)) {
-            foreach ($d->valueAliases as $alias => $real) {
-                if (isset($d->allowed[$alias])) {
-                    $this->error("alias '$alias'", 'must not be an allowed value');
-                } elseif (!isset($d->allowed[$real])) {
-                    $this->error("alias '$alias'", 'must be an alias to an allowed value');
-                }
-            }
-        }
-        array_pop($this->context);
-    }
-
-    /**
-     * Extra validation if $aliases member variable of
-     * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
-     * @param HTMLPurifier_ConfigSchema_Interchange_Directive $d
-     */
-    public function validateDirectiveAliases($d)
-    {
-        $this->with($d, 'aliases')
-            ->assertIsArray(); // handled by InterchangeBuilder
-        $this->context[] = 'aliases';
-        foreach ($d->aliases as $alias) {
-            $this->validateId($alias);
-            $s = $alias->toString();
-            if (isset($this->interchange->directives[$s])) {
-                $this->error("alias '$s'", 'collides with another directive');
-            }
-            if (isset($this->aliases[$s])) {
-                $other_directive = $this->aliases[$s];
-                $this->error("alias '$s'", "collides with alias for directive '$other_directive'");
-            }
-            $this->aliases[$s] = $d->id->toString();
-        }
-        array_pop($this->context);
-    }
-
-    // protected helper functions
-
-    /**
-     * Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
-     * for validating simple member variables of objects.
-     * @param $obj
-     * @param $member
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    protected function with($obj, $member)
-    {
-        return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
-    }
-
-    /**
-     * Emits an error, providing helpful context.
-     * @throws HTMLPurifier_ConfigSchema_Exception
-     */
-    protected function error($target, $msg)
-    {
-        if ($target !== false) {
-            $prefix = ucfirst($target) . ' in ' . $this->getFormattedContext();
-        } else {
-            $prefix = ucfirst($this->getFormattedContext());
-        }
-        throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
-    }
-
-    /**
-     * Returns a formatted context string.
-     * @return string
-     */
-    protected function getFormattedContext()
-    {
-        return implode(' in ', array_reverse($this->context));
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/ValidatorAtom.php b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/ValidatorAtom.php
deleted file mode 100644
index a2e0b4a1b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/ValidatorAtom.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-/**
- * Fluent interface for validating the contents of member variables.
- * This should be immutable. See HTMLPurifier_ConfigSchema_Validator for
- * use-cases. We name this an 'atom' because it's ONLY for validations that
- * are independent and usually scalar.
- */
-class HTMLPurifier_ConfigSchema_ValidatorAtom
-{
-    /**
-     * @type string
-     */
-    protected $context;
-
-    /**
-     * @type object
-     */
-    protected $obj;
-
-    /**
-     * @type string
-     */
-    protected $member;
-
-    /**
-     * @type mixed
-     */
-    protected $contents;
-
-    public function __construct($context, $obj, $member)
-    {
-        $this->context = $context;
-        $this->obj = $obj;
-        $this->member = $member;
-        $this->contents =& $obj->$member;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertIsString()
-    {
-        if (!is_string($this->contents)) {
-            $this->error('must be a string');
-        }
-        return $this;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertIsBool()
-    {
-        if (!is_bool($this->contents)) {
-            $this->error('must be a boolean');
-        }
-        return $this;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertIsArray()
-    {
-        if (!is_array($this->contents)) {
-            $this->error('must be an array');
-        }
-        return $this;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertNotNull()
-    {
-        if ($this->contents === null) {
-            $this->error('must not be null');
-        }
-        return $this;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertAlnum()
-    {
-        $this->assertIsString();
-        if (!ctype_alnum($this->contents)) {
-            $this->error('must be alphanumeric');
-        }
-        return $this;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertNotEmpty()
-    {
-        if (empty($this->contents)) {
-            $this->error('must not be empty');
-        }
-        return $this;
-    }
-
-    /**
-     * @return HTMLPurifier_ConfigSchema_ValidatorAtom
-     */
-    public function assertIsLookup()
-    {
-        $this->assertIsArray();
-        foreach ($this->contents as $v) {
-            if ($v !== true) {
-                $this->error('must be a lookup array');
-            }
-        }
-        return $this;
-    }
-
-    /**
-     * @param string $msg
-     * @throws HTMLPurifier_ConfigSchema_Exception
-     */
-    protected function error($msg)
-    {
-        throw new HTMLPurifier_ConfigSchema_Exception(ucfirst($this->member) . ' in ' . $this->context . ' ' . $msg);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema.ser b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema.ser
deleted file mode 100644
index 371e948f1c76d99bacea65b4735454656858edbf..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 15923
zcmeHOO>Y}V63tIB6zpXI6QX2q9Qve4B0{Vr8={P4Pr-<6QL`S-aOXpoV)(!Bd(~Cl
zO=>7Qhusq$#3rYzyQ}M~t7{%VjE>%p4t~A4y!hDF`CabnKTfOiE?-P%_imXTjE+ZN
zo6)<`!Q9<tUC}lN@3YYmWAJqN^XTBDZR^2FQB+^t{ItlL#)0GNeKR_GvrZh>+0xx)
z^}_i%4o6?VVG1msPI2uDF0hUGkPso0jFeSBHSYB6<mN=zK2+M77kaYH7Ve~IHzYG^
z`H&U)T$m0ZIR^8eqn|b=N!VmANPj#!nE1!9a<0K~K`T1_jeBg*@|q;D7p;8aNRj@$
z%x()eIXifNJ38d5LnVx>`Zk}>T^Y0*)M8^NX9F7Ut>4!0A3Ab!_Dhk?J{Ng|4cnlj
zqvzCXw{VXu9UUkASi8IYG10`(R6RNKw2Nw%!A?<Cv~|~3ka?N41AhFN)!CxXR`<5C
zA=MdqPP?Y9mWh0Hgh)Qin^loLUF7BGPuG($2L*{tq~>=|Mm^>hBGvp^xdvy|?9=sy
zn&HR4!A+rU>TK(fFfnx(xvt%^dT{5<Rr@r6KIZu>Yhn3p^hQHvRuzl7>Y&-6{n0@S
zO{8Dv@hgPL?-(9@G#q`+#S^fbrk)+V|AsJmv##J&0{{8ywpk6%A7^gW=2a;{dPHd;
zd5e{9M?>z`OTjOgb3<MIbD9doeR@@39LG!sn;g?sRyM!o?S0j?boczWYndRtuQO6k
zr&FIk&bn10nv7&vJCG;KRaLiH376KvaF{^7sq@+A;0TO_KyveORWjvBQbKekl#g|_
za&?<q&Z3W!jL6N)oSM9LNIALJ9t=Wa2+VY}S=N@m%pNDp#f2*uw0kpxM8l)Q!<B>;
zlOAW{1a<D(td63qfHyVb!-?f2D<CJGX2{5iXwZnn;1IN_t8?VAKb<6(qre@Xf6OR|
z=zyD)xe}_YmwD58*U3k3em<tVz+X<Q+6_(?i`s$u;EJbl{&*oa5Qm}xH#xi`O=oq!
zii|X+F!H4MwQAZD?*6HqySka-c`&N+omNHRX6<=hSM|C>a28Oj`k(IUOI6Q7MbP|2
zXNQuPSzT2nHI7~W`0kK@G~^Mf_Iy0H=NMAeS?M!3hm6N3Z~YLEo*c!Eqd1P=V85z>
zI*jt}kSp;U2Cce!RV1WC5S8(+o832gX2Uq$c+78@@XLM9EaC+p%O8G2;1@YFgC}r6
zkO5Y4VXs`qQ!u2=9^g_o#3TUWw&;?%Y<Uo}|8zkvKK62f&^n*$sT@w^Hv@rhdB~)T
z1PwHK@!&m?gH8|mpY8=mLJ*8|aW>{6daSo>iJ>iWb+>e7dsCroSnv})gf4ds4GSlZ
zR5-|mdqjSBSKac~)zhbPHYr<I<2+~7hRET}I8k`gB1ab8Jjp?fMbhmczCsP58HNGx
zNwaF6mkaIz>|J~J`W-*>^zaPLEL%CP1WxbsVqViQdZJqxou^zk*&_J$k%f`xxT?yN
z>FH#0dXF=7hV2AKNtl%ASE&rn3rE#R1W2}rJk46%LE5H$qBm;NXWbzpU%=@*tymzS
z_aoM9p6V9a?CHF0^Y-b?VfQqrY9;bKy4oiptM_E=WtNvM{*QKnfWl#lxMG>WY<1<n
z6tJG`Px1+~ANS{Th$<9`)XVSBtb_pxbjHL~E+%Eu*4<1GKUKV$HqA&VZd<Q2ibQpc
z^8z{^Y!)QP*r$@tA6pt?N=^P!RI|^`KrAILp>7Guw{uTtIA^>PUY_<QpFbrk#Rj%c
zn%YB|{#A81-K`j#u0MpnSsz+?9<7i*O^;=<5<)ShpH|D@WWFq?+xKy#<s^@wlqb5X
zs2vWUQZK7{SJ)wZ1e<swuNGH0CkC;)S06-P5f-t=ZzwZyj58u(g_ZnkBGOsH>=_P)
zugwUHPsLd}fAG-rU~Jau=4X`eiKRjE3@jH?QhST@bVQ{7etAI+A!OIe8_vmSeTgjD
zqi-nhMK}m$hu$rb4_nCNEyyZGXt7M;{XrCK!y+lEV1h%eO=tJN!5G)Kd%4PuyQ07W
zE~kse5_T_ZhUzEXuT?+P$vRiGyYU3+*GnYSSg4PvH8cNJb%!E=$FCY4#+Au&wU7e=
z=>XT#90eLinZf&NDwBPh-Jxv1jb#-JF`1H-iI(8HT1xtG`)`~zK@d|iNBKHOGC|m(
z2?{UElVK*JzXaosR^s^7)hr-9?W#h)D1FYgyeM)S88<Xn*O4JumI>r!jzT90W1A=C
z!l8ttx**CD7ncqfFzC*<N*13hlksNKjf#|2r-<}B|F*a}f@(f=?W${0qe<TI`iWWB
z2M<F-`A|?!O6)bAhTd;vIwj^>Wl{gwl2Y{mQRl}#^!XHb1v+TZFG5C1+@!y!ro<c9
zw5;rB?y8#1suE76mVqd^fm#lgt_U-g<`Rf<-?qp(eqWG)U&Db$J!d#yDr11h-bHqd
zF3a_=?n@X9-j?R#)JO>`$S+xw<N=DNeFiTY4H|^<aiKhVqY0@3Dp{wbnF1~>L|-%o
zWx#C7W1NewE?H}NUD5hI<ZIVd9W*N&vzjd7dq&r3cuj~Ij|2Fmr?<i2C;2k_>`rc*
zs=y`FWKxMQJE`$4M+!F|JzJZu7pPN*B-rAj;l<#=N7@IJsC7O^M@iaV!6)=!KxB|B
z=9G9aGP5I~=DscU(YI(mJa572)e`*=sKB@2V6Gqj{=+<LQKs)ZaK4)dZ6Zka9XMP?
z5c5g*g&+4FxP1ri!R<S6`wpCxkT}=m<}8QSz5{1{Hfw>Qa@%*{*m^;!zVE>8J8=6B
zoHWCb7WN&ueFv^uuC>fU4=c9W!nGRbtn@`9DZN))H)U<QeFyF$xh>nxJ+!5Gk=}RU
zE(ZG!96?5*+p_P#@onb51DE>5cXi;<5=19$rEd{<%p+&x$&8=~cKXnzLpvoe@6fhI
ztL^w5-x{%H&6cutf&(loAH9BuIbO!Q<s<SirKNKS+HD(2fG08v;>oBDq#G9gi3_9O
zC}iyeN3a_h<m$)X5G6N;1jrV^Eod)p;}Ni%$G`+7=u`pQ_JKNVS`Ps{0MZB=!?OOR
zl^=^0GT$(zR)qu2JHf+wv*BCaTECl}Qaliu?A1Jl<&MMg>j~uH@!KZ@rufYEZSQPy
z2h5w3BG0txj#Xa(;HjldtO&nTORx_u0<R(P^3l(<5>Eb2n)QX%PGP?Wvoqst!`~?`
z>BZJx)L7CUw0GSq8oe?iw>F`7Is=_BGAXFeEV6+m+XlV!0w2@Y!c=TiE(aSUP#y_Z
z?`4yI=c@f?rmcbyo9l;t(Q1*)Uy7a~|FA8-*7)lnJ?~H(+ejDjp9$_WiNue3B{Gh`
z1jJM0BDV!tTnfaCwh!b4h^JJzPoNqQPf1X6AO#>E++7kT-Z3RaedQroJmp}VljB(_
z{gwfRFeEX&kY1la5~nV|`KDR2B6Bgvue~r<u~o8AaQVj(Ru={GU=0mmVPFp>(gkR@
zD>ZGOxZib=@Sg$r1m0(IP;W0I{9cO+;oZI`_#EJ;Tc%@hM=1o*JEecIYfi^ke=oNe
zRkg;q0q}cHO#yxyVBdohQ@N27y*M*MVu@!!N)bpIGX0LMLiO(Gg!S6xuRzm8{kG6E
zXqsw+9!f#%{3A3?NpyZsGH6;pI$~7N<%N)f%_1aC)nkV5fut#i8Gbt?O(ikLO-Nci
zEJdD(H;bp1C-gzhbZ)aEP<{qAql;TnBjbDFX5f<2$oAQTIMaPH)TuA;)G6Z3GcY+P
z49FI}h%=qdES82y#6GB0Jm<Bkw0;o3j17yBvnbit-c)4X;p|ZH)=3hSTff62nEhaX
zh~qZ0fs_0HhyfdJ--BZBG&M4XY~@wf9UA+d)%w*1?|4~V|7!tWG&X@T@i=3Q;o`GH
z;5cT7(!O)$UcIqBw$)}KBgPd14ARF*z(y%tgCkzQVXj1WkXD@%Sf1Mt6u=@i3fv`S
ziC{>d-gZGD)$4e`r_)4KoUX%rRmu<`izWwBhNtr$w}FY&ZQ{@umUT>|&$a;`$5fU~
zE>#k&ECV;7hAMlwY{jC6mo1~(;7HYWCr`Mb`q1v&a1;4)87!CH6NxO7i{c+8j%{`W
z>5JH1a(k4YpPBt$y%`)1U)=!4-^gz^JRpgKY}=kA!tvw)f%OHu_G&md+&VgPtdEAh
zj5PEj@@G0b8o7E%V85d8P`R!<p7@=)X5dL(MyzJ$epcLy;>}+oh*G@-*-I8j#ugCe
zhJW-`!zM5LunM2l$q<+_S%f-;a7;<oywy?WG8~n_C$(TO0ZrdJ2z8AtwFaJ4ngx%c
zBMm(1$-K}fLs1F@@T876Wiy)zcv3~Njq|xeCpY|ecb`Lk6NZV(suWBbT@Sh`^2L2X
z8)I*V#`Mk(hI=PJ;ox_AR%nJ(7GGUZ)#3?3eEZFiZp)I6A~fSusb}<Q--h5k)->6e
zqdz~xpbD<s0{T=#SZ%t6>t#`PLrZ&w+ln+*bwt?({%lB7rNVHVNK;FEu+cNHsg6Qu
z_JB>5h;gES8WPcs-%IYgkT3)H%-6qN@b+L?<7SCW)blQM(!C!+6C`?ksqGTe@gcH1
zfBb6@Q=`J5N=?9}MvOz(e@iF%2{9=n4PP3SBTX{B5rJi=ayDn`R|`@^vR-VP`*n8%
zSCtRpkW7<+M?GCt=z*&ndf33O`qo=Na@9|!A}ey$X456)>9h5>fme0#F8u2HCSy`x
J>r;OF_FtxB?Uw)m

diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt
deleted file mode 100644
index 4a42382ec..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedClasses.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Attr.AllowedClasses
-TYPE: lookup/null
-VERSION: 4.0.0
-DEFAULT: null
---DESCRIPTION--
-List of allowed class values in the class attribute. By default, this is null,
-which means all classes are allowed.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt
deleted file mode 100644
index b033eb516..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Attr.AllowedFrameTargets
-TYPE: lookup
-DEFAULT: array()
---DESCRIPTION--
-Lookup table of all allowed link frame targets.  Some commonly used link
-targets include _blank, _self, _parent and _top. Values should be
-lowercase, as validation will be done in a case-sensitive manner despite
-W3C's recommendation. XHTML 1.0 Strict does not permit the target attribute
-so this directive will have no effect in that doctype. XHTML 1.1 does not
-enable the Target module by default, you will have to manually enable it
-(see the module documentation for more details.)
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt
deleted file mode 100644
index ed72a9d56..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Attr.AllowedRel
-TYPE: lookup
-VERSION: 1.6.0
-DEFAULT: array()
---DESCRIPTION--
-List of allowed forward document relationships in the rel attribute. Common
-values may be nofollow or print. By default, this is empty, meaning that no
-document relationships are allowed.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt
deleted file mode 100644
index 1ae672d01..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Attr.AllowedRev
-TYPE: lookup
-VERSION: 1.6.0
-DEFAULT: array()
---DESCRIPTION--
-List of allowed reverse document relationships in the rev attribute. This
-attribute is a bit of an edge-case; if you don't know what it is for, stay
-away.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt
deleted file mode 100644
index 119a9d2c6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ClassUseCDATA.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Attr.ClassUseCDATA
-TYPE: bool/null
-DEFAULT: null
-VERSION: 4.0.0
---DESCRIPTION--
-If null, class will auto-detect the doctype and, if matching XHTML 1.1 or
-XHTML 2.0, will use the restrictive NMTOKENS specification of class. Otherwise,
-it will use a relaxed CDATA definition.  If true, the relaxed CDATA definition
-is forced; if false, the NMTOKENS definition is forced.  To get behavior
-of HTML Purifier prior to 4.0.0, set this directive to false.
-
-Some rational behind the auto-detection:
-in previous versions of HTML Purifier, it was assumed that the form of
-class was NMTOKENS, as specified by the XHTML Modularization (representing
-XHTML 1.1 and XHTML 2.0).  The DTDs for HTML 4.01 and XHTML 1.0, however
-specify class as CDATA.  HTML 5 effectively defines it as CDATA, but
-with the additional constraint that each name should be unique (this is not
-explicitly outlined in previous specifications).
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt
deleted file mode 100644
index 80b1431c3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Attr.DefaultImageAlt
-TYPE: string/null
-DEFAULT: null
-VERSION: 3.2.0
---DESCRIPTION--
-This is the content of the alt tag of an image if the user had not
-previously specified an alt attribute.  This applies to all images without
-a valid alt attribute, as opposed to %Attr.DefaultInvalidImageAlt, which
-only applies to invalid images, and overrides in the case of an invalid image.
-Default behavior with null is to use the basename of the src tag for the alt.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt
deleted file mode 100644
index c51000d1d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Attr.DefaultInvalidImage
-TYPE: string
-DEFAULT: ''
---DESCRIPTION--
-This is the default image an img tag will be pointed to if it does not have
-a valid src attribute.  In future versions, we may allow the image tag to
-be removed completely, but due to design issues, this is not possible right
-now.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt
deleted file mode 100644
index c1ec4b038..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Attr.DefaultInvalidImageAlt
-TYPE: string
-DEFAULT: 'Invalid image'
---DESCRIPTION--
-This is the content of the alt tag of an invalid image if the user had not
-previously specified an alt attribute.  It has no effect when the image is
-valid but there was no alt attribute present.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt
deleted file mode 100644
index f57dcc40f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Attr.DefaultTextDir
-TYPE: string
-DEFAULT: 'ltr'
---DESCRIPTION--
-Defines the default text direction (ltr or rtl) of the document being
-parsed.  This generally is the same as the value of the dir attribute in
-HTML, or ltr if that is not specified.
---ALLOWED--
-'ltr', 'rtl'
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt
deleted file mode 100644
index 9b93a5575..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Attr.EnableID
-TYPE: bool
-DEFAULT: false
-VERSION: 1.2.0
---DESCRIPTION--
-Allows the ID attribute in HTML.  This is disabled by default due to the
-fact that without proper configuration user input can easily break the
-validation of a webpage by specifying an ID that is already on the
-surrounding HTML.  If you don't mind throwing caution to the wind, enable
-this directive, but I strongly recommend you also consider blacklisting IDs
-you use (%Attr.IDBlacklist) or prefixing all user supplied IDs
-(%Attr.IDPrefix).  When set to true HTML Purifier reverts to the behavior of
-pre-1.2.0 versions.
---ALIASES--
-HTML.EnableAttrID
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt
deleted file mode 100644
index fed8954cf..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ForbiddenClasses.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Attr.ForbiddenClasses
-TYPE: lookup
-VERSION: 4.0.0
-DEFAULT: array()
---DESCRIPTION--
-List of forbidden class values in the class attribute. By default, this is
-empty, which means that no classes are forbidden. See also %Attr.AllowedClasses.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ID.HTML5.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ID.HTML5.txt
deleted file mode 100644
index c48e62fbe..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.ID.HTML5.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Attr.ID.HTML5
-TYPE: bool/null
-DEFAULT: null
-VERSION: 4.8.0
---DESCRIPTION--
-In HTML5, restrictions on the format of the id attribute have been significantly
-relaxed, such that any string is valid so long as it contains no spaces and
-is at least one character.  In lieu of a general HTML5 compatibility flag,
-set this configuration directive to true to use the relaxed rules.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt
deleted file mode 100644
index 52168bb5e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Attr.IDBlacklist
-TYPE: list
-DEFAULT: array()
-DESCRIPTION: Array of IDs not allowed in the document.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt
deleted file mode 100644
index 7b8504307..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Attr.IDBlacklistRegexp
-TYPE: string/null
-VERSION: 1.6.0
-DEFAULT: NULL
---DESCRIPTION--
-PCRE regular expression to be matched against all IDs. If the expression is
-matches, the ID is rejected. Use this with care: may cause significant
-degradation. ID matching is done after all other validation.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt
deleted file mode 100644
index 578138277..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Attr.IDPrefix
-TYPE: string
-VERSION: 1.2.0
-DEFAULT: ''
---DESCRIPTION--
-String to prefix to IDs.  If you have no idea what IDs your pages may use,
-you may opt to simply add a prefix to all user-submitted ID attributes so
-that they are still usable, but will not conflict with core page IDs.
-Example: setting the directive to 'user_' will result in a user submitted
-'foo' to become 'user_foo'  Be sure to set %HTML.EnableAttrID to true
-before using this.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt
deleted file mode 100644
index f91fcd602..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Attr.IDPrefixLocal
-TYPE: string
-VERSION: 1.2.0
-DEFAULT: ''
---DESCRIPTION--
-Temporary prefix for IDs used in conjunction with %Attr.IDPrefix.  If you
-need to allow multiple sets of user content on web page, you may need to
-have a seperate prefix that changes with each iteration.  This way,
-seperately submitted user content displayed on the same page doesn't
-clobber each other. Ideal values are unique identifiers for the content it
-represents (i.e. the id of the row in the database). Be sure to add a
-seperator (like an underscore) at the end.  Warning: this directive will
-not work unless %Attr.IDPrefix is set to a non-empty value!
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt
deleted file mode 100644
index 2d7f94e02..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-AutoFormat.AutoParagraph
-TYPE: bool
-VERSION: 2.0.1
-DEFAULT: false
---DESCRIPTION--
-
-<p>
-  This directive turns on auto-paragraphing, where double newlines are
-  converted in to paragraphs whenever possible. Auto-paragraphing:
-</p>
-<ul>
-  <li>Always applies to inline elements or text in the root node,</li>
-  <li>Applies to inline elements or text with double newlines in nodes
-      that allow paragraph tags,</li>
-  <li>Applies to double newlines in paragraph tags</li>
-</ul>
-<p>
-  <code>p</code> tags must be allowed for this directive to take effect.
-  We do not use <code>br</code> tags for paragraphing, as that is
-  semantically incorrect.
-</p>
-<p>
-  To prevent auto-paragraphing as a content-producer, refrain from using
-  double-newlines except to specify a new paragraph or in contexts where
-  it has special meaning (whitespace usually has no meaning except in
-  tags like <code>pre</code>, so this should not be difficult.) To prevent
-  the paragraphing of inline text adjacent to block elements, wrap them
-  in <code>div</code> tags (the behavior is slightly different outside of
-  the root node.)
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt
deleted file mode 100644
index 2eb1974fd..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-AutoFormat.Custom
-TYPE: list
-VERSION: 2.0.1
-DEFAULT: array()
---DESCRIPTION--
-
-<p>
-  This directive can be used to add custom auto-format injectors.
-  Specify an array of injector names (class name minus the prefix)
-  or concrete implementations. Injector class must exist.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt
deleted file mode 100644
index c955de7f6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-AutoFormat.DisplayLinkURI
-TYPE: bool
-VERSION: 3.2.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-  This directive turns on the in-text display of URIs in &lt;a&gt; tags, and disables
-  those links. For example, <a href="http://example.com">example</a> becomes
-  example (<a>http://example.com</a>).
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt
deleted file mode 100644
index 328b2b2bf..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-AutoFormat.Linkify
-TYPE: bool
-VERSION: 2.0.1
-DEFAULT: false
---DESCRIPTION--
-
-<p>
-  This directive turns on linkification, auto-linking http, ftp and
-  https URLs. <code>a</code> tags with the <code>href</code> attribute
-  must be allowed.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt
deleted file mode 100644
index d0532b6ba..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.DocURL.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-AutoFormat.PurifierLinkify.DocURL
-TYPE: string
-VERSION: 2.0.1
-DEFAULT: '#%s'
-ALIASES: AutoFormatParam.PurifierLinkifyDocURL
---DESCRIPTION--
-<p>
-  Location of configuration documentation to link to, let %s substitute
-  into the configuration's namespace and directive names sans the percent
-  sign.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt
deleted file mode 100644
index f3ab259a1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-AutoFormat.PurifierLinkify
-TYPE: bool
-VERSION: 2.0.1
-DEFAULT: false
---DESCRIPTION--
-
-<p>
-  Internal auto-formatter that converts configuration directives in
-  syntax <a>%Namespace.Directive</a> to links. <code>a</code> tags
-  with the <code>href</code> attribute must be allowed.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt
deleted file mode 100644
index 376f771ea..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.Predicate.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-AutoFormat.RemoveEmpty.Predicate
-TYPE: hash
-VERSION: 4.7.0
-DEFAULT: array('colgroup' => array(), 'th' => array(), 'td' => array(), 'iframe' => array('src'))
---DESCRIPTION--
-<p>
-  Given that an element has no contents, it will be removed by default, unless
-  this predicate dictates otherwise.  The predicate can either be an associative
-  map from tag name to list of attributes that must be present for the element
-  to be considered preserved: thus, the default always preserves <code>colgroup</code>,
-  <code>th</code> and <code>td</code>, and also <code>iframe</code> if it
-  has a <code>src</code>.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt
deleted file mode 100644
index 219d04ac4..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions
-TYPE: lookup
-VERSION: 4.0.0
-DEFAULT: array('td' => true, 'th' => true)
---DESCRIPTION--
-<p>
-  When %AutoFormat.RemoveEmpty and %AutoFormat.RemoveEmpty.RemoveNbsp
-  are enabled, this directive defines what HTML elements should not be
-  removede if they have only a non-breaking space in them.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
deleted file mode 100644
index 5f355d662..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-AutoFormat.RemoveEmpty.RemoveNbsp
-TYPE: bool
-VERSION: 4.0.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-  When enabled, HTML Purifier will treat any elements that contain only
-  non-breaking spaces as well as regular whitespace as empty, and remove
-  them when %AutoForamt.RemoveEmpty is enabled.
-</p>
-<p>
-  See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements
-  that don't have this behavior applied to them.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt
deleted file mode 100644
index 6b5a7a5c9..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-AutoFormat.RemoveEmpty
-TYPE: bool
-VERSION: 3.2.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-  When enabled, HTML Purifier will attempt to remove empty elements that
-  contribute no semantic information to the document. The following types
-  of nodes will be removed:
-</p>
-<ul><li>
-    Tags with no attributes and no content, and that are not empty
-    elements (remove <code>&lt;a&gt;&lt;/a&gt;</code> but not
-    <code>&lt;br /&gt;</code>), and
-  </li>
-  <li>
-    Tags with no content, except for:<ul>
-      <li>The <code>colgroup</code> element, or</li>
-      <li>
-        Elements with the <code>id</code> or <code>name</code> attribute,
-        when those attributes are permitted on those elements.
-      </li>
-    </ul></li>
-</ul>
-<p>
-  Please be very careful when using this functionality; while it may not
-  seem that empty elements contain useful information, they can alter the
-  layout of a document given appropriate styling. This directive is most
-  useful when you are processing machine-generated HTML, please avoid using
-  it on regular user HTML.
-</p>
-<p>
-  Elements that contain only whitespace will be treated as empty. Non-breaking
-  spaces, however, do not count as whitespace. See
-  %AutoFormat.RemoveEmpty.RemoveNbsp for alternate behavior.
-</p>
-<p>
-  This algorithm is not perfect; you may still notice some empty tags,
-  particularly if a node had elements, but those elements were later removed
-  because they were not permitted in that context, or tags that, after
-  being auto-closed by another tag, where empty. This is for safety reasons
-  to prevent clever code from breaking validation. The general rule of thumb:
-  if a tag looked empty on the way in, it will get removed; if HTML Purifier
-  made it empty, it will stay.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt
deleted file mode 100644
index a448770e5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveSpansWithoutAttributes.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-AutoFormat.RemoveSpansWithoutAttributes
-TYPE: bool
-VERSION: 4.0.1
-DEFAULT: false
---DESCRIPTION--
-<p>
-  This directive causes <code>span</code> tags without any attributes
-  to be removed. It will also remove spans that had all attributes
-  removed during processing.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowDuplicates.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowDuplicates.txt
deleted file mode 100644
index acfeab3c8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowDuplicates.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-CSS.AllowDuplicates
-TYPE: bool
-DEFAULT: false
-VERSION: 4.8.0
---DESCRIPTION--
-<p>
-  By default, HTML Purifier removes duplicate CSS properties,
-  like <code>color:red; color:blue</code>.  If this is set to
-  true, duplicate properties are allowed.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt
deleted file mode 100644
index 8096eb01a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-CSS.AllowImportant
-TYPE: bool
-DEFAULT: false
-VERSION: 3.1.0
---DESCRIPTION--
-This parameter determines whether or not !important cascade modifiers should
-be allowed in user CSS. If false, !important will stripped.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt
deleted file mode 100644
index 9d34debc4..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-CSS.AllowTricky
-TYPE: bool
-DEFAULT: false
-VERSION: 3.1.0
---DESCRIPTION--
-This parameter determines whether or not to allow "tricky" CSS properties and
-values. Tricky CSS properties/values can drastically modify page layout or
-be used for deceptive practices but do not directly constitute a security risk.
-For example, <code>display:none;</code> is considered a tricky property that
-will only be allowed if this directive is set to true.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedFonts.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedFonts.txt
deleted file mode 100644
index 7c2b54763..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedFonts.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-CSS.AllowedFonts
-TYPE: lookup/null
-VERSION: 4.3.0
-DEFAULT: NULL
---DESCRIPTION--
-<p>
-    Allows you to manually specify a set of allowed fonts.  If
-    <code>NULL</code>, all fonts are allowed.  This directive
-    affects generic names (serif, sans-serif, monospace, cursive,
-    fantasy) as well as specific font families.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt
deleted file mode 100644
index f1ba513c3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-CSS.AllowedProperties
-TYPE: lookup/null
-VERSION: 3.1.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    If HTML Purifier's style attributes set is unsatisfactory for your needs,
-    you can overload it with your own list of tags to allow.  Note that this
-    method is subtractive: it does its job by taking away from HTML Purifier
-    usual feature set, so you cannot add an attribute that HTML Purifier never
-    supported in the first place.
-</p>
-<p>
-    <strong>Warning:</strong> If another directive conflicts with the
-    elements here, <em>that</em> directive will win and override.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt
deleted file mode 100644
index 96b410829..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-CSS.DefinitionRev
-TYPE: int
-VERSION: 2.0.0
-DEFAULT: 1
---DESCRIPTION--
-
-<p>
-    Revision identifier for your custom definition. See
-    %HTML.DefinitionRev for details.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt
deleted file mode 100644
index 923e8e995..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.ForbiddenProperties.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-CSS.ForbiddenProperties
-TYPE: lookup
-VERSION: 4.2.0
-DEFAULT: array()
---DESCRIPTION--
-<p>
-    This is the logical inverse of %CSS.AllowedProperties, and it will
-    override that directive or any other directive.  If possible,
-    %CSS.AllowedProperties is recommended over this directive,
-    because it can sometimes be difficult to tell whether or not you've
-    forbidden all of the CSS properties you truly would like to disallow.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt
deleted file mode 100644
index 3808581e2..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-CSS.MaxImgLength
-TYPE: string/null
-DEFAULT: '1200px'
-VERSION: 3.1.1
---DESCRIPTION--
-<p>
- This parameter sets the maximum allowed length on <code>img</code> tags,
- effectively the <code>width</code> and <code>height</code> properties.
- Only absolute units of measurement (in, pt, pc, mm, cm) and pixels (px) are allowed. This is
- in place to prevent imagecrash attacks, disable with null at your own risk.
- This directive is similar to %HTML.MaxImgLength, and both should be
- concurrently edited, although there are
- subtle differences in the input format (the CSS max is a number with
- a unit).
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt
deleted file mode 100644
index 8a26f228d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-CSS.Proprietary
-TYPE: bool
-VERSION: 3.0.0
-DEFAULT: false
---DESCRIPTION--
-
-<p>
-    Whether or not to allow safe, proprietary CSS values.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Trusted.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Trusted.txt
deleted file mode 100644
index 917ec42ba..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/CSS.Trusted.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CSS.Trusted
-TYPE: bool
-VERSION: 4.2.1
-DEFAULT: false
---DESCRIPTION--
-Indicates whether or not the user's CSS input is trusted or not. If the
-input is trusted, a more expansive set of allowed properties.  See
-also %HTML.Trusted.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt
deleted file mode 100644
index afc6a87a6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Cache.DefinitionImpl
-TYPE: string/null
-VERSION: 2.0.0
-DEFAULT: 'Serializer'
---DESCRIPTION--
-
-This directive defines which method to use when caching definitions,
-the complex data-type that makes HTML Purifier tick. Set to null
-to disable caching (not recommended, as you will see a definite
-performance degradation).
-
---ALIASES--
-Core.DefinitionCache
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt
deleted file mode 100644
index 668f248af..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Cache.SerializerPath
-TYPE: string/null
-VERSION: 2.0.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    Absolute path with no trailing slash to store serialized definitions in.
-    Default is within the
-    HTML Purifier library inside DefinitionCache/Serializer. This
-    path must be writable by the webserver.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPermissions.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPermissions.txt
deleted file mode 100644
index f6059e672..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPermissions.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Cache.SerializerPermissions
-TYPE: int/null
-VERSION: 4.3.0
-DEFAULT: 0755
---DESCRIPTION--
-
-<p>
-    Directory permissions of the files and directories created inside
-    the DefinitionCache/Serializer or other custom serializer path.
-</p>
-<p>
-    In HTML Purifier 4.8.0, this also supports <code>NULL</code>,
-    which means that no chmod'ing or directory creation shall
-    occur.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt
deleted file mode 100644
index e0fa378ea..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Core.AggressivelyFixLt
-TYPE: bool
-VERSION: 2.1.0
-DEFAULT: true
---DESCRIPTION--
-<p>
-    This directive enables aggressive pre-filter fixes HTML Purifier can
-    perform in order to ensure that open angled-brackets do not get killed
-    during parsing stage. Enabling this will result in two preg_replace_callback
-    calls and at least two preg_replace calls for every HTML document parsed;
-    if your users make very well-formed HTML, you can set this directive false.
-    This has no effect when DirectLex is used.
-</p>
-<p>
-    <strong>Notice:</strong> This directive's default turned from false to true
-    in HTML Purifier 3.2.0.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt
deleted file mode 100644
index fb140b69d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Core.AggressivelyRemoveScript
-TYPE: bool
-VERSION: 4.9.0
-DEFAULT: true
---DESCRIPTION--
-<p>
-    This directive enables aggressive pre-filter removal of
-    script tags.  This is not necessary for security,
-    but it can help work around a bug in libxml where embedded
-    HTML elements inside script sections cause the parser to
-    choke.  To revert to pre-4.9.0 behavior, set this to false.
-    This directive has no effect if %Core.Trusted is true,
-    %Core.RemoveScriptContents is false, or %Core.HiddenElements
-    does not contain script.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AllowHostnameUnderscore.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AllowHostnameUnderscore.txt
deleted file mode 100644
index 405d36f17..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.AllowHostnameUnderscore.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Core.AllowHostnameUnderscore
-TYPE: bool
-VERSION: 4.6.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-    By RFC 1123, underscores are not permitted in host names.
-    (This is in contrast to the specification for DNS, RFC
-    2181, which allows underscores.)
-    However, most browsers do the right thing when faced with
-    an underscore in the host name, and so some poorly written
-    websites are written with the expectation this should work.
-    Setting this parameter to true relaxes our allowed character
-    check so that underscores are permitted.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt
deleted file mode 100644
index c6ea06990..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Core.CollectErrors
-TYPE: bool
-VERSION: 2.0.0
-DEFAULT: false
---DESCRIPTION--
-
-Whether or not to collect errors found while filtering the document. This
-is a useful way to give feedback to your users. <strong>Warning:</strong>
-Currently this feature is very patchy and experimental, with lots of
-possible error messages not yet implemented. It will not cause any
-problems, but it may not help your users either.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
deleted file mode 100644
index f78239825..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Core.ColorKeywords
-TYPE: hash
-VERSION: 2.0.0
---DEFAULT--
-array (
-  'maroon' => '#800000',
-  'red' => '#FF0000',
-  'orange' => '#FFA500',
-  'yellow' => '#FFFF00',
-  'olive' => '#808000',
-  'purple' => '#800080',
-  'fuchsia' => '#FF00FF',
-  'white' => '#FFFFFF',
-  'lime' => '#00FF00',
-  'green' => '#008000',
-  'navy' => '#000080',
-  'blue' => '#0000FF',
-  'aqua' => '#00FFFF',
-  'teal' => '#008080',
-  'black' => '#000000',
-  'silver' => '#C0C0C0',
-  'gray' => '#808080',
-)
---DESCRIPTION--
-
-Lookup array of color names to six digit hexadecimal number corresponding
-to color, with preceding hash mark. Used when parsing colors.  The lookup
-is done in a case-insensitive manner.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt
deleted file mode 100644
index 656d3783a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Core.ConvertDocumentToFragment
-TYPE: bool
-DEFAULT: true
---DESCRIPTION--
-
-This parameter determines whether or not the filter should convert
-input that is a full document with html and body tags to a fragment
-of just the contents of a body tag. This parameter is simply something
-HTML Purifier can do during an edge-case: for most inputs, this
-processing is not necessary.
-
---ALIASES--
-Core.AcceptFullDocuments
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt
deleted file mode 100644
index 2f54e462a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Core.DirectLexLineNumberSyncInterval
-TYPE: int
-VERSION: 2.0.0
-DEFAULT: 0
---DESCRIPTION--
-
-<p>
-  Specifies the number of tokens the DirectLex line number tracking
-  implementations should process before attempting to resyncronize the
-  current line count by manually counting all previous new-lines. When
-  at 0, this functionality is disabled. Lower values will decrease
-  performance, and this is only strictly necessary if the counting
-  algorithm is buggy (in which case you should report it as a bug).
-  This has no effect when %Core.MaintainLineNumbers is disabled or DirectLex is
-  not being used.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DisableExcludes.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DisableExcludes.txt
deleted file mode 100644
index 3c63c923c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.DisableExcludes.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Core.DisableExcludes
-TYPE: bool
-DEFAULT: false
-VERSION: 4.5.0
---DESCRIPTION--
-<p>
-  This directive disables SGML-style exclusions, e.g. the exclusion of
-  <code>&lt;object&gt;</code> in any descendant of a
-  <code>&lt;pre&gt;</code> tag.  Disabling excludes will allow some
-  invalid documents to pass through HTML Purifier, but HTML Purifier
-  will also be less likely to accidentally remove large documents during
-  processing.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EnableIDNA.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EnableIDNA.txt
deleted file mode 100644
index 7f498e7e7..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EnableIDNA.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Core.EnableIDNA
-TYPE: bool
-DEFAULT: false
-VERSION: 4.4.0
---DESCRIPTION--
-Allows international domain names in URLs.  This configuration option
-requires the PEAR Net_IDNA2 module to be installed.  It operates by
-punycoding any internationalized host names for maximum portability.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt
deleted file mode 100644
index 89e2ae34b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Core.Encoding
-TYPE: istring
-DEFAULT: 'utf-8'
---DESCRIPTION--
-If for some reason you are unable to convert all webpages to UTF-8, you can
-use this directive as a stop-gap compatibility change to let HTML Purifier
-deal with non UTF-8 input.  This technique has notable deficiencies:
-absolutely no characters outside of the selected character encoding will be
-preserved, not even the ones that have been ampersand escaped (this is due
-to a UTF-8 specific <em>feature</em> that automatically resolves all
-entities), making it pretty useless for anything except the most I18N-blind
-applications, although %Core.EscapeNonASCIICharacters offers fixes this
-trouble with another tradeoff. This directive only accepts ISO-8859-1 if
-iconv is not enabled.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt
deleted file mode 100644
index 1cc3fcda2..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Core.EscapeInvalidChildren
-TYPE: bool
-DEFAULT: false
---DESCRIPTION--
-<p><strong>Warning:</strong> this configuration option is no longer does anything as of 4.6.0.</p>
-
-<p>When true, a child is found that is not allowed in the context of the
-parent element will be transformed into text as if it were ASCII. When
-false, that element and all internal tags will be dropped, though text will
-be preserved.  There is no option for dropping the element but preserving
-child nodes.</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt
deleted file mode 100644
index 299775fab..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Core.EscapeInvalidTags
-TYPE: bool
-DEFAULT: false
---DESCRIPTION--
-When true, invalid tags will be written back to the document as plain text.
-Otherwise, they are silently dropped.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt
deleted file mode 100644
index f50db2f92..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Core.EscapeNonASCIICharacters
-TYPE: bool
-VERSION: 1.4.0
-DEFAULT: false
---DESCRIPTION--
-This directive overcomes a deficiency in %Core.Encoding by blindly
-converting all non-ASCII characters into decimal numeric entities before
-converting it to its native encoding. This means that even characters that
-can be expressed in the non-UTF-8 encoding will be entity-ized, which can
-be a real downer for encodings like Big5. It also assumes that the ASCII
-repetoire is available, although this is the case for almost all encodings.
-Anyway, use UTF-8!
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt
deleted file mode 100644
index c337e47fc..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Core.HiddenElements
-TYPE: lookup
---DEFAULT--
-array (
-  'script' => true,
-  'style' => true,
-)
---DESCRIPTION--
-
-<p>
-  This directive is a lookup array of elements which should have their
-  contents removed when they are not allowed by the HTML definition.
-  For example, the contents of a <code>script</code> tag are not
-  normally shown in a document, so if script tags are to be removed,
-  their contents should be removed to. This is opposed to a <code>b</code>
-  tag, which defines some presentational changes but does not hide its
-  contents.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Language.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Language.txt
deleted file mode 100644
index ed1f39b5f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.Language.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Core.Language
-TYPE: string
-VERSION: 2.0.0
-DEFAULT: 'en'
---DESCRIPTION--
-
-ISO 639 language code for localizable things in HTML Purifier to use,
-which is mainly error reporting. There is currently only an English (en)
-translation, so this directive is currently useless.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt
deleted file mode 100644
index 81d9ae4dc..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Core.LegacyEntityDecoder
-TYPE: bool
-VERSION: 4.9.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Prior to HTML Purifier 4.9.0, entities were decoded by performing
-    a global search replace for all entities whose decoded versions
-    did not have special meanings under HTML, and replaced them with
-    their decoded versions.  We would match all entities, even if they did
-    not have a trailing semicolon, but only if there weren't any trailing
-    alphanumeric characters.
-</p>
-<table>
-<tr><th>Original</th><th>Text</th><th>Attribute</th></tr>
-<tr><td>&amp;yen;</td><td>&yen;</td><td>&yen;</td></tr>
-<tr><td>&amp;yen</td><td>&yen;</td><td>&yen;</td></tr>
-<tr><td>&amp;yena</td><td>&amp;yena</td><td>&amp;yena</td></tr>
-<tr><td>&amp;yen=</td><td>&yen;=</td><td>&yen;=</td></tr>
-</table>
-<p>
-    In HTML Purifier 4.9.0, we changed the behavior of entity parsing
-    to match entities that had missing trailing semicolons in less
-    cases, to more closely match HTML5 parsing behavior:
-</p>
-<table>
-<tr><th>Original</th><th>Text</th><th>Attribute</th></tr>
-<tr><td>&amp;yen;</td><td>&yen;</td><td>&yen;</td></tr>
-<tr><td>&amp;yen</td><td>&yen;</td><td>&yen;</td></tr>
-<tr><td>&amp;yena</td><td>&yen;a</td><td>&amp;yena</td></tr>
-<tr><td>&amp;yen=</td><td>&yen;=</td><td>&amp;yen=</td></tr>
-</table>
-<p>
-    This flag reverts back to pre-HTML Purifier 4.9.0 behavior.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt
deleted file mode 100644
index e11c0152c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-Core.LexerImpl
-TYPE: mixed/null
-VERSION: 2.0.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-  This parameter determines what lexer implementation can be used. The
-  valid values are:
-</p>
-<dl>
-  <dt><em>null</em></dt>
-  <dd>
-    Recommended, the lexer implementation will be auto-detected based on
-    your PHP-version and configuration.
-  </dd>
-  <dt><em>string</em> lexer identifier</dt>
-  <dd>
-    This is a slim way of manually overridding the implementation.
-    Currently recognized values are: DOMLex (the default PHP5
-implementation)
-    and DirectLex (the default PHP4 implementation). Only use this if
-    you know what you are doing: usually, the auto-detection will
-    manage things for cases you aren't even aware of.
-  </dd>
-  <dt><em>object</em> lexer instance</dt>
-  <dd>
-    Super-advanced: you can specify your own, custom, implementation that
-    implements the interface defined by <code>HTMLPurifier_Lexer</code>.
-    I may remove this option simply because I don't expect anyone
-    to use it.
-  </dd>
-</dl>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt
deleted file mode 100644
index 838f10f61..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Core.MaintainLineNumbers
-TYPE: bool/null
-VERSION: 2.0.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-  If true, HTML Purifier will add line number information to all tokens.
-  This is useful when error reporting is turned on, but can result in
-  significant performance degradation and should not be used when
-  unnecessary. This directive must be used with the DirectLex lexer,
-  as the DOMLex lexer does not (yet) support this functionality.
-  If the value is null, an appropriate value will be selected based
-  on other configuration.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt
deleted file mode 100644
index 94a88600d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.NormalizeNewlines.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Core.NormalizeNewlines
-TYPE: bool
-VERSION: 4.2.0
-DEFAULT: true
---DESCRIPTION--
-<p>
-    Whether or not to normalize newlines to the operating
-    system default.  When <code>false</code>, HTML Purifier
-    will attempt to preserve mixed newline files.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt
deleted file mode 100644
index 704ac56c8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Core.RemoveInvalidImg
-TYPE: bool
-DEFAULT: true
-VERSION: 1.3.0
---DESCRIPTION--
-
-<p>
-  This directive enables pre-emptive URI checking in <code>img</code>
-  tags, as the attribute validation strategy is not authorized to
-  remove elements from the document. Revert to pre-1.3.0 behavior by setting to false.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt
deleted file mode 100644
index ed6f13425..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveProcessingInstructions.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Core.RemoveProcessingInstructions
-TYPE: bool
-VERSION: 4.2.0
-DEFAULT: false
---DESCRIPTION--
-Instead of escaping processing instructions in the form <code>&lt;? ...
-?&gt;</code>, remove it out-right.  This may be useful if the HTML
-you are validating contains XML processing instruction gunk, however,
-it can also be user-unfriendly for people attempting to post PHP
-snippets.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt
deleted file mode 100644
index efbe994c2..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Core.RemoveScriptContents
-TYPE: bool/null
-DEFAULT: NULL
-VERSION: 2.0.0
-DEPRECATED-VERSION: 2.1.0
-DEPRECATED-USE: Core.HiddenElements
---DESCRIPTION--
-<p>
-  This directive enables HTML Purifier to remove not only script tags
-  but all of their contents.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
deleted file mode 100644
index 861ae66c3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Filter.Custom
-TYPE: list
-VERSION: 3.1.0
-DEFAULT: array()
---DESCRIPTION--
-<p>
-  This directive can be used to add custom filters; it is nearly the
-  equivalent of the now deprecated <code>HTMLPurifier-&gt;addFilter()</code>
-  method. Specify an array of concrete implementations.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt
deleted file mode 100644
index 69602635e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Escaping.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Filter.ExtractStyleBlocks.Escaping
-TYPE: bool
-VERSION: 3.0.0
-DEFAULT: true
-ALIASES: Filter.ExtractStyleBlocksEscaping, FilterParam.ExtractStyleBlocksEscaping
---DESCRIPTION--
-
-<p>
-  Whether or not to escape the dangerous characters &lt;, &gt; and &amp;
-  as \3C, \3E and \26, respectively. This is can be safely set to false
-  if the contents of StyleBlocks will be placed in an external stylesheet,
-  where there is no risk of it being interpreted as HTML.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt
deleted file mode 100644
index baa81ae06..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.Scope.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Filter.ExtractStyleBlocks.Scope
-TYPE: string/null
-VERSION: 3.0.0
-DEFAULT: NULL
-ALIASES: Filter.ExtractStyleBlocksScope, FilterParam.ExtractStyleBlocksScope
---DESCRIPTION--
-
-<p>
-  If you would like users to be able to define external stylesheets, but
-  only allow them to specify CSS declarations for a specific node and
-  prevent them from fiddling with other elements, use this directive.
-  It accepts any valid CSS selector, and will prepend this to any
-  CSS declaration extracted from the document. For example, if this
-  directive is set to <code>#user-content</code> and a user uses the
-  selector <code>a:hover</code>, the final selector will be
-  <code>#user-content a:hover</code>.
-</p>
-<p>
-  The comma shorthand may be used; consider the above example, with
-  <code>#user-content, #user-content2</code>, the final selector will
-  be <code>#user-content a:hover, #user-content2 a:hover</code>.
-</p>
-<p>
-  <strong>Warning:</strong> It is possible for users to bypass this measure
-  using a naughty + selector. This is a bug in CSS Tidy 1.3, not HTML
-  Purifier, and I am working to get it fixed. Until then, HTML Purifier
-  performs a basic check to prevent this.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt
deleted file mode 100644
index 3b7018917..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.TidyImpl.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Filter.ExtractStyleBlocks.TidyImpl
-TYPE: mixed/null
-VERSION: 3.1.0
-DEFAULT: NULL
-ALIASES: FilterParam.ExtractStyleBlocksTidyImpl
---DESCRIPTION--
-<p>
-  If left NULL, HTML Purifier will attempt to instantiate a <code>csstidy</code>
-  class to use for internal cleaning. This will usually be good enough.
-</p>
-<p>
-  However, for trusted user input, you can set this to <code>false</code> to
-  disable cleaning. In addition, you can supply your own concrete implementation
-  of Tidy's interface to use, although I don't know why you'd want to do that.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt
deleted file mode 100644
index be0177d4e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Filter.ExtractStyleBlocks
-TYPE: bool
-VERSION: 3.1.0
-DEFAULT: false
-EXTERNAL: CSSTidy
---DESCRIPTION--
-<p>
-  This directive turns on the style block extraction filter, which removes
-  <code>style</code> blocks from input HTML, cleans them up with CSSTidy,
-  and places them in the <code>StyleBlocks</code> context variable, for further
-  use by you, usually to be placed in an external stylesheet, or a
-  <code>style</code> block in the <code>head</code> of your document.
-</p>
-<p>
-  Sample usage:
-</p>
-<pre><![CDATA[
-<?php
-    header('Content-type: text/html; charset=utf-8');
-    echo '<?xml version="1.0" encoding="UTF-8"?>';
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
-  <title>Filter.ExtractStyleBlocks</title>
-<?php
-    require_once '/path/to/library/HTMLPurifier.auto.php';
-    require_once '/path/to/csstidy.class.php';
-
-    $dirty = '<style>body {color:#F00;}</style> Some text';
-
-    $config = HTMLPurifier_Config::createDefault();
-    $config->set('Filter', 'ExtractStyleBlocks', true);
-    $purifier = new HTMLPurifier($config);
-
-    $html = $purifier->purify($dirty);
-
-    // This implementation writes the stylesheets to the styles/ directory.
-    // You can also echo the styles inside the document, but it's a bit
-    // more difficult to make sure they get interpreted properly by
-    // browsers; try the usual CSS armoring techniques.
-    $styles = $purifier->context->get('StyleBlocks');
-    $dir = 'styles/';
-    if (!is_dir($dir)) mkdir($dir);
-    $hash = sha1($_GET['html']);
-    foreach ($styles as $i => $style) {
-        file_put_contents($name = $dir . $hash . "_$i");
-        echo '<link rel="stylesheet" type="text/css" href="'.$name.'" />';
-    }
-?>
-</head>
-<body>
-  <div>
-    <?php echo $html; ?>
-  </div>
-</b]]><![CDATA[ody>
-</html>
-]]></pre>
-<p>
-  <strong>Warning:</strong> It is possible for a user to mount an
-  imagecrash attack using this CSS. Counter-measures are difficult;
-  it is not simply enough to limit the range of CSS lengths (using
-  relative lengths with many nesting levels allows for large values
-  to be attained without actually specifying them in the stylesheet),
-  and the flexible nature of selectors makes it difficult to selectively
-  disable lengths on image tags (HTML Purifier, however, does disable
-  CSS width and height in inline styling). There are probably two effective
-  counter measures: an explicit width and height set to auto in all
-  images in your document (unlikely) or the disabling of width and
-  height (somewhat reasonable). Whether or not these measures should be
-  used is left to the reader.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
deleted file mode 100644
index 882218668..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Filter.YouTube
-TYPE: bool
-VERSION: 3.1.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-  <strong>Warning:</strong> Deprecated in favor of %HTML.SafeObject and
-  %Output.FlashCompat (turn both on to allow YouTube videos and other
-  Flash content).
-</p>
-<p>
-  This directive enables YouTube video embedding in HTML Purifier. Check
-  <a href="http://htmlpurifier.org/docs/enduser-youtube.html">this document
-  on embedding videos</a> for more information on what this filter does.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt
deleted file mode 100644
index afd48a0d4..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-HTML.Allowed
-TYPE: itext/null
-VERSION: 2.0.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    This is a preferred convenience directive that combines
-    %HTML.AllowedElements and %HTML.AllowedAttributes.
-    Specify elements and attributes that are allowed using:
-    <code>element1[attr1|attr2],element2...</code>.  For example,
-    if you would like to only allow paragraphs and links, specify
-    <code>a[href],p</code>.  You can specify attributes that apply
-    to all elements using an asterisk, e.g. <code>*[lang]</code>.
-    You can also use newlines instead of commas to separate elements.
-</p>
-<p>
-    <strong>Warning</strong>:
-    All of the constraints on the component directives are still enforced.
-    The syntax is a <em>subset</em> of TinyMCE's <code>valid_elements</code>
-    whitelist: directly copy-pasting it here will probably result in
-    broken whitelists. If %HTML.AllowedElements or %HTML.AllowedAttributes
-    are set, this directive has no effect.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt
deleted file mode 100644
index 0e6ec54f3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-HTML.AllowedAttributes
-TYPE: lookup/null
-VERSION: 1.3.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    If HTML Purifier's attribute set is unsatisfactory, overload it!
-    The syntax is "tag.attr" or "*.attr" for the global attributes
-    (style, id, class, dir, lang, xml:lang).
-</p>
-<p>
-    <strong>Warning:</strong> If another directive conflicts with the
-    elements here, <em>that</em> directive will win and override. For
-    example, %HTML.EnableAttrID will take precedence over *.id in this
-    directive.  You must set that directive to true before you can use
-    IDs at all.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedComments.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedComments.txt
deleted file mode 100644
index 8440bc39d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedComments.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-HTML.AllowedComments
-TYPE: lookup
-VERSION: 4.4.0
-DEFAULT: array()
---DESCRIPTION--
-A whitelist which indicates what explicit comment bodies should be
-allowed, modulo leading and trailing whitespace.  See also %HTML.AllowedCommentsRegexp
-(these directives are union'ed together, so a comment is considered
-valid if any directive deems it valid.)
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedCommentsRegexp.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedCommentsRegexp.txt
deleted file mode 100644
index b1e65beb1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedCommentsRegexp.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-HTML.AllowedCommentsRegexp
-TYPE: string/null
-VERSION: 4.4.0
-DEFAULT: NULL
---DESCRIPTION--
-A regexp, which if it matches the body of a comment, indicates that
-it should be allowed. Trailing and leading spaces are removed prior
-to running this regular expression.
-<strong>Warning:</strong> Make sure you specify
-correct anchor metacharacters <code>^regex$</code>, otherwise you may accept
-comments that you did not mean to! In particular, the regex <code>/foo|bar/</code>
-is probably not sufficiently strict, since it also allows <code>foobar</code>.
-See also %HTML.AllowedComments (these directives are union'ed together,
-so a comment is considered valid if any directive deems it valid.)
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt
deleted file mode 100644
index ca3c13ddb..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-HTML.AllowedElements
-TYPE: lookup/null
-VERSION: 1.3.0
-DEFAULT: NULL
---DESCRIPTION--
-<p>
-    If HTML Purifier's tag set is unsatisfactory for your needs, you can
-    overload it with your own list of tags to allow.  If you change
-    this, you probably also want to change %HTML.AllowedAttributes; see
-    also %HTML.Allowed which lets you set allowed elements and
-    attributes at the same time.
-</p>
-<p>
-    If you attempt to allow an element that HTML Purifier does not know
-    about, HTML Purifier will raise an error.  You will need to manually
-    tell HTML Purifier about this element by using the
-    <a href="http://htmlpurifier.org/docs/enduser-customize.html">advanced customization features.</a>
-</p>
-<p>
-    <strong>Warning:</strong> If another directive conflicts with the
-    elements here, <em>that</em> directive will win and override.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt
deleted file mode 100644
index e373791a5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-HTML.AllowedModules
-TYPE: lookup/null
-VERSION: 2.0.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    A doctype comes with a set of usual modules to use. Without having
-    to mucking about with the doctypes, you can quickly activate or
-    disable these modules by specifying which modules you wish to allow
-    with this directive. This is most useful for unit testing specific
-    modules, although end users may find it useful for their own ends.
-</p>
-<p>
-    If you specify a module that does not exist, the manager will silently
-    fail to use it, so be careful! User-defined modules are not affected
-    by this directive. Modules defined in %HTML.CoreModules are not
-    affected by this directive.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt
deleted file mode 100644
index 75d680ee1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Attr.Name.UseCDATA.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-HTML.Attr.Name.UseCDATA
-TYPE: bool
-DEFAULT: false
-VERSION: 4.0.0
---DESCRIPTION--
-The W3C specification DTD defines the name attribute to be CDATA, not ID, due
-to limitations of DTD.  In certain documents, this relaxed behavior is desired,
-whether it is to specify duplicate names, or to specify names that would be
-illegal IDs (for example, names that begin with a digit.) Set this configuration
-directive to true to use the relaxed parsing rules.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt
deleted file mode 100644
index f32b802c6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-HTML.BlockWrapper
-TYPE: string
-VERSION: 1.3.0
-DEFAULT: 'p'
---DESCRIPTION--
-
-<p>
-    String name of element to wrap inline elements that are inside a block
-    context.  This only occurs in the children of blockquote in strict mode.
-</p>
-<p>
-    Example: by default value,
-    <code>&lt;blockquote&gt;Foo&lt;/blockquote&gt;</code> would become
-    <code>&lt;blockquote&gt;&lt;p&gt;Foo&lt;/p&gt;&lt;/blockquote&gt;</code>.
-    The <code>&lt;p&gt;</code> tags can be replaced with whatever you desire,
-    as long as it is a block level element.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt
deleted file mode 100644
index fc8e40205..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-HTML.CoreModules
-TYPE: lookup
-VERSION: 2.0.0
---DEFAULT--
-array (
-  'Structure' => true,
-  'Text' => true,
-  'Hypertext' => true,
-  'List' => true,
-  'NonXMLCommonAttributes' => true,
-  'XMLCommonAttributes' => true,
-  'CommonAttributes' => true,
-)
---DESCRIPTION--
-
-<p>
-    Certain modularized doctypes (XHTML, namely), have certain modules
-    that must be included for the doctype to be an conforming document
-    type: put those modules here. By default, XHTML's core modules
-    are used. You can set this to a blank array to disable core module
-    protection, but this is not recommended.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt
deleted file mode 100644
index 187c0a0d5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-HTML.CustomDoctype
-TYPE: string/null
-VERSION: 2.0.1
-DEFAULT: NULL
---DESCRIPTION--
-
-A custom doctype for power-users who defined their own document
-type. This directive only applies when %HTML.Doctype is blank.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt
deleted file mode 100644
index f5433e3f1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-HTML.DefinitionID
-TYPE: string/null
-DEFAULT: NULL
-VERSION: 2.0.0
---DESCRIPTION--
-
-<p>
-    Unique identifier for a custom-built HTML definition. If you edit
-    the raw version of the HTMLDefinition, introducing changes that the
-    configuration object does not reflect, you must specify this variable.
-    If you change your custom edits, you should change this directive, or
-    clear your cache. Example:
-</p>
-<pre>
-$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'DefinitionID', '1');
-$def = $config->getHTMLDefinition();
-$def->addAttribute('a', 'tabindex', 'Number');
-</pre>
-<p>
-    In the above example, the configuration is still at the defaults, but
-    using the advanced API, an extra attribute has been added. The
-    configuration object normally has no way of knowing that this change
-    has taken place, so it needs an extra directive: %HTML.DefinitionID.
-    If someone else attempts to use the default configuration, these two
-    pieces of code will not clobber each other in the cache, since one has
-    an extra directive attached to it.
-</p>
-<p>
-    You <em>must</em> specify a value to this directive to use the
-    advanced API features.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt
deleted file mode 100644
index 0bb5a718d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-HTML.DefinitionRev
-TYPE: int
-VERSION: 2.0.0
-DEFAULT: 1
---DESCRIPTION--
-
-<p>
-    Revision identifier for your custom definition specified in
-    %HTML.DefinitionID.  This serves the same purpose: uniquely identifying
-    your custom definition, but this one does so in a chronological
-    context: revision 3 is more up-to-date then revision 2.  Thus, when
-    this gets incremented, the cache handling is smart enough to clean
-    up any older revisions of your definition as well as flush the
-    cache.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt
deleted file mode 100644
index a6969b995..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-HTML.Doctype
-TYPE: string/null
-DEFAULT: NULL
---DESCRIPTION--
-Doctype to use during filtering. Technically speaking this is not actually
-a doctype (as it does not identify a corresponding DTD), but we are using
-this name for sake of simplicity. When non-blank, this will override any
-older directives like %HTML.XHTML or %HTML.Strict.
---ALLOWED--
-'HTML 4.01 Transitional', 'HTML 4.01 Strict', 'XHTML 1.0 Transitional', 'XHTML 1.0 Strict', 'XHTML 1.1'
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt
deleted file mode 100644
index 08d641f95..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.FlashAllowFullScreen.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-HTML.FlashAllowFullScreen
-TYPE: bool
-VERSION: 4.2.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Whether or not to permit embedded Flash content from
-    %HTML.SafeObject to expand to the full screen.  Corresponds to
-    the <code>allowFullScreen</code> parameter.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt
deleted file mode 100644
index 2b8df97cb..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-HTML.ForbiddenAttributes
-TYPE: lookup
-VERSION: 3.1.0
-DEFAULT: array()
---DESCRIPTION--
-<p>
-    While this directive is similar to %HTML.AllowedAttributes, for
-    forwards-compatibility with XML, this attribute has a different syntax. Instead of
-    <code>tag.attr</code>, use <code>tag@attr</code>. To disallow <code>href</code>
-    attributes in <code>a</code> tags, set this directive to
-    <code>a@href</code>. You can also disallow an attribute globally with
-    <code>attr</code> or <code>*@attr</code> (either syntax is fine; the latter
-    is provided for consistency with %HTML.AllowedAttributes).
-</p>
-<p>
-    <strong>Warning:</strong> This directive complements %HTML.ForbiddenElements,
-    accordingly, check
-    out that directive for a discussion of why you
-    should think twice before using this directive.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt
deleted file mode 100644
index 40466c463..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-HTML.ForbiddenElements
-TYPE: lookup
-VERSION: 3.1.0
-DEFAULT: array()
---DESCRIPTION--
-<p>
-    This was, perhaps, the most requested feature ever in HTML
-    Purifier. Please don't abuse it! This is the logical inverse of
-    %HTML.AllowedElements, and it will override that directive, or any
-    other directive.
-</p>
-<p>
-    If possible, %HTML.Allowed is recommended over this directive, because it
-    can sometimes be difficult to tell whether or not you've forbidden all of
-    the behavior you would like to disallow. If you forbid <code>img</code>
-    with the expectation of preventing images on your site, you'll be in for
-    a nasty surprise when people start using the <code>background-image</code>
-    CSS property.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt
deleted file mode 100644
index 319747954..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-HTML.MaxImgLength
-TYPE: int/null
-DEFAULT: 1200
-VERSION: 3.1.1
---DESCRIPTION--
-<p>
- This directive controls the maximum number of pixels in the width and
- height attributes in <code>img</code> tags. This is
- in place to prevent imagecrash attacks, disable with null at your own risk.
- This directive is similar to %CSS.MaxImgLength, and both should be
- concurrently edited, although there are
- subtle differences in the input format (the HTML max is an integer).
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Nofollow.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Nofollow.txt
deleted file mode 100644
index 7aa356353..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Nofollow.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-HTML.Nofollow
-TYPE: bool
-VERSION: 4.3.0
-DEFAULT: FALSE
---DESCRIPTION--
-If enabled, nofollow rel attributes are added to all outgoing links.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt
deleted file mode 100644
index 2d2fbd117..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-HTML.Parent
-TYPE: string
-VERSION: 1.3.0
-DEFAULT: 'div'
---DESCRIPTION--
-
-<p>
-    String name of element that HTML fragment passed to library will be
-    inserted in.  An interesting variation would be using span as the
-    parent element, meaning that only inline tags would be allowed.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt
deleted file mode 100644
index b3c45e190..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-HTML.Proprietary
-TYPE: bool
-VERSION: 3.1.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Whether or not to allow proprietary elements and attributes in your
-    documents, as per <code>HTMLPurifier_HTMLModule_Proprietary</code>.
-    <strong>Warning:</strong> This can cause your documents to stop
-    validating!
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt
deleted file mode 100644
index 556fa674f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-HTML.SafeEmbed
-TYPE: bool
-VERSION: 3.1.1
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Whether or not to permit embed tags in documents, with a number of extra
-    security features added to prevent script execution. This is similar to
-    what websites like MySpace do to embed tags. Embed is a proprietary
-    element and will cause your website to stop validating; you should
-    see if you can use %Output.FlashCompat with %HTML.SafeObject instead
-    first.</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeIframe.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeIframe.txt
deleted file mode 100644
index 295a8cf66..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeIframe.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-HTML.SafeIframe
-TYPE: bool
-VERSION: 4.4.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Whether or not to permit iframe tags in untrusted documents.  This
-    directive must be accompanied by a whitelist of permitted iframes,
-    such as %URI.SafeIframeRegexp, otherwise it will fatally error.
-    This directive has no effect on strict doctypes, as iframes are not
-    valid.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt
deleted file mode 100644
index 07f6e536e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-HTML.SafeObject
-TYPE: bool
-VERSION: 3.1.1
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Whether or not to permit object tags in documents, with a number of extra
-    security features added to prevent script execution. This is similar to
-    what websites like MySpace do to object tags.  You should also enable
-    %Output.FlashCompat in order to generate Internet Explorer
-    compatibility code for your object tags.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeScripting.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeScripting.txt
deleted file mode 100644
index 641b4a8d6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.SafeScripting.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-HTML.SafeScripting
-TYPE: lookup
-VERSION: 4.5.0
-DEFAULT: array()
---DESCRIPTION--
-<p>
-    Whether or not to permit script tags to external scripts in documents.
-    Inline scripting is not allowed, and the script must match an explicit whitelist.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt
deleted file mode 100644
index d99663a5e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-HTML.Strict
-TYPE: bool
-VERSION: 1.3.0
-DEFAULT: false
-DEPRECATED-VERSION: 1.7.0
-DEPRECATED-USE: HTML.Doctype
---DESCRIPTION--
-Determines whether or not to use Transitional (loose) or Strict rulesets.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetBlank.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetBlank.txt
deleted file mode 100644
index d65f0d041..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetBlank.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-HTML.TargetBlank
-TYPE: bool
-VERSION: 4.4.0
-DEFAULT: FALSE
---DESCRIPTION--
-If enabled, <code>target=blank</code> attributes are added to all outgoing links.
-(This includes links from an HTTPS version of a page to an HTTP version.)
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt
deleted file mode 100644
index 05cb3424f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt
+++ /dev/null
@@ -1,10 +0,0 @@
---# vim: et sw=4 sts=4
-HTML.TargetNoopener
-TYPE: bool
-VERSION: 4.8.0
-DEFAULT: TRUE
---DESCRIPTION--
-If enabled, noopener rel attributes are added to links which have
-a target attribute associated with them.  This prevents malicious
-destinations from overwriting the original window.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoreferrer.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoreferrer.txt
deleted file mode 100644
index 993a81704..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoreferrer.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-HTML.TargetNoreferrer
-TYPE: bool
-VERSION: 4.8.0
-DEFAULT: TRUE
---DESCRIPTION--
-If enabled, noreferrer rel attributes are added to links which have
-a target attribute associated with them.  This prevents malicious
-destinations from overwriting the original window.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt
deleted file mode 100644
index 602453f6e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-HTML.TidyAdd
-TYPE: lookup
-VERSION: 2.0.0
-DEFAULT: array()
---DESCRIPTION--
-
-Fixes to add to the default set of Tidy fixes as per your level.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt
deleted file mode 100644
index bf943e8f0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-HTML.TidyLevel
-TYPE: string
-VERSION: 2.0.0
-DEFAULT: 'medium'
---DESCRIPTION--
-
-<p>General level of cleanliness the Tidy module should enforce.
-There are four allowed values:</p>
-<dl>
-    <dt>none</dt>
-    <dd>No extra tidying should be done</dd>
-    <dt>light</dt>
-    <dd>Only fix elements that would be discarded otherwise due to
-    lack of support in doctype</dd>
-    <dt>medium</dt>
-    <dd>Enforce best practices</dd>
-    <dt>heavy</dt>
-    <dd>Transform all deprecated elements and attributes to standards
-    compliant equivalents</dd>
-</dl>
-
---ALLOWED--
-'none', 'light', 'medium', 'heavy'
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt
deleted file mode 100644
index 92cca2a43..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-HTML.TidyRemove
-TYPE: lookup
-VERSION: 2.0.0
-DEFAULT: array()
---DESCRIPTION--
-
-Fixes to remove from the default set of Tidy fixes as per your level.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt
deleted file mode 100644
index bc8e65499..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-HTML.Trusted
-TYPE: bool
-VERSION: 2.0.0
-DEFAULT: false
---DESCRIPTION--
-Indicates whether or not the user input is trusted or not. If the input is
-trusted, a more expansive set of allowed tags and attributes will be used.
-See also %CSS.Trusted.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt
deleted file mode 100644
index a3c2f42c3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-HTML.XHTML
-TYPE: bool
-DEFAULT: true
-VERSION: 1.1.0
-DEPRECATED-VERSION: 1.7.0
-DEPRECATED-USE: HTML.Doctype
---DESCRIPTION--
-Determines whether or not output is XHTML 1.0 or HTML 4.01 flavor.
---ALIASES--
-Core.XHTML
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt
deleted file mode 100644
index 2a1370470..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Output.CommentScriptContents
-TYPE: bool
-VERSION: 2.0.0
-DEFAULT: true
---DESCRIPTION--
-Determines whether or not HTML Purifier should attempt to fix up the
-contents of script tags for legacy browsers with comments.
---ALIASES--
-Core.CommentScriptContents
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FixInnerHTML.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FixInnerHTML.txt
deleted file mode 100644
index d215ba2d3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FixInnerHTML.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Output.FixInnerHTML
-TYPE: bool
-VERSION: 4.3.0
-DEFAULT: true
---DESCRIPTION--
-<p>
-  If true, HTML Purifier will protect against Internet Explorer's
-  mishandling of the <code>innerHTML</code> attribute by appending
-  a space to any attribute that does not contain angled brackets, spaces
-  or quotes, but contains a backtick.  This slightly changes the
-  semantics of any given attribute, so if this is unacceptable and
-  you do not use <code>innerHTML</code> on any of your pages, you can
-  turn this directive off.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt
deleted file mode 100644
index e58f91aa8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.FlashCompat.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Output.FlashCompat
-TYPE: bool
-VERSION: 4.1.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-  If true, HTML Purifier will generate Internet Explorer compatibility
-  code for all object code.  This is highly recommended if you enable
-  %HTML.SafeObject.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt
deleted file mode 100644
index 4bb902523..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Output.Newline
-TYPE: string/null
-VERSION: 2.0.1
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    Newline string to format final output with. If left null, HTML Purifier
-    will auto-detect the default newline type of the system and use that;
-    you can manually override it here. Remember, \r\n is Windows, \r
-    is Mac, and \n is Unix.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt
deleted file mode 100644
index 322310651..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Output.SortAttr
-TYPE: bool
-VERSION: 3.2.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-  If true, HTML Purifier will sort attributes by name before writing them back
-  to the document, converting a tag like: <code>&lt;el b="" a="" c="" /&gt;</code>
-  to <code>&lt;el a="" b="" c="" /&gt;</code>. This is a workaround for
-  a bug in FCKeditor which causes it to swap attributes order, adding noise
-  to text diffs. If you're not seeing this bug, chances are, you don't need
-  this directive.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt
deleted file mode 100644
index 23dd4d3d5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Output.TidyFormat
-TYPE: bool
-VERSION: 1.1.1
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Determines whether or not to run Tidy on the final output for pretty
-    formatting reasons, such as indentation and wrap.
-</p>
-<p>
-    This can greatly improve readability for editors who are hand-editing
-    the HTML, but is by no means necessary as HTML Purifier has already
-    fixed all major errors the HTML may have had. Tidy is a non-default
-    extension, and this directive will silently fail if Tidy is not
-    available.
-</p>
-<p>
-    If you are looking to make the overall look of your page's source
-    better, I recommend running Tidy on the entire page rather than just
-    user-content (after all, the indentation relative to the containing
-    blocks will be incorrect).
-</p>
---ALIASES--
-Core.TidyFormat
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt
deleted file mode 100644
index d1820cdbd..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Test.ForceNoIconv
-TYPE: bool
-DEFAULT: false
---DESCRIPTION--
-When set to true, HTMLPurifier_Encoder will act as if iconv does not exist
-and use only pure PHP implementations.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt
deleted file mode 100644
index 0b0533a77..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-URI.AllowedSchemes
-TYPE: lookup
---DEFAULT--
-array (
-  'http' => true,
-  'https' => true,
-  'mailto' => true,
-  'ftp' => true,
-  'nntp' => true,
-  'news' => true,
-  'tel' => true,
-)
---DESCRIPTION--
-Whitelist that defines the schemes that a URI is allowed to have.  This
-prevents XSS attacks from using pseudo-schemes like javascript or mocha.
-There is also support for the <code>data</code> and <code>file</code>
-URI schemes, but they are not enabled by default.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Base.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Base.txt
deleted file mode 100644
index ba4730808..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Base.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-URI.Base
-TYPE: string/null
-VERSION: 2.1.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    The base URI is the URI of the document this purified HTML will be
-    inserted into.  This information is important if HTML Purifier needs
-    to calculate absolute URIs from relative URIs, such as when %URI.MakeAbsolute
-    is on.  You may use a non-absolute URI for this value, but behavior
-    may vary (%URI.MakeAbsolute deals nicely with both absolute and
-    relative paths, but forwards-compatibility is not guaranteed).
-    <strong>Warning:</strong> If set, the scheme on this URI
-    overrides the one specified by %URI.DefaultScheme.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt
deleted file mode 100644
index 981e44325..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-URI.DefaultScheme
-TYPE: string/null
-DEFAULT: 'http'
---DESCRIPTION--
-
-<p>
-    Defines through what scheme the output will be served, in order to
-    select the proper object validator when no scheme information is present.
-</p>
-
-<p>
-    Starting with HTML Purifier 4.9.0, the default scheme can be null, in
-    which case we reject all URIs which do not have explicit schemes.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt
deleted file mode 100644
index 523204c08..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-URI.DefinitionID
-TYPE: string/null
-VERSION: 2.1.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    Unique identifier for a custom-built URI definition. If you  want
-    to add custom URIFilters, you must specify this value.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt
deleted file mode 100644
index a9c07b1a3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-URI.DefinitionRev
-TYPE: int
-VERSION: 2.1.0
-DEFAULT: 1
---DESCRIPTION--
-
-<p>
-    Revision identifier for your custom definition. See
-    %HTML.DefinitionRev for details.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt
deleted file mode 100644
index b19ca1d5b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-URI.Disable
-TYPE: bool
-VERSION: 1.3.0
-DEFAULT: false
---DESCRIPTION--
-
-<p>
-    Disables all URIs in all forms. Not sure why you'd want to do that
-    (after all, the Internet's founded on the notion of a hyperlink).
-</p>
-
---ALIASES--
-Attr.DisableURI
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt
deleted file mode 100644
index 9132ea4f5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-URI.DisableExternal
-TYPE: bool
-VERSION: 1.2.0
-DEFAULT: false
---DESCRIPTION--
-Disables links to external websites.  This is a highly effective anti-spam
-and anti-pagerank-leech measure, but comes at a hefty price: nolinks or
-images outside of your domain will be allowed.  Non-linkified URIs will
-still be preserved.  If you want to be able to link to subdomains or use
-absolute URIs, specify %URI.Host for your website.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt
deleted file mode 100644
index d74bc1e3d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-URI.DisableExternalResources
-TYPE: bool
-VERSION: 1.3.0
-DEFAULT: false
---DESCRIPTION--
-Disables the embedding of external resources, preventing users from
-embedding things like images from other hosts. This prevents access
-tracking (good for email viewers), bandwidth leeching, cross-site request
-forging, goatse.cx posting, and other nasties, but also results in a loss
-of end-user functionality (they can't directly post a pic they posted from
-Flickr anymore). Use it if you don't have a robust user-content moderation
-team.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt
deleted file mode 100644
index 6c106144a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-URI.DisableResources
-TYPE: bool
-VERSION: 4.2.0
-DEFAULT: false
---DESCRIPTION--
-<p>
-    Disables embedding resources, essentially meaning no pictures. You can
-    still link to them though. See %URI.DisableExternalResources for why
-    this might be a good idea.
-</p>
-<p>
-    <em>Note:</em> While this directive has been available since 1.3.0,
-    it didn't actually start doing anything until 4.2.0.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Host.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Host.txt
deleted file mode 100644
index ba0e6bce1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Host.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-URI.Host
-TYPE: string/null
-VERSION: 1.2.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    Defines the domain name of the server, so we can determine whether or
-    an absolute URI is from your website or not.  Not strictly necessary,
-    as users should be using relative URIs to reference resources on your
-    website.  It will, however, let you use absolute URIs to link to
-    subdomains of the domain you post here: i.e. example.com will allow
-    sub.example.com.  However, higher up domains will still be excluded:
-    if you set %URI.Host to sub.example.com, example.com will be blocked.
-    <strong>Note:</strong> This directive overrides %URI.Base because
-    a given page may be on a sub-domain, but you wish HTML Purifier to be
-    more relaxed and allow some of the parent domains too.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt
deleted file mode 100644
index 825fef276..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-URI.HostBlacklist
-TYPE: list
-VERSION: 1.3.0
-DEFAULT: array()
---DESCRIPTION--
-List of strings that are forbidden in the host of any URI. Use it to kill
-domain names of spam, etc. Note that it will catch anything in the domain,
-so <tt>moo.com</tt> will catch <tt>moo.com.example.com</tt>.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt
deleted file mode 100644
index eb58c7f1a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-URI.MakeAbsolute
-TYPE: bool
-VERSION: 2.1.0
-DEFAULT: false
---DESCRIPTION--
-
-<p>
-    Converts all URIs into absolute forms. This is useful when the HTML
-    being filtered assumes a specific base path, but will actually be
-    viewed in a different context (and setting an alternate base URI is
-    not possible). %URI.Base must be set for this directive to work.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt
deleted file mode 100644
index bedd610d6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-URI.Munge
-TYPE: string/null
-VERSION: 1.3.0
-DEFAULT: NULL
---DESCRIPTION--
-
-<p>
-    Munges all browsable (usually http, https and ftp)
-    absolute URIs into another URI, usually a URI redirection service.
-    This directive accepts a URI, formatted with a <code>%s</code> where
-    the url-encoded original URI should be inserted (sample:
-    <code>http://www.google.com/url?q=%s</code>).
-</p>
-<p>
-    Uses for this directive:
-</p>
-<ul>
-    <li>
-        Prevent PageRank leaks, while being fairly transparent
-        to users (you may also want to add some client side JavaScript to
-        override the text in the statusbar). <strong>Notice</strong>:
-        Many security experts believe that this form of protection does not deter spam-bots.
-    </li>
-    <li>
-        Redirect users to a splash page telling them they are leaving your
-        website. While this is poor usability practice, it is often mandated
-        in corporate environments.
-    </li>
-</ul>
-<p>
-    Prior to HTML Purifier 3.1.1, this directive also enabled the munging
-    of browsable external resources, which could break things if your redirection
-    script was a splash page or used <code>meta</code> tags. To revert to
-    previous behavior, please use %URI.MungeResources.
-</p>
-<p>
-    You may want to also use %URI.MungeSecretKey along with this directive
-    in order to enforce what URIs your redirector script allows. Open
-    redirector scripts can be a security risk and negatively affect the
-    reputation of your domain name.
-</p>
-<p>
-    Starting with HTML Purifier 3.1.1, there is also these substitutions:
-</p>
-<table>
-    <thead>
-        <tr>
-            <th>Key</th>
-            <th>Description</th>
-            <th>Example <code>&lt;a href=""&gt;</code></th>
-        </tr>
-    </thead>
-    <tbody>
-        <tr>
-            <td>%r</td>
-            <td>1 - The URI embeds a resource<br />(blank) - The URI is merely a link</td>
-            <td></td>
-        </tr>
-        <tr>
-            <td>%n</td>
-            <td>The name of the tag this URI came from</td>
-            <td>a</td>
-        </tr>
-        <tr>
-            <td>%m</td>
-            <td>The name of the attribute this URI came from</td>
-            <td>href</td>
-        </tr>
-        <tr>
-            <td>%p</td>
-            <td>The name of the CSS property this URI came from, or blank if irrelevant</td>
-            <td></td>
-        </tr>
-    </tbody>
-</table>
-<p>
-    Admittedly, these letters are somewhat arbitrary; the only stipulation
-    was that they couldn't be a through f. r is for resource (I would have preferred
-    e, but you take what you can get), n is for name, m
-    was picked because it came after n (and I couldn't use a), p is for
-    property.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt
deleted file mode 100644
index ed4b5b0d0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-URI.MungeResources
-TYPE: bool
-VERSION: 3.1.1
-DEFAULT: false
---DESCRIPTION--
-<p>
-    If true, any URI munging directives like %URI.Munge
-    will also apply to embedded resources, such as <code>&lt;img src=""&gt;</code>.
-    Be careful enabling this directive if you have a redirector script
-    that does not use the <code>Location</code> HTTP header; all of your images
-    and other embedded resources will break.
-</p>
-<p>
-    <strong>Warning:</strong> It is strongly advised you use this in conjunction
-    %URI.MungeSecretKey to mitigate the security risk of an open redirector.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt
deleted file mode 100644
index 123b6e26b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-URI.MungeSecretKey
-TYPE: string/null
-VERSION: 3.1.1
-DEFAULT: NULL
---DESCRIPTION--
-<p>
-    This directive enables secure checksum generation along with %URI.Munge.
-    It should be set to a secure key that is not shared with anyone else.
-    The checksum can be placed in the URI using %t. Use of this checksum
-    affords an additional level of protection by allowing a redirector
-    to check if a URI has passed through HTML Purifier with this line:
-</p>
-
-<pre>$checksum === hash_hmac("sha256", $url, $secret_key)</pre>
-
-<p>
-    If the output is TRUE, the redirector script should accept the URI.
-</p>
-
-<p>
-    Please note that it would still be possible for an attacker to procure
-    secure hashes en-mass by abusing your website's Preview feature or the
-    like, but this service affords an additional level of protection
-    that should be combined with website blacklisting.
-</p>
-
-<p>
-    Remember this has no effect if %URI.Munge is not on.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt
deleted file mode 100644
index 8b387dea3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-URI.OverrideAllowedSchemes
-TYPE: bool
-DEFAULT: true
---DESCRIPTION--
-If this is set to true (which it is by default), you can override
-%URI.AllowedSchemes by simply registering a HTMLPurifier_URIScheme to the
-registry.  If false, you will also have to update that directive in order
-to add more schemes.
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeRegexp.txt b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeRegexp.txt
deleted file mode 100644
index 7e1f227f7..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/URI.SafeIframeRegexp.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-URI.SafeIframeRegexp
-TYPE: string/null
-VERSION: 4.4.0
-DEFAULT: NULL
---DESCRIPTION--
-<p>
-    A PCRE regular expression that will be matched against an iframe URI.  This is
-    a relatively inflexible scheme, but works well enough for the most common
-    use-case of iframes: embedded video.  This directive only has an effect if
-    %HTML.SafeIframe is enabled.  Here are some example values:
-</p>
-<ul>
-    <li><code>%^http://www.youtube.com/embed/%</code> - Allow YouTube videos</li>
-    <li><code>%^http://player.vimeo.com/video/%</code> - Allow Vimeo videos</li>
-    <li><code>%^http://(www.youtube.com/embed/|player.vimeo.com/video/)%</code> - Allow both</li>
-</ul>
-<p>
-    Note that this directive does not give you enough granularity to, say, disable
-    all <code>autoplay</code> videos.  Pipe up on the HTML Purifier forums if this
-    is a capability you want.
-</p>
---# vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/info.ini b/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/info.ini
deleted file mode 100644
index 58e0ce4a1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ConfigSchema/schema/info.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-name = "HTML Purifier"
-
-; vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ContentSets.php b/libraries/htmlpurifier410/library/HTMLPurifier/ContentSets.php
deleted file mode 100644
index f68b19631..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ContentSets.php
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-
-/**
- * @todo Unit test
- */
-class HTMLPurifier_ContentSets
-{
-
-    /**
-     * List of content set strings (pipe separators) indexed by name.
-     * @type array
-     */
-    public $info = array();
-
-    /**
-     * List of content set lookups (element => true) indexed by name.
-     * @type array
-     * @note This is in HTMLPurifier_HTMLDefinition->info_content_sets
-     */
-    public $lookup = array();
-
-    /**
-     * Synchronized list of defined content sets (keys of info).
-     * @type array
-     */
-    protected $keys = array();
-    /**
-     * Synchronized list of defined content values (values of info).
-     * @type array
-     */
-    protected $values = array();
-
-    /**
-     * Merges in module's content sets, expands identifiers in the content
-     * sets and populates the keys, values and lookup member variables.
-     * @param HTMLPurifier_HTMLModule[] $modules List of HTMLPurifier_HTMLModule
-     */
-    public function __construct($modules)
-    {
-        if (!is_array($modules)) {
-            $modules = array($modules);
-        }
-        // populate content_sets based on module hints
-        // sorry, no way of overloading
-        foreach ($modules as $module) {
-            foreach ($module->content_sets as $key => $value) {
-                $temp = $this->convertToLookup($value);
-                if (isset($this->lookup[$key])) {
-                    // add it into the existing content set
-                    $this->lookup[$key] = array_merge($this->lookup[$key], $temp);
-                } else {
-                    $this->lookup[$key] = $temp;
-                }
-            }
-        }
-        $old_lookup = false;
-        while ($old_lookup !== $this->lookup) {
-            $old_lookup = $this->lookup;
-            foreach ($this->lookup as $i => $set) {
-                $add = array();
-                foreach ($set as $element => $x) {
-                    if (isset($this->lookup[$element])) {
-                        $add += $this->lookup[$element];
-                        unset($this->lookup[$i][$element]);
-                    }
-                }
-                $this->lookup[$i] += $add;
-            }
-        }
-
-        foreach ($this->lookup as $key => $lookup) {
-            $this->info[$key] = implode(' | ', array_keys($lookup));
-        }
-        $this->keys   = array_keys($this->info);
-        $this->values = array_values($this->info);
-    }
-
-    /**
-     * Accepts a definition; generates and assigns a ChildDef for it
-     * @param HTMLPurifier_ElementDef $def HTMLPurifier_ElementDef reference
-     * @param HTMLPurifier_HTMLModule $module Module that defined the ElementDef
-     */
-    public function generateChildDef(&$def, $module)
-    {
-        if (!empty($def->child)) { // already done!
-            return;
-        }
-        $content_model = $def->content_model;
-        if (is_string($content_model)) {
-            // Assume that $this->keys is alphanumeric
-            $def->content_model = preg_replace_callback(
-                '/\b(' . implode('|', $this->keys) . ')\b/',
-                array($this, 'generateChildDefCallback'),
-                $content_model
-            );
-            //$def->content_model = str_replace(
-            //    $this->keys, $this->values, $content_model);
-        }
-        $def->child = $this->getChildDef($def, $module);
-    }
-
-    public function generateChildDefCallback($matches)
-    {
-        return $this->info[$matches[0]];
-    }
-
-    /**
-     * Instantiates a ChildDef based on content_model and content_model_type
-     * member variables in HTMLPurifier_ElementDef
-     * @note This will also defer to modules for custom HTMLPurifier_ChildDef
-     *       subclasses that need content set expansion
-     * @param HTMLPurifier_ElementDef $def HTMLPurifier_ElementDef to have ChildDef extracted
-     * @param HTMLPurifier_HTMLModule $module Module that defined the ElementDef
-     * @return HTMLPurifier_ChildDef corresponding to ElementDef
-     */
-    public function getChildDef($def, $module)
-    {
-        $value = $def->content_model;
-        if (is_object($value)) {
-            trigger_error(
-                'Literal object child definitions should be stored in '.
-                'ElementDef->child not ElementDef->content_model',
-                E_USER_NOTICE
-            );
-            return $value;
-        }
-        switch ($def->content_model_type) {
-            case 'required':
-                return new HTMLPurifier_ChildDef_Required($value);
-            case 'optional':
-                return new HTMLPurifier_ChildDef_Optional($value);
-            case 'empty':
-                return new HTMLPurifier_ChildDef_Empty();
-            case 'custom':
-                return new HTMLPurifier_ChildDef_Custom($value);
-        }
-        // defer to its module
-        $return = false;
-        if ($module->defines_child_def) { // save a func call
-            $return = $module->getChildDef($def);
-        }
-        if ($return !== false) {
-            return $return;
-        }
-        // error-out
-        trigger_error(
-            'Could not determine which ChildDef class to instantiate',
-            E_USER_ERROR
-        );
-        return false;
-    }
-
-    /**
-     * Converts a string list of elements separated by pipes into
-     * a lookup array.
-     * @param string $string List of elements
-     * @return array Lookup array of elements
-     */
-    protected function convertToLookup($string)
-    {
-        $array = explode('|', str_replace(' ', '', $string));
-        $ret = array();
-        foreach ($array as $k) {
-            $ret[$k] = true;
-        }
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Context.php b/libraries/htmlpurifier410/library/HTMLPurifier/Context.php
deleted file mode 100644
index 5ad536d51..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Context.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-
-/**
- * Registry object that contains information about the current context.
- * @warning Is a bit buggy when variables are set to null: it thinks
- *          they don't exist! So use false instead, please.
- * @note Since the variables Context deals with may not be objects,
- *       references are very important here! Do not remove!
- */
-class HTMLPurifier_Context
-{
-
-    /**
-     * Private array that stores the references.
-     * @type array
-     */
-    private $_storage = array();
-
-    /**
-     * Registers a variable into the context.
-     * @param string $name String name
-     * @param mixed $ref Reference to variable to be registered
-     */
-    public function register($name, &$ref)
-    {
-        if (array_key_exists($name, $this->_storage)) {
-            trigger_error(
-                "Name $name produces collision, cannot re-register",
-                E_USER_ERROR
-            );
-            return;
-        }
-        $this->_storage[$name] =& $ref;
-    }
-
-    /**
-     * Retrieves a variable reference from the context.
-     * @param string $name String name
-     * @param bool $ignore_error Boolean whether or not to ignore error
-     * @return mixed
-     */
-    public function &get($name, $ignore_error = false)
-    {
-        if (!array_key_exists($name, $this->_storage)) {
-            if (!$ignore_error) {
-                trigger_error(
-                    "Attempted to retrieve non-existent variable $name",
-                    E_USER_ERROR
-                );
-            }
-            $var = null; // so we can return by reference
-            return $var;
-        }
-        return $this->_storage[$name];
-    }
-
-    /**
-     * Destroys a variable in the context.
-     * @param string $name String name
-     */
-    public function destroy($name)
-    {
-        if (!array_key_exists($name, $this->_storage)) {
-            trigger_error(
-                "Attempted to destroy non-existent variable $name",
-                E_USER_ERROR
-            );
-            return;
-        }
-        unset($this->_storage[$name]);
-    }
-
-    /**
-     * Checks whether or not the variable exists.
-     * @param string $name String name
-     * @return bool
-     */
-    public function exists($name)
-    {
-        return array_key_exists($name, $this->_storage);
-    }
-
-    /**
-     * Loads a series of variables from an associative array
-     * @param array $context_array Assoc array of variables to load
-     */
-    public function loadArray($context_array)
-    {
-        foreach ($context_array as $key => $discard) {
-            $this->register($key, $context_array[$key]);
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Definition.php b/libraries/htmlpurifier410/library/HTMLPurifier/Definition.php
deleted file mode 100644
index f987e6035..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Definition.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * Super-class for definition datatype objects, implements serialization
- * functions for the class.
- */
-abstract class HTMLPurifier_Definition
-{
-
-    /**
-     * Has setup() been called yet?
-     * @type bool
-     */
-    public $setup = false;
-
-    /**
-     * If true, write out the final definition object to the cache after
-     * setup.  This will be true only if all invocations to get a raw
-     * definition object are also optimized.  This does not cause file
-     * system thrashing because on subsequent calls the cached object
-     * is used and any writes to the raw definition object are short
-     * circuited.  See enduser-customize.html for the high-level
-     * picture.
-     * @type bool
-     */
-    public $optimized = null;
-
-    /**
-     * What type of definition is it?
-     * @type string
-     */
-    public $type;
-
-    /**
-     * Sets up the definition object into the final form, something
-     * not done by the constructor
-     * @param HTMLPurifier_Config $config
-     */
-    abstract protected function doSetup($config);
-
-    /**
-     * Setup function that aborts if already setup
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        if ($this->setup) {
-            return;
-        }
-        $this->setup = true;
-        $this->doSetup($config);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache.php
deleted file mode 100644
index 72448d03f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-/**
- * Abstract class representing Definition cache managers that implements
- * useful common methods and is a factory.
- * @todo Create a separate maintenance file advanced users can use to
- *       cache their custom HTMLDefinition, which can be loaded
- *       via a configuration directive
- * @todo Implement memcached
- */
-abstract class HTMLPurifier_DefinitionCache
-{
-    /**
-     * @type string
-     */
-    public $type;
-
-    /**
-     * @param string $type Type of definition objects this instance of the
-     *      cache will handle.
-     */
-    public function __construct($type)
-    {
-        $this->type = $type;
-    }
-
-    /**
-     * Generates a unique identifier for a particular configuration
-     * @param HTMLPurifier_Config $config Instance of HTMLPurifier_Config
-     * @return string
-     */
-    public function generateKey($config)
-    {
-        return $config->version . ',' . // possibly replace with function calls
-               $config->getBatchSerial($this->type) . ',' .
-               $config->get($this->type . '.DefinitionRev');
-    }
-
-    /**
-     * Tests whether or not a key is old with respect to the configuration's
-     * version and revision number.
-     * @param string $key Key to test
-     * @param HTMLPurifier_Config $config Instance of HTMLPurifier_Config to test against
-     * @return bool
-     */
-    public function isOld($key, $config)
-    {
-        if (substr_count($key, ',') < 2) {
-            return true;
-        }
-        list($version, $hash, $revision) = explode(',', $key, 3);
-        $compare = version_compare($version, $config->version);
-        // version mismatch, is always old
-        if ($compare != 0) {
-            return true;
-        }
-        // versions match, ids match, check revision number
-        if ($hash == $config->getBatchSerial($this->type) &&
-            $revision < $config->get($this->type . '.DefinitionRev')) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Checks if a definition's type jives with the cache's type
-     * @note Throws an error on failure
-     * @param HTMLPurifier_Definition $def Definition object to check
-     * @return bool true if good, false if not
-     */
-    public function checkDefType($def)
-    {
-        if ($def->type !== $this->type) {
-            trigger_error("Cannot use definition of type {$def->type} in cache for {$this->type}");
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Adds a definition object to the cache
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function add($def, $config);
-
-    /**
-     * Unconditionally saves a definition object to the cache
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function set($def, $config);
-
-    /**
-     * Replace an object in the cache
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function replace($def, $config);
-
-    /**
-     * Retrieves a definition object from the cache
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function get($config);
-
-    /**
-     * Removes a definition object to the cache
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function remove($config);
-
-    /**
-     * Clears all objects from cache
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function flush($config);
-
-    /**
-     * Clears all expired (older version or revision) objects from cache
-     * @note Be careful implementing this method as flush. Flush must
-     *       not interfere with other Definition types, and cleanup()
-     *       should not be repeatedly called by userland code.
-     * @param HTMLPurifier_Config $config
-     */
-    abstract public function cleanup($config);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator.php
deleted file mode 100644
index 09cdc1c82..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCache
-{
-
-    /**
-     * Cache object we are decorating
-     * @type HTMLPurifier_DefinitionCache
-     */
-    public $cache;
-
-    /**
-     * The name of the decorator
-     * @var string
-     */
-    public $name;
-
-    public function __construct()
-    {
-    }
-
-    /**
-     * Lazy decorator function
-     * @param HTMLPurifier_DefinitionCache $cache Reference to cache object to decorate
-     * @return HTMLPurifier_DefinitionCache_Decorator
-     */
-    public function decorate(&$cache)
-    {
-        $decorator = $this->copy();
-        // reference is necessary for mocks in PHP 4
-        $decorator->cache =& $cache;
-        $decorator->type = $cache->type;
-        return $decorator;
-    }
-
-    /**
-     * Cross-compatible clone substitute
-     * @return HTMLPurifier_DefinitionCache_Decorator
-     */
-    public function copy()
-    {
-        return new HTMLPurifier_DefinitionCache_Decorator();
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function add($def, $config)
-    {
-        return $this->cache->add($def, $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function set($def, $config)
-    {
-        return $this->cache->set($def, $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function replace($def, $config)
-    {
-        return $this->cache->replace($def, $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function get($config)
-    {
-        return $this->cache->get($config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function remove($config)
-    {
-        return $this->cache->remove($config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function flush($config)
-    {
-        return $this->cache->flush($config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function cleanup($config)
-    {
-        return $this->cache->cleanup($config);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php
deleted file mode 100644
index 53dca67dc..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * Definition cache decorator class that cleans up the cache
- * whenever there is a cache miss.
- */
-class HTMLPurifier_DefinitionCache_Decorator_Cleanup extends HTMLPurifier_DefinitionCache_Decorator
-{
-    /**
-     * @type string
-     */
-    public $name = 'Cleanup';
-
-    /**
-     * @return HTMLPurifier_DefinitionCache_Decorator_Cleanup
-     */
-    public function copy()
-    {
-        return new HTMLPurifier_DefinitionCache_Decorator_Cleanup();
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function add($def, $config)
-    {
-        $status = parent::add($def, $config);
-        if (!$status) {
-            parent::cleanup($config);
-        }
-        return $status;
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function set($def, $config)
-    {
-        $status = parent::set($def, $config);
-        if (!$status) {
-            parent::cleanup($config);
-        }
-        return $status;
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function replace($def, $config)
-    {
-        $status = parent::replace($def, $config);
-        if (!$status) {
-            parent::cleanup($config);
-        }
-        return $status;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function get($config)
-    {
-        $ret = parent::get($config);
-        if (!$ret) {
-            parent::cleanup($config);
-        }
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Memory.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Memory.php
deleted file mode 100644
index 1725d8303..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Memory.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-/**
- * Definition cache decorator class that saves all cache retrievals
- * to PHP's memory; good for unit tests or circumstances where
- * there are lots of configuration objects floating around.
- */
-class HTMLPurifier_DefinitionCache_Decorator_Memory extends HTMLPurifier_DefinitionCache_Decorator
-{
-    /**
-     * @type array
-     */
-    protected $definitions;
-
-    /**
-     * @type string
-     */
-    public $name = 'Memory';
-
-    /**
-     * @return HTMLPurifier_DefinitionCache_Decorator_Memory
-     */
-    public function copy()
-    {
-        return new HTMLPurifier_DefinitionCache_Decorator_Memory();
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function add($def, $config)
-    {
-        $status = parent::add($def, $config);
-        if ($status) {
-            $this->definitions[$this->generateKey($config)] = $def;
-        }
-        return $status;
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function set($def, $config)
-    {
-        $status = parent::set($def, $config);
-        if ($status) {
-            $this->definitions[$this->generateKey($config)] = $def;
-        }
-        return $status;
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function replace($def, $config)
-    {
-        $status = parent::replace($def, $config);
-        if ($status) {
-            $this->definitions[$this->generateKey($config)] = $def;
-        }
-        return $status;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function get($config)
-    {
-        $key = $this->generateKey($config);
-        if (isset($this->definitions[$key])) {
-            return $this->definitions[$key];
-        }
-        $this->definitions[$key] = parent::get($config);
-        return $this->definitions[$key];
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Template.php.in b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Template.php.in
deleted file mode 100644
index c586890fb..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Decorator/Template.php.in
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-
-require_once 'HTMLPurifier/DefinitionCache/Decorator.php';
-
-/**
- * Definition cache decorator template.
- */
-class HTMLPurifier_DefinitionCache_Decorator_Template extends HTMLPurifier_DefinitionCache_Decorator
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Template'; // replace this
-
-    public function copy()
-    {
-        // replace class name with yours
-        return new HTMLPurifier_DefinitionCache_Decorator_Template();
-    }
-
-    // remove methods you don't need
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function add($def, $config)
-    {
-        return parent::add($def, $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function set($def, $config)
-    {
-        return parent::set($def, $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function replace($def, $config)
-    {
-        return parent::replace($def, $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function get($config)
-    {
-        return parent::get($config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function flush($config)
-    {
-        return parent::flush($config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return mixed
-     */
-    public function cleanup($config)
-    {
-        return parent::cleanup($config);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Null.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Null.php
deleted file mode 100644
index 55eff9e03..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Null.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * Null cache object to use when no caching is on.
- */
-class HTMLPurifier_DefinitionCache_Null extends HTMLPurifier_DefinitionCache
-{
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function add($def, $config)
-    {
-        return false;
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function set($def, $config)
-    {
-        return false;
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function replace($def, $config)
-    {
-        return false;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function remove($config)
-    {
-        return false;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function get($config)
-    {
-        return false;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function flush($config)
-    {
-        return false;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function cleanup($config)
-    {
-        return false;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer.php
deleted file mode 100644
index 22b50b5ad..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer.php
+++ /dev/null
@@ -1,311 +0,0 @@
-<?php
-
-class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCache
-{
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return int|bool
-     */
-    public function add($def, $config)
-    {
-        if (!$this->checkDefType($def)) {
-            return;
-        }
-        $file = $this->generateFilePath($config);
-        if (file_exists($file)) {
-            return false;
-        }
-        if (!$this->_prepareDir($config)) {
-            return false;
-        }
-        return $this->_write($file, serialize($def), $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return int|bool
-     */
-    public function set($def, $config)
-    {
-        if (!$this->checkDefType($def)) {
-            return;
-        }
-        $file = $this->generateFilePath($config);
-        if (!$this->_prepareDir($config)) {
-            return false;
-        }
-        return $this->_write($file, serialize($def), $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Definition $def
-     * @param HTMLPurifier_Config $config
-     * @return int|bool
-     */
-    public function replace($def, $config)
-    {
-        if (!$this->checkDefType($def)) {
-            return;
-        }
-        $file = $this->generateFilePath($config);
-        if (!file_exists($file)) {
-            return false;
-        }
-        if (!$this->_prepareDir($config)) {
-            return false;
-        }
-        return $this->_write($file, serialize($def), $config);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool|HTMLPurifier_Config
-     */
-    public function get($config)
-    {
-        $file = $this->generateFilePath($config);
-        if (!file_exists($file)) {
-            return false;
-        }
-        return unserialize(file_get_contents($file));
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function remove($config)
-    {
-        $file = $this->generateFilePath($config);
-        if (!file_exists($file)) {
-            return false;
-        }
-        return unlink($file);
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function flush($config)
-    {
-        if (!$this->_prepareDir($config)) {
-            return false;
-        }
-        $dir = $this->generateDirectoryPath($config);
-        $dh = opendir($dir);
-        // Apparently, on some versions of PHP, readdir will return
-        // an empty string if you pass an invalid argument to readdir.
-        // So you need this test.  See #49.
-        if (false === $dh) {
-            return false;
-        }
-        while (false !== ($filename = readdir($dh))) {
-            if (empty($filename)) {
-                continue;
-            }
-            if ($filename[0] === '.') {
-                continue;
-            }
-            unlink($dir . '/' . $filename);
-        }
-        closedir($dh);
-        return true;
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function cleanup($config)
-    {
-        if (!$this->_prepareDir($config)) {
-            return false;
-        }
-        $dir = $this->generateDirectoryPath($config);
-        $dh = opendir($dir);
-        // See #49 (and above).
-        if (false === $dh) {
-            return false;
-        }
-        while (false !== ($filename = readdir($dh))) {
-            if (empty($filename)) {
-                continue;
-            }
-            if ($filename[0] === '.') {
-                continue;
-            }
-            $key = substr($filename, 0, strlen($filename) - 4);
-            if ($this->isOld($key, $config)) {
-                unlink($dir . '/' . $filename);
-            }
-        }
-        closedir($dh);
-        return true;
-    }
-
-    /**
-     * Generates the file path to the serial file corresponding to
-     * the configuration and definition name
-     * @param HTMLPurifier_Config $config
-     * @return string
-     * @todo Make protected
-     */
-    public function generateFilePath($config)
-    {
-        $key = $this->generateKey($config);
-        return $this->generateDirectoryPath($config) . '/' . $key . '.ser';
-    }
-
-    /**
-     * Generates the path to the directory contain this cache's serial files
-     * @param HTMLPurifier_Config $config
-     * @return string
-     * @note No trailing slash
-     * @todo Make protected
-     */
-    public function generateDirectoryPath($config)
-    {
-        $base = $this->generateBaseDirectoryPath($config);
-        return $base . '/' . $this->type;
-    }
-
-    /**
-     * Generates path to base directory that contains all definition type
-     * serials
-     * @param HTMLPurifier_Config $config
-     * @return mixed|string
-     * @todo Make protected
-     */
-    public function generateBaseDirectoryPath($config)
-    {
-        $base = $config->get('Cache.SerializerPath');
-        $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base;
-        return $base;
-    }
-
-    /**
-     * Convenience wrapper function for file_put_contents
-     * @param string $file File name to write to
-     * @param string $data Data to write into file
-     * @param HTMLPurifier_Config $config
-     * @return int|bool Number of bytes written if success, or false if failure.
-     */
-    private function _write($file, $data, $config)
-    {
-        $result = file_put_contents($file, $data);
-        if ($result !== false) {
-            // set permissions of the new file (no execute)
-            $chmod = $config->get('Cache.SerializerPermissions');
-            if ($chmod !== null) {
-                chmod($file, $chmod & 0666);
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Prepares the directory that this type stores the serials in
-     * @param HTMLPurifier_Config $config
-     * @return bool True if successful
-     */
-    private function _prepareDir($config)
-    {
-        $directory = $this->generateDirectoryPath($config);
-        $chmod = $config->get('Cache.SerializerPermissions');
-        if ($chmod === null) {
-            if (!@mkdir($directory) && !is_dir($directory)) {
-                trigger_error(
-                    'Could not create directory ' . $directory . '',
-                    E_USER_WARNING
-                );
-                return false;
-            }
-            return true;
-        }
-        if (!is_dir($directory)) {
-            $base = $this->generateBaseDirectoryPath($config);
-            if (!is_dir($base)) {
-                trigger_error(
-                    'Base directory ' . $base . ' does not exist,
-                    please create or change using %Cache.SerializerPath',
-                    E_USER_WARNING
-                );
-                return false;
-            } elseif (!$this->_testPermissions($base, $chmod)) {
-                return false;
-            }
-            if (!@mkdir($directory, $chmod) && !is_dir($directory)) {
-                trigger_error(
-                    'Could not create directory ' . $directory . '',
-                    E_USER_WARNING
-                );
-                return false;
-            }
-            if (!$this->_testPermissions($directory, $chmod)) {
-                return false;
-            }
-        } elseif (!$this->_testPermissions($directory, $chmod)) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Tests permissions on a directory and throws out friendly
-     * error messages and attempts to chmod it itself if possible
-     * @param string $dir Directory path
-     * @param int $chmod Permissions
-     * @return bool True if directory is writable
-     */
-    private function _testPermissions($dir, $chmod)
-    {
-        // early abort, if it is writable, everything is hunky-dory
-        if (is_writable($dir)) {
-            return true;
-        }
-        if (!is_dir($dir)) {
-            // generally, you'll want to handle this beforehand
-            // so a more specific error message can be given
-            trigger_error(
-                'Directory ' . $dir . ' does not exist',
-                E_USER_WARNING
-            );
-            return false;
-        }
-        if (function_exists('posix_getuid') && $chmod !== null) {
-            // POSIX system, we can give more specific advice
-            if (fileowner($dir) === posix_getuid()) {
-                // we can chmod it ourselves
-                $chmod = $chmod | 0700;
-                if (chmod($dir, $chmod)) {
-                    return true;
-                }
-            } elseif (filegroup($dir) === posix_getgid()) {
-                $chmod = $chmod | 0070;
-            } else {
-                // PHP's probably running as nobody, so we'll
-                // need to give global permissions
-                $chmod = $chmod | 0777;
-            }
-            trigger_error(
-                'Directory ' . $dir . ' not writable, ' .
-                'please chmod to ' . decoct($chmod),
-                E_USER_WARNING
-            );
-        } else {
-            // generic error message
-            trigger_error(
-                'Directory ' . $dir . ' not writable, ' .
-                'please alter file permissions',
-                E_USER_WARNING
-            );
-        }
-        return false;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer/README b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer/README
deleted file mode 100644
index ba005de73..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCache/Serializer/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This is a dummy file to prevent Git from ignoring this empty directory.
-
-    vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCacheFactory.php b/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCacheFactory.php
deleted file mode 100644
index 737b8bb3b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DefinitionCacheFactory.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * Responsible for creating definition caches.
- */
-class HTMLPurifier_DefinitionCacheFactory
-{
-    /**
-     * @type array
-     */
-    protected $caches = array('Serializer' => array());
-
-    /**
-     * @type array
-     */
-    protected $implementations = array();
-
-    /**
-     * @type HTMLPurifier_DefinitionCache_Decorator[]
-     */
-    protected $decorators = array();
-
-    /**
-     * Initialize default decorators
-     */
-    public function setup()
-    {
-        $this->addDecorator('Cleanup');
-    }
-
-    /**
-     * Retrieves an instance of global definition cache factory.
-     * @param HTMLPurifier_DefinitionCacheFactory $prototype
-     * @return HTMLPurifier_DefinitionCacheFactory
-     */
-    public static function instance($prototype = null)
-    {
-        static $instance;
-        if ($prototype !== null) {
-            $instance = $prototype;
-        } elseif ($instance === null || $prototype === true) {
-            $instance = new HTMLPurifier_DefinitionCacheFactory();
-            $instance->setup();
-        }
-        return $instance;
-    }
-
-    /**
-     * Registers a new definition cache object
-     * @param string $short Short name of cache object, for reference
-     * @param string $long Full class name of cache object, for construction
-     */
-    public function register($short, $long)
-    {
-        $this->implementations[$short] = $long;
-    }
-
-    /**
-     * Factory method that creates a cache object based on configuration
-     * @param string $type Name of definitions handled by cache
-     * @param HTMLPurifier_Config $config Config instance
-     * @return mixed
-     */
-    public function create($type, $config)
-    {
-        $method = $config->get('Cache.DefinitionImpl');
-        if ($method === null) {
-            return new HTMLPurifier_DefinitionCache_Null($type);
-        }
-        if (!empty($this->caches[$method][$type])) {
-            return $this->caches[$method][$type];
-        }
-        if (isset($this->implementations[$method]) &&
-            class_exists($class = $this->implementations[$method], false)) {
-            $cache = new $class($type);
-        } else {
-            if ($method != 'Serializer') {
-                trigger_error("Unrecognized DefinitionCache $method, using Serializer instead", E_USER_WARNING);
-            }
-            $cache = new HTMLPurifier_DefinitionCache_Serializer($type);
-        }
-        foreach ($this->decorators as $decorator) {
-            $new_cache = $decorator->decorate($cache);
-            // prevent infinite recursion in PHP 4
-            unset($cache);
-            $cache = $new_cache;
-        }
-        $this->caches[$method][$type] = $cache;
-        return $this->caches[$method][$type];
-    }
-
-    /**
-     * Registers a decorator to add to all new cache objects
-     * @param HTMLPurifier_DefinitionCache_Decorator|string $decorator An instance or the name of a decorator
-     */
-    public function addDecorator($decorator)
-    {
-        if (is_string($decorator)) {
-            $class = "HTMLPurifier_DefinitionCache_Decorator_$decorator";
-            $decorator = new $class;
-        }
-        $this->decorators[$decorator->name] = $decorator;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Doctype.php b/libraries/htmlpurifier410/library/HTMLPurifier/Doctype.php
deleted file mode 100644
index 4d723129e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Doctype.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/**
- * Represents a document type, contains information on which modules
- * need to be loaded.
- * @note This class is inspected by Printer_HTMLDefinition->renderDoctype.
- *       If structure changes, please update that function.
- */
-class HTMLPurifier_Doctype
-{
-    /**
-     * Full name of doctype
-     * @type string
-     */
-    public $name;
-
-    /**
-     * List of standard modules (string identifiers or literal objects)
-     * that this doctype uses
-     * @type array
-     */
-    public $modules = array();
-
-    /**
-     * List of modules to use for tidying up code
-     * @type array
-     */
-    public $tidyModules = array();
-
-    /**
-     * Is the language derived from XML (i.e. XHTML)?
-     * @type bool
-     */
-    public $xml = true;
-
-    /**
-     * List of aliases for this doctype
-     * @type array
-     */
-    public $aliases = array();
-
-    /**
-     * Public DTD identifier
-     * @type string
-     */
-    public $dtdPublic;
-
-    /**
-     * System DTD identifier
-     * @type string
-     */
-    public $dtdSystem;
-
-    public function __construct(
-        $name = null,
-        $xml = true,
-        $modules = array(),
-        $tidyModules = array(),
-        $aliases = array(),
-        $dtd_public = null,
-        $dtd_system = null
-    ) {
-        $this->name         = $name;
-        $this->xml          = $xml;
-        $this->modules      = $modules;
-        $this->tidyModules  = $tidyModules;
-        $this->aliases      = $aliases;
-        $this->dtdPublic    = $dtd_public;
-        $this->dtdSystem    = $dtd_system;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/DoctypeRegistry.php b/libraries/htmlpurifier410/library/HTMLPurifier/DoctypeRegistry.php
deleted file mode 100644
index cab9dc536..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/DoctypeRegistry.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-
-class HTMLPurifier_DoctypeRegistry
-{
-
-    /**
-     * Hash of doctype names to doctype objects.
-     * @type array
-     */
-    protected $doctypes;
-
-    /**
-     * Lookup table of aliases to real doctype names.
-     * @type array
-     */
-    protected $aliases;
-
-    /**
-     * Registers a doctype to the registry
-     * @note Accepts a fully-formed doctype object, or the
-     *       parameters for constructing a doctype object
-     * @param string $doctype Name of doctype or literal doctype object
-     * @param bool $xml
-     * @param array $modules Modules doctype will load
-     * @param array $tidy_modules Modules doctype will load for certain modes
-     * @param array $aliases Alias names for doctype
-     * @param string $dtd_public
-     * @param string $dtd_system
-     * @return HTMLPurifier_Doctype Editable registered doctype
-     */
-    public function register(
-        $doctype,
-        $xml = true,
-        $modules = array(),
-        $tidy_modules = array(),
-        $aliases = array(),
-        $dtd_public = null,
-        $dtd_system = null
-    ) {
-        if (!is_array($modules)) {
-            $modules = array($modules);
-        }
-        if (!is_array($tidy_modules)) {
-            $tidy_modules = array($tidy_modules);
-        }
-        if (!is_array($aliases)) {
-            $aliases = array($aliases);
-        }
-        if (!is_object($doctype)) {
-            $doctype = new HTMLPurifier_Doctype(
-                $doctype,
-                $xml,
-                $modules,
-                $tidy_modules,
-                $aliases,
-                $dtd_public,
-                $dtd_system
-            );
-        }
-        $this->doctypes[$doctype->name] = $doctype;
-        $name = $doctype->name;
-        // hookup aliases
-        foreach ($doctype->aliases as $alias) {
-            if (isset($this->doctypes[$alias])) {
-                continue;
-            }
-            $this->aliases[$alias] = $name;
-        }
-        // remove old aliases
-        if (isset($this->aliases[$name])) {
-            unset($this->aliases[$name]);
-        }
-        return $doctype;
-    }
-
-    /**
-     * Retrieves reference to a doctype of a certain name
-     * @note This function resolves aliases
-     * @note When possible, use the more fully-featured make()
-     * @param string $doctype Name of doctype
-     * @return HTMLPurifier_Doctype Editable doctype object
-     */
-    public function get($doctype)
-    {
-        if (isset($this->aliases[$doctype])) {
-            $doctype = $this->aliases[$doctype];
-        }
-        if (!isset($this->doctypes[$doctype])) {
-            trigger_error('Doctype ' . htmlspecialchars($doctype) . ' does not exist', E_USER_ERROR);
-            $anon = new HTMLPurifier_Doctype($doctype);
-            return $anon;
-        }
-        return $this->doctypes[$doctype];
-    }
-
-    /**
-     * Creates a doctype based on a configuration object,
-     * will perform initialization on the doctype
-     * @note Use this function to get a copy of doctype that config
-     *       can hold on to (this is necessary in order to tell
-     *       Generator whether or not the current document is XML
-     *       based or not).
-     * @param HTMLPurifier_Config $config
-     * @return HTMLPurifier_Doctype
-     */
-    public function make($config)
-    {
-        return clone $this->get($this->getDoctypeFromConfig($config));
-    }
-
-    /**
-     * Retrieves the doctype from the configuration object
-     * @param HTMLPurifier_Config $config
-     * @return string
-     */
-    public function getDoctypeFromConfig($config)
-    {
-        // recommended test
-        $doctype = $config->get('HTML.Doctype');
-        if (!empty($doctype)) {
-            return $doctype;
-        }
-        $doctype = $config->get('HTML.CustomDoctype');
-        if (!empty($doctype)) {
-            return $doctype;
-        }
-        // backwards-compatibility
-        if ($config->get('HTML.XHTML')) {
-            $doctype = 'XHTML 1.0';
-        } else {
-            $doctype = 'HTML 4.01';
-        }
-        if ($config->get('HTML.Strict')) {
-            $doctype .= ' Strict';
-        } else {
-            $doctype .= ' Transitional';
-        }
-        return $doctype;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ElementDef.php b/libraries/htmlpurifier410/library/HTMLPurifier/ElementDef.php
deleted file mode 100644
index 089f7efe8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ElementDef.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-
-/**
- * Structure that stores an HTML element definition. Used by
- * HTMLPurifier_HTMLDefinition and HTMLPurifier_HTMLModule.
- * @note This class is inspected by HTMLPurifier_Printer_HTMLDefinition.
- *       Please update that class too.
- * @warning If you add new properties to this class, you MUST update
- *          the mergeIn() method.
- */
-class HTMLPurifier_ElementDef
-{
-    /**
-     * Does the definition work by itself, or is it created solely
-     * for the purpose of merging into another definition?
-     * @type bool
-     */
-    public $standalone = true;
-
-    /**
-     * Associative array of attribute name to HTMLPurifier_AttrDef.
-     * @type array
-     * @note Before being processed by HTMLPurifier_AttrCollections
-     *       when modules are finalized during
-     *       HTMLPurifier_HTMLDefinition->setup(), this array may also
-     *       contain an array at index 0 that indicates which attribute
-     *       collections to load into the full array. It may also
-     *       contain string indentifiers in lieu of HTMLPurifier_AttrDef,
-     *       see HTMLPurifier_AttrTypes on how they are expanded during
-     *       HTMLPurifier_HTMLDefinition->setup() processing.
-     */
-    public $attr = array();
-
-    // XXX: Design note: currently, it's not possible to override
-    // previously defined AttrTransforms without messing around with
-    // the final generated config. This is by design; a previous version
-    // used an associated list of attr_transform, but it was extremely
-    // easy to accidentally override other attribute transforms by
-    // forgetting to specify an index (and just using 0.)  While we
-    // could check this by checking the index number and complaining,
-    // there is a second problem which is that it is not at all easy to
-    // tell when something is getting overridden. Combine this with a
-    // codebase where this isn't really being used, and it's perfect for
-    // nuking.
-
-    /**
-     * List of tags HTMLPurifier_AttrTransform to be done before validation.
-     * @type array
-     */
-    public $attr_transform_pre = array();
-
-    /**
-     * List of tags HTMLPurifier_AttrTransform to be done after validation.
-     * @type array
-     */
-    public $attr_transform_post = array();
-
-    /**
-     * HTMLPurifier_ChildDef of this tag.
-     * @type HTMLPurifier_ChildDef
-     */
-    public $child;
-
-    /**
-     * Abstract string representation of internal ChildDef rules.
-     * @see HTMLPurifier_ContentSets for how this is parsed and then transformed
-     * into an HTMLPurifier_ChildDef.
-     * @warning This is a temporary variable that is not available after
-     *      being processed by HTMLDefinition
-     * @type string
-     */
-    public $content_model;
-
-    /**
-     * Value of $child->type, used to determine which ChildDef to use,
-     * used in combination with $content_model.
-     * @warning This must be lowercase
-     * @warning This is a temporary variable that is not available after
-     *      being processed by HTMLDefinition
-     * @type string
-     */
-    public $content_model_type;
-
-    /**
-     * Does the element have a content model (#PCDATA | Inline)*? This
-     * is important for chameleon ins and del processing in
-     * HTMLPurifier_ChildDef_Chameleon. Dynamically set: modules don't
-     * have to worry about this one.
-     * @type bool
-     */
-    public $descendants_are_inline = false;
-
-    /**
-     * List of the names of required attributes this element has.
-     * Dynamically populated by HTMLPurifier_HTMLDefinition::getElement()
-     * @type array
-     */
-    public $required_attr = array();
-
-    /**
-     * Lookup table of tags excluded from all descendants of this tag.
-     * @type array
-     * @note SGML permits exclusions for all descendants, but this is
-     *       not possible with DTDs or XML Schemas. W3C has elected to
-     *       use complicated compositions of content_models to simulate
-     *       exclusion for children, but we go the simpler, SGML-style
-     *       route of flat-out exclusions, which correctly apply to
-     *       all descendants and not just children. Note that the XHTML
-     *       Modularization Abstract Modules are blithely unaware of such
-     *       distinctions.
-     */
-    public $excludes = array();
-
-    /**
-     * This tag is explicitly auto-closed by the following tags.
-     * @type array
-     */
-    public $autoclose = array();
-
-    /**
-     * If a foreign element is found in this element, test if it is
-     * allowed by this sub-element; if it is, instead of closing the
-     * current element, place it inside this element.
-     * @type string
-     */
-    public $wrap;
-
-    /**
-     * Whether or not this is a formatting element affected by the
-     * "Active Formatting Elements" algorithm.
-     * @type bool
-     */
-    public $formatting;
-
-    /**
-     * Low-level factory constructor for creating new standalone element defs
-     */
-    public static function create($content_model, $content_model_type, $attr)
-    {
-        $def = new HTMLPurifier_ElementDef();
-        $def->content_model = $content_model;
-        $def->content_model_type = $content_model_type;
-        $def->attr = $attr;
-        return $def;
-    }
-
-    /**
-     * Merges the values of another element definition into this one.
-     * Values from the new element def take precedence if a value is
-     * not mergeable.
-     * @param HTMLPurifier_ElementDef $def
-     */
-    public function mergeIn($def)
-    {
-        // later keys takes precedence
-        foreach ($def->attr as $k => $v) {
-            if ($k === 0) {
-                // merge in the includes
-                // sorry, no way to override an include
-                foreach ($v as $v2) {
-                    $this->attr[0][] = $v2;
-                }
-                continue;
-            }
-            if ($v === false) {
-                if (isset($this->attr[$k])) {
-                    unset($this->attr[$k]);
-                }
-                continue;
-            }
-            $this->attr[$k] = $v;
-        }
-        $this->_mergeAssocArray($this->excludes, $def->excludes);
-        $this->attr_transform_pre = array_merge($this->attr_transform_pre, $def->attr_transform_pre);
-        $this->attr_transform_post = array_merge($this->attr_transform_post, $def->attr_transform_post);
-
-        if (!empty($def->content_model)) {
-            $this->content_model =
-                str_replace("#SUPER", $this->content_model, $def->content_model);
-            $this->child = false;
-        }
-        if (!empty($def->content_model_type)) {
-            $this->content_model_type = $def->content_model_type;
-            $this->child = false;
-        }
-        if (!is_null($def->child)) {
-            $this->child = $def->child;
-        }
-        if (!is_null($def->formatting)) {
-            $this->formatting = $def->formatting;
-        }
-        if ($def->descendants_are_inline) {
-            $this->descendants_are_inline = $def->descendants_are_inline;
-        }
-    }
-
-    /**
-     * Merges one array into another, removes values which equal false
-     * @param $a1 Array by reference that is merged into
-     * @param $a2 Array that merges into $a1
-     */
-    private function _mergeAssocArray(&$a1, $a2)
-    {
-        foreach ($a2 as $k => $v) {
-            if ($v === false) {
-                if (isset($a1[$k])) {
-                    unset($a1[$k]);
-                }
-                continue;
-            }
-            $a1[$k] = $v;
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Encoder.php b/libraries/htmlpurifier410/library/HTMLPurifier/Encoder.php
deleted file mode 100644
index f6e45523c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Encoder.php
+++ /dev/null
@@ -1,617 +0,0 @@
-<?php
-
-/**
- * A UTF-8 specific character encoder that handles cleaning and transforming.
- * @note All functions in this class should be static.
- */
-class HTMLPurifier_Encoder
-{
-
-    /**
-     * Constructor throws fatal error if you attempt to instantiate class
-     */
-    private function __construct()
-    {
-        trigger_error('Cannot instantiate encoder, call methods statically', E_USER_ERROR);
-    }
-
-    /**
-     * Error-handler that mutes errors, alternative to shut-up operator.
-     */
-    public static function muteErrorHandler()
-    {
-    }
-
-    /**
-     * iconv wrapper which mutes errors, but doesn't work around bugs.
-     * @param string $in Input encoding
-     * @param string $out Output encoding
-     * @param string $text The text to convert
-     * @return string
-     */
-    public static function unsafeIconv($in, $out, $text)
-    {
-        set_error_handler(array('HTMLPurifier_Encoder', 'muteErrorHandler'));
-        $r = iconv($in, $out, $text);
-        restore_error_handler();
-        return $r;
-    }
-
-    /**
-     * iconv wrapper which mutes errors and works around bugs.
-     * @param string $in Input encoding
-     * @param string $out Output encoding
-     * @param string $text The text to convert
-     * @param int $max_chunk_size
-     * @return string
-     */
-    public static function iconv($in, $out, $text, $max_chunk_size = 8000)
-    {
-        $code = self::testIconvTruncateBug();
-        if ($code == self::ICONV_OK) {
-            return self::unsafeIconv($in, $out, $text);
-        } elseif ($code == self::ICONV_TRUNCATES) {
-            // we can only work around this if the input character set
-            // is utf-8
-            if ($in == 'utf-8') {
-                if ($max_chunk_size < 4) {
-                    trigger_error('max_chunk_size is too small', E_USER_WARNING);
-                    return false;
-                }
-                // split into 8000 byte chunks, but be careful to handle
-                // multibyte boundaries properly
-                if (($c = strlen($text)) <= $max_chunk_size) {
-                    return self::unsafeIconv($in, $out, $text);
-                }
-                $r = '';
-                $i = 0;
-                while (true) {
-                    if ($i + $max_chunk_size >= $c) {
-                        $r .= self::unsafeIconv($in, $out, substr($text, $i));
-                        break;
-                    }
-                    // wibble the boundary
-                    if (0x80 != (0xC0 & ord($text[$i + $max_chunk_size]))) {
-                        $chunk_size = $max_chunk_size;
-                    } elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 1]))) {
-                        $chunk_size = $max_chunk_size - 1;
-                    } elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 2]))) {
-                        $chunk_size = $max_chunk_size - 2;
-                    } elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 3]))) {
-                        $chunk_size = $max_chunk_size - 3;
-                    } else {
-                        return false; // rather confusing UTF-8...
-                    }
-                    $chunk = substr($text, $i, $chunk_size); // substr doesn't mind overlong lengths
-                    $r .= self::unsafeIconv($in, $out, $chunk);
-                    $i += $chunk_size;
-                }
-                return $r;
-            } else {
-                return false;
-            }
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * Cleans a UTF-8 string for well-formedness and SGML validity
-     *
-     * It will parse according to UTF-8 and return a valid UTF8 string, with
-     * non-SGML codepoints excluded.
-     *
-     * Specifically, it will permit:
-     * \x{9}\x{A}\x{D}\x{20}-\x{7E}\x{A0}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}
-     * Source: https://www.w3.org/TR/REC-xml/#NT-Char
-     * Arguably this function should be modernized to the HTML5 set
-     * of allowed characters:
-     * https://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
-     * which simultaneously expand and restrict the set of allowed characters.
-     *
-     * @param string $str The string to clean
-     * @param bool $force_php
-     * @return string
-     *
-     * @note Just for reference, the non-SGML code points are 0 to 31 and
-     *       127 to 159, inclusive.  However, we allow code points 9, 10
-     *       and 13, which are the tab, line feed and carriage return
-     *       respectively. 128 and above the code points map to multibyte
-     *       UTF-8 representations.
-     *
-     * @note Fallback code adapted from utf8ToUnicode by Henri Sivonen and
-     *       hsivonen@iki.fi at <http://iki.fi/hsivonen/php-utf8/> under the
-     *       LGPL license.  Notes on what changed are inside, but in general,
-     *       the original code transformed UTF-8 text into an array of integer
-     *       Unicode codepoints. Understandably, transforming that back to
-     *       a string would be somewhat expensive, so the function was modded to
-     *       directly operate on the string.  However, this discourages code
-     *       reuse, and the logic enumerated here would be useful for any
-     *       function that needs to be able to understand UTF-8 characters.
-     *       As of right now, only smart lossless character encoding converters
-     *       would need that, and I'm probably not going to implement them.
-     */
-    public static function cleanUTF8($str, $force_php = false)
-    {
-        // UTF-8 validity is checked since PHP 4.3.5
-        // This is an optimization: if the string is already valid UTF-8, no
-        // need to do PHP stuff. 99% of the time, this will be the case.
-        if (preg_match(
-            '/^[\x{9}\x{A}\x{D}\x{20}-\x{7E}\x{A0}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]*$/Du',
-            $str
-        )) {
-            return $str;
-        }
-
-        $mState = 0; // cached expected number of octets after the current octet
-                     // until the beginning of the next UTF8 character sequence
-        $mUcs4  = 0; // cached Unicode character
-        $mBytes = 1; // cached expected number of octets in the current sequence
-
-        // original code involved an $out that was an array of Unicode
-        // codepoints.  Instead of having to convert back into UTF-8, we've
-        // decided to directly append valid UTF-8 characters onto a string
-        // $out once they're done.  $char accumulates raw bytes, while $mUcs4
-        // turns into the Unicode code point, so there's some redundancy.
-
-        $out = '';
-        $char = '';
-
-        $len = strlen($str);
-        for ($i = 0; $i < $len; $i++) {
-            $in = ord($str[$i]);
-            $char .= $str[$i]; // append byte to char
-            if (0 == $mState) {
-                // When mState is zero we expect either a US-ASCII character
-                // or a multi-octet sequence.
-                if (0 == (0x80 & ($in))) {
-                    // US-ASCII, pass straight through.
-                    if (($in <= 31 || $in == 127) &&
-                        !($in == 9 || $in == 13 || $in == 10) // save \r\t\n
-                    ) {
-                        // control characters, remove
-                    } else {
-                        $out .= $char;
-                    }
-                    // reset
-                    $char = '';
-                    $mBytes = 1;
-                } elseif (0xC0 == (0xE0 & ($in))) {
-                    // First octet of 2 octet sequence
-                    $mUcs4 = ($in);
-                    $mUcs4 = ($mUcs4 & 0x1F) << 6;
-                    $mState = 1;
-                    $mBytes = 2;
-                } elseif (0xE0 == (0xF0 & ($in))) {
-                    // First octet of 3 octet sequence
-                    $mUcs4 = ($in);
-                    $mUcs4 = ($mUcs4 & 0x0F) << 12;
-                    $mState = 2;
-                    $mBytes = 3;
-                } elseif (0xF0 == (0xF8 & ($in))) {
-                    // First octet of 4 octet sequence
-                    $mUcs4 = ($in);
-                    $mUcs4 = ($mUcs4 & 0x07) << 18;
-                    $mState = 3;
-                    $mBytes = 4;
-                } elseif (0xF8 == (0xFC & ($in))) {
-                    // First octet of 5 octet sequence.
-                    //
-                    // This is illegal because the encoded codepoint must be
-                    // either:
-                    // (a) not the shortest form or
-                    // (b) outside the Unicode range of 0-0x10FFFF.
-                    // Rather than trying to resynchronize, we will carry on
-                    // until the end of the sequence and let the later error
-                    // handling code catch it.
-                    $mUcs4 = ($in);
-                    $mUcs4 = ($mUcs4 & 0x03) << 24;
-                    $mState = 4;
-                    $mBytes = 5;
-                } elseif (0xFC == (0xFE & ($in))) {
-                    // First octet of 6 octet sequence, see comments for 5
-                    // octet sequence.
-                    $mUcs4 = ($in);
-                    $mUcs4 = ($mUcs4 & 1) << 30;
-                    $mState = 5;
-                    $mBytes = 6;
-                } else {
-                    // Current octet is neither in the US-ASCII range nor a
-                    // legal first octet of a multi-octet sequence.
-                    $mState = 0;
-                    $mUcs4  = 0;
-                    $mBytes = 1;
-                    $char = '';
-                }
-            } else {
-                // When mState is non-zero, we expect a continuation of the
-                // multi-octet sequence
-                if (0x80 == (0xC0 & ($in))) {
-                    // Legal continuation.
-                    $shift = ($mState - 1) * 6;
-                    $tmp = $in;
-                    $tmp = ($tmp & 0x0000003F) << $shift;
-                    $mUcs4 |= $tmp;
-
-                    if (0 == --$mState) {
-                        // End of the multi-octet sequence. mUcs4 now contains
-                        // the final Unicode codepoint to be output
-
-                        // Check for illegal sequences and codepoints.
-
-                        // From Unicode 3.1, non-shortest form is illegal
-                        if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||
-                            ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||
-                            ((4 == $mBytes) && ($mUcs4 < 0x10000)) ||
-                            (4 < $mBytes) ||
-                            // From Unicode 3.2, surrogate characters = illegal
-                            (($mUcs4 & 0xFFFFF800) == 0xD800) ||
-                            // Codepoints outside the Unicode range are illegal
-                            ($mUcs4 > 0x10FFFF)
-                        ) {
-
-                        } elseif (0xFEFF != $mUcs4 && // omit BOM
-                            // check for valid Char unicode codepoints
-                            (
-                                0x9 == $mUcs4 ||
-                                0xA == $mUcs4 ||
-                                0xD == $mUcs4 ||
-                                (0x20 <= $mUcs4 && 0x7E >= $mUcs4) ||
-                                // 7F-9F is not strictly prohibited by XML,
-                                // but it is non-SGML, and thus we don't allow it
-                                (0xA0 <= $mUcs4 && 0xD7FF >= $mUcs4) ||
-                                (0xE000 <= $mUcs4 && 0xFFFD >= $mUcs4) ||
-                                (0x10000 <= $mUcs4 && 0x10FFFF >= $mUcs4)
-                            )
-                        ) {
-                            $out .= $char;
-                        }
-                        // initialize UTF8 cache (reset)
-                        $mState = 0;
-                        $mUcs4  = 0;
-                        $mBytes = 1;
-                        $char = '';
-                    }
-                } else {
-                    // ((0xC0 & (*in) != 0x80) && (mState != 0))
-                    // Incomplete multi-octet sequence.
-                    // used to result in complete fail, but we'll reset
-                    $mState = 0;
-                    $mUcs4  = 0;
-                    $mBytes = 1;
-                    $char ='';
-                }
-            }
-        }
-        return $out;
-    }
-
-    /**
-     * Translates a Unicode codepoint into its corresponding UTF-8 character.
-     * @note Based on Feyd's function at
-     *       <http://forums.devnetwork.net/viewtopic.php?p=191404#191404>,
-     *       which is in public domain.
-     * @note While we're going to do code point parsing anyway, a good
-     *       optimization would be to refuse to translate code points that
-     *       are non-SGML characters.  However, this could lead to duplication.
-     * @note This is very similar to the unichr function in
-     *       maintenance/generate-entity-file.php (although this is superior,
-     *       due to its sanity checks).
-     */
-
-    // +----------+----------+----------+----------+
-    // | 33222222 | 22221111 | 111111   |          |
-    // | 10987654 | 32109876 | 54321098 | 76543210 | bit
-    // +----------+----------+----------+----------+
-    // |          |          |          | 0xxxxxxx | 1 byte 0x00000000..0x0000007F
-    // |          |          | 110yyyyy | 10xxxxxx | 2 byte 0x00000080..0x000007FF
-    // |          | 1110zzzz | 10yyyyyy | 10xxxxxx | 3 byte 0x00000800..0x0000FFFF
-    // | 11110www | 10wwzzzz | 10yyyyyy | 10xxxxxx | 4 byte 0x00010000..0x0010FFFF
-    // +----------+----------+----------+----------+
-    // | 00000000 | 00011111 | 11111111 | 11111111 | Theoretical upper limit of legal scalars: 2097151 (0x001FFFFF)
-    // | 00000000 | 00010000 | 11111111 | 11111111 | Defined upper limit of legal scalar codes
-    // +----------+----------+----------+----------+
-
-    public static function unichr($code)
-    {
-        if ($code > 1114111 or $code < 0 or
-          ($code >= 55296 and $code <= 57343) ) {
-            // bits are set outside the "valid" range as defined
-            // by UNICODE 4.1.0
-            return '';
-        }
-
-        $x = $y = $z = $w = 0;
-        if ($code < 128) {
-            // regular ASCII character
-            $x = $code;
-        } else {
-            // set up bits for UTF-8
-            $x = ($code & 63) | 128;
-            if ($code < 2048) {
-                $y = (($code & 2047) >> 6) | 192;
-            } else {
-                $y = (($code & 4032) >> 6) | 128;
-                if ($code < 65536) {
-                    $z = (($code >> 12) & 15) | 224;
-                } else {
-                    $z = (($code >> 12) & 63) | 128;
-                    $w = (($code >> 18) & 7)  | 240;
-                }
-            }
-        }
-        // set up the actual character
-        $ret = '';
-        if ($w) {
-            $ret .= chr($w);
-        }
-        if ($z) {
-            $ret .= chr($z);
-        }
-        if ($y) {
-            $ret .= chr($y);
-        }
-        $ret .= chr($x);
-
-        return $ret;
-    }
-
-    /**
-     * @return bool
-     */
-    public static function iconvAvailable()
-    {
-        static $iconv = null;
-        if ($iconv === null) {
-            $iconv = function_exists('iconv') && self::testIconvTruncateBug() != self::ICONV_UNUSABLE;
-        }
-        return $iconv;
-    }
-
-    /**
-     * Convert a string to UTF-8 based on configuration.
-     * @param string $str The string to convert
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public static function convertToUTF8($str, $config, $context)
-    {
-        $encoding = $config->get('Core.Encoding');
-        if ($encoding === 'utf-8') {
-            return $str;
-        }
-        static $iconv = null;
-        if ($iconv === null) {
-            $iconv = self::iconvAvailable();
-        }
-        if ($iconv && !$config->get('Test.ForceNoIconv')) {
-            // unaffected by bugs, since UTF-8 support all characters
-            $str = self::unsafeIconv($encoding, 'utf-8//IGNORE', $str);
-            if ($str === false) {
-                // $encoding is not a valid encoding
-                trigger_error('Invalid encoding ' . $encoding, E_USER_ERROR);
-                return '';
-            }
-            // If the string is bjorked by Shift_JIS or a similar encoding
-            // that doesn't support all of ASCII, convert the naughty
-            // characters to their true byte-wise ASCII/UTF-8 equivalents.
-            $str = strtr($str, self::testEncodingSupportsASCII($encoding));
-            return $str;
-        } elseif ($encoding === 'iso-8859-1') {
-            $str = utf8_encode($str);
-            return $str;
-        }
-        $bug = HTMLPurifier_Encoder::testIconvTruncateBug();
-        if ($bug == self::ICONV_OK) {
-            trigger_error('Encoding not supported, please install iconv', E_USER_ERROR);
-        } else {
-            trigger_error(
-                'You have a buggy version of iconv, see https://bugs.php.net/bug.php?id=48147 ' .
-                'and http://sourceware.org/bugzilla/show_bug.cgi?id=13541',
-                E_USER_ERROR
-            );
-        }
-    }
-
-    /**
-     * Converts a string from UTF-8 based on configuration.
-     * @param string $str The string to convert
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     * @note Currently, this is a lossy conversion, with unexpressable
-     *       characters being omitted.
-     */
-    public static function convertFromUTF8($str, $config, $context)
-    {
-        $encoding = $config->get('Core.Encoding');
-        if ($escape = $config->get('Core.EscapeNonASCIICharacters')) {
-            $str = self::convertToASCIIDumbLossless($str);
-        }
-        if ($encoding === 'utf-8') {
-            return $str;
-        }
-        static $iconv = null;
-        if ($iconv === null) {
-            $iconv = self::iconvAvailable();
-        }
-        if ($iconv && !$config->get('Test.ForceNoIconv')) {
-            // Undo our previous fix in convertToUTF8, otherwise iconv will barf
-            $ascii_fix = self::testEncodingSupportsASCII($encoding);
-            if (!$escape && !empty($ascii_fix)) {
-                $clear_fix = array();
-                foreach ($ascii_fix as $utf8 => $native) {
-                    $clear_fix[$utf8] = '';
-                }
-                $str = strtr($str, $clear_fix);
-            }
-            $str = strtr($str, array_flip($ascii_fix));
-            // Normal stuff
-            $str = self::iconv('utf-8', $encoding . '//IGNORE', $str);
-            return $str;
-        } elseif ($encoding === 'iso-8859-1') {
-            $str = utf8_decode($str);
-            return $str;
-        }
-        trigger_error('Encoding not supported', E_USER_ERROR);
-        // You might be tempted to assume that the ASCII representation
-        // might be OK, however, this is *not* universally true over all
-        // encodings.  So we take the conservative route here, rather
-        // than forcibly turn on %Core.EscapeNonASCIICharacters
-    }
-
-    /**
-     * Lossless (character-wise) conversion of HTML to ASCII
-     * @param string $str UTF-8 string to be converted to ASCII
-     * @return string ASCII encoded string with non-ASCII character entity-ized
-     * @warning Adapted from MediaWiki, claiming fair use: this is a common
-     *       algorithm. If you disagree with this license fudgery,
-     *       implement it yourself.
-     * @note Uses decimal numeric entities since they are best supported.
-     * @note This is a DUMB function: it has no concept of keeping
-     *       character entities that the projected character encoding
-     *       can allow. We could possibly implement a smart version
-     *       but that would require it to also know which Unicode
-     *       codepoints the charset supported (not an easy task).
-     * @note Sort of with cleanUTF8() but it assumes that $str is
-     *       well-formed UTF-8
-     */
-    public static function convertToASCIIDumbLossless($str)
-    {
-        $bytesleft = 0;
-        $result = '';
-        $working = 0;
-        $len = strlen($str);
-        for ($i = 0; $i < $len; $i++) {
-            $bytevalue = ord($str[$i]);
-            if ($bytevalue <= 0x7F) { //0xxx xxxx
-                $result .= chr($bytevalue);
-                $bytesleft = 0;
-            } elseif ($bytevalue <= 0xBF) { //10xx xxxx
-                $working = $working << 6;
-                $working += ($bytevalue & 0x3F);
-                $bytesleft--;
-                if ($bytesleft <= 0) {
-                    $result .= "&#" . $working . ";";
-                }
-            } elseif ($bytevalue <= 0xDF) { //110x xxxx
-                $working = $bytevalue & 0x1F;
-                $bytesleft = 1;
-            } elseif ($bytevalue <= 0xEF) { //1110 xxxx
-                $working = $bytevalue & 0x0F;
-                $bytesleft = 2;
-            } else { //1111 0xxx
-                $working = $bytevalue & 0x07;
-                $bytesleft = 3;
-            }
-        }
-        return $result;
-    }
-
-    /** No bugs detected in iconv. */
-    const ICONV_OK = 0;
-
-    /** Iconv truncates output if converting from UTF-8 to another
-     *  character set with //IGNORE, and a non-encodable character is found */
-    const ICONV_TRUNCATES = 1;
-
-    /** Iconv does not support //IGNORE, making it unusable for
-     *  transcoding purposes */
-    const ICONV_UNUSABLE = 2;
-
-    /**
-     * glibc iconv has a known bug where it doesn't handle the magic
-     * //IGNORE stanza correctly.  In particular, rather than ignore
-     * characters, it will return an EILSEQ after consuming some number
-     * of characters, and expect you to restart iconv as if it were
-     * an E2BIG.  Old versions of PHP did not respect the errno, and
-     * returned the fragment, so as a result you would see iconv
-     * mysteriously truncating output. We can work around this by
-     * manually chopping our input into segments of about 8000
-     * characters, as long as PHP ignores the error code.  If PHP starts
-     * paying attention to the error code, iconv becomes unusable.
-     *
-     * @return int Error code indicating severity of bug.
-     */
-    public static function testIconvTruncateBug()
-    {
-        static $code = null;
-        if ($code === null) {
-            // better not use iconv, otherwise infinite loop!
-            $r = self::unsafeIconv('utf-8', 'ascii//IGNORE', "\xCE\xB1" . str_repeat('a', 9000));
-            if ($r === false) {
-                $code = self::ICONV_UNUSABLE;
-            } elseif (($c = strlen($r)) < 9000) {
-                $code = self::ICONV_TRUNCATES;
-            } elseif ($c > 9000) {
-                trigger_error(
-                    'Your copy of iconv is extremely buggy. Please notify HTML Purifier maintainers: ' .
-                    'include your iconv version as per phpversion()',
-                    E_USER_ERROR
-                );
-            } else {
-                $code = self::ICONV_OK;
-            }
-        }
-        return $code;
-    }
-
-    /**
-     * This expensive function tests whether or not a given character
-     * encoding supports ASCII. 7/8-bit encodings like Shift_JIS will
-     * fail this test, and require special processing. Variable width
-     * encodings shouldn't ever fail.
-     *
-     * @param string $encoding Encoding name to test, as per iconv format
-     * @param bool $bypass Whether or not to bypass the precompiled arrays.
-     * @return Array of UTF-8 characters to their corresponding ASCII,
-     *      which can be used to "undo" any overzealous iconv action.
-     */
-    public static function testEncodingSupportsASCII($encoding, $bypass = false)
-    {
-        // All calls to iconv here are unsafe, proof by case analysis:
-        // If ICONV_OK, no difference.
-        // If ICONV_TRUNCATE, all calls involve one character inputs,
-        // so bug is not triggered.
-        // If ICONV_UNUSABLE, this call is irrelevant
-        static $encodings = array();
-        if (!$bypass) {
-            if (isset($encodings[$encoding])) {
-                return $encodings[$encoding];
-            }
-            $lenc = strtolower($encoding);
-            switch ($lenc) {
-                case 'shift_jis':
-                    return array("\xC2\xA5" => '\\', "\xE2\x80\xBE" => '~');
-                case 'johab':
-                    return array("\xE2\x82\xA9" => '\\');
-            }
-            if (strpos($lenc, 'iso-8859-') === 0) {
-                return array();
-            }
-        }
-        $ret = array();
-        if (self::unsafeIconv('UTF-8', $encoding, 'a') === false) {
-            return false;
-        }
-        for ($i = 0x20; $i <= 0x7E; $i++) { // all printable ASCII chars
-            $c = chr($i); // UTF-8 char
-            $r = self::unsafeIconv('UTF-8', "$encoding//IGNORE", $c); // initial conversion
-            if ($r === '' ||
-                // This line is needed for iconv implementations that do not
-                // omit characters that do not exist in the target character set
-                ($r === $c && self::unsafeIconv($encoding, 'UTF-8//IGNORE', $r) !== $c)
-            ) {
-                // Reverse engineer: what's the UTF-8 equiv of this byte
-                // sequence? This assumes that there's no variable width
-                // encoding that doesn't support ASCII.
-                $ret[self::unsafeIconv($encoding, 'UTF-8//IGNORE', $c)] = $c;
-            }
-        }
-        $encodings[$encoding] = $ret;
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup.php b/libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup.php
deleted file mode 100644
index cb3474e3b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Object that provides entity lookup table from entity name to character
- */
-class HTMLPurifier_EntityLookup
-{
-    /**
-     * Assoc array of entity name to character represented.
-     * @type array
-     */
-    public $table;
-
-    /**
-     * Sets up the entity lookup table from the serialized file contents.
-     * @param bool $file
-     * @note The serialized contents are versioned, but were generated
-     *       using the maintenance script generate_entity_file.php
-     * @warning This is not in constructor to help enforce the Singleton
-     */
-    public function setup($file = false)
-    {
-        if (!$file) {
-            $file = HTMLPURIFIER_PREFIX . '/HTMLPurifier/EntityLookup/entities.ser';
-        }
-        $this->table = unserialize(file_get_contents($file));
-    }
-
-    /**
-     * Retrieves sole instance of the object.
-     * @param bool|HTMLPurifier_EntityLookup $prototype Optional prototype of custom lookup table to overload with.
-     * @return HTMLPurifier_EntityLookup
-     */
-    public static function instance($prototype = false)
-    {
-        // no references, since PHP doesn't copy unless modified
-        static $instance = null;
-        if ($prototype) {
-            $instance = $prototype;
-        } elseif (!$instance) {
-            $instance = new HTMLPurifier_EntityLookup();
-            $instance->setup();
-        }
-        return $instance;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup/entities.ser b/libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup/entities.ser
deleted file mode 100644
index e8b08128b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/EntityLookup/entities.ser
+++ /dev/null
@@ -1 +0,0 @@
-a:253:{s:4:"fnof";s:2:"ƒ";s:5:"Alpha";s:2:"Α";s:4:"Beta";s:2:"Β";s:5:"Gamma";s:2:"Γ";s:5:"Delta";s:2:"Δ";s:7:"Epsilon";s:2:"Ε";s:4:"Zeta";s:2:"Ζ";s:3:"Eta";s:2:"Η";s:5:"Theta";s:2:"Θ";s:4:"Iota";s:2:"Ι";s:5:"Kappa";s:2:"Κ";s:6:"Lambda";s:2:"Λ";s:2:"Mu";s:2:"Μ";s:2:"Nu";s:2:"Ν";s:2:"Xi";s:2:"Ξ";s:7:"Omicron";s:2:"Ο";s:2:"Pi";s:2:"Π";s:3:"Rho";s:2:"Ρ";s:5:"Sigma";s:2:"Σ";s:3:"Tau";s:2:"Τ";s:7:"Upsilon";s:2:"Υ";s:3:"Phi";s:2:"Φ";s:3:"Chi";s:2:"Χ";s:3:"Psi";s:2:"Ψ";s:5:"Omega";s:2:"Ω";s:5:"alpha";s:2:"α";s:4:"beta";s:2:"β";s:5:"gamma";s:2:"γ";s:5:"delta";s:2:"δ";s:7:"epsilon";s:2:"ε";s:4:"zeta";s:2:"ζ";s:3:"eta";s:2:"η";s:5:"theta";s:2:"θ";s:4:"iota";s:2:"ι";s:5:"kappa";s:2:"κ";s:6:"lambda";s:2:"λ";s:2:"mu";s:2:"μ";s:2:"nu";s:2:"ν";s:2:"xi";s:2:"ξ";s:7:"omicron";s:2:"ο";s:2:"pi";s:2:"π";s:3:"rho";s:2:"ρ";s:6:"sigmaf";s:2:"ς";s:5:"sigma";s:2:"σ";s:3:"tau";s:2:"τ";s:7:"upsilon";s:2:"υ";s:3:"phi";s:2:"φ";s:3:"chi";s:2:"χ";s:3:"psi";s:2:"ψ";s:5:"omega";s:2:"ω";s:8:"thetasym";s:2:"ϑ";s:5:"upsih";s:2:"ϒ";s:3:"piv";s:2:"ϖ";s:4:"bull";s:3:"•";s:6:"hellip";s:3:"…";s:5:"prime";s:3:"′";s:5:"Prime";s:3:"″";s:5:"oline";s:3:"‾";s:5:"frasl";s:3:"⁄";s:6:"weierp";s:3:"℘";s:5:"image";s:3:"ℑ";s:4:"real";s:3:"ℜ";s:5:"trade";s:3:"™";s:7:"alefsym";s:3:"ℵ";s:4:"larr";s:3:"←";s:4:"uarr";s:3:"↑";s:4:"rarr";s:3:"→";s:4:"darr";s:3:"↓";s:4:"harr";s:3:"↔";s:5:"crarr";s:3:"↵";s:4:"lArr";s:3:"⇐";s:4:"uArr";s:3:"⇑";s:4:"rArr";s:3:"⇒";s:4:"dArr";s:3:"⇓";s:4:"hArr";s:3:"⇔";s:6:"forall";s:3:"∀";s:4:"part";s:3:"∂";s:5:"exist";s:3:"∃";s:5:"empty";s:3:"∅";s:5:"nabla";s:3:"∇";s:4:"isin";s:3:"∈";s:5:"notin";s:3:"∉";s:2:"ni";s:3:"∋";s:4:"prod";s:3:"∏";s:3:"sum";s:3:"∑";s:5:"minus";s:3:"−";s:6:"lowast";s:3:"∗";s:5:"radic";s:3:"√";s:4:"prop";s:3:"∝";s:5:"infin";s:3:"∞";s:3:"ang";s:3:"∠";s:3:"and";s:3:"∧";s:2:"or";s:3:"∨";s:3:"cap";s:3:"∩";s:3:"cup";s:3:"∪";s:3:"int";s:3:"∫";s:6:"there4";s:3:"∴";s:3:"sim";s:3:"∼";s:4:"cong";s:3:"≅";s:5:"asymp";s:3:"≈";s:2:"ne";s:3:"≠";s:5:"equiv";s:3:"≡";s:2:"le";s:3:"≤";s:2:"ge";s:3:"≥";s:3:"sub";s:3:"⊂";s:3:"sup";s:3:"⊃";s:4:"nsub";s:3:"⊄";s:4:"sube";s:3:"⊆";s:4:"supe";s:3:"⊇";s:5:"oplus";s:3:"⊕";s:6:"otimes";s:3:"⊗";s:4:"perp";s:3:"⊥";s:4:"sdot";s:3:"⋅";s:5:"lceil";s:3:"⌈";s:5:"rceil";s:3:"⌉";s:6:"lfloor";s:3:"⌊";s:6:"rfloor";s:3:"⌋";s:4:"lang";s:3:"〈";s:4:"rang";s:3:"〉";s:3:"loz";s:3:"◊";s:6:"spades";s:3:"♠";s:5:"clubs";s:3:"♣";s:6:"hearts";s:3:"♥";s:5:"diams";s:3:"♦";s:4:"quot";s:1:""";s:3:"amp";s:1:"&";s:2:"lt";s:1:"<";s:2:"gt";s:1:">";s:4:"apos";s:1:"'";s:5:"OElig";s:2:"Œ";s:5:"oelig";s:2:"œ";s:6:"Scaron";s:2:"Š";s:6:"scaron";s:2:"š";s:4:"Yuml";s:2:"Ÿ";s:4:"circ";s:2:"ˆ";s:5:"tilde";s:2:"˜";s:4:"ensp";s:3:" ";s:4:"emsp";s:3:" ";s:6:"thinsp";s:3:" ";s:4:"zwnj";s:3:"‌";s:3:"zwj";s:3:"‍";s:3:"lrm";s:3:"‎";s:3:"rlm";s:3:"‏";s:5:"ndash";s:3:"–";s:5:"mdash";s:3:"—";s:5:"lsquo";s:3:"‘";s:5:"rsquo";s:3:"’";s:5:"sbquo";s:3:"‚";s:5:"ldquo";s:3:"“";s:5:"rdquo";s:3:"”";s:5:"bdquo";s:3:"„";s:6:"dagger";s:3:"†";s:6:"Dagger";s:3:"‡";s:6:"permil";s:3:"‰";s:6:"lsaquo";s:3:"‹";s:6:"rsaquo";s:3:"›";s:4:"euro";s:3:"€";s:4:"nbsp";s:2:" ";s:5:"iexcl";s:2:"¡";s:4:"cent";s:2:"¢";s:5:"pound";s:2:"£";s:6:"curren";s:2:"¤";s:3:"yen";s:2:"¥";s:6:"brvbar";s:2:"¦";s:4:"sect";s:2:"§";s:3:"uml";s:2:"¨";s:4:"copy";s:2:"©";s:4:"ordf";s:2:"ª";s:5:"laquo";s:2:"«";s:3:"not";s:2:"¬";s:3:"shy";s:2:"­";s:3:"reg";s:2:"®";s:4:"macr";s:2:"¯";s:3:"deg";s:2:"°";s:6:"plusmn";s:2:"±";s:4:"sup2";s:2:"²";s:4:"sup3";s:2:"³";s:5:"acute";s:2:"´";s:5:"micro";s:2:"µ";s:4:"para";s:2:"¶";s:6:"middot";s:2:"·";s:5:"cedil";s:2:"¸";s:4:"sup1";s:2:"¹";s:4:"ordm";s:2:"º";s:5:"raquo";s:2:"»";s:6:"frac14";s:2:"¼";s:6:"frac12";s:2:"½";s:6:"frac34";s:2:"¾";s:6:"iquest";s:2:"¿";s:6:"Agrave";s:2:"À";s:6:"Aacute";s:2:"Á";s:5:"Acirc";s:2:"Â";s:6:"Atilde";s:2:"Ã";s:4:"Auml";s:2:"Ä";s:5:"Aring";s:2:"Å";s:5:"AElig";s:2:"Æ";s:6:"Ccedil";s:2:"Ç";s:6:"Egrave";s:2:"È";s:6:"Eacute";s:2:"É";s:5:"Ecirc";s:2:"Ê";s:4:"Euml";s:2:"Ë";s:6:"Igrave";s:2:"Ì";s:6:"Iacute";s:2:"Í";s:5:"Icirc";s:2:"Î";s:4:"Iuml";s:2:"Ï";s:3:"ETH";s:2:"Ð";s:6:"Ntilde";s:2:"Ñ";s:6:"Ograve";s:2:"Ò";s:6:"Oacute";s:2:"Ó";s:5:"Ocirc";s:2:"Ô";s:6:"Otilde";s:2:"Õ";s:4:"Ouml";s:2:"Ö";s:5:"times";s:2:"×";s:6:"Oslash";s:2:"Ø";s:6:"Ugrave";s:2:"Ù";s:6:"Uacute";s:2:"Ú";s:5:"Ucirc";s:2:"Û";s:4:"Uuml";s:2:"Ü";s:6:"Yacute";s:2:"Ý";s:5:"THORN";s:2:"Þ";s:5:"szlig";s:2:"ß";s:6:"agrave";s:2:"à";s:6:"aacute";s:2:"á";s:5:"acirc";s:2:"â";s:6:"atilde";s:2:"ã";s:4:"auml";s:2:"ä";s:5:"aring";s:2:"å";s:5:"aelig";s:2:"æ";s:6:"ccedil";s:2:"ç";s:6:"egrave";s:2:"è";s:6:"eacute";s:2:"é";s:5:"ecirc";s:2:"ê";s:4:"euml";s:2:"ë";s:6:"igrave";s:2:"ì";s:6:"iacute";s:2:"í";s:5:"icirc";s:2:"î";s:4:"iuml";s:2:"ï";s:3:"eth";s:2:"ð";s:6:"ntilde";s:2:"ñ";s:6:"ograve";s:2:"ò";s:6:"oacute";s:2:"ó";s:5:"ocirc";s:2:"ô";s:6:"otilde";s:2:"õ";s:4:"ouml";s:2:"ö";s:6:"divide";s:2:"÷";s:6:"oslash";s:2:"ø";s:6:"ugrave";s:2:"ù";s:6:"uacute";s:2:"ú";s:5:"ucirc";s:2:"û";s:4:"uuml";s:2:"ü";s:6:"yacute";s:2:"ý";s:5:"thorn";s:2:"þ";s:4:"yuml";s:2:"ÿ";}
\ No newline at end of file
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/EntityParser.php b/libraries/htmlpurifier410/library/HTMLPurifier/EntityParser.php
deleted file mode 100644
index 41059e50f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/EntityParser.php
+++ /dev/null
@@ -1,285 +0,0 @@
-<?php
-
-// if want to implement error collecting here, we'll need to use some sort
-// of global data (probably trigger_error) because it's impossible to pass
-// $config or $context to the callback functions.
-
-/**
- * Handles referencing and derefencing character entities
- */
-class HTMLPurifier_EntityParser
-{
-
-    /**
-     * Reference to entity lookup table.
-     * @type HTMLPurifier_EntityLookup
-     */
-    protected $_entity_lookup;
-
-    /**
-     * Callback regex string for entities in text.
-     * @type string
-     */
-    protected $_textEntitiesRegex;
-
-    /**
-     * Callback regex string for entities in attributes.
-     * @type string
-     */
-    protected $_attrEntitiesRegex;
-
-    /**
-     * Tests if the beginning of a string is a semi-optional regex
-     */
-    protected $_semiOptionalPrefixRegex;
-
-    public function __construct() {
-        // From
-        // http://stackoverflow.com/questions/15532252/why-is-reg-being-rendered-as-without-the-bounding-semicolon
-        $semi_optional = "quot|QUOT|lt|LT|gt|GT|amp|AMP|AElig|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|Iacute|Icirc|Igrave|Iuml|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml";
-
-        // NB: three empty captures to put the fourth match in the right
-        // place
-        $this->_semiOptionalPrefixRegex = "/&()()()($semi_optional)/";
-
-        $this->_textEntitiesRegex =
-            '/&(?:'.
-            // hex
-            '[#]x([a-fA-F0-9]+);?|'.
-            // dec
-            '[#]0*(\d+);?|'.
-            // string (mandatory semicolon)
-            // NB: order matters: match semicolon preferentially
-            '([A-Za-z_:][A-Za-z0-9.\-_:]*);|'.
-            // string (optional semicolon)
-            "($semi_optional)".
-            ')/';
-
-        $this->_attrEntitiesRegex =
-            '/&(?:'.
-            // hex
-            '[#]x([a-fA-F0-9]+);?|'.
-            // dec
-            '[#]0*(\d+);?|'.
-            // string (mandatory semicolon)
-            // NB: order matters: match semicolon preferentially
-            '([A-Za-z_:][A-Za-z0-9.\-_:]*);|'.
-            // string (optional semicolon)
-            // don't match if trailing is equals or alphanumeric (URL
-            // like)
-            "($semi_optional)(?![=;A-Za-z0-9])".
-            ')/';
-
-    }
-
-    /**
-     * Substitute entities with the parsed equivalents.  Use this on
-     * textual data in an HTML document (as opposed to attributes.)
-     *
-     * @param string $string String to have entities parsed.
-     * @return string Parsed string.
-     */
-    public function substituteTextEntities($string)
-    {
-        return preg_replace_callback(
-            $this->_textEntitiesRegex,
-            array($this, 'entityCallback'),
-            $string
-        );
-    }
-
-    /**
-     * Substitute entities with the parsed equivalents.  Use this on
-     * attribute contents in documents.
-     *
-     * @param string $string String to have entities parsed.
-     * @return string Parsed string.
-     */
-    public function substituteAttrEntities($string)
-    {
-        return preg_replace_callback(
-            $this->_attrEntitiesRegex,
-            array($this, 'entityCallback'),
-            $string
-        );
-    }
-
-    /**
-     * Callback function for substituteNonSpecialEntities() that does the work.
-     *
-     * @param array $matches  PCRE matches array, with 0 the entire match, and
-     *                  either index 1, 2 or 3 set with a hex value, dec value,
-     *                  or string (respectively).
-     * @return string Replacement string.
-     */
-
-    protected function entityCallback($matches)
-    {
-        $entity = $matches[0];
-        $hex_part = @$matches[1];
-        $dec_part = @$matches[2];
-        $named_part = empty($matches[3]) ? @$matches[4] : $matches[3];
-        if ($hex_part !== NULL && $hex_part !== "") {
-            return HTMLPurifier_Encoder::unichr(hexdec($hex_part));
-        } elseif ($dec_part !== NULL && $dec_part !== "") {
-            return HTMLPurifier_Encoder::unichr((int) $dec_part);
-        } else {
-            if (!$this->_entity_lookup) {
-                $this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
-            }
-            if (isset($this->_entity_lookup->table[$named_part])) {
-                return $this->_entity_lookup->table[$named_part];
-            } else {
-                // exact match didn't match anything, so test if
-                // any of the semicolon optional match the prefix.
-                // Test that this is an EXACT match is important to
-                // prevent infinite loop
-                if (!empty($matches[3])) {
-                    return preg_replace_callback(
-                        $this->_semiOptionalPrefixRegex,
-                        array($this, 'entityCallback'),
-                        $entity
-                    );
-                }
-                return $entity;
-            }
-        }
-    }
-
-    // LEGACY CODE BELOW
-
-    /**
-     * Callback regex string for parsing entities.
-     * @type string
-     */
-    protected $_substituteEntitiesRegex =
-        '/&(?:[#]x([a-fA-F0-9]+)|[#]0*(\d+)|([A-Za-z_:][A-Za-z0-9.\-_:]*));?/';
-        //     1. hex             2. dec      3. string (XML style)
-
-    /**
-     * Decimal to parsed string conversion table for special entities.
-     * @type array
-     */
-    protected $_special_dec2str =
-            array(
-                    34 => '"',
-                    38 => '&',
-                    39 => "'",
-                    60 => '<',
-                    62 => '>'
-            );
-
-    /**
-     * Stripped entity names to decimal conversion table for special entities.
-     * @type array
-     */
-    protected $_special_ent2dec =
-            array(
-                    'quot' => 34,
-                    'amp'  => 38,
-                    'lt'   => 60,
-                    'gt'   => 62
-            );
-
-    /**
-     * Substitutes non-special entities with their parsed equivalents. Since
-     * running this whenever you have parsed character is t3h 5uck, we run
-     * it before everything else.
-     *
-     * @param string $string String to have non-special entities parsed.
-     * @return string Parsed string.
-     */
-    public function substituteNonSpecialEntities($string)
-    {
-        // it will try to detect missing semicolons, but don't rely on it
-        return preg_replace_callback(
-            $this->_substituteEntitiesRegex,
-            array($this, 'nonSpecialEntityCallback'),
-            $string
-        );
-    }
-
-    /**
-     * Callback function for substituteNonSpecialEntities() that does the work.
-     *
-     * @param array $matches  PCRE matches array, with 0 the entire match, and
-     *                  either index 1, 2 or 3 set with a hex value, dec value,
-     *                  or string (respectively).
-     * @return string Replacement string.
-     */
-
-    protected function nonSpecialEntityCallback($matches)
-    {
-        // replaces all but big five
-        $entity = $matches[0];
-        $is_num = (@$matches[0][1] === '#');
-        if ($is_num) {
-            $is_hex = (@$entity[2] === 'x');
-            $code = $is_hex ? hexdec($matches[1]) : (int) $matches[2];
-            // abort for special characters
-            if (isset($this->_special_dec2str[$code])) {
-                return $entity;
-            }
-            return HTMLPurifier_Encoder::unichr($code);
-        } else {
-            if (isset($this->_special_ent2dec[$matches[3]])) {
-                return $entity;
-            }
-            if (!$this->_entity_lookup) {
-                $this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
-            }
-            if (isset($this->_entity_lookup->table[$matches[3]])) {
-                return $this->_entity_lookup->table[$matches[3]];
-            } else {
-                return $entity;
-            }
-        }
-    }
-
-    /**
-     * Substitutes only special entities with their parsed equivalents.
-     *
-     * @notice We try to avoid calling this function because otherwise, it
-     * would have to be called a lot (for every parsed section).
-     *
-     * @param string $string String to have non-special entities parsed.
-     * @return string Parsed string.
-     */
-    public function substituteSpecialEntities($string)
-    {
-        return preg_replace_callback(
-            $this->_substituteEntitiesRegex,
-            array($this, 'specialEntityCallback'),
-            $string
-        );
-    }
-
-    /**
-     * Callback function for substituteSpecialEntities() that does the work.
-     *
-     * This callback has same syntax as nonSpecialEntityCallback().
-     *
-     * @param array $matches  PCRE-style matches array, with 0 the entire match, and
-     *                  either index 1, 2 or 3 set with a hex value, dec value,
-     *                  or string (respectively).
-     * @return string Replacement string.
-     */
-    protected function specialEntityCallback($matches)
-    {
-        $entity = $matches[0];
-        $is_num = (@$matches[0][1] === '#');
-        if ($is_num) {
-            $is_hex = (@$entity[2] === 'x');
-            $int = $is_hex ? hexdec($matches[1]) : (int) $matches[2];
-            return isset($this->_special_dec2str[$int]) ?
-                $this->_special_dec2str[$int] :
-                $entity;
-        } else {
-            return isset($this->_special_ent2dec[$matches[3]]) ?
-                $this->_special_dec2str[$this->_special_ent2dec[$matches[3]]] :
-                $entity;
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ErrorCollector.php b/libraries/htmlpurifier410/library/HTMLPurifier/ErrorCollector.php
deleted file mode 100644
index a6cbcaa0e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ErrorCollector.php
+++ /dev/null
@@ -1,244 +0,0 @@
-<?php
-
-/**
- * Error collection class that enables HTML Purifier to report HTML
- * problems back to the user
- */
-class HTMLPurifier_ErrorCollector
-{
-
-    /**
-     * Identifiers for the returned error array. These are purposely numeric
-     * so list() can be used.
-     */
-    const LINENO   = 0;
-    const SEVERITY = 1;
-    const MESSAGE  = 2;
-    const CHILDREN = 3;
-
-    /**
-     * @type array
-     */
-    protected $errors;
-
-    /**
-     * @type array
-     */
-    protected $_current;
-
-    /**
-     * @type array
-     */
-    protected $_stacks = array(array());
-
-    /**
-     * @type HTMLPurifier_Language
-     */
-    protected $locale;
-
-    /**
-     * @type HTMLPurifier_Generator
-     */
-    protected $generator;
-
-    /**
-     * @type HTMLPurifier_Context
-     */
-    protected $context;
-
-    /**
-     * @type array
-     */
-    protected $lines = array();
-
-    /**
-     * @param HTMLPurifier_Context $context
-     */
-    public function __construct($context)
-    {
-        $this->locale    =& $context->get('Locale');
-        $this->context   = $context;
-        $this->_current  =& $this->_stacks[0];
-        $this->errors    =& $this->_stacks[0];
-    }
-
-    /**
-     * Sends an error message to the collector for later use
-     * @param int $severity Error severity, PHP error style (don't use E_USER_)
-     * @param string $msg Error message text
-     */
-    public function send($severity, $msg)
-    {
-        $args = array();
-        if (func_num_args() > 2) {
-            $args = func_get_args();
-            array_shift($args);
-            unset($args[0]);
-        }
-
-        $token = $this->context->get('CurrentToken', true);
-        $line  = $token ? $token->line : $this->context->get('CurrentLine', true);
-        $col   = $token ? $token->col  : $this->context->get('CurrentCol', true);
-        $attr  = $this->context->get('CurrentAttr', true);
-
-        // perform special substitutions, also add custom parameters
-        $subst = array();
-        if (!is_null($token)) {
-            $args['CurrentToken'] = $token;
-        }
-        if (!is_null($attr)) {
-            $subst['$CurrentAttr.Name'] = $attr;
-            if (isset($token->attr[$attr])) {
-                $subst['$CurrentAttr.Value'] = $token->attr[$attr];
-            }
-        }
-
-        if (empty($args)) {
-            $msg = $this->locale->getMessage($msg);
-        } else {
-            $msg = $this->locale->formatMessage($msg, $args);
-        }
-
-        if (!empty($subst)) {
-            $msg = strtr($msg, $subst);
-        }
-
-        // (numerically indexed)
-        $error = array(
-            self::LINENO   => $line,
-            self::SEVERITY => $severity,
-            self::MESSAGE  => $msg,
-            self::CHILDREN => array()
-        );
-        $this->_current[] = $error;
-
-        // NEW CODE BELOW ...
-        // Top-level errors are either:
-        //  TOKEN type, if $value is set appropriately, or
-        //  "syntax" type, if $value is null
-        $new_struct = new HTMLPurifier_ErrorStruct();
-        $new_struct->type = HTMLPurifier_ErrorStruct::TOKEN;
-        if ($token) {
-            $new_struct->value = clone $token;
-        }
-        if (is_int($line) && is_int($col)) {
-            if (isset($this->lines[$line][$col])) {
-                $struct = $this->lines[$line][$col];
-            } else {
-                $struct = $this->lines[$line][$col] = $new_struct;
-            }
-            // These ksorts may present a performance problem
-            ksort($this->lines[$line], SORT_NUMERIC);
-        } else {
-            if (isset($this->lines[-1])) {
-                $struct = $this->lines[-1];
-            } else {
-                $struct = $this->lines[-1] = $new_struct;
-            }
-        }
-        ksort($this->lines, SORT_NUMERIC);
-
-        // Now, check if we need to operate on a lower structure
-        if (!empty($attr)) {
-            $struct = $struct->getChild(HTMLPurifier_ErrorStruct::ATTR, $attr);
-            if (!$struct->value) {
-                $struct->value = array($attr, 'PUT VALUE HERE');
-            }
-        }
-        if (!empty($cssprop)) {
-            $struct = $struct->getChild(HTMLPurifier_ErrorStruct::CSSPROP, $cssprop);
-            if (!$struct->value) {
-                // if we tokenize CSS this might be a little more difficult to do
-                $struct->value = array($cssprop, 'PUT VALUE HERE');
-            }
-        }
-
-        // Ok, structs are all setup, now time to register the error
-        $struct->addError($severity, $msg);
-    }
-
-    /**
-     * Retrieves raw error data for custom formatter to use
-     */
-    public function getRaw()
-    {
-        return $this->errors;
-    }
-
-    /**
-     * Default HTML formatting implementation for error messages
-     * @param HTMLPurifier_Config $config Configuration, vital for HTML output nature
-     * @param array $errors Errors array to display; used for recursion.
-     * @return string
-     */
-    public function getHTMLFormatted($config, $errors = null)
-    {
-        $ret = array();
-
-        $this->generator = new HTMLPurifier_Generator($config, $this->context);
-        if ($errors === null) {
-            $errors = $this->errors;
-        }
-
-        // 'At line' message needs to be removed
-
-        // generation code for new structure goes here. It needs to be recursive.
-        foreach ($this->lines as $line => $col_array) {
-            if ($line == -1) {
-                continue;
-            }
-            foreach ($col_array as $col => $struct) {
-                $this->_renderStruct($ret, $struct, $line, $col);
-            }
-        }
-        if (isset($this->lines[-1])) {
-            $this->_renderStruct($ret, $this->lines[-1]);
-        }
-
-        if (empty($errors)) {
-            return '<p>' . $this->locale->getMessage('ErrorCollector: No errors') . '</p>';
-        } else {
-            return '<ul><li>' . implode('</li><li>', $ret) . '</li></ul>';
-        }
-
-    }
-
-    private function _renderStruct(&$ret, $struct, $line = null, $col = null)
-    {
-        $stack = array($struct);
-        $context_stack = array(array());
-        while ($current = array_pop($stack)) {
-            $context = array_pop($context_stack);
-            foreach ($current->errors as $error) {
-                list($severity, $msg) = $error;
-                $string = '';
-                $string .= '<div>';
-                // W3C uses an icon to indicate the severity of the error.
-                $error = $this->locale->getErrorName($severity);
-                $string .= "<span class=\"error e$severity\"><strong>$error</strong></span> ";
-                if (!is_null($line) && !is_null($col)) {
-                    $string .= "<em class=\"location\">Line $line, Column $col: </em> ";
-                } else {
-                    $string .= '<em class="location">End of Document: </em> ';
-                }
-                $string .= '<strong class="description">' . $this->generator->escape($msg) . '</strong> ';
-                $string .= '</div>';
-                // Here, have a marker for the character on the column appropriate.
-                // Be sure to clip extremely long lines.
-                //$string .= '<pre>';
-                //$string .= '';
-                //$string .= '</pre>';
-                $ret[] = $string;
-            }
-            foreach ($current->children as $array) {
-                $context[] = $current;
-                $stack = array_merge($stack, array_reverse($array, true));
-                for ($i = count($array); $i > 0; $i--) {
-                    $context_stack[] = $context;
-                }
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/ErrorStruct.php b/libraries/htmlpurifier410/library/HTMLPurifier/ErrorStruct.php
deleted file mode 100644
index a6c0da29e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/ErrorStruct.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * Records errors for particular segments of an HTML document such as tokens,
- * attributes or CSS properties. They can contain error structs (which apply
- * to components of what they represent), but their main purpose is to hold
- * errors applying to whatever struct is being used.
- */
-class HTMLPurifier_ErrorStruct
-{
-
-    /**
-     * Possible values for $children first-key. Note that top-level structures
-     * are automatically token-level.
-     */
-    const TOKEN     = 0;
-    const ATTR      = 1;
-    const CSSPROP   = 2;
-
-    /**
-     * Type of this struct.
-     * @type string
-     */
-    public $type;
-
-    /**
-     * Value of the struct we are recording errors for. There are various
-     * values for this:
-     *  - TOKEN: Instance of HTMLPurifier_Token
-     *  - ATTR: array('attr-name', 'value')
-     *  - CSSPROP: array('prop-name', 'value')
-     * @type mixed
-     */
-    public $value;
-
-    /**
-     * Errors registered for this structure.
-     * @type array
-     */
-    public $errors = array();
-
-    /**
-     * Child ErrorStructs that are from this structure. For example, a TOKEN
-     * ErrorStruct would contain ATTR ErrorStructs. This is a multi-dimensional
-     * array in structure: [TYPE]['identifier']
-     * @type array
-     */
-    public $children = array();
-
-    /**
-     * @param string $type
-     * @param string $id
-     * @return mixed
-     */
-    public function getChild($type, $id)
-    {
-        if (!isset($this->children[$type][$id])) {
-            $this->children[$type][$id] = new HTMLPurifier_ErrorStruct();
-            $this->children[$type][$id]->type = $type;
-        }
-        return $this->children[$type][$id];
-    }
-
-    /**
-     * @param int $severity
-     * @param string $message
-     */
-    public function addError($severity, $message)
-    {
-        $this->errors[] = array($severity, $message);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Exception.php b/libraries/htmlpurifier410/library/HTMLPurifier/Exception.php
deleted file mode 100644
index defe157e7..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Exception.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-/**
- * Global exception class for HTML Purifier; any exceptions we throw
- * are from here.
- */
-class HTMLPurifier_Exception extends Exception
-{
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Filter.php b/libraries/htmlpurifier410/library/HTMLPurifier/Filter.php
deleted file mode 100644
index 2f85b93ff..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Filter.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * Represents a pre or post processing filter on HTML Purifier's output
- *
- * Sometimes, a little ad-hoc fixing of HTML has to be done before
- * it gets sent through HTML Purifier: you can use filters to acheive
- * this effect. For instance, YouTube videos can be preserved using
- * this manner. You could have used a decorator for this task, but
- * PHP's support for them is not terribly robust, so we're going
- * to just loop through the filters.
- *
- * Filters should be exited first in, last out. If there are three filters,
- * named 1, 2 and 3, the order of execution should go 1->preFilter,
- * 2->preFilter, 3->preFilter, purify, 3->postFilter, 2->postFilter,
- * 1->postFilter.
- *
- * @note Methods are not declared abstract as it is perfectly legitimate
- *       for an implementation not to want anything to happen on a step
- */
-
-class HTMLPurifier_Filter
-{
-
-    /**
-     * Name of the filter for identification purposes.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * Pre-processor function, handles HTML before HTML Purifier
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function preFilter($html, $config, $context)
-    {
-        return $html;
-    }
-
-    /**
-     * Post-processor function, handles HTML after HTML Purifier
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function postFilter($html, $config, $context)
-    {
-        return $html;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Filter/ExtractStyleBlocks.php b/libraries/htmlpurifier410/library/HTMLPurifier/Filter/ExtractStyleBlocks.php
deleted file mode 100644
index 5af24c202..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Filter/ExtractStyleBlocks.php
+++ /dev/null
@@ -1,341 +0,0 @@
-<?php
-
-// why is this a top level function? Because PHP 5.2.0 doesn't seem to
-// understand how to interpret this filter if it's a static method.
-// It's all really silly, but if we go this route it might be reasonable
-// to coalesce all of these methods into one.
-function htmlpurifier_filter_extractstyleblocks_muteerrorhandler()
-{
-}
-
-/**
- * This filter extracts <style> blocks from input HTML, cleans them up
- * using CSSTidy, and then places them in $purifier->context->get('StyleBlocks')
- * so they can be used elsewhere in the document.
- *
- * @note
- *      See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for
- *      sample usage.
- *
- * @note
- *      This filter can also be used on stylesheets not included in the
- *      document--something purists would probably prefer. Just directly
- *      call HTMLPurifier_Filter_ExtractStyleBlocks->cleanCSS()
- */
-class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
-{
-    /**
-     * @type string
-     */
-    public $name = 'ExtractStyleBlocks';
-
-    /**
-     * @type array
-     */
-    private $_styleMatches = array();
-
-    /**
-     * @type csstidy
-     */
-    private $_tidy;
-
-    /**
-     * @type HTMLPurifier_AttrDef_HTML_ID
-     */
-    private $_id_attrdef;
-
-    /**
-     * @type HTMLPurifier_AttrDef_CSS_Ident
-     */
-    private $_class_attrdef;
-
-    /**
-     * @type HTMLPurifier_AttrDef_Enum
-     */
-    private $_enum_attrdef;
-
-    public function __construct()
-    {
-        $this->_tidy = new csstidy();
-        $this->_tidy->set_cfg('lowercase_s', false);
-        $this->_id_attrdef = new HTMLPurifier_AttrDef_HTML_ID(true);
-        $this->_class_attrdef = new HTMLPurifier_AttrDef_CSS_Ident();
-        $this->_enum_attrdef = new HTMLPurifier_AttrDef_Enum(
-            array(
-                'first-child',
-                'link',
-                'visited',
-                'active',
-                'hover',
-                'focus'
-            )
-        );
-    }
-
-    /**
-     * Save the contents of CSS blocks to style matches
-     * @param array $matches preg_replace style $matches array
-     */
-    protected function styleCallback($matches)
-    {
-        $this->_styleMatches[] = $matches[1];
-    }
-
-    /**
-     * Removes inline <style> tags from HTML, saves them for later use
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     * @todo Extend to indicate non-text/css style blocks
-     */
-    public function preFilter($html, $config, $context)
-    {
-        $tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl');
-        if ($tidy !== null) {
-            $this->_tidy = $tidy;
-        }
-        // NB: this must be NON-greedy because if we have
-        // <style>foo</style>  <style>bar</style>
-        // we must not grab foo</style>  <style>bar
-        $html = preg_replace_callback('#<style(?:\s.*)?>(.*)<\/style>#isU', array($this, 'styleCallback'), $html);
-        $style_blocks = $this->_styleMatches;
-        $this->_styleMatches = array(); // reset
-        $context->register('StyleBlocks', $style_blocks); // $context must not be reused
-        if ($this->_tidy) {
-            foreach ($style_blocks as &$style) {
-                $style = $this->cleanCSS($style, $config, $context);
-            }
-        }
-        return $html;
-    }
-
-    /**
-     * Takes CSS (the stuff found in <style>) and cleans it.
-     * @warning Requires CSSTidy <http://csstidy.sourceforge.net/>
-     * @param string $css CSS styling to clean
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @throws HTMLPurifier_Exception
-     * @return string Cleaned CSS
-     */
-    public function cleanCSS($css, $config, $context)
-    {
-        // prepare scope
-        $scope = $config->get('Filter.ExtractStyleBlocks.Scope');
-        if ($scope !== null) {
-            $scopes = array_map('trim', explode(',', $scope));
-        } else {
-            $scopes = array();
-        }
-        // remove comments from CSS
-        $css = trim($css);
-        if (strncmp('<!--', $css, 4) === 0) {
-            $css = substr($css, 4);
-        }
-        if (strlen($css) > 3 && substr($css, -3) == '-->') {
-            $css = substr($css, 0, -3);
-        }
-        $css = trim($css);
-        set_error_handler('htmlpurifier_filter_extractstyleblocks_muteerrorhandler');
-        $this->_tidy->parse($css);
-        restore_error_handler();
-        $css_definition = $config->getDefinition('CSS');
-        $html_definition = $config->getDefinition('HTML');
-        $new_css = array();
-        foreach ($this->_tidy->css as $k => $decls) {
-            // $decls are all CSS declarations inside an @ selector
-            $new_decls = array();
-            foreach ($decls as $selector => $style) {
-                $selector = trim($selector);
-                if ($selector === '') {
-                    continue;
-                } // should not happen
-                // Parse the selector
-                // Here is the relevant part of the CSS grammar:
-                //
-                // ruleset
-                //   : selector [ ',' S* selector ]* '{' ...
-                // selector
-                //   : simple_selector [ combinator selector | S+ [ combinator? selector ]? ]?
-                // combinator
-                //   : '+' S*
-                //   : '>' S*
-                // simple_selector
-                //   : element_name [ HASH | class | attrib | pseudo ]*
-                //   | [ HASH | class | attrib | pseudo ]+
-                // element_name
-                //   : IDENT | '*'
-                //   ;
-                // class
-                //   : '.' IDENT
-                //   ;
-                // attrib
-                //   : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
-                //     [ IDENT | STRING ] S* ]? ']'
-                //   ;
-                // pseudo
-                //   : ':' [ IDENT | FUNCTION S* [IDENT S*]? ')' ]
-                //   ;
-                //
-                // For reference, here are the relevant tokens:
-                //
-                // HASH         #{name}
-                // IDENT        {ident}
-                // INCLUDES     ==
-                // DASHMATCH    |=
-                // STRING       {string}
-                // FUNCTION     {ident}\(
-                //
-                // And the lexical scanner tokens
-                //
-                // name         {nmchar}+
-                // nmchar       [_a-z0-9-]|{nonascii}|{escape}
-                // nonascii     [\240-\377]
-                // escape       {unicode}|\\[^\r\n\f0-9a-f]
-                // unicode      \\{h}}{1,6}(\r\n|[ \t\r\n\f])?
-                // ident        -?{nmstart}{nmchar*}
-                // nmstart      [_a-z]|{nonascii}|{escape}
-                // string       {string1}|{string2}
-                // string1      \"([^\n\r\f\\"]|\\{nl}|{escape})*\"
-                // string2      \'([^\n\r\f\\"]|\\{nl}|{escape})*\'
-                //
-                // We'll implement a subset (in order to reduce attack
-                // surface); in particular:
-                //
-                //      - No Unicode support
-                //      - No escapes support
-                //      - No string support (by proxy no attrib support)
-                //      - element_name is matched against allowed
-                //        elements (some people might find this
-                //        annoying...)
-                //      - Pseudo-elements one of :first-child, :link,
-                //        :visited, :active, :hover, :focus
-
-                // handle ruleset
-                $selectors = array_map('trim', explode(',', $selector));
-                $new_selectors = array();
-                foreach ($selectors as $sel) {
-                    // split on +, > and spaces
-                    $basic_selectors = preg_split('/\s*([+> ])\s*/', $sel, -1, PREG_SPLIT_DELIM_CAPTURE);
-                    // even indices are chunks, odd indices are
-                    // delimiters
-                    $nsel = null;
-                    $delim = null; // guaranteed to be non-null after
-                    // two loop iterations
-                    for ($i = 0, $c = count($basic_selectors); $i < $c; $i++) {
-                        $x = $basic_selectors[$i];
-                        if ($i % 2) {
-                            // delimiter
-                            if ($x === ' ') {
-                                $delim = ' ';
-                            } else {
-                                $delim = ' ' . $x . ' ';
-                            }
-                        } else {
-                            // simple selector
-                            $components = preg_split('/([#.:])/', $x, -1, PREG_SPLIT_DELIM_CAPTURE);
-                            $sdelim = null;
-                            $nx = null;
-                            for ($j = 0, $cc = count($components); $j < $cc; $j++) {
-                                $y = $components[$j];
-                                if ($j === 0) {
-                                    if ($y === '*' || isset($html_definition->info[$y = strtolower($y)])) {
-                                        $nx = $y;
-                                    } else {
-                                        // $nx stays null; this matters
-                                        // if we don't manage to find
-                                        // any valid selector content,
-                                        // in which case we ignore the
-                                        // outer $delim
-                                    }
-                                } elseif ($j % 2) {
-                                    // set delimiter
-                                    $sdelim = $y;
-                                } else {
-                                    $attrdef = null;
-                                    if ($sdelim === '#') {
-                                        $attrdef = $this->_id_attrdef;
-                                    } elseif ($sdelim === '.') {
-                                        $attrdef = $this->_class_attrdef;
-                                    } elseif ($sdelim === ':') {
-                                        $attrdef = $this->_enum_attrdef;
-                                    } else {
-                                        throw new HTMLPurifier_Exception('broken invariant sdelim and preg_split');
-                                    }
-                                    $r = $attrdef->validate($y, $config, $context);
-                                    if ($r !== false) {
-                                        if ($r !== true) {
-                                            $y = $r;
-                                        }
-                                        if ($nx === null) {
-                                            $nx = '';
-                                        }
-                                        $nx .= $sdelim . $y;
-                                    }
-                                }
-                            }
-                            if ($nx !== null) {
-                                if ($nsel === null) {
-                                    $nsel = $nx;
-                                } else {
-                                    $nsel .= $delim . $nx;
-                                }
-                            } else {
-                                // delimiters to the left of invalid
-                                // basic selector ignored
-                            }
-                        }
-                    }
-                    if ($nsel !== null) {
-                        if (!empty($scopes)) {
-                            foreach ($scopes as $s) {
-                                $new_selectors[] = "$s $nsel";
-                            }
-                        } else {
-                            $new_selectors[] = $nsel;
-                        }
-                    }
-                }
-                if (empty($new_selectors)) {
-                    continue;
-                }
-                $selector = implode(', ', $new_selectors);
-                foreach ($style as $name => $value) {
-                    if (!isset($css_definition->info[$name])) {
-                        unset($style[$name]);
-                        continue;
-                    }
-                    $def = $css_definition->info[$name];
-                    $ret = $def->validate($value, $config, $context);
-                    if ($ret === false) {
-                        unset($style[$name]);
-                    } else {
-                        $style[$name] = $ret;
-                    }
-                }
-                $new_decls[$selector] = $style;
-            }
-            $new_css[$k] = $new_decls;
-        }
-        // remove stuff that shouldn't be used, could be reenabled
-        // after security risks are analyzed
-        $this->_tidy->css = $new_css;
-        $this->_tidy->import = array();
-        $this->_tidy->charset = null;
-        $this->_tidy->namespace = null;
-        $css = $this->_tidy->print->plain();
-        // we are going to escape any special characters <>& to ensure
-        // that no funny business occurs (i.e. </style> in a font-family prop).
-        if ($config->get('Filter.ExtractStyleBlocks.Escaping')) {
-            $css = str_replace(
-                array('<', '>', '&'),
-                array('\3C ', '\3E ', '\26 '),
-                $css
-            );
-        }
-        return $css;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Filter/YouTube.php b/libraries/htmlpurifier410/library/HTMLPurifier/Filter/YouTube.php
deleted file mode 100644
index b90ddf751..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Filter/YouTube.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'YouTube';
-
-    /**
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function preFilter($html, $config, $context)
-    {
-        $pre_regex = '#<object[^>]+>.+?' .
-            '(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s';
-        $pre_replace = '<span class="youtube-embed">\1</span>';
-        return preg_replace($pre_regex, $pre_replace, $html);
-    }
-
-    /**
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function postFilter($html, $config, $context)
-    {
-        $post_regex = '#<span class="youtube-embed">((?:v|cp)/[A-Za-z0-9\-_=]+)</span>#';
-        return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
-    }
-
-    /**
-     * @param $url
-     * @return string
-     */
-    protected function armorUrl($url)
-    {
-        return str_replace('--', '-&#45;', $url);
-    }
-
-    /**
-     * @param array $matches
-     * @return string
-     */
-    protected function postFilterCallback($matches)
-    {
-        $url = $this->armorUrl($matches[1]);
-        return '<object width="425" height="350" type="application/x-shockwave-flash" ' .
-        'data="//www.youtube.com/' . $url . '">' .
-        '<param name="movie" value="//www.youtube.com/' . $url . '"></param>' .
-        '<!--[if IE]>' .
-        '<embed src="//www.youtube.com/' . $url . '"' .
-        'type="application/x-shockwave-flash"' .
-        'wmode="transparent" width="425" height="350" />' .
-        '<![endif]-->' .
-        '</object>';
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Generator.php b/libraries/htmlpurifier410/library/HTMLPurifier/Generator.php
deleted file mode 100644
index addc23e9e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Generator.php
+++ /dev/null
@@ -1,286 +0,0 @@
-<?php
-
-/**
- * Generates HTML from tokens.
- * @todo Refactor interface so that configuration/context is determined
- *       upon instantiation, no need for messy generateFromTokens() calls
- * @todo Make some of the more internal functions protected, and have
- *       unit tests work around that
- */
-class HTMLPurifier_Generator
-{
-
-    /**
-     * Whether or not generator should produce XML output.
-     * @type bool
-     */
-    private $_xhtml = true;
-
-    /**
-     * :HACK: Whether or not generator should comment the insides of <script> tags.
-     * @type bool
-     */
-    private $_scriptFix = false;
-
-    /**
-     * Cache of HTMLDefinition during HTML output to determine whether or
-     * not attributes should be minimized.
-     * @type HTMLPurifier_HTMLDefinition
-     */
-    private $_def;
-
-    /**
-     * Cache of %Output.SortAttr.
-     * @type bool
-     */
-    private $_sortAttr;
-
-    /**
-     * Cache of %Output.FlashCompat.
-     * @type bool
-     */
-    private $_flashCompat;
-
-    /**
-     * Cache of %Output.FixInnerHTML.
-     * @type bool
-     */
-    private $_innerHTMLFix;
-
-    /**
-     * Stack for keeping track of object information when outputting IE
-     * compatibility code.
-     * @type array
-     */
-    private $_flashStack = array();
-
-    /**
-     * Configuration for the generator
-     * @type HTMLPurifier_Config
-     */
-    protected $config;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     */
-    public function __construct($config, $context)
-    {
-        $this->config = $config;
-        $this->_scriptFix = $config->get('Output.CommentScriptContents');
-        $this->_innerHTMLFix = $config->get('Output.FixInnerHTML');
-        $this->_sortAttr = $config->get('Output.SortAttr');
-        $this->_flashCompat = $config->get('Output.FlashCompat');
-        $this->_def = $config->getHTMLDefinition();
-        $this->_xhtml = $this->_def->doctype->xml;
-    }
-
-    /**
-     * Generates HTML from an array of tokens.
-     * @param HTMLPurifier_Token[] $tokens Array of HTMLPurifier_Token
-     * @return string Generated HTML
-     */
-    public function generateFromTokens($tokens)
-    {
-        if (!$tokens) {
-            return '';
-        }
-
-        // Basic algorithm
-        $html = '';
-        for ($i = 0, $size = count($tokens); $i < $size; $i++) {
-            if ($this->_scriptFix && $tokens[$i]->name === 'script'
-                && $i + 2 < $size && $tokens[$i+2] instanceof HTMLPurifier_Token_End) {
-                // script special case
-                // the contents of the script block must be ONE token
-                // for this to work.
-                $html .= $this->generateFromToken($tokens[$i++]);
-                $html .= $this->generateScriptFromToken($tokens[$i++]);
-            }
-            $html .= $this->generateFromToken($tokens[$i]);
-        }
-
-        // Tidy cleanup
-        if (extension_loaded('tidy') && $this->config->get('Output.TidyFormat')) {
-            $tidy = new Tidy;
-            $tidy->parseString(
-                $html,
-                array(
-                   'indent'=> true,
-                   'output-xhtml' => $this->_xhtml,
-                   'show-body-only' => true,
-                   'indent-spaces' => 2,
-                   'wrap' => 68,
-                ),
-                'utf8'
-            );
-            $tidy->cleanRepair();
-            $html = (string) $tidy; // explicit cast necessary
-        }
-
-        // Normalize newlines to system defined value
-        if ($this->config->get('Core.NormalizeNewlines')) {
-            $nl = $this->config->get('Output.Newline');
-            if ($nl === null) {
-                $nl = PHP_EOL;
-            }
-            if ($nl !== "\n") {
-                $html = str_replace("\n", $nl, $html);
-            }
-        }
-        return $html;
-    }
-
-    /**
-     * Generates HTML from a single token.
-     * @param HTMLPurifier_Token $token HTMLPurifier_Token object.
-     * @return string Generated HTML
-     */
-    public function generateFromToken($token)
-    {
-        if (!$token instanceof HTMLPurifier_Token) {
-            trigger_error('Cannot generate HTML from non-HTMLPurifier_Token object', E_USER_WARNING);
-            return '';
-
-        } elseif ($token instanceof HTMLPurifier_Token_Start) {
-            $attr = $this->generateAttributes($token->attr, $token->name);
-            if ($this->_flashCompat) {
-                if ($token->name == "object") {
-                    $flash = new stdClass();
-                    $flash->attr = $token->attr;
-                    $flash->param = array();
-                    $this->_flashStack[] = $flash;
-                }
-            }
-            return '<' . $token->name . ($attr ? ' ' : '') . $attr . '>';
-
-        } elseif ($token instanceof HTMLPurifier_Token_End) {
-            $_extra = '';
-            if ($this->_flashCompat) {
-                if ($token->name == "object" && !empty($this->_flashStack)) {
-                    // doesn't do anything for now
-                }
-            }
-            return $_extra . '</' . $token->name . '>';
-
-        } elseif ($token instanceof HTMLPurifier_Token_Empty) {
-            if ($this->_flashCompat && $token->name == "param" && !empty($this->_flashStack)) {
-                $this->_flashStack[count($this->_flashStack)-1]->param[$token->attr['name']] = $token->attr['value'];
-            }
-            $attr = $this->generateAttributes($token->attr, $token->name);
-             return '<' . $token->name . ($attr ? ' ' : '') . $attr .
-                ( $this->_xhtml ? ' /': '' ) // <br /> v. <br>
-                . '>';
-
-        } elseif ($token instanceof HTMLPurifier_Token_Text) {
-            return $this->escape($token->data, ENT_NOQUOTES);
-
-        } elseif ($token instanceof HTMLPurifier_Token_Comment) {
-            return '<!--' . $token->data . '-->';
-        } else {
-            return '';
-
-        }
-    }
-
-    /**
-     * Special case processor for the contents of script tags
-     * @param HTMLPurifier_Token $token HTMLPurifier_Token object.
-     * @return string
-     * @warning This runs into problems if there's already a literal
-     *          --> somewhere inside the script contents.
-     */
-    public function generateScriptFromToken($token)
-    {
-        if (!$token instanceof HTMLPurifier_Token_Text) {
-            return $this->generateFromToken($token);
-        }
-        // Thanks <http://lachy.id.au/log/2005/05/script-comments>
-        $data = preg_replace('#//\s*$#', '', $token->data);
-        return '<!--//--><![CDATA[//><!--' . "\n" . trim($data) . "\n" . '//--><!]]>';
-    }
-
-    /**
-     * Generates attribute declarations from attribute array.
-     * @note This does not include the leading or trailing space.
-     * @param array $assoc_array_of_attributes Attribute array
-     * @param string $element Name of element attributes are for, used to check
-     *        attribute minimization.
-     * @return string Generated HTML fragment for insertion.
-     */
-    public function generateAttributes($assoc_array_of_attributes, $element = '')
-    {
-        $html = '';
-        if ($this->_sortAttr) {
-            ksort($assoc_array_of_attributes);
-        }
-        foreach ($assoc_array_of_attributes as $key => $value) {
-            if (!$this->_xhtml) {
-                // Remove namespaced attributes
-                if (strpos($key, ':') !== false) {
-                    continue;
-                }
-                // Check if we should minimize the attribute: val="val" -> val
-                if ($element && !empty($this->_def->info[$element]->attr[$key]->minimized)) {
-                    $html .= $key . ' ';
-                    continue;
-                }
-            }
-            // Workaround for Internet Explorer innerHTML bug.
-            // Essentially, Internet Explorer, when calculating
-            // innerHTML, omits quotes if there are no instances of
-            // angled brackets, quotes or spaces.  However, when parsing
-            // HTML (for example, when you assign to innerHTML), it
-            // treats backticks as quotes.  Thus,
-            //      <img alt="``" />
-            // becomes
-            //      <img alt=`` />
-            // becomes
-            //      <img alt='' />
-            // Fortunately, all we need to do is trigger an appropriate
-            // quoting style, which we do by adding an extra space.
-            // This also is consistent with the W3C spec, which states
-            // that user agents may ignore leading or trailing
-            // whitespace (in fact, most don't, at least for attributes
-            // like alt, but an extra space at the end is barely
-            // noticeable).  Still, we have a configuration knob for
-            // this, since this transformation is not necesary if you
-            // don't process user input with innerHTML or you don't plan
-            // on supporting Internet Explorer.
-            if ($this->_innerHTMLFix) {
-                if (strpos($value, '`') !== false) {
-                    // check if correct quoting style would not already be
-                    // triggered
-                    if (strcspn($value, '"\' <>') === strlen($value)) {
-                        // protect!
-                        $value .= ' ';
-                    }
-                }
-            }
-            $html .= $key.'="'.$this->escape($value).'" ';
-        }
-        return rtrim($html);
-    }
-
-    /**
-     * Escapes raw text data.
-     * @todo This really ought to be protected, but until we have a facility
-     *       for properly generating HTML here w/o using tokens, it stays
-     *       public.
-     * @param string $string String data to escape for HTML.
-     * @param int $quote Quoting style, like htmlspecialchars. ENT_NOQUOTES is
-     *               permissible for non-attribute output.
-     * @return string escaped data.
-     */
-    public function escape($string, $quote = null)
-    {
-        // Workaround for APC bug on Mac Leopard reported by sidepodcast
-        // http://htmlpurifier.org/phorum/read.php?3,4823,4846
-        if ($quote === null) {
-            $quote = ENT_COMPAT;
-        }
-        return htmlspecialchars($string, $quote, 'UTF-8');
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLDefinition.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLDefinition.php
deleted file mode 100644
index 027c85d56..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLDefinition.php
+++ /dev/null
@@ -1,493 +0,0 @@
-<?php
-
-/**
- * Definition of the purified HTML that describes allowed children,
- * attributes, and many other things.
- *
- * Conventions:
- *
- * All member variables that are prefixed with info
- * (including the main $info array) are used by HTML Purifier internals
- * and should not be directly edited when customizing the HTMLDefinition.
- * They can usually be set via configuration directives or custom
- * modules.
- *
- * On the other hand, member variables without the info prefix are used
- * internally by the HTMLDefinition and MUST NOT be used by other HTML
- * Purifier internals. Many of them, however, are public, and may be
- * edited by userspace code to tweak the behavior of HTMLDefinition.
- *
- * @note This class is inspected by Printer_HTMLDefinition; please
- *       update that class if things here change.
- *
- * @warning Directives that change this object's structure must be in
- *          the HTML or Attr namespace!
- */
-class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
-{
-
-    // FULLY-PUBLIC VARIABLES ---------------------------------------------
-
-    /**
-     * Associative array of element names to HTMLPurifier_ElementDef.
-     * @type HTMLPurifier_ElementDef[]
-     */
-    public $info = array();
-
-    /**
-     * Associative array of global attribute name to attribute definition.
-     * @type array
-     */
-    public $info_global_attr = array();
-
-    /**
-     * String name of parent element HTML will be going into.
-     * @type string
-     */
-    public $info_parent = 'div';
-
-    /**
-     * Definition for parent element, allows parent element to be a
-     * tag that's not allowed inside the HTML fragment.
-     * @type HTMLPurifier_ElementDef
-     */
-    public $info_parent_def;
-
-    /**
-     * String name of element used to wrap inline elements in block context.
-     * @type string
-     * @note This is rarely used except for BLOCKQUOTEs in strict mode
-     */
-    public $info_block_wrapper = 'p';
-
-    /**
-     * Associative array of deprecated tag name to HTMLPurifier_TagTransform.
-     * @type array
-     */
-    public $info_tag_transform = array();
-
-    /**
-     * Indexed list of HTMLPurifier_AttrTransform to be performed before validation.
-     * @type HTMLPurifier_AttrTransform[]
-     */
-    public $info_attr_transform_pre = array();
-
-    /**
-     * Indexed list of HTMLPurifier_AttrTransform to be performed after validation.
-     * @type HTMLPurifier_AttrTransform[]
-     */
-    public $info_attr_transform_post = array();
-
-    /**
-     * Nested lookup array of content set name (Block, Inline) to
-     * element name to whether or not it belongs in that content set.
-     * @type array
-     */
-    public $info_content_sets = array();
-
-    /**
-     * Indexed list of HTMLPurifier_Injector to be used.
-     * @type HTMLPurifier_Injector[]
-     */
-    public $info_injector = array();
-
-    /**
-     * Doctype object
-     * @type HTMLPurifier_Doctype
-     */
-    public $doctype;
-
-
-
-    // RAW CUSTOMIZATION STUFF --------------------------------------------
-
-    /**
-     * Adds a custom attribute to a pre-existing element
-     * @note This is strictly convenience, and does not have a corresponding
-     *       method in HTMLPurifier_HTMLModule
-     * @param string $element_name Element name to add attribute to
-     * @param string $attr_name Name of attribute
-     * @param mixed $def Attribute definition, can be string or object, see
-     *             HTMLPurifier_AttrTypes for details
-     */
-    public function addAttribute($element_name, $attr_name, $def)
-    {
-        $module = $this->getAnonymousModule();
-        if (!isset($module->info[$element_name])) {
-            $element = $module->addBlankElement($element_name);
-        } else {
-            $element = $module->info[$element_name];
-        }
-        $element->attr[$attr_name] = $def;
-    }
-
-    /**
-     * Adds a custom element to your HTML definition
-     * @see HTMLPurifier_HTMLModule::addElement() for detailed
-     *       parameter and return value descriptions.
-     */
-    public function addElement($element_name, $type, $contents, $attr_collections, $attributes = array())
-    {
-        $module = $this->getAnonymousModule();
-        // assume that if the user is calling this, the element
-        // is safe. This may not be a good idea
-        $element = $module->addElement($element_name, $type, $contents, $attr_collections, $attributes);
-        return $element;
-    }
-
-    /**
-     * Adds a blank element to your HTML definition, for overriding
-     * existing behavior
-     * @param string $element_name
-     * @return HTMLPurifier_ElementDef
-     * @see HTMLPurifier_HTMLModule::addBlankElement() for detailed
-     *       parameter and return value descriptions.
-     */
-    public function addBlankElement($element_name)
-    {
-        $module  = $this->getAnonymousModule();
-        $element = $module->addBlankElement($element_name);
-        return $element;
-    }
-
-    /**
-     * Retrieves a reference to the anonymous module, so you can
-     * bust out advanced features without having to make your own
-     * module.
-     * @return HTMLPurifier_HTMLModule
-     */
-    public function getAnonymousModule()
-    {
-        if (!$this->_anonModule) {
-            $this->_anonModule = new HTMLPurifier_HTMLModule();
-            $this->_anonModule->name = 'Anonymous';
-        }
-        return $this->_anonModule;
-    }
-
-    private $_anonModule = null;
-
-    // PUBLIC BUT INTERNAL VARIABLES --------------------------------------
-
-    /**
-     * @type string
-     */
-    public $type = 'HTML';
-
-    /**
-     * @type HTMLPurifier_HTMLModuleManager
-     */
-    public $manager;
-
-    /**
-     * Performs low-cost, preliminary initialization.
-     */
-    public function __construct()
-    {
-        $this->manager = new HTMLPurifier_HTMLModuleManager();
-    }
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    protected function doSetup($config)
-    {
-        $this->processModules($config);
-        $this->setupConfigStuff($config);
-        unset($this->manager);
-
-        // cleanup some of the element definitions
-        foreach ($this->info as $k => $v) {
-            unset($this->info[$k]->content_model);
-            unset($this->info[$k]->content_model_type);
-        }
-    }
-
-    /**
-     * Extract out the information from the manager
-     * @param HTMLPurifier_Config $config
-     */
-    protected function processModules($config)
-    {
-        if ($this->_anonModule) {
-            // for user specific changes
-            // this is late-loaded so we don't have to deal with PHP4
-            // reference wonky-ness
-            $this->manager->addModule($this->_anonModule);
-            unset($this->_anonModule);
-        }
-
-        $this->manager->setup($config);
-        $this->doctype = $this->manager->doctype;
-
-        foreach ($this->manager->modules as $module) {
-            foreach ($module->info_tag_transform as $k => $v) {
-                if ($v === false) {
-                    unset($this->info_tag_transform[$k]);
-                } else {
-                    $this->info_tag_transform[$k] = $v;
-                }
-            }
-            foreach ($module->info_attr_transform_pre as $k => $v) {
-                if ($v === false) {
-                    unset($this->info_attr_transform_pre[$k]);
-                } else {
-                    $this->info_attr_transform_pre[$k] = $v;
-                }
-            }
-            foreach ($module->info_attr_transform_post as $k => $v) {
-                if ($v === false) {
-                    unset($this->info_attr_transform_post[$k]);
-                } else {
-                    $this->info_attr_transform_post[$k] = $v;
-                }
-            }
-            foreach ($module->info_injector as $k => $v) {
-                if ($v === false) {
-                    unset($this->info_injector[$k]);
-                } else {
-                    $this->info_injector[$k] = $v;
-                }
-            }
-        }
-        $this->info = $this->manager->getElements();
-        $this->info_content_sets = $this->manager->contentSets->lookup;
-    }
-
-    /**
-     * Sets up stuff based on config. We need a better way of doing this.
-     * @param HTMLPurifier_Config $config
-     */
-    protected function setupConfigStuff($config)
-    {
-        $block_wrapper = $config->get('HTML.BlockWrapper');
-        if (isset($this->info_content_sets['Block'][$block_wrapper])) {
-            $this->info_block_wrapper = $block_wrapper;
-        } else {
-            trigger_error(
-                'Cannot use non-block element as block wrapper',
-                E_USER_ERROR
-            );
-        }
-
-        $parent = $config->get('HTML.Parent');
-        $def = $this->manager->getElement($parent, true);
-        if ($def) {
-            $this->info_parent = $parent;
-            $this->info_parent_def = $def;
-        } else {
-            trigger_error(
-                'Cannot use unrecognized element as parent',
-                E_USER_ERROR
-            );
-            $this->info_parent_def = $this->manager->getElement($this->info_parent, true);
-        }
-
-        // support template text
-        $support = "(for information on implementing this, see the support forums) ";
-
-        // setup allowed elements -----------------------------------------
-
-        $allowed_elements = $config->get('HTML.AllowedElements');
-        $allowed_attributes = $config->get('HTML.AllowedAttributes'); // retrieve early
-
-        if (!is_array($allowed_elements) && !is_array($allowed_attributes)) {
-            $allowed = $config->get('HTML.Allowed');
-            if (is_string($allowed)) {
-                list($allowed_elements, $allowed_attributes) = $this->parseTinyMCEAllowedList($allowed);
-            }
-        }
-
-        if (is_array($allowed_elements)) {
-            foreach ($this->info as $name => $d) {
-                if (!isset($allowed_elements[$name])) {
-                    unset($this->info[$name]);
-                }
-                unset($allowed_elements[$name]);
-            }
-            // emit errors
-            foreach ($allowed_elements as $element => $d) {
-                $element = htmlspecialchars($element); // PHP doesn't escape errors, be careful!
-                trigger_error("Element '$element' is not supported $support", E_USER_WARNING);
-            }
-        }
-
-        // setup allowed attributes ---------------------------------------
-
-        $allowed_attributes_mutable = $allowed_attributes; // by copy!
-        if (is_array($allowed_attributes)) {
-            // This actually doesn't do anything, since we went away from
-            // global attributes. It's possible that userland code uses
-            // it, but HTMLModuleManager doesn't!
-            foreach ($this->info_global_attr as $attr => $x) {
-                $keys = array($attr, "*@$attr", "*.$attr");
-                $delete = true;
-                foreach ($keys as $key) {
-                    if ($delete && isset($allowed_attributes[$key])) {
-                        $delete = false;
-                    }
-                    if (isset($allowed_attributes_mutable[$key])) {
-                        unset($allowed_attributes_mutable[$key]);
-                    }
-                }
-                if ($delete) {
-                    unset($this->info_global_attr[$attr]);
-                }
-            }
-
-            foreach ($this->info as $tag => $info) {
-                foreach ($info->attr as $attr => $x) {
-                    $keys = array("$tag@$attr", $attr, "*@$attr", "$tag.$attr", "*.$attr");
-                    $delete = true;
-                    foreach ($keys as $key) {
-                        if ($delete && isset($allowed_attributes[$key])) {
-                            $delete = false;
-                        }
-                        if (isset($allowed_attributes_mutable[$key])) {
-                            unset($allowed_attributes_mutable[$key]);
-                        }
-                    }
-                    if ($delete) {
-                        if ($this->info[$tag]->attr[$attr]->required) {
-                            trigger_error(
-                                "Required attribute '$attr' in element '$tag' " .
-                                "was not allowed, which means '$tag' will not be allowed either",
-                                E_USER_WARNING
-                            );
-                        }
-                        unset($this->info[$tag]->attr[$attr]);
-                    }
-                }
-            }
-            // emit errors
-            foreach ($allowed_attributes_mutable as $elattr => $d) {
-                $bits = preg_split('/[.@]/', $elattr, 2);
-                $c = count($bits);
-                switch ($c) {
-                    case 2:
-                        if ($bits[0] !== '*') {
-                            $element = htmlspecialchars($bits[0]);
-                            $attribute = htmlspecialchars($bits[1]);
-                            if (!isset($this->info[$element])) {
-                                trigger_error(
-                                    "Cannot allow attribute '$attribute' if element " .
-                                    "'$element' is not allowed/supported $support"
-                                );
-                            } else {
-                                trigger_error(
-                                    "Attribute '$attribute' in element '$element' not supported $support",
-                                    E_USER_WARNING
-                                );
-                            }
-                            break;
-                        }
-                        // otherwise fall through
-                    case 1:
-                        $attribute = htmlspecialchars($bits[0]);
-                        trigger_error(
-                            "Global attribute '$attribute' is not ".
-                            "supported in any elements $support",
-                            E_USER_WARNING
-                        );
-                        break;
-                }
-            }
-        }
-
-        // setup forbidden elements ---------------------------------------
-
-        $forbidden_elements   = $config->get('HTML.ForbiddenElements');
-        $forbidden_attributes = $config->get('HTML.ForbiddenAttributes');
-
-        foreach ($this->info as $tag => $info) {
-            if (isset($forbidden_elements[$tag])) {
-                unset($this->info[$tag]);
-                continue;
-            }
-            foreach ($info->attr as $attr => $x) {
-                if (isset($forbidden_attributes["$tag@$attr"]) ||
-                    isset($forbidden_attributes["*@$attr"]) ||
-                    isset($forbidden_attributes[$attr])
-                ) {
-                    unset($this->info[$tag]->attr[$attr]);
-                    continue;
-                } elseif (isset($forbidden_attributes["$tag.$attr"])) { // this segment might get removed eventually
-                    // $tag.$attr are not user supplied, so no worries!
-                    trigger_error(
-                        "Error with $tag.$attr: tag.attr syntax not supported for " .
-                        "HTML.ForbiddenAttributes; use tag@attr instead",
-                        E_USER_WARNING
-                    );
-                }
-            }
-        }
-        foreach ($forbidden_attributes as $key => $v) {
-            if (strlen($key) < 2) {
-                continue;
-            }
-            if ($key[0] != '*') {
-                continue;
-            }
-            if ($key[1] == '.') {
-                trigger_error(
-                    "Error with $key: *.attr syntax not supported for HTML.ForbiddenAttributes; use attr instead",
-                    E_USER_WARNING
-                );
-            }
-        }
-
-        // setup injectors -----------------------------------------------------
-        foreach ($this->info_injector as $i => $injector) {
-            if ($injector->checkNeeded($config) !== false) {
-                // remove injector that does not have it's required
-                // elements/attributes present, and is thus not needed.
-                unset($this->info_injector[$i]);
-            }
-        }
-    }
-
-    /**
-     * Parses a TinyMCE-flavored Allowed Elements and Attributes list into
-     * separate lists for processing. Format is element[attr1|attr2],element2...
-     * @warning Although it's largely drawn from TinyMCE's implementation,
-     *      it is different, and you'll probably have to modify your lists
-     * @param array $list String list to parse
-     * @return array
-     * @todo Give this its own class, probably static interface
-     */
-    public function parseTinyMCEAllowedList($list)
-    {
-        $list = str_replace(array(' ', "\t"), '', $list);
-
-        $elements = array();
-        $attributes = array();
-
-        $chunks = preg_split('/(,|[\n\r]+)/', $list);
-        foreach ($chunks as $chunk) {
-            if (empty($chunk)) {
-                continue;
-            }
-            // remove TinyMCE element control characters
-            if (!strpos($chunk, '[')) {
-                $element = $chunk;
-                $attr = false;
-            } else {
-                list($element, $attr) = explode('[', $chunk);
-            }
-            if ($element !== '*') {
-                $elements[$element] = true;
-            }
-            if (!$attr) {
-                continue;
-            }
-            $attr = substr($attr, 0, strlen($attr) - 1); // remove trailing ]
-            $attr = explode('|', $attr);
-            foreach ($attr as $key) {
-                $attributes["$element.$key"] = true;
-            }
-        }
-        return array($elements, $attributes);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule.php
deleted file mode 100644
index 9877f9efe..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule.php
+++ /dev/null
@@ -1,284 +0,0 @@
-<?php
-
-/**
- * Represents an XHTML 1.1 module, with information on elements, tags
- * and attributes.
- * @note Even though this is technically XHTML 1.1, it is also used for
- *       regular HTML parsing. We are using modulization as a convenient
- *       way to represent the internals of HTMLDefinition, and our
- *       implementation is by no means conforming and does not directly
- *       use the normative DTDs or XML schemas.
- * @note The public variables in a module should almost directly
- *       correspond to the variables in HTMLPurifier_HTMLDefinition.
- *       However, the prefix info carries no special meaning in these
- *       objects (include it anyway if that's the correspondence though).
- * @todo Consider making some member functions protected
- */
-
-class HTMLPurifier_HTMLModule
-{
-
-    // -- Overloadable ----------------------------------------------------
-
-    /**
-     * Short unique string identifier of the module.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * Informally, a list of elements this module changes.
-     * Not used in any significant way.
-     * @type array
-     */
-    public $elements = array();
-
-    /**
-     * Associative array of element names to element definitions.
-     * Some definitions may be incomplete, to be merged in later
-     * with the full definition.
-     * @type array
-     */
-    public $info = array();
-
-    /**
-     * Associative array of content set names to content set additions.
-     * This is commonly used to, say, add an A element to the Inline
-     * content set. This corresponds to an internal variable $content_sets
-     * and NOT info_content_sets member variable of HTMLDefinition.
-     * @type array
-     */
-    public $content_sets = array();
-
-    /**
-     * Associative array of attribute collection names to attribute
-     * collection additions. More rarely used for adding attributes to
-     * the global collections. Example is the StyleAttribute module adding
-     * the style attribute to the Core. Corresponds to HTMLDefinition's
-     * attr_collections->info, since the object's data is only info,
-     * with extra behavior associated with it.
-     * @type array
-     */
-    public $attr_collections = array();
-
-    /**
-     * Associative array of deprecated tag name to HTMLPurifier_TagTransform.
-     * @type array
-     */
-    public $info_tag_transform = array();
-
-    /**
-     * List of HTMLPurifier_AttrTransform to be performed before validation.
-     * @type array
-     */
-    public $info_attr_transform_pre = array();
-
-    /**
-     * List of HTMLPurifier_AttrTransform to be performed after validation.
-     * @type array
-     */
-    public $info_attr_transform_post = array();
-
-    /**
-     * List of HTMLPurifier_Injector to be performed during well-formedness fixing.
-     * An injector will only be invoked if all of it's pre-requisites are met;
-     * if an injector fails setup, there will be no error; it will simply be
-     * silently disabled.
-     * @type array
-     */
-    public $info_injector = array();
-
-    /**
-     * Boolean flag that indicates whether or not getChildDef is implemented.
-     * For optimization reasons: may save a call to a function. Be sure
-     * to set it if you do implement getChildDef(), otherwise it will have
-     * no effect!
-     * @type bool
-     */
-    public $defines_child_def = false;
-
-    /**
-     * Boolean flag whether or not this module is safe. If it is not safe, all
-     * of its members are unsafe. Modules are safe by default (this might be
-     * slightly dangerous, but it doesn't make much sense to force HTML Purifier,
-     * which is based off of safe HTML, to explicitly say, "This is safe," even
-     * though there are modules which are "unsafe")
-     *
-     * @type bool
-     * @note Previously, safety could be applied at an element level granularity.
-     *       We've removed this ability, so in order to add "unsafe" elements
-     *       or attributes, a dedicated module with this property set to false
-     *       must be used.
-     */
-    public $safe = true;
-
-    /**
-     * Retrieves a proper HTMLPurifier_ChildDef subclass based on
-     * content_model and content_model_type member variables of
-     * the HTMLPurifier_ElementDef class. There is a similar function
-     * in HTMLPurifier_HTMLDefinition.
-     * @param HTMLPurifier_ElementDef $def
-     * @return HTMLPurifier_ChildDef subclass
-     */
-    public function getChildDef($def)
-    {
-        return false;
-    }
-
-    // -- Convenience -----------------------------------------------------
-
-    /**
-     * Convenience function that sets up a new element
-     * @param string $element Name of element to add
-     * @param string|bool $type What content set should element be registered to?
-     *              Set as false to skip this step.
-     * @param string $contents Allowed children in form of:
-     *              "$content_model_type: $content_model"
-     * @param array $attr_includes What attribute collections to register to
-     *              element?
-     * @param array $attr What unique attributes does the element define?
-     * @see HTMLPurifier_ElementDef:: for in-depth descriptions of these parameters.
-     * @return HTMLPurifier_ElementDef Created element definition object, so you
-     *         can set advanced parameters
-     */
-    public function addElement($element, $type, $contents, $attr_includes = array(), $attr = array())
-    {
-        $this->elements[] = $element;
-        // parse content_model
-        list($content_model_type, $content_model) = $this->parseContents($contents);
-        // merge in attribute inclusions
-        $this->mergeInAttrIncludes($attr, $attr_includes);
-        // add element to content sets
-        if ($type) {
-            $this->addElementToContentSet($element, $type);
-        }
-        // create element
-        $this->info[$element] = HTMLPurifier_ElementDef::create(
-            $content_model,
-            $content_model_type,
-            $attr
-        );
-        // literal object $contents means direct child manipulation
-        if (!is_string($contents)) {
-            $this->info[$element]->child = $contents;
-        }
-        return $this->info[$element];
-    }
-
-    /**
-     * Convenience function that creates a totally blank, non-standalone
-     * element.
-     * @param string $element Name of element to create
-     * @return HTMLPurifier_ElementDef Created element
-     */
-    public function addBlankElement($element)
-    {
-        if (!isset($this->info[$element])) {
-            $this->elements[] = $element;
-            $this->info[$element] = new HTMLPurifier_ElementDef();
-            $this->info[$element]->standalone = false;
-        } else {
-            trigger_error("Definition for $element already exists in module, cannot redefine");
-        }
-        return $this->info[$element];
-    }
-
-    /**
-     * Convenience function that registers an element to a content set
-     * @param string $element Element to register
-     * @param string $type Name content set (warning: case sensitive, usually upper-case
-     *        first letter)
-     */
-    public function addElementToContentSet($element, $type)
-    {
-        if (!isset($this->content_sets[$type])) {
-            $this->content_sets[$type] = '';
-        } else {
-            $this->content_sets[$type] .= ' | ';
-        }
-        $this->content_sets[$type] .= $element;
-    }
-
-    /**
-     * Convenience function that transforms single-string contents
-     * into separate content model and content model type
-     * @param string $contents Allowed children in form of:
-     *                  "$content_model_type: $content_model"
-     * @return array
-     * @note If contents is an object, an array of two nulls will be
-     *       returned, and the callee needs to take the original $contents
-     *       and use it directly.
-     */
-    public function parseContents($contents)
-    {
-        if (!is_string($contents)) {
-            return array(null, null);
-        } // defer
-        switch ($contents) {
-            // check for shorthand content model forms
-            case 'Empty':
-                return array('empty', '');
-            case 'Inline':
-                return array('optional', 'Inline | #PCDATA');
-            case 'Flow':
-                return array('optional', 'Flow | #PCDATA');
-        }
-        list($content_model_type, $content_model) = explode(':', $contents);
-        $content_model_type = strtolower(trim($content_model_type));
-        $content_model = trim($content_model);
-        return array($content_model_type, $content_model);
-    }
-
-    /**
-     * Convenience function that merges a list of attribute includes into
-     * an attribute array.
-     * @param array $attr Reference to attr array to modify
-     * @param array $attr_includes Array of includes / string include to merge in
-     */
-    public function mergeInAttrIncludes(&$attr, $attr_includes)
-    {
-        if (!is_array($attr_includes)) {
-            if (empty($attr_includes)) {
-                $attr_includes = array();
-            } else {
-                $attr_includes = array($attr_includes);
-            }
-        }
-        $attr[0] = $attr_includes;
-    }
-
-    /**
-     * Convenience function that generates a lookup table with boolean
-     * true as value.
-     * @param string $list List of values to turn into a lookup
-     * @note You can also pass an arbitrary number of arguments in
-     *       place of the regular argument
-     * @return array array equivalent of list
-     */
-    public function makeLookup($list)
-    {
-        if (is_string($list)) {
-            $list = func_get_args();
-        }
-        $ret = array();
-        foreach ($list as $value) {
-            if (is_null($value)) {
-                continue;
-            }
-            $ret[$value] = true;
-        }
-        return $ret;
-    }
-
-    /**
-     * Lazy load construction of the module after determining whether
-     * or not it's needed, and also when a finalized configuration object
-     * is available.
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Bdo.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Bdo.php
deleted file mode 100644
index 191a78d1c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Bdo.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Bi-directional Text Module, defines elements that
- * declare directionality of content. Text Extension Module.
- */
-class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Bdo';
-
-    /**
-     * @type array
-     */
-    public $attr_collections = array(
-        'I18N' => array('dir' => false)
-    );
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $bdo = $this->addElement(
-            'bdo',
-            'Inline',
-            'Inline',
-            array('Core', 'Lang'),
-            array(
-                'dir' => 'Enum#ltr,rtl', // required
-                // The Abstract Module specification has the attribute
-                // inclusions wrong for bdo: bdo allows Lang
-            )
-        );
-        $bdo->attr_transform_post[] = new HTMLPurifier_AttrTransform_BdoDir();
-
-        $this->attr_collections['I18N']['dir'] = 'Enum#ltr,rtl';
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/CommonAttributes.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/CommonAttributes.php
deleted file mode 100644
index e2fe53fc8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/CommonAttributes.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_CommonAttributes extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'CommonAttributes';
-
-    /**
-     * @type array
-     */
-    public $attr_collections = array(
-        'Core' => array(
-            0 => array('Style'),
-            // 'xml:space' => false,
-            'class' => 'Class',
-            'id' => 'ID',
-            'title' => 'CDATA',
-        ),
-        'Lang' => array(),
-        'I18N' => array(
-            0 => array('Lang'), // proprietary, for xml:lang/lang
-        ),
-        'Common' => array(
-            0 => array('Core', 'I18N')
-        )
-    );
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Edit.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Edit.php
deleted file mode 100644
index b8288368c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Edit.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
- * Module.
- */
-class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Edit';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
-        $attr = array(
-            'cite' => 'URI',
-            // 'datetime' => 'Datetime', // not implemented
-        );
-        $this->addElement('del', 'Inline', $contents, 'Common', $attr);
-        $this->addElement('ins', 'Inline', $contents, 'Common', $attr);
-    }
-
-    // HTML 4.01 specifies that ins/del must not contain block
-    // elements when used in an inline context, chameleon is
-    // a complicated workaround to acheive this effect
-
-    // Inline context ! Block context (exclamation mark is
-    // separator, see getChildDef for parsing)
-
-    /**
-     * @type bool
-     */
-    public $defines_child_def = true;
-
-    /**
-     * @param HTMLPurifier_ElementDef $def
-     * @return HTMLPurifier_ChildDef_Chameleon
-     */
-    public function getChildDef($def)
-    {
-        if ($def->content_model_type != 'chameleon') {
-            return false;
-        }
-        $value = explode('!', $def->content_model);
-        return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Forms.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Forms.php
deleted file mode 100644
index 13ce6ad5d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Forms.php
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Forms module, defines all form-related elements found in HTML 4.
- */
-class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Forms';
-
-    /**
-     * @type bool
-     */
-    public $safe = false;
-
-    /**
-     * @type array
-     */
-    public $content_sets = array(
-        'Block' => 'Form',
-        'Inline' => 'Formctrl',
-    );
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $form = $this->addElement(
-            'form',
-            'Form',
-            'Required: Heading | List | Block | fieldset',
-            'Common',
-            array(
-                'accept' => 'ContentTypes',
-                'accept-charset' => 'Charsets',
-                'action*' => 'URI',
-                'method' => 'Enum#get,post',
-                // really ContentType, but these two are the only ones used today
-                'enctype' => 'Enum#application/x-www-form-urlencoded,multipart/form-data',
-            )
-        );
-        $form->excludes = array('form' => true);
-
-        $input = $this->addElement(
-            'input',
-            'Formctrl',
-            'Empty',
-            'Common',
-            array(
-                'accept' => 'ContentTypes',
-                'accesskey' => 'Character',
-                'alt' => 'Text',
-                'checked' => 'Bool#checked',
-                'disabled' => 'Bool#disabled',
-                'maxlength' => 'Number',
-                'name' => 'CDATA',
-                'readonly' => 'Bool#readonly',
-                'size' => 'Number',
-                'src' => 'URI#embedded',
-                'tabindex' => 'Number',
-                'type' => 'Enum#text,password,checkbox,button,radio,submit,reset,file,hidden,image',
-                'value' => 'CDATA',
-            )
-        );
-        $input->attr_transform_post[] = new HTMLPurifier_AttrTransform_Input();
-
-        $this->addElement(
-            'select',
-            'Formctrl',
-            'Required: optgroup | option',
-            'Common',
-            array(
-                'disabled' => 'Bool#disabled',
-                'multiple' => 'Bool#multiple',
-                'name' => 'CDATA',
-                'size' => 'Number',
-                'tabindex' => 'Number',
-            )
-        );
-
-        $this->addElement(
-            'option',
-            false,
-            'Optional: #PCDATA',
-            'Common',
-            array(
-                'disabled' => 'Bool#disabled',
-                'label' => 'Text',
-                'selected' => 'Bool#selected',
-                'value' => 'CDATA',
-            )
-        );
-        // It's illegal for there to be more than one selected, but not
-        // be multiple. Also, no selected means undefined behavior. This might
-        // be difficult to implement; perhaps an injector, or a context variable.
-
-        $textarea = $this->addElement(
-            'textarea',
-            'Formctrl',
-            'Optional: #PCDATA',
-            'Common',
-            array(
-                'accesskey' => 'Character',
-                'cols*' => 'Number',
-                'disabled' => 'Bool#disabled',
-                'name' => 'CDATA',
-                'readonly' => 'Bool#readonly',
-                'rows*' => 'Number',
-                'tabindex' => 'Number',
-            )
-        );
-        $textarea->attr_transform_pre[] = new HTMLPurifier_AttrTransform_Textarea();
-
-        $button = $this->addElement(
-            'button',
-            'Formctrl',
-            'Optional: #PCDATA | Heading | List | Block | Inline',
-            'Common',
-            array(
-                'accesskey' => 'Character',
-                'disabled' => 'Bool#disabled',
-                'name' => 'CDATA',
-                'tabindex' => 'Number',
-                'type' => 'Enum#button,submit,reset',
-                'value' => 'CDATA',
-            )
-        );
-
-        // For exclusions, ideally we'd specify content sets, not literal elements
-        $button->excludes = $this->makeLookup(
-            'form',
-            'fieldset', // Form
-            'input',
-            'select',
-            'textarea',
-            'label',
-            'button', // Formctrl
-            'a', // as per HTML 4.01 spec, this is omitted by modularization
-            'isindex',
-            'iframe' // legacy items
-        );
-
-        // Extra exclusion: img usemap="" is not permitted within this element.
-        // We'll omit this for now, since we don't have any good way of
-        // indicating it yet.
-
-        // This is HIGHLY user-unfriendly; we need a custom child-def for this
-        $this->addElement('fieldset', 'Form', 'Custom: (#WS?,legend,(Flow|#PCDATA)*)', 'Common');
-
-        $label = $this->addElement(
-            'label',
-            'Formctrl',
-            'Optional: #PCDATA | Inline',
-            'Common',
-            array(
-                'accesskey' => 'Character',
-                // 'for' => 'IDREF', // IDREF not implemented, cannot allow
-            )
-        );
-        $label->excludes = array('label' => true);
-
-        $this->addElement(
-            'legend',
-            false,
-            'Optional: #PCDATA | Inline',
-            'Common',
-            array(
-                'accesskey' => 'Character',
-            )
-        );
-
-        $this->addElement(
-            'optgroup',
-            false,
-            'Required: option',
-            'Common',
-            array(
-                'disabled' => 'Bool#disabled',
-                'label*' => 'Text',
-            )
-        );
-        // Don't forget an injector for <isindex>. This one's a little complex
-        // because it maps to multiple elements.
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Hypertext.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Hypertext.php
deleted file mode 100644
index 968c07e98..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Hypertext.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Hypertext Module, defines hypertext links. Core Module.
- */
-class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Hypertext';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $a = $this->addElement(
-            'a',
-            'Inline',
-            'Inline',
-            'Common',
-            array(
-                // 'accesskey' => 'Character',
-                // 'charset' => 'Charset',
-                'href' => 'URI',
-                // 'hreflang' => 'LanguageCode',
-                'rel' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rel'),
-                'rev' => new HTMLPurifier_AttrDef_HTML_LinkTypes('rev'),
-                // 'tabindex' => 'Number',
-                // 'type' => 'ContentType',
-            )
-        );
-        $a->formatting = true;
-        $a->excludes = array('a' => true);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Iframe.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Iframe.php
deleted file mode 100644
index 2c9bdc580..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Iframe.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Iframe Module provides inline frames.
- *
- * @note This module is not considered safe unless an Iframe
- * whitelisting mechanism is specified.  Currently, the only
- * such mechanism is %URL.SafeIframeRegexp
- */
-class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Iframe';
-
-    /**
-     * @type bool
-     */
-    public $safe = false;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        if ($config->get('HTML.SafeIframe')) {
-            $this->safe = true;
-        }
-        $this->addElement(
-            'iframe',
-            'Inline',
-            'Flow',
-            'Common',
-            array(
-                'src' => 'URI#embedded',
-                'width' => 'Length',
-                'height' => 'Length',
-                'name' => 'ID',
-                'scrolling' => 'Enum#yes,no,auto',
-                'frameborder' => 'Enum#0,1',
-                'longdesc' => 'URI',
-                'marginheight' => 'Pixels',
-                'marginwidth' => 'Pixels',
-            )
-        );
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Image.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Image.php
deleted file mode 100644
index 0ed7411e7..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Image.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Image Module provides basic image embedding.
- * @note There is specialized code for removing empty images in
- *       HTMLPurifier_Strategy_RemoveForeignElements
- */
-class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Image';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $max = $config->get('HTML.MaxImgLength');
-        $img = $this->addElement(
-            'img',
-            'Inline',
-            'Empty',
-            'Common',
-            array(
-                'alt*' => 'Text',
-                // According to the spec, it's Length, but percents can
-                // be abused, so we allow only Pixels.
-                'height' => 'Pixels#' . $max,
-                'width' => 'Pixels#' . $max,
-                'longdesc' => 'URI',
-                'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded
-            )
-        );
-        if ($max === null || $config->get('HTML.Trusted')) {
-            $img->attr['height'] =
-            $img->attr['width'] = 'Length';
-        }
-
-        // kind of strange, but splitting things up would be inefficient
-        $img->attr_transform_pre[] =
-        $img->attr_transform_post[] =
-            new HTMLPurifier_AttrTransform_ImgRequired();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Legacy.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Legacy.php
deleted file mode 100644
index 9ca1cb375..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Legacy.php
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Legacy module defines elements that were previously
- * deprecated.
- *
- * @note Not all legacy elements have been implemented yet, which
- *       is a bit of a reverse problem as compared to browsers! In
- *       addition, this legacy module may implement a bit more than
- *       mandated by XHTML 1.1.
- *
- * This module can be used in combination with TransformToStrict in order
- * to transform as many deprecated elements as possible, but retain
- * questionably deprecated elements that do not have good alternatives
- * as well as transform elements that don't have an implementation.
- * See docs/ref-strictness.txt for more details.
- */
-
-class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Legacy';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->addElement(
-            'basefont',
-            'Inline',
-            'Empty',
-            null,
-            array(
-                'color' => 'Color',
-                'face' => 'Text', // extremely broad, we should
-                'size' => 'Text', // tighten it
-                'id' => 'ID'
-            )
-        );
-        $this->addElement('center', 'Block', 'Flow', 'Common');
-        $this->addElement(
-            'dir',
-            'Block',
-            'Required: li',
-            'Common',
-            array(
-                'compact' => 'Bool#compact'
-            )
-        );
-        $this->addElement(
-            'font',
-            'Inline',
-            'Inline',
-            array('Core', 'I18N'),
-            array(
-                'color' => 'Color',
-                'face' => 'Text', // extremely broad, we should
-                'size' => 'Text', // tighten it
-            )
-        );
-        $this->addElement(
-            'menu',
-            'Block',
-            'Required: li',
-            'Common',
-            array(
-                'compact' => 'Bool#compact'
-            )
-        );
-
-        $s = $this->addElement('s', 'Inline', 'Inline', 'Common');
-        $s->formatting = true;
-
-        $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common');
-        $strike->formatting = true;
-
-        $u = $this->addElement('u', 'Inline', 'Inline', 'Common');
-        $u->formatting = true;
-
-        // setup modifications to old elements
-
-        $align = 'Enum#left,right,center,justify';
-
-        $address = $this->addBlankElement('address');
-        $address->content_model = 'Inline | #PCDATA | p';
-        $address->content_model_type = 'optional';
-        $address->child = false;
-
-        $blockquote = $this->addBlankElement('blockquote');
-        $blockquote->content_model = 'Flow | #PCDATA';
-        $blockquote->content_model_type = 'optional';
-        $blockquote->child = false;
-
-        $br = $this->addBlankElement('br');
-        $br->attr['clear'] = 'Enum#left,all,right,none';
-
-        $caption = $this->addBlankElement('caption');
-        $caption->attr['align'] = 'Enum#top,bottom,left,right';
-
-        $div = $this->addBlankElement('div');
-        $div->attr['align'] = $align;
-
-        $dl = $this->addBlankElement('dl');
-        $dl->attr['compact'] = 'Bool#compact';
-
-        for ($i = 1; $i <= 6; $i++) {
-            $h = $this->addBlankElement("h$i");
-            $h->attr['align'] = $align;
-        }
-
-        $hr = $this->addBlankElement('hr');
-        $hr->attr['align'] = $align;
-        $hr->attr['noshade'] = 'Bool#noshade';
-        $hr->attr['size'] = 'Pixels';
-        $hr->attr['width'] = 'Length';
-
-        $img = $this->addBlankElement('img');
-        $img->attr['align'] = 'IAlign';
-        $img->attr['border'] = 'Pixels';
-        $img->attr['hspace'] = 'Pixels';
-        $img->attr['vspace'] = 'Pixels';
-
-        // figure out this integer business
-
-        $li = $this->addBlankElement('li');
-        $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
-        $li->attr['type'] = 'Enum#s:1,i,I,a,A,disc,square,circle';
-
-        $ol = $this->addBlankElement('ol');
-        $ol->attr['compact'] = 'Bool#compact';
-        $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
-        $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
-
-        $p = $this->addBlankElement('p');
-        $p->attr['align'] = $align;
-
-        $pre = $this->addBlankElement('pre');
-        $pre->attr['width'] = 'Number';
-
-        // script omitted
-
-        $table = $this->addBlankElement('table');
-        $table->attr['align'] = 'Enum#left,center,right';
-        $table->attr['bgcolor'] = 'Color';
-
-        $tr = $this->addBlankElement('tr');
-        $tr->attr['bgcolor'] = 'Color';
-
-        $th = $this->addBlankElement('th');
-        $th->attr['bgcolor'] = 'Color';
-        $th->attr['height'] = 'Length';
-        $th->attr['nowrap'] = 'Bool#nowrap';
-        $th->attr['width'] = 'Length';
-
-        $td = $this->addBlankElement('td');
-        $td->attr['bgcolor'] = 'Color';
-        $td->attr['height'] = 'Length';
-        $td->attr['nowrap'] = 'Bool#nowrap';
-        $td->attr['width'] = 'Length';
-
-        $ul = $this->addBlankElement('ul');
-        $ul->attr['compact'] = 'Bool#compact';
-        $ul->attr['type'] = 'Enum#square,disc,circle';
-
-        // "safe" modifications to "unsafe" elements
-        // WARNING: If you want to add support for an unsafe, legacy
-        // attribute, make a new TrustedLegacy module with the trusted
-        // bit set appropriately
-
-        $form = $this->addBlankElement('form');
-        $form->content_model = 'Flow | #PCDATA';
-        $form->content_model_type = 'optional';
-        $form->attr['target'] = 'FrameTarget';
-
-        $input = $this->addBlankElement('input');
-        $input->attr['align'] = 'IAlign';
-
-        $legend = $this->addBlankElement('legend');
-        $legend->attr['align'] = 'LAlign';
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/List.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/List.php
deleted file mode 100644
index 605e37c97..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/List.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 List Module, defines list-oriented elements. Core Module.
- */
-class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'List';
-
-    // According to the abstract schema, the List content set is a fully formed
-    // one or more expr, but it invariably occurs in an optional declaration
-    // so we're not going to do that subtlety. It might cause trouble
-    // if a user defines "List" and expects that multiple lists are
-    // allowed to be specified, but then again, that's not very intuitive.
-    // Furthermore, the actual XML Schema may disagree. Regardless,
-    // we don't have support for such nested expressions without using
-    // the incredibly inefficient and draconic Custom ChildDef.
-
-    /**
-     * @type array
-     */
-    public $content_sets = array('Flow' => 'List');
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common');
-        $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common');
-        // XXX The wrap attribute is handled by MakeWellFormed.  This is all
-        // quite unsatisfactory, because we generated this
-        // *specifically* for lists, and now a big chunk of the handling
-        // is done properly by the List ChildDef.  So actually, we just
-        // want enough information to make autoclosing work properly,
-        // and then hand off the tricky stuff to the ChildDef.
-        $ol->wrap = 'li';
-        $ul->wrap = 'li';
-        $this->addElement('dl', 'List', 'Required: dt | dd', 'Common');
-
-        $this->addElement('li', false, 'Flow', 'Common');
-
-        $this->addElement('dd', false, 'Flow', 'Common');
-        $this->addElement('dt', false, 'Inline', 'Common');
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Name.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Name.php
deleted file mode 100644
index 315e22a80..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Name.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_Name extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Name';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $elements = array('a', 'applet', 'form', 'frame', 'iframe', 'img', 'map');
-        foreach ($elements as $name) {
-            $element = $this->addBlankElement($name);
-            $element->attr['name'] = 'CDATA';
-            if (!$config->get('HTML.Attr.Name.UseCDATA')) {
-                $element->attr_transform_post[] = new HTMLPurifier_AttrTransform_NameSync();
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Nofollow.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Nofollow.php
deleted file mode 100644
index c145e8e96..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Nofollow.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * Module adds the nofollow attribute transformation to a tags.  It
- * is enabled by HTML.Nofollow
- */
-class HTMLPurifier_HTMLModule_Nofollow extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Nofollow';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $a = $this->addBlankElement('a');
-        $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_Nofollow();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
deleted file mode 100644
index 7d66e114f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_NonXMLCommonAttributes extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'NonXMLCommonAttributes';
-
-    /**
-     * @type array
-     */
-    public $attr_collections = array(
-        'Lang' => array(
-            'lang' => 'LanguageCode',
-        )
-    );
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Object.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Object.php
deleted file mode 100644
index d388b24c7..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Object.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Object Module, defines elements for generic object inclusion
- * @warning Users will commonly use <embed> to cater to legacy browsers: this
- *      module does not allow this sort of behavior
- */
-class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Object';
-
-    /**
-     * @type bool
-     */
-    public $safe = false;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->addElement(
-            'object',
-            'Inline',
-            'Optional: #PCDATA | Flow | param',
-            'Common',
-            array(
-                'archive' => 'URI',
-                'classid' => 'URI',
-                'codebase' => 'URI',
-                'codetype' => 'Text',
-                'data' => 'URI',
-                'declare' => 'Bool#declare',
-                'height' => 'Length',
-                'name' => 'CDATA',
-                'standby' => 'Text',
-                'tabindex' => 'Number',
-                'type' => 'ContentType',
-                'width' => 'Length'
-            )
-        );
-
-        $this->addElement(
-            'param',
-            false,
-            'Empty',
-            null,
-            array(
-                'id' => 'ID',
-                'name*' => 'Text',
-                'type' => 'Text',
-                'value' => 'Text',
-                'valuetype' => 'Enum#data,ref,object'
-            )
-        );
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Presentation.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Presentation.php
deleted file mode 100644
index 831db4cff..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Presentation.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Presentation Module, defines simple presentation-related
- * markup. Text Extension Module.
- * @note The official XML Schema and DTD specs further divide this into
- *       two modules:
- *          - Block Presentation (hr)
- *          - Inline Presentation (b, big, i, small, sub, sup, tt)
- *       We have chosen not to heed this distinction, as content_sets
- *       provides satisfactory disambiguation.
- */
-class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Presentation';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->addElement('hr', 'Block', 'Empty', 'Common');
-        $this->addElement('sub', 'Inline', 'Inline', 'Common');
-        $this->addElement('sup', 'Inline', 'Inline', 'Common');
-        $b = $this->addElement('b', 'Inline', 'Inline', 'Common');
-        $b->formatting = true;
-        $big = $this->addElement('big', 'Inline', 'Inline', 'Common');
-        $big->formatting = true;
-        $i = $this->addElement('i', 'Inline', 'Inline', 'Common');
-        $i->formatting = true;
-        $small = $this->addElement('small', 'Inline', 'Inline', 'Common');
-        $small->formatting = true;
-        $tt = $this->addElement('tt', 'Inline', 'Inline', 'Common');
-        $tt->formatting = true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Proprietary.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Proprietary.php
deleted file mode 100644
index 4593fc40f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Proprietary.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Module defines proprietary tags and attributes in HTML.
- * @warning If this module is enabled, standards-compliance is off!
- */
-class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Proprietary';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->addElement(
-            'marquee',
-            'Inline',
-            'Flow',
-            'Common',
-            array(
-                'direction' => 'Enum#left,right,up,down',
-                'behavior' => 'Enum#alternate',
-                'width' => 'Length',
-                'height' => 'Length',
-                'scrolldelay' => 'Number',
-                'scrollamount' => 'Number',
-                'loop' => 'Number',
-                'bgcolor' => 'Color',
-                'hspace' => 'Pixels',
-                'vspace' => 'Pixels',
-            )
-        );
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Ruby.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Ruby.php
deleted file mode 100644
index 9a2617296..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Ruby.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Ruby Annotation Module, defines elements that indicate
- * short runs of text alongside base text for annotation or pronounciation.
- */
-class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Ruby';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->addElement(
-            'ruby',
-            'Inline',
-            'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
-            'Common'
-        );
-        $this->addElement('rbc', false, 'Required: rb', 'Common');
-        $this->addElement('rtc', false, 'Required: rt', 'Common');
-        $rb = $this->addElement('rb', false, 'Inline', 'Common');
-        $rb->excludes = array('ruby' => true);
-        $rt = $this->addElement('rt', false, 'Inline', 'Common', array('rbspan' => 'Number'));
-        $rt->excludes = array('ruby' => true);
-        $this->addElement('rp', false, 'Optional: #PCDATA', 'Common');
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeEmbed.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeEmbed.php
deleted file mode 100644
index 11572887d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeEmbed.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * A "safe" embed module. See SafeObject. This is a proprietary element.
- */
-class HTMLPurifier_HTMLModule_SafeEmbed extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'SafeEmbed';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $max = $config->get('HTML.MaxImgLength');
-        $embed = $this->addElement(
-            'embed',
-            'Inline',
-            'Empty',
-            'Common',
-            array(
-                'src*' => 'URI#embedded',
-                'type' => 'Enum#application/x-shockwave-flash',
-                'width' => 'Pixels#' . $max,
-                'height' => 'Pixels#' . $max,
-                'allowscriptaccess' => 'Enum#never',
-                'allownetworking' => 'Enum#internal',
-                'flashvars' => 'Text',
-                'wmode' => 'Enum#window,transparent,opaque',
-                'name' => 'ID',
-            )
-        );
-        $embed->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeEmbed();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeObject.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeObject.php
deleted file mode 100644
index a061cec15..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeObject.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * A "safe" object module. In theory, objects permitted by this module will
- * be safe, and untrusted users can be allowed to embed arbitrary flash objects
- * (maybe other types too, but only Flash is supported as of right now).
- * Highly experimental.
- */
-class HTMLPurifier_HTMLModule_SafeObject extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'SafeObject';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        // These definitions are not intrinsically safe: the attribute transforms
-        // are a vital part of ensuring safety.
-
-        $max = $config->get('HTML.MaxImgLength');
-        $object = $this->addElement(
-            'object',
-            'Inline',
-            'Optional: param | Flow | #PCDATA',
-            'Common',
-            array(
-                // While technically not required by the spec, we're forcing
-                // it to this value.
-                'type' => 'Enum#application/x-shockwave-flash',
-                'width' => 'Pixels#' . $max,
-                'height' => 'Pixels#' . $max,
-                'data' => 'URI#embedded',
-                'codebase' => new HTMLPurifier_AttrDef_Enum(
-                    array(
-                        'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'
-                    )
-                ),
-            )
-        );
-        $object->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeObject();
-
-        $param = $this->addElement(
-            'param',
-            false,
-            'Empty',
-            false,
-            array(
-                'id' => 'ID',
-                'name*' => 'Text',
-                'value' => 'Text'
-            )
-        );
-        $param->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeParam();
-        $this->info_injector[] = 'SafeObject';
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeScripting.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeScripting.php
deleted file mode 100644
index 6e9113cb5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/SafeScripting.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * A "safe" script module. No inline JS is allowed, and pointed to JS
- * files must match whitelist.
- */
-class HTMLPurifier_HTMLModule_SafeScripting extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'SafeScripting';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        // These definitions are not intrinsically safe: the attribute transforms
-        // are a vital part of ensuring safety.
-
-        $allowed = $config->get('HTML.SafeScripting');
-        $script = $this->addElement(
-            'script',
-            'Inline',
-            'Empty',
-            null,
-            array(
-                // While technically not required by the spec, we're forcing
-                // it to this value.
-                'type' => 'Enum#text/javascript',
-                'src*' => new HTMLPurifier_AttrDef_Enum(array_keys($allowed))
-            )
-        );
-        $script->attr_transform_pre[] =
-        $script->attr_transform_post[] = new HTMLPurifier_AttrTransform_ScriptRequired();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Scripting.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Scripting.php
deleted file mode 100644
index 18785372a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Scripting.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/*
-
-WARNING: THIS MODULE IS EXTREMELY DANGEROUS AS IT ENABLES INLINE SCRIPTING
-INSIDE HTML PURIFIER DOCUMENTS. USE ONLY WITH TRUSTED USER INPUT!!!
-
-*/
-
-/**
- * XHTML 1.1 Scripting module, defines elements that are used to contain
- * information pertaining to executable scripts or the lack of support
- * for executable scripts.
- * @note This module does not contain inline scripting elements
- */
-class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Scripting';
-
-    /**
-     * @type array
-     */
-    public $elements = array('script', 'noscript');
-
-    /**
-     * @type array
-     */
-    public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
-
-    /**
-     * @type bool
-     */
-    public $safe = false;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        // TODO: create custom child-definition for noscript that
-        // auto-wraps stray #PCDATA in a similar manner to
-        // blockquote's custom definition (we would use it but
-        // blockquote's contents are optional while noscript's contents
-        // are required)
-
-        // TODO: convert this to new syntax, main problem is getting
-        // both content sets working
-
-        // In theory, this could be safe, but I don't see any reason to
-        // allow it.
-        $this->info['noscript'] = new HTMLPurifier_ElementDef();
-        $this->info['noscript']->attr = array(0 => array('Common'));
-        $this->info['noscript']->content_model = 'Heading | List | Block';
-        $this->info['noscript']->content_model_type = 'required';
-
-        $this->info['script'] = new HTMLPurifier_ElementDef();
-        $this->info['script']->attr = array(
-            'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')),
-            'src' => new HTMLPurifier_AttrDef_URI(true),
-            'type' => new HTMLPurifier_AttrDef_Enum(array('text/javascript'))
-        );
-        $this->info['script']->content_model = '#PCDATA';
-        $this->info['script']->content_model_type = 'optional';
-        $this->info['script']->attr_transform_pre[] =
-        $this->info['script']->attr_transform_post[] =
-            new HTMLPurifier_AttrTransform_ScriptRequired();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/StyleAttribute.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/StyleAttribute.php
deleted file mode 100644
index f192780a0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/StyleAttribute.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
- * Module.
- */
-class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'StyleAttribute';
-
-    /**
-     * @type array
-     */
-    public $attr_collections = array(
-        // The inclusion routine differs from the Abstract Modules but
-        // is in line with the DTD and XML Schemas.
-        'Style' => array('style' => false), // see constructor
-        'Core' => array(0 => array('Style'))
-    );
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tables.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tables.php
deleted file mode 100644
index f993e3ca1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tables.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Tables Module, fully defines accessible table elements.
- */
-class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Tables';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->addElement('caption', false, 'Inline', 'Common');
-
-        $this->addElement(
-            'table',
-            'Block',
-            new HTMLPurifier_ChildDef_Table(),
-            'Common',
-            array(
-                'border' => 'Pixels',
-                'cellpadding' => 'Length',
-                'cellspacing' => 'Length',
-                'frame' => 'Enum#void,above,below,hsides,lhs,rhs,vsides,box,border',
-                'rules' => 'Enum#none,groups,rows,cols,all',
-                'summary' => 'Text',
-                'width' => 'Length'
-            )
-        );
-
-        // common attributes
-        $cell_align = array(
-            'align' => 'Enum#left,center,right,justify,char',
-            'charoff' => 'Length',
-            'valign' => 'Enum#top,middle,bottom,baseline',
-        );
-
-        $cell_t = array_merge(
-            array(
-                'abbr' => 'Text',
-                'colspan' => 'Number',
-                'rowspan' => 'Number',
-                // Apparently, as of HTML5 this attribute only applies
-                // to 'th' elements.
-                'scope' => 'Enum#row,col,rowgroup,colgroup',
-            ),
-            $cell_align
-        );
-        $this->addElement('td', false, 'Flow', 'Common', $cell_t);
-        $this->addElement('th', false, 'Flow', 'Common', $cell_t);
-
-        $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
-
-        $cell_col = array_merge(
-            array(
-                'span' => 'Number',
-                'width' => 'MultiLength',
-            ),
-            $cell_align
-        );
-        $this->addElement('col', false, 'Empty', 'Common', $cell_col);
-        $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
-
-        $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
-        $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
-        $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Target.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Target.php
deleted file mode 100644
index f3af04863..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Target.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Target Module, defines target attribute in link elements.
- */
-class HTMLPurifier_HTMLModule_Target extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Target';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $elements = array('a');
-        foreach ($elements as $name) {
-            $e = $this->addBlankElement($name);
-            $e->attr = array(
-                'target' => new HTMLPurifier_AttrDef_HTML_FrameTarget()
-            );
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetBlank.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetBlank.php
deleted file mode 100644
index 757cddcda..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetBlank.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * Module adds the target=blank attribute transformation to a tags.  It
- * is enabled by HTML.TargetBlank
- */
-class HTMLPurifier_HTMLModule_TargetBlank extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'TargetBlank';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $a = $this->addBlankElement('a');
-        $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_TargetBlank();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoopener.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoopener.php
deleted file mode 100644
index bc8e88d69..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoopener.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * Module adds the target-based noopener attribute transformation to a tags.  It
- * is enabled by HTML.TargetNoopener
- */
-class HTMLPurifier_HTMLModule_TargetNoopener extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'TargetNoopener';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config) {
-        $a = $this->addBlankElement('a');
-        $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_TargetNoopener();
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoreferrer.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoreferrer.php
deleted file mode 100644
index 9fa558c26..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/TargetNoreferrer.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * Module adds the target-based noreferrer attribute transformation to a tags.  It
- * is enabled by HTML.TargetNoreferrer
- */
-class HTMLPurifier_HTMLModule_TargetNoreferrer extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'TargetNoreferrer';
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config) {
-        $a = $this->addBlankElement('a');
-        $a->attr_transform_post[] = new HTMLPurifier_AttrTransform_TargetNoreferrer();
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Text.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Text.php
deleted file mode 100644
index 11fdd8bd5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Text.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-/**
- * XHTML 1.1 Text Module, defines basic text containers. Core Module.
- * @note In the normative XML Schema specification, this module
- *       is further abstracted into the following modules:
- *          - Block Phrasal (address, blockquote, pre, h1, h2, h3, h4, h5, h6)
- *          - Block Structural (div, p)
- *          - Inline Phrasal (abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var)
- *          - Inline Structural (br, span)
- *       This module, functionally, does not distinguish between these
- *       sub-modules, but the code is internally structured to reflect
- *       these distinctions.
- */
-class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'Text';
-
-    /**
-     * @type array
-     */
-    public $content_sets = array(
-        'Flow' => 'Heading | Block | Inline'
-    );
-
-    /**
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        // Inline Phrasal -------------------------------------------------
-        $this->addElement('abbr', 'Inline', 'Inline', 'Common');
-        $this->addElement('acronym', 'Inline', 'Inline', 'Common');
-        $this->addElement('cite', 'Inline', 'Inline', 'Common');
-        $this->addElement('dfn', 'Inline', 'Inline', 'Common');
-        $this->addElement('kbd', 'Inline', 'Inline', 'Common');
-        $this->addElement('q', 'Inline', 'Inline', 'Common', array('cite' => 'URI'));
-        $this->addElement('samp', 'Inline', 'Inline', 'Common');
-        $this->addElement('var', 'Inline', 'Inline', 'Common');
-
-        $em = $this->addElement('em', 'Inline', 'Inline', 'Common');
-        $em->formatting = true;
-
-        $strong = $this->addElement('strong', 'Inline', 'Inline', 'Common');
-        $strong->formatting = true;
-
-        $code = $this->addElement('code', 'Inline', 'Inline', 'Common');
-        $code->formatting = true;
-
-        // Inline Structural ----------------------------------------------
-        $this->addElement('span', 'Inline', 'Inline', 'Common');
-        $this->addElement('br', 'Inline', 'Empty', 'Core');
-
-        // Block Phrasal --------------------------------------------------
-        $this->addElement('address', 'Block', 'Inline', 'Common');
-        $this->addElement('blockquote', 'Block', 'Optional: Heading | Block | List', 'Common', array('cite' => 'URI'));
-        $pre = $this->addElement('pre', 'Block', 'Inline', 'Common');
-        $pre->excludes = $this->makeLookup(
-            'img',
-            'big',
-            'small',
-            'object',
-            'applet',
-            'font',
-            'basefont'
-        );
-        $this->addElement('h1', 'Heading', 'Inline', 'Common');
-        $this->addElement('h2', 'Heading', 'Inline', 'Common');
-        $this->addElement('h3', 'Heading', 'Inline', 'Common');
-        $this->addElement('h4', 'Heading', 'Inline', 'Common');
-        $this->addElement('h5', 'Heading', 'Inline', 'Common');
-        $this->addElement('h6', 'Heading', 'Inline', 'Common');
-
-        // Block Structural -----------------------------------------------
-        $p = $this->addElement('p', 'Block', 'Inline', 'Common');
-        $p->autoclose = array_flip(
-            array("address", "blockquote", "center", "dir", "div", "dl", "fieldset", "ol", "p", "ul")
-        );
-
-        $this->addElement('div', 'Block', 'Flow', 'Common');
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy.php
deleted file mode 100644
index f482a3741..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy.php
+++ /dev/null
@@ -1,230 +0,0 @@
-<?php
-
-/**
- * Abstract class for a set of proprietary modules that clean up (tidy)
- * poorly written HTML.
- * @todo Figure out how to protect some of these methods/properties
- */
-class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
-{
-    /**
-     * List of supported levels.
-     * Index zero is a special case "no fixes" level.
-     * @type array
-     */
-    public $levels = array(0 => 'none', 'light', 'medium', 'heavy');
-
-    /**
-     * Default level to place all fixes in.
-     * Disabled by default.
-     * @type string
-     */
-    public $defaultLevel = null;
-
-    /**
-     * Lists of fixes used by getFixesForLevel().
-     * Format is:
-     *      HTMLModule_Tidy->fixesForLevel[$level] = array('fix-1', 'fix-2');
-     * @type array
-     */
-    public $fixesForLevel = array(
-        'light' => array(),
-        'medium' => array(),
-        'heavy' => array()
-    );
-
-    /**
-     * Lazy load constructs the module by determining the necessary
-     * fixes to create and then delegating to the populate() function.
-     * @param HTMLPurifier_Config $config
-     * @todo Wildcard matching and error reporting when an added or
-     *       subtracted fix has no effect.
-     */
-    public function setup($config)
-    {
-        // create fixes, initialize fixesForLevel
-        $fixes = $this->makeFixes();
-        $this->makeFixesForLevel($fixes);
-
-        // figure out which fixes to use
-        $level = $config->get('HTML.TidyLevel');
-        $fixes_lookup = $this->getFixesForLevel($level);
-
-        // get custom fix declarations: these need namespace processing
-        $add_fixes = $config->get('HTML.TidyAdd');
-        $remove_fixes = $config->get('HTML.TidyRemove');
-
-        foreach ($fixes as $name => $fix) {
-            // needs to be refactored a little to implement globbing
-            if (isset($remove_fixes[$name]) ||
-                (!isset($add_fixes[$name]) && !isset($fixes_lookup[$name]))) {
-                unset($fixes[$name]);
-            }
-        }
-
-        // populate this module with necessary fixes
-        $this->populate($fixes);
-    }
-
-    /**
-     * Retrieves all fixes per a level, returning fixes for that specific
-     * level as well as all levels below it.
-     * @param string $level level identifier, see $levels for valid values
-     * @return array Lookup up table of fixes
-     */
-    public function getFixesForLevel($level)
-    {
-        if ($level == $this->levels[0]) {
-            return array();
-        }
-        $activated_levels = array();
-        for ($i = 1, $c = count($this->levels); $i < $c; $i++) {
-            $activated_levels[] = $this->levels[$i];
-            if ($this->levels[$i] == $level) {
-                break;
-            }
-        }
-        if ($i == $c) {
-            trigger_error(
-                'Tidy level ' . htmlspecialchars($level) . ' not recognized',
-                E_USER_WARNING
-            );
-            return array();
-        }
-        $ret = array();
-        foreach ($activated_levels as $level) {
-            foreach ($this->fixesForLevel[$level] as $fix) {
-                $ret[$fix] = true;
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Dynamically populates the $fixesForLevel member variable using
-     * the fixes array. It may be custom overloaded, used in conjunction
-     * with $defaultLevel, or not used at all.
-     * @param array $fixes
-     */
-    public function makeFixesForLevel($fixes)
-    {
-        if (!isset($this->defaultLevel)) {
-            return;
-        }
-        if (!isset($this->fixesForLevel[$this->defaultLevel])) {
-            trigger_error(
-                'Default level ' . $this->defaultLevel . ' does not exist',
-                E_USER_ERROR
-            );
-            return;
-        }
-        $this->fixesForLevel[$this->defaultLevel] = array_keys($fixes);
-    }
-
-    /**
-     * Populates the module with transforms and other special-case code
-     * based on a list of fixes passed to it
-     * @param array $fixes Lookup table of fixes to activate
-     */
-    public function populate($fixes)
-    {
-        foreach ($fixes as $name => $fix) {
-            // determine what the fix is for
-            list($type, $params) = $this->getFixType($name);
-            switch ($type) {
-                case 'attr_transform_pre':
-                case 'attr_transform_post':
-                    $attr = $params['attr'];
-                    if (isset($params['element'])) {
-                        $element = $params['element'];
-                        if (empty($this->info[$element])) {
-                            $e = $this->addBlankElement($element);
-                        } else {
-                            $e = $this->info[$element];
-                        }
-                    } else {
-                        $type = "info_$type";
-                        $e = $this;
-                    }
-                    // PHP does some weird parsing when I do
-                    // $e->$type[$attr], so I have to assign a ref.
-                    $f =& $e->$type;
-                    $f[$attr] = $fix;
-                    break;
-                case 'tag_transform':
-                    $this->info_tag_transform[$params['element']] = $fix;
-                    break;
-                case 'child':
-                case 'content_model_type':
-                    $element = $params['element'];
-                    if (empty($this->info[$element])) {
-                        $e = $this->addBlankElement($element);
-                    } else {
-                        $e = $this->info[$element];
-                    }
-                    $e->$type = $fix;
-                    break;
-                default:
-                    trigger_error("Fix type $type not supported", E_USER_ERROR);
-                    break;
-            }
-        }
-    }
-
-    /**
-     * Parses a fix name and determines what kind of fix it is, as well
-     * as other information defined by the fix
-     * @param $name String name of fix
-     * @return array(string $fix_type, array $fix_parameters)
-     * @note $fix_parameters is type dependant, see populate() for usage
-     *       of these parameters
-     */
-    public function getFixType($name)
-    {
-        // parse it
-        $property = $attr = null;
-        if (strpos($name, '#') !== false) {
-            list($name, $property) = explode('#', $name);
-        }
-        if (strpos($name, '@') !== false) {
-            list($name, $attr) = explode('@', $name);
-        }
-
-        // figure out the parameters
-        $params = array();
-        if ($name !== '') {
-            $params['element'] = $name;
-        }
-        if (!is_null($attr)) {
-            $params['attr'] = $attr;
-        }
-
-        // special case: attribute transform
-        if (!is_null($attr)) {
-            if (is_null($property)) {
-                $property = 'pre';
-            }
-            $type = 'attr_transform_' . $property;
-            return array($type, $params);
-        }
-
-        // special case: tag transform
-        if (is_null($property)) {
-            return array('tag_transform', $params);
-        }
-
-        return array($property, $params);
-
-    }
-
-    /**
-     * Defines all fixes the module will perform in a compact
-     * associative array of fix name to fix implementation.
-     * @return array
-     */
-    public function makeFixes()
-    {
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Name.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Name.php
deleted file mode 100644
index bb47bafd2..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Name.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * Name is deprecated, but allowed in strict doctypes, so onl
- */
-class HTMLPurifier_HTMLModule_Tidy_Name extends HTMLPurifier_HTMLModule_Tidy
-{
-    /**
-     * @type string
-     */
-    public $name = 'Tidy_Name';
-
-    /**
-     * @type string
-     */
-    public $defaultLevel = 'heavy';
-
-    /**
-     * @return array
-     */
-    public function makeFixes()
-    {
-        $r = array();
-        // @name for img, a -----------------------------------------------
-        // Technically, it's allowed even on strict, so we allow authors to use
-        // it. However, it's deprecated in future versions of XHTML.
-        $r['img@name'] =
-        $r['a@name'] = new HTMLPurifier_AttrTransform_Name();
-        return $r;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
deleted file mode 100644
index 638cb5419..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_Tidy_Proprietary extends HTMLPurifier_HTMLModule_Tidy
-{
-
-    /**
-     * @type string
-     */
-    public $name = 'Tidy_Proprietary';
-
-    /**
-     * @type string
-     */
-    public $defaultLevel = 'light';
-
-    /**
-     * @return array
-     */
-    public function makeFixes()
-    {
-        $r = array();
-        $r['table@background'] = new HTMLPurifier_AttrTransform_Background();
-        $r['td@background']    = new HTMLPurifier_AttrTransform_Background();
-        $r['th@background']    = new HTMLPurifier_AttrTransform_Background();
-        $r['tr@background']    = new HTMLPurifier_AttrTransform_Background();
-        $r['thead@background'] = new HTMLPurifier_AttrTransform_Background();
-        $r['tfoot@background'] = new HTMLPurifier_AttrTransform_Background();
-        $r['tbody@background'] = new HTMLPurifier_AttrTransform_Background();
-        $r['table@height']     = new HTMLPurifier_AttrTransform_Length('height');
-        return $r;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Strict.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Strict.php
deleted file mode 100644
index ba3260e6f..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Strict.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_Tidy_Strict extends HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4
-{
-    /**
-     * @type string
-     */
-    public $name = 'Tidy_Strict';
-
-    /**
-     * @type string
-     */
-    public $defaultLevel = 'light';
-
-    /**
-     * @return array
-     */
-    public function makeFixes()
-    {
-        $r = parent::makeFixes();
-        $r['blockquote#content_model_type'] = 'strictblockquote';
-        return $r;
-    }
-
-    /**
-     * @type bool
-     */
-    public $defines_child_def = true;
-
-    /**
-     * @param HTMLPurifier_ElementDef $def
-     * @return HTMLPurifier_ChildDef_StrictBlockquote
-     */
-    public function getChildDef($def)
-    {
-        if ($def->content_model_type != 'strictblockquote') {
-            return parent::getChildDef($def);
-        }
-        return new HTMLPurifier_ChildDef_StrictBlockquote($def->content_model);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php
deleted file mode 100644
index 79411d257..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_Tidy_Transitional extends HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4
-{
-    /**
-     * @type string
-     */
-    public $name = 'Tidy_Transitional';
-
-    /**
-     * @type string
-     */
-    public $defaultLevel = 'heavy';
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTML.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTML.php
deleted file mode 100644
index 935ad7f52..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTML.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_Tidy_XHTML extends HTMLPurifier_HTMLModule_Tidy
-{
-    /**
-     * @type string
-     */
-    public $name = 'Tidy_XHTML';
-
-    /**
-     * @type string
-     */
-    public $defaultLevel = 'medium';
-
-    /**
-     * @return array
-     */
-    public function makeFixes()
-    {
-        $r = array();
-        $r['@lang'] = new HTMLPurifier_AttrTransform_Lang();
-        return $r;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
deleted file mode 100644
index 17164fb6d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule_Tidy
-{
-
-    /**
-     * @return array
-     */
-    public function makeFixes()
-    {
-        $r = array();
-
-        // == deprecated tag transforms ===================================
-
-        $r['font'] = new HTMLPurifier_TagTransform_Font();
-        $r['menu'] = new HTMLPurifier_TagTransform_Simple('ul');
-        $r['dir'] = new HTMLPurifier_TagTransform_Simple('ul');
-        $r['center'] = new HTMLPurifier_TagTransform_Simple('div', 'text-align:center;');
-        $r['u'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:underline;');
-        $r['s'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
-        $r['strike'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
-
-        // == deprecated attribute transforms =============================
-
-        $r['caption@align'] =
-            new HTMLPurifier_AttrTransform_EnumToCSS(
-                'align',
-                array(
-                    // we're following IE's behavior, not Firefox's, due
-                    // to the fact that no one supports caption-side:right,
-                    // W3C included (with CSS 2.1). This is a slightly
-                    // unreasonable attribute!
-                    'left' => 'text-align:left;',
-                    'right' => 'text-align:right;',
-                    'top' => 'caption-side:top;',
-                    'bottom' => 'caption-side:bottom;' // not supported by IE
-                )
-            );
-
-        // @align for img -------------------------------------------------
-        $r['img@align'] =
-            new HTMLPurifier_AttrTransform_EnumToCSS(
-                'align',
-                array(
-                    'left' => 'float:left;',
-                    'right' => 'float:right;',
-                    'top' => 'vertical-align:top;',
-                    'middle' => 'vertical-align:middle;',
-                    'bottom' => 'vertical-align:baseline;',
-                )
-            );
-
-        // @align for table -----------------------------------------------
-        $r['table@align'] =
-            new HTMLPurifier_AttrTransform_EnumToCSS(
-                'align',
-                array(
-                    'left' => 'float:left;',
-                    'center' => 'margin-left:auto;margin-right:auto;',
-                    'right' => 'float:right;'
-                )
-            );
-
-        // @align for hr -----------------------------------------------
-        $r['hr@align'] =
-            new HTMLPurifier_AttrTransform_EnumToCSS(
-                'align',
-                array(
-                    // we use both text-align and margin because these work
-                    // for different browsers (IE and Firefox, respectively)
-                    // and the melange makes for a pretty cross-compatible
-                    // solution
-                    'left' => 'margin-left:0;margin-right:auto;text-align:left;',
-                    'center' => 'margin-left:auto;margin-right:auto;text-align:center;',
-                    'right' => 'margin-left:auto;margin-right:0;text-align:right;'
-                )
-            );
-
-        // @align for h1, h2, h3, h4, h5, h6, p, div ----------------------
-        // {{{
-        $align_lookup = array();
-        $align_values = array('left', 'right', 'center', 'justify');
-        foreach ($align_values as $v) {
-            $align_lookup[$v] = "text-align:$v;";
-        }
-        // }}}
-        $r['h1@align'] =
-        $r['h2@align'] =
-        $r['h3@align'] =
-        $r['h4@align'] =
-        $r['h5@align'] =
-        $r['h6@align'] =
-        $r['p@align'] =
-        $r['div@align'] =
-            new HTMLPurifier_AttrTransform_EnumToCSS('align', $align_lookup);
-
-        // @bgcolor for table, tr, td, th ---------------------------------
-        $r['table@bgcolor'] =
-        $r['td@bgcolor'] =
-        $r['th@bgcolor'] =
-            new HTMLPurifier_AttrTransform_BgColor();
-
-        // @border for img ------------------------------------------------
-        $r['img@border'] = new HTMLPurifier_AttrTransform_Border();
-
-        // @clear for br --------------------------------------------------
-        $r['br@clear'] =
-            new HTMLPurifier_AttrTransform_EnumToCSS(
-                'clear',
-                array(
-                    'left' => 'clear:left;',
-                    'right' => 'clear:right;',
-                    'all' => 'clear:both;',
-                    'none' => 'clear:none;',
-                )
-            );
-
-        // @height for td, th ---------------------------------------------
-        $r['td@height'] =
-        $r['th@height'] =
-            new HTMLPurifier_AttrTransform_Length('height');
-
-        // @hspace for img ------------------------------------------------
-        $r['img@hspace'] = new HTMLPurifier_AttrTransform_ImgSpace('hspace');
-
-        // @noshade for hr ------------------------------------------------
-        // this transformation is not precise but often good enough.
-        // different browsers use different styles to designate noshade
-        $r['hr@noshade'] =
-            new HTMLPurifier_AttrTransform_BoolToCSS(
-                'noshade',
-                'color:#808080;background-color:#808080;border:0;'
-            );
-
-        // @nowrap for td, th ---------------------------------------------
-        $r['td@nowrap'] =
-        $r['th@nowrap'] =
-            new HTMLPurifier_AttrTransform_BoolToCSS(
-                'nowrap',
-                'white-space:nowrap;'
-            );
-
-        // @size for hr  --------------------------------------------------
-        $r['hr@size'] = new HTMLPurifier_AttrTransform_Length('size', 'height');
-
-        // @type for li, ol, ul -------------------------------------------
-        // {{{
-        $ul_types = array(
-            'disc' => 'list-style-type:disc;',
-            'square' => 'list-style-type:square;',
-            'circle' => 'list-style-type:circle;'
-        );
-        $ol_types = array(
-            '1' => 'list-style-type:decimal;',
-            'i' => 'list-style-type:lower-roman;',
-            'I' => 'list-style-type:upper-roman;',
-            'a' => 'list-style-type:lower-alpha;',
-            'A' => 'list-style-type:upper-alpha;'
-        );
-        $li_types = $ul_types + $ol_types;
-        // }}}
-
-        $r['ul@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ul_types);
-        $r['ol@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ol_types, true);
-        $r['li@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $li_types, true);
-
-        // @vspace for img ------------------------------------------------
-        $r['img@vspace'] = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
-
-        // @width for hr, td, th ------------------------------------------
-        $r['td@width'] =
-        $r['th@width'] =
-        $r['hr@width'] = new HTMLPurifier_AttrTransform_Length('width');
-
-        return $r;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/XMLCommonAttributes.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
deleted file mode 100644
index 27a353db3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModule_XMLCommonAttributes extends HTMLPurifier_HTMLModule
-{
-    /**
-     * @type string
-     */
-    public $name = 'XMLCommonAttributes';
-
-    /**
-     * @type array
-     */
-    public $attr_collections = array(
-        'Lang' => array(
-            'xml:lang' => 'LanguageCode',
-        )
-    );
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModuleManager.php b/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModuleManager.php
deleted file mode 100644
index 7b5a87868..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/HTMLModuleManager.php
+++ /dev/null
@@ -1,467 +0,0 @@
-<?php
-
-class HTMLPurifier_HTMLModuleManager
-{
-
-    /**
-     * @type HTMLPurifier_DoctypeRegistry
-     */
-    public $doctypes;
-
-    /**
-     * Instance of current doctype.
-     * @type string
-     */
-    public $doctype;
-
-    /**
-     * @type HTMLPurifier_AttrTypes
-     */
-    public $attrTypes;
-
-    /**
-     * Active instances of modules for the specified doctype are
-     * indexed, by name, in this array.
-     * @type HTMLPurifier_HTMLModule[]
-     */
-    public $modules = array();
-
-    /**
-     * Array of recognized HTMLPurifier_HTMLModule instances,
-     * indexed by module's class name. This array is usually lazy loaded, but a
-     * user can overload a module by pre-emptively registering it.
-     * @type HTMLPurifier_HTMLModule[]
-     */
-    public $registeredModules = array();
-
-    /**
-     * List of extra modules that were added by the user
-     * using addModule(). These get unconditionally merged into the current doctype, whatever
-     * it may be.
-     * @type HTMLPurifier_HTMLModule[]
-     */
-    public $userModules = array();
-
-    /**
-     * Associative array of element name to list of modules that have
-     * definitions for the element; this array is dynamically filled.
-     * @type array
-     */
-    public $elementLookup = array();
-
-    /**
-     * List of prefixes we should use for registering small names.
-     * @type array
-     */
-    public $prefixes = array('HTMLPurifier_HTMLModule_');
-
-    /**
-     * @type HTMLPurifier_ContentSets
-     */
-    public $contentSets;
-
-    /**
-     * @type HTMLPurifier_AttrCollections
-     */
-    public $attrCollections;
-
-    /**
-     * If set to true, unsafe elements and attributes will be allowed.
-     * @type bool
-     */
-    public $trusted = false;
-
-    public function __construct()
-    {
-        // editable internal objects
-        $this->attrTypes = new HTMLPurifier_AttrTypes();
-        $this->doctypes  = new HTMLPurifier_DoctypeRegistry();
-
-        // setup basic modules
-        $common = array(
-            'CommonAttributes', 'Text', 'Hypertext', 'List',
-            'Presentation', 'Edit', 'Bdo', 'Tables', 'Image',
-            'StyleAttribute',
-            // Unsafe:
-            'Scripting', 'Object', 'Forms',
-            // Sorta legacy, but present in strict:
-            'Name',
-        );
-        $transitional = array('Legacy', 'Target', 'Iframe');
-        $xml = array('XMLCommonAttributes');
-        $non_xml = array('NonXMLCommonAttributes');
-
-        // setup basic doctypes
-        $this->doctypes->register(
-            'HTML 4.01 Transitional',
-            false,
-            array_merge($common, $transitional, $non_xml),
-            array('Tidy_Transitional', 'Tidy_Proprietary'),
-            array(),
-            '-//W3C//DTD HTML 4.01 Transitional//EN',
-            'http://www.w3.org/TR/html4/loose.dtd'
-        );
-
-        $this->doctypes->register(
-            'HTML 4.01 Strict',
-            false,
-            array_merge($common, $non_xml),
-            array('Tidy_Strict', 'Tidy_Proprietary', 'Tidy_Name'),
-            array(),
-            '-//W3C//DTD HTML 4.01//EN',
-            'http://www.w3.org/TR/html4/strict.dtd'
-        );
-
-        $this->doctypes->register(
-            'XHTML 1.0 Transitional',
-            true,
-            array_merge($common, $transitional, $xml, $non_xml),
-            array('Tidy_Transitional', 'Tidy_XHTML', 'Tidy_Proprietary', 'Tidy_Name'),
-            array(),
-            '-//W3C//DTD XHTML 1.0 Transitional//EN',
-            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
-        );
-
-        $this->doctypes->register(
-            'XHTML 1.0 Strict',
-            true,
-            array_merge($common, $xml, $non_xml),
-            array('Tidy_Strict', 'Tidy_XHTML', 'Tidy_Strict', 'Tidy_Proprietary', 'Tidy_Name'),
-            array(),
-            '-//W3C//DTD XHTML 1.0 Strict//EN',
-            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
-        );
-
-        $this->doctypes->register(
-            'XHTML 1.1',
-            true,
-            // Iframe is a real XHTML 1.1 module, despite being
-            // "transitional"!
-            array_merge($common, $xml, array('Ruby', 'Iframe')),
-            array('Tidy_Strict', 'Tidy_XHTML', 'Tidy_Proprietary', 'Tidy_Strict', 'Tidy_Name'), // Tidy_XHTML1_1
-            array(),
-            '-//W3C//DTD XHTML 1.1//EN',
-            'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'
-        );
-
-    }
-
-    /**
-     * Registers a module to the recognized module list, useful for
-     * overloading pre-existing modules.
-     * @param $module Mixed: string module name, with or without
-     *                HTMLPurifier_HTMLModule prefix, or instance of
-     *                subclass of HTMLPurifier_HTMLModule.
-     * @param $overload Boolean whether or not to overload previous modules.
-     *                  If this is not set, and you do overload a module,
-     *                  HTML Purifier will complain with a warning.
-     * @note This function will not call autoload, you must instantiate
-     *       (and thus invoke) autoload outside the method.
-     * @note If a string is passed as a module name, different variants
-     *       will be tested in this order:
-     *          - Check for HTMLPurifier_HTMLModule_$name
-     *          - Check all prefixes with $name in order they were added
-     *          - Check for literal object name
-     *          - Throw fatal error
-     *       If your object name collides with an internal class, specify
-     *       your module manually. All modules must have been included
-     *       externally: registerModule will not perform inclusions for you!
-     */
-    public function registerModule($module, $overload = false)
-    {
-        if (is_string($module)) {
-            // attempt to load the module
-            $original_module = $module;
-            $ok = false;
-            foreach ($this->prefixes as $prefix) {
-                $module = $prefix . $original_module;
-                if (class_exists($module)) {
-                    $ok = true;
-                    break;
-                }
-            }
-            if (!$ok) {
-                $module = $original_module;
-                if (!class_exists($module)) {
-                    trigger_error(
-                        $original_module . ' module does not exist',
-                        E_USER_ERROR
-                    );
-                    return;
-                }
-            }
-            $module = new $module();
-        }
-        if (empty($module->name)) {
-            trigger_error('Module instance of ' . get_class($module) . ' must have name');
-            return;
-        }
-        if (!$overload && isset($this->registeredModules[$module->name])) {
-            trigger_error('Overloading ' . $module->name . ' without explicit overload parameter', E_USER_WARNING);
-        }
-        $this->registeredModules[$module->name] = $module;
-    }
-
-    /**
-     * Adds a module to the current doctype by first registering it,
-     * and then tacking it on to the active doctype
-     */
-    public function addModule($module)
-    {
-        $this->registerModule($module);
-        if (is_object($module)) {
-            $module = $module->name;
-        }
-        $this->userModules[] = $module;
-    }
-
-    /**
-     * Adds a class prefix that registerModule() will use to resolve a
-     * string name to a concrete class
-     */
-    public function addPrefix($prefix)
-    {
-        $this->prefixes[] = $prefix;
-    }
-
-    /**
-     * Performs processing on modules, after being called you may
-     * use getElement() and getElements()
-     * @param HTMLPurifier_Config $config
-     */
-    public function setup($config)
-    {
-        $this->trusted = $config->get('HTML.Trusted');
-
-        // generate
-        $this->doctype = $this->doctypes->make($config);
-        $modules = $this->doctype->modules;
-
-        // take out the default modules that aren't allowed
-        $lookup = $config->get('HTML.AllowedModules');
-        $special_cases = $config->get('HTML.CoreModules');
-
-        if (is_array($lookup)) {
-            foreach ($modules as $k => $m) {
-                if (isset($special_cases[$m])) {
-                    continue;
-                }
-                if (!isset($lookup[$m])) {
-                    unset($modules[$k]);
-                }
-            }
-        }
-
-        // custom modules
-        if ($config->get('HTML.Proprietary')) {
-            $modules[] = 'Proprietary';
-        }
-        if ($config->get('HTML.SafeObject')) {
-            $modules[] = 'SafeObject';
-        }
-        if ($config->get('HTML.SafeEmbed')) {
-            $modules[] = 'SafeEmbed';
-        }
-        if ($config->get('HTML.SafeScripting') !== array()) {
-            $modules[] = 'SafeScripting';
-        }
-        if ($config->get('HTML.Nofollow')) {
-            $modules[] = 'Nofollow';
-        }
-        if ($config->get('HTML.TargetBlank')) {
-            $modules[] = 'TargetBlank';
-        }
-        // NB: HTML.TargetNoreferrer and HTML.TargetNoopener must be AFTER HTML.TargetBlank
-        // so that its post-attr-transform gets run afterwards.
-        if ($config->get('HTML.TargetNoreferrer')) {
-            $modules[] = 'TargetNoreferrer';
-        }
-        if ($config->get('HTML.TargetNoopener')) {
-            $modules[] = 'TargetNoopener';
-        }
-
-        // merge in custom modules
-        $modules = array_merge($modules, $this->userModules);
-
-        foreach ($modules as $module) {
-            $this->processModule($module);
-            $this->modules[$module]->setup($config);
-        }
-
-        foreach ($this->doctype->tidyModules as $module) {
-            $this->processModule($module);
-            $this->modules[$module]->setup($config);
-        }
-
-        // prepare any injectors
-        foreach ($this->modules as $module) {
-            $n = array();
-            foreach ($module->info_injector as $injector) {
-                if (!is_object($injector)) {
-                    $class = "HTMLPurifier_Injector_$injector";
-                    $injector = new $class;
-                }
-                $n[$injector->name] = $injector;
-            }
-            $module->info_injector = $n;
-        }
-
-        // setup lookup table based on all valid modules
-        foreach ($this->modules as $module) {
-            foreach ($module->info as $name => $def) {
-                if (!isset($this->elementLookup[$name])) {
-                    $this->elementLookup[$name] = array();
-                }
-                $this->elementLookup[$name][] = $module->name;
-            }
-        }
-
-        // note the different choice
-        $this->contentSets = new HTMLPurifier_ContentSets(
-            // content set assembly deals with all possible modules,
-            // not just ones deemed to be "safe"
-            $this->modules
-        );
-        $this->attrCollections = new HTMLPurifier_AttrCollections(
-            $this->attrTypes,
-            // there is no way to directly disable a global attribute,
-            // but using AllowedAttributes or simply not including
-            // the module in your custom doctype should be sufficient
-            $this->modules
-        );
-    }
-
-    /**
-     * Takes a module and adds it to the active module collection,
-     * registering it if necessary.
-     */
-    public function processModule($module)
-    {
-        if (!isset($this->registeredModules[$module]) || is_object($module)) {
-            $this->registerModule($module);
-        }
-        $this->modules[$module] = $this->registeredModules[$module];
-    }
-
-    /**
-     * Retrieves merged element definitions.
-     * @return Array of HTMLPurifier_ElementDef
-     */
-    public function getElements()
-    {
-        $elements = array();
-        foreach ($this->modules as $module) {
-            if (!$this->trusted && !$module->safe) {
-                continue;
-            }
-            foreach ($module->info as $name => $v) {
-                if (isset($elements[$name])) {
-                    continue;
-                }
-                $elements[$name] = $this->getElement($name);
-            }
-        }
-
-        // remove dud elements, this happens when an element that
-        // appeared to be safe actually wasn't
-        foreach ($elements as $n => $v) {
-            if ($v === false) {
-                unset($elements[$n]);
-            }
-        }
-
-        return $elements;
-
-    }
-
-    /**
-     * Retrieves a single merged element definition
-     * @param string $name Name of element
-     * @param bool $trusted Boolean trusted overriding parameter: set to true
-     *                 if you want the full version of an element
-     * @return HTMLPurifier_ElementDef Merged HTMLPurifier_ElementDef
-     * @note You may notice that modules are getting iterated over twice (once
-     *       in getElements() and once here). This
-     *       is because
-     */
-    public function getElement($name, $trusted = null)
-    {
-        if (!isset($this->elementLookup[$name])) {
-            return false;
-        }
-
-        // setup global state variables
-        $def = false;
-        if ($trusted === null) {
-            $trusted = $this->trusted;
-        }
-
-        // iterate through each module that has registered itself to this
-        // element
-        foreach ($this->elementLookup[$name] as $module_name) {
-            $module = $this->modules[$module_name];
-
-            // refuse to create/merge from a module that is deemed unsafe--
-            // pretend the module doesn't exist--when trusted mode is not on.
-            if (!$trusted && !$module->safe) {
-                continue;
-            }
-
-            // clone is used because, ideally speaking, the original
-            // definition should not be modified. Usually, this will
-            // make no difference, but for consistency's sake
-            $new_def = clone $module->info[$name];
-
-            if (!$def && $new_def->standalone) {
-                $def = $new_def;
-            } elseif ($def) {
-                // This will occur even if $new_def is standalone. In practice,
-                // this will usually result in a full replacement.
-                $def->mergeIn($new_def);
-            } else {
-                // :TODO:
-                // non-standalone definitions that don't have a standalone
-                // to merge into could be deferred to the end
-                // HOWEVER, it is perfectly valid for a non-standalone
-                // definition to lack a standalone definition, even
-                // after all processing: this allows us to safely
-                // specify extra attributes for elements that may not be
-                // enabled all in one place.  In particular, this might
-                // be the case for trusted elements.  WARNING: care must
-                // be taken that the /extra/ definitions are all safe.
-                continue;
-            }
-
-            // attribute value expansions
-            $this->attrCollections->performInclusions($def->attr);
-            $this->attrCollections->expandIdentifiers($def->attr, $this->attrTypes);
-
-            // descendants_are_inline, for ChildDef_Chameleon
-            if (is_string($def->content_model) &&
-                strpos($def->content_model, 'Inline') !== false) {
-                if ($name != 'del' && $name != 'ins') {
-                    // this is for you, ins/del
-                    $def->descendants_are_inline = true;
-                }
-            }
-
-            $this->contentSets->generateChildDef($def, $module);
-        }
-
-        // This can occur if there is a blank definition, but no base to
-        // mix it in with
-        if (!$def) {
-            return false;
-        }
-
-        // add information on required attributes
-        foreach ($def->attr as $attr_name => $attr_def) {
-            if ($attr_def->required) {
-                $def->required_attr[] = $attr_name;
-            }
-        }
-        return $def;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/IDAccumulator.php b/libraries/htmlpurifier410/library/HTMLPurifier/IDAccumulator.php
deleted file mode 100644
index bf399af4a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/IDAccumulator.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * Component of HTMLPurifier_AttrContext that accumulates IDs to prevent dupes
- * @note In Slashdot-speak, dupe means duplicate.
- * @note The default constructor does not accept $config or $context objects:
- *       use must use the static build() factory method to perform initialization.
- */
-class HTMLPurifier_IDAccumulator
-{
-
-    /**
-     * Lookup table of IDs we've accumulated.
-     * @public
-     */
-    public $ids = array();
-
-    /**
-     * Builds an IDAccumulator, also initializing the default blacklist
-     * @param HTMLPurifier_Config $config Instance of HTMLPurifier_Config
-     * @param HTMLPurifier_Context $context Instance of HTMLPurifier_Context
-     * @return HTMLPurifier_IDAccumulator Fully initialized HTMLPurifier_IDAccumulator
-     */
-    public static function build($config, $context)
-    {
-        $id_accumulator = new HTMLPurifier_IDAccumulator();
-        $id_accumulator->load($config->get('Attr.IDBlacklist'));
-        return $id_accumulator;
-    }
-
-    /**
-     * Add an ID to the lookup table.
-     * @param string $id ID to be added.
-     * @return bool status, true if success, false if there's a dupe
-     */
-    public function add($id)
-    {
-        if (isset($this->ids[$id])) {
-            return false;
-        }
-        return $this->ids[$id] = true;
-    }
-
-    /**
-     * Load a list of IDs into the lookup table
-     * @param $array_of_ids Array of IDs to load
-     * @note This function doesn't care about duplicates
-     */
-    public function load($array_of_ids)
-    {
-        foreach ($array_of_ids as $id) {
-            $this->ids[$id] = true;
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector.php
deleted file mode 100644
index 24a4bc1fe..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector.php
+++ /dev/null
@@ -1,283 +0,0 @@
-<?php
-
-/**
- * Injects tokens into the document while parsing for well-formedness.
- * This enables "formatter-like" functionality such as auto-paragraphing,
- * smiley-ification and linkification to take place.
- *
- * A note on how handlers create changes; this is done by assigning a new
- * value to the $token reference. These values can take a variety of forms and
- * are best described HTMLPurifier_Strategy_MakeWellFormed->processToken()
- * documentation.
- *
- * @todo Allow injectors to request a re-run on their output. This
- *       would help if an operation is recursive.
- */
-abstract class HTMLPurifier_Injector
-{
-
-    /**
-     * Advisory name of injector, this is for friendly error messages.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * @type HTMLPurifier_HTMLDefinition
-     */
-    protected $htmlDefinition;
-
-    /**
-     * Reference to CurrentNesting variable in Context. This is an array
-     * list of tokens that we are currently "inside"
-     * @type array
-     */
-    protected $currentNesting;
-
-    /**
-     * Reference to current token.
-     * @type HTMLPurifier_Token
-     */
-    protected $currentToken;
-
-    /**
-     * Reference to InputZipper variable in Context.
-     * @type HTMLPurifier_Zipper
-     */
-    protected $inputZipper;
-
-    /**
-     * Array of elements and attributes this injector creates and therefore
-     * need to be allowed by the definition. Takes form of
-     * array('element' => array('attr', 'attr2'), 'element2')
-     * @type array
-     */
-    public $needed = array();
-
-    /**
-     * Number of elements to rewind backwards (relative).
-     * @type bool|int
-     */
-    protected $rewindOffset = false;
-
-    /**
-     * Rewind to a spot to re-perform processing. This is useful if you
-     * deleted a node, and now need to see if this change affected any
-     * earlier nodes. Rewinding does not affect other injectors, and can
-     * result in infinite loops if not used carefully.
-     * @param bool|int $offset
-     * @warning HTML Purifier will prevent you from fast-forwarding with this
-     *          function.
-     */
-    public function rewindOffset($offset)
-    {
-        $this->rewindOffset = $offset;
-    }
-
-    /**
-     * Retrieves rewind offset, and then unsets it.
-     * @return bool|int
-     */
-    public function getRewindOffset()
-    {
-        $r = $this->rewindOffset;
-        $this->rewindOffset = false;
-        return $r;
-    }
-
-    /**
-     * Prepares the injector by giving it the config and context objects:
-     * this allows references to important variables to be made within
-     * the injector. This function also checks if the HTML environment
-     * will work with the Injector (see checkNeeded()).
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool|string Boolean false if success, string of missing needed element/attribute if failure
-     */
-    public function prepare($config, $context)
-    {
-        $this->htmlDefinition = $config->getHTMLDefinition();
-        // Even though this might fail, some unit tests ignore this and
-        // still test checkNeeded, so be careful. Maybe get rid of that
-        // dependency.
-        $result = $this->checkNeeded($config);
-        if ($result !== false) {
-            return $result;
-        }
-        $this->currentNesting =& $context->get('CurrentNesting');
-        $this->currentToken   =& $context->get('CurrentToken');
-        $this->inputZipper    =& $context->get('InputZipper');
-        return false;
-    }
-
-    /**
-     * This function checks if the HTML environment
-     * will work with the Injector: if p tags are not allowed, the
-     * Auto-Paragraphing injector should not be enabled.
-     * @param HTMLPurifier_Config $config
-     * @return bool|string Boolean false if success, string of missing needed element/attribute if failure
-     */
-    public function checkNeeded($config)
-    {
-        $def = $config->getHTMLDefinition();
-        foreach ($this->needed as $element => $attributes) {
-            if (is_int($element)) {
-                $element = $attributes;
-            }
-            if (!isset($def->info[$element])) {
-                return $element;
-            }
-            if (!is_array($attributes)) {
-                continue;
-            }
-            foreach ($attributes as $name) {
-                if (!isset($def->info[$element]->attr[$name])) {
-                    return "$element.$name";
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Tests if the context node allows a certain element
-     * @param string $name Name of element to test for
-     * @return bool True if element is allowed, false if it is not
-     */
-    public function allowsElement($name)
-    {
-        if (!empty($this->currentNesting)) {
-            $parent_token = array_pop($this->currentNesting);
-            $this->currentNesting[] = $parent_token;
-            $parent = $this->htmlDefinition->info[$parent_token->name];
-        } else {
-            $parent = $this->htmlDefinition->info_parent_def;
-        }
-        if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) {
-            return false;
-        }
-        // check for exclusion
-        if (!empty($this->currentNesting)) {
-            for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
-                $node = $this->currentNesting[$i];
-                $def  = $this->htmlDefinition->info[$node->name];
-                if (isset($def->excludes[$name])) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Iterator function, which starts with the next token and continues until
-     * you reach the end of the input tokens.
-     * @warning Please prevent previous references from interfering with this
-     *          functions by setting $i = null beforehand!
-     * @param int $i Current integer index variable for inputTokens
-     * @param HTMLPurifier_Token $current Current token variable.
-     *          Do NOT use $token, as that variable is also a reference
-     * @return bool
-     */
-    protected function forward(&$i, &$current)
-    {
-        if ($i === null) {
-            $i = count($this->inputZipper->back) - 1;
-        } else {
-            $i--;
-        }
-        if ($i < 0) {
-            return false;
-        }
-        $current = $this->inputZipper->back[$i];
-        return true;
-    }
-
-    /**
-     * Similar to _forward, but accepts a third parameter $nesting (which
-     * should be initialized at 0) and stops when we hit the end tag
-     * for the node $this->inputIndex starts in.
-     * @param int $i Current integer index variable for inputTokens
-     * @param HTMLPurifier_Token $current Current token variable.
-     *          Do NOT use $token, as that variable is also a reference
-     * @param int $nesting
-     * @return bool
-     */
-    protected function forwardUntilEndToken(&$i, &$current, &$nesting)
-    {
-        $result = $this->forward($i, $current);
-        if (!$result) {
-            return false;
-        }
-        if ($nesting === null) {
-            $nesting = 0;
-        }
-        if ($current instanceof HTMLPurifier_Token_Start) {
-            $nesting++;
-        } elseif ($current instanceof HTMLPurifier_Token_End) {
-            if ($nesting <= 0) {
-                return false;
-            }
-            $nesting--;
-        }
-        return true;
-    }
-
-    /**
-     * Iterator function, starts with the previous token and continues until
-     * you reach the beginning of input tokens.
-     * @warning Please prevent previous references from interfering with this
-     *          functions by setting $i = null beforehand!
-     * @param int $i Current integer index variable for inputTokens
-     * @param HTMLPurifier_Token $current Current token variable.
-     *          Do NOT use $token, as that variable is also a reference
-     * @return bool
-     */
-    protected function backward(&$i, &$current)
-    {
-        if ($i === null) {
-            $i = count($this->inputZipper->front) - 1;
-        } else {
-            $i--;
-        }
-        if ($i < 0) {
-            return false;
-        }
-        $current = $this->inputZipper->front[$i];
-        return true;
-    }
-
-    /**
-     * Handler that is called when a text token is processed
-     */
-    public function handleText(&$token)
-    {
-    }
-
-    /**
-     * Handler that is called when a start or empty token is processed
-     */
-    public function handleElement(&$token)
-    {
-    }
-
-    /**
-     * Handler that is called when an end token is processed
-     */
-    public function handleEnd(&$token)
-    {
-        $this->notifyEnd($token);
-    }
-
-    /**
-     * Notifier that is called when an end token is processed
-     * @param HTMLPurifier_Token $token Current token variable.
-     * @note This differs from handlers in that the token is read-only
-     * @deprecated
-     */
-    public function notifyEnd($token)
-    {
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/AutoParagraph.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/AutoParagraph.php
deleted file mode 100644
index d3ec44f1c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/AutoParagraph.php
+++ /dev/null
@@ -1,356 +0,0 @@
-<?php
-
-/**
- * Injector that auto paragraphs text in the root node based on
- * double-spacing.
- * @todo Ensure all states are unit tested, including variations as well.
- * @todo Make a graph of the flow control for this Injector.
- */
-class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
-{
-    /**
-     * @type string
-     */
-    public $name = 'AutoParagraph';
-
-    /**
-     * @type array
-     */
-    public $needed = array('p');
-
-    /**
-     * @return HTMLPurifier_Token_Start
-     */
-    private function _pStart()
-    {
-        $par = new HTMLPurifier_Token_Start('p');
-        $par->armor['MakeWellFormed_TagClosedError'] = true;
-        return $par;
-    }
-
-    /**
-     * @param HTMLPurifier_Token_Text $token
-     */
-    public function handleText(&$token)
-    {
-        $text = $token->data;
-        // Does the current parent allow <p> tags?
-        if ($this->allowsElement('p')) {
-            if (empty($this->currentNesting) || strpos($text, "\n\n") !== false) {
-                // Note that we have differing behavior when dealing with text
-                // in the anonymous root node, or a node inside the document.
-                // If the text as a double-newline, the treatment is the same;
-                // if it doesn't, see the next if-block if you're in the document.
-
-                $i = $nesting = null;
-                if (!$this->forwardUntilEndToken($i, $current, $nesting) && $token->is_whitespace) {
-                    // State 1.1: ...    ^ (whitespace, then document end)
-                    //               ----
-                    // This is a degenerate case
-                } else {
-                    if (!$token->is_whitespace || $this->_isInline($current)) {
-                        // State 1.2: PAR1
-                        //            ----
-
-                        // State 1.3: PAR1\n\nPAR2
-                        //            ------------
-
-                        // State 1.4: <div>PAR1\n\nPAR2 (see State 2)
-                        //                 ------------
-                        $token = array($this->_pStart());
-                        $this->_splitText($text, $token);
-                    } else {
-                        // State 1.5: \n<hr />
-                        //            --
-                    }
-                }
-            } else {
-                // State 2:   <div>PAR1... (similar to 1.4)
-                //                 ----
-
-                // We're in an element that allows paragraph tags, but we're not
-                // sure if we're going to need them.
-                if ($this->_pLookAhead()) {
-                    // State 2.1: <div>PAR1<b>PAR1\n\nPAR2
-                    //                 ----
-                    // Note: This will always be the first child, since any
-                    // previous inline element would have triggered this very
-                    // same routine, and found the double newline. One possible
-                    // exception would be a comment.
-                    $token = array($this->_pStart(), $token);
-                } else {
-                    // State 2.2.1: <div>PAR1<div>
-                    //                   ----
-
-                    // State 2.2.2: <div>PAR1<b>PAR1</b></div>
-                    //                   ----
-                }
-            }
-            // Is the current parent a <p> tag?
-        } elseif (!empty($this->currentNesting) &&
-            $this->currentNesting[count($this->currentNesting) - 1]->name == 'p') {
-            // State 3.1: ...<p>PAR1
-            //                  ----
-
-            // State 3.2: ...<p>PAR1\n\nPAR2
-            //                  ------------
-            $token = array();
-            $this->_splitText($text, $token);
-            // Abort!
-        } else {
-            // State 4.1: ...<b>PAR1
-            //                  ----
-
-            // State 4.2: ...<b>PAR1\n\nPAR2
-            //                  ------------
-        }
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleElement(&$token)
-    {
-        // We don't have to check if we're already in a <p> tag for block
-        // tokens, because the tag would have been autoclosed by MakeWellFormed.
-        if ($this->allowsElement('p')) {
-            if (!empty($this->currentNesting)) {
-                if ($this->_isInline($token)) {
-                    // State 1: <div>...<b>
-                    //                  ---
-                    // Check if this token is adjacent to the parent token
-                    // (seek backwards until token isn't whitespace)
-                    $i = null;
-                    $this->backward($i, $prev);
-
-                    if (!$prev instanceof HTMLPurifier_Token_Start) {
-                        // Token wasn't adjacent
-                        if ($prev instanceof HTMLPurifier_Token_Text &&
-                            substr($prev->data, -2) === "\n\n"
-                        ) {
-                            // State 1.1.4: <div><p>PAR1</p>\n\n<b>
-                            //                                  ---
-                            // Quite frankly, this should be handled by splitText
-                            $token = array($this->_pStart(), $token);
-                        } else {
-                            // State 1.1.1: <div><p>PAR1</p><b>
-                            //                              ---
-                            // State 1.1.2: <div><br /><b>
-                            //                         ---
-                            // State 1.1.3: <div>PAR<b>
-                            //                      ---
-                        }
-                    } else {
-                        // State 1.2.1: <div><b>
-                        //                   ---
-                        // Lookahead to see if <p> is needed.
-                        if ($this->_pLookAhead()) {
-                            // State 1.3.1: <div><b>PAR1\n\nPAR2
-                            //                   ---
-                            $token = array($this->_pStart(), $token);
-                        } else {
-                            // State 1.3.2: <div><b>PAR1</b></div>
-                            //                   ---
-
-                            // State 1.3.3: <div><b>PAR1</b><div></div>\n\n</div>
-                            //                   ---
-                        }
-                    }
-                } else {
-                    // State 2.3: ...<div>
-                    //               -----
-                }
-            } else {
-                if ($this->_isInline($token)) {
-                    // State 3.1: <b>
-                    //            ---
-                    // This is where the {p} tag is inserted, not reflected in
-                    // inputTokens yet, however.
-                    $token = array($this->_pStart(), $token);
-                } else {
-                    // State 3.2: <div>
-                    //            -----
-                }
-
-                $i = null;
-                if ($this->backward($i, $prev)) {
-                    if (!$prev instanceof HTMLPurifier_Token_Text) {
-                        // State 3.1.1: ...</p>{p}<b>
-                        //                        ---
-                        // State 3.2.1: ...</p><div>
-                        //                     -----
-                        if (!is_array($token)) {
-                            $token = array($token);
-                        }
-                        array_unshift($token, new HTMLPurifier_Token_Text("\n\n"));
-                    } else {
-                        // State 3.1.2: ...</p>\n\n{p}<b>
-                        //                            ---
-                        // State 3.2.2: ...</p>\n\n<div>
-                        //                         -----
-                        // Note: PAR<ELEM> cannot occur because PAR would have been
-                        // wrapped in <p> tags.
-                    }
-                }
-            }
-        } else {
-            // State 2.2: <ul><li>
-            //                ----
-            // State 2.4: <p><b>
-            //               ---
-        }
-    }
-
-    /**
-     * Splits up a text in paragraph tokens and appends them
-     * to the result stream that will replace the original
-     * @param string $data String text data that will be processed
-     *    into paragraphs
-     * @param HTMLPurifier_Token[] $result Reference to array of tokens that the
-     *    tags will be appended onto
-     */
-    private function _splitText($data, &$result)
-    {
-        $raw_paragraphs = explode("\n\n", $data);
-        $paragraphs = array(); // without empty paragraphs
-        $needs_start = false;
-        $needs_end = false;
-
-        $c = count($raw_paragraphs);
-        if ($c == 1) {
-            // There were no double-newlines, abort quickly. In theory this
-            // should never happen.
-            $result[] = new HTMLPurifier_Token_Text($data);
-            return;
-        }
-        for ($i = 0; $i < $c; $i++) {
-            $par = $raw_paragraphs[$i];
-            if (trim($par) !== '') {
-                $paragraphs[] = $par;
-            } else {
-                if ($i == 0) {
-                    // Double newline at the front
-                    if (empty($result)) {
-                        // The empty result indicates that the AutoParagraph
-                        // injector did not add any start paragraph tokens.
-                        // This means that we have been in a paragraph for
-                        // a while, and the newline means we should start a new one.
-                        $result[] = new HTMLPurifier_Token_End('p');
-                        $result[] = new HTMLPurifier_Token_Text("\n\n");
-                        // However, the start token should only be added if
-                        // there is more processing to be done (i.e. there are
-                        // real paragraphs in here). If there are none, the
-                        // next start paragraph tag will be handled by the
-                        // next call to the injector
-                        $needs_start = true;
-                    } else {
-                        // We just started a new paragraph!
-                        // Reinstate a double-newline for presentation's sake, since
-                        // it was in the source code.
-                        array_unshift($result, new HTMLPurifier_Token_Text("\n\n"));
-                    }
-                } elseif ($i + 1 == $c) {
-                    // Double newline at the end
-                    // There should be a trailing </p> when we're finally done.
-                    $needs_end = true;
-                }
-            }
-        }
-
-        // Check if this was just a giant blob of whitespace. Move this earlier,
-        // perhaps?
-        if (empty($paragraphs)) {
-            return;
-        }
-
-        // Add the start tag indicated by \n\n at the beginning of $data
-        if ($needs_start) {
-            $result[] = $this->_pStart();
-        }
-
-        // Append the paragraphs onto the result
-        foreach ($paragraphs as $par) {
-            $result[] = new HTMLPurifier_Token_Text($par);
-            $result[] = new HTMLPurifier_Token_End('p');
-            $result[] = new HTMLPurifier_Token_Text("\n\n");
-            $result[] = $this->_pStart();
-        }
-
-        // Remove trailing start token; Injector will handle this later if
-        // it was indeed needed. This prevents from needing to do a lookahead,
-        // at the cost of a lookbehind later.
-        array_pop($result);
-
-        // If there is no need for an end tag, remove all of it and let
-        // MakeWellFormed close it later.
-        if (!$needs_end) {
-            array_pop($result); // removes \n\n
-            array_pop($result); // removes </p>
-        }
-    }
-
-    /**
-     * Returns true if passed token is inline (and, ergo, allowed in
-     * paragraph tags)
-     * @param HTMLPurifier_Token $token
-     * @return bool
-     */
-    private function _isInline($token)
-    {
-        return isset($this->htmlDefinition->info['p']->child->elements[$token->name]);
-    }
-
-    /**
-     * Looks ahead in the token list and determines whether or not we need
-     * to insert a <p> tag.
-     * @return bool
-     */
-    private function _pLookAhead()
-    {
-        if ($this->currentToken instanceof HTMLPurifier_Token_Start) {
-            $nesting = 1;
-        } else {
-            $nesting = 0;
-        }
-        $ok = false;
-        $i = null;
-        while ($this->forwardUntilEndToken($i, $current, $nesting)) {
-            $result = $this->_checkNeedsP($current);
-            if ($result !== null) {
-                $ok = $result;
-                break;
-            }
-        }
-        return $ok;
-    }
-
-    /**
-     * Determines if a particular token requires an earlier inline token
-     * to get a paragraph. This should be used with _forwardUntilEndToken
-     * @param HTMLPurifier_Token $current
-     * @return bool
-     */
-    private function _checkNeedsP($current)
-    {
-        if ($current instanceof HTMLPurifier_Token_Start) {
-            if (!$this->_isInline($current)) {
-                // <div>PAR1<div>
-                //      ----
-                // Terminate early, since we hit a block element
-                return false;
-            }
-        } elseif ($current instanceof HTMLPurifier_Token_Text) {
-            if (strpos($current->data, "\n\n") !== false) {
-                // <div>PAR1<b>PAR1\n\nPAR2
-                //      ----
-                return true;
-            } else {
-                // <div>PAR1<b>PAR1...
-                //      ----
-            }
-        }
-        return null;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/DisplayLinkURI.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/DisplayLinkURI.php
deleted file mode 100644
index 9f9044829..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/DisplayLinkURI.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Injector that displays the URL of an anchor instead of linking to it, in addition to showing the text of the link.
- */
-class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier_Injector
-{
-    /**
-     * @type string
-     */
-    public $name = 'DisplayLinkURI';
-
-    /**
-     * @type array
-     */
-    public $needed = array('a');
-
-    /**
-     * @param $token
-     */
-    public function handleElement(&$token)
-    {
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleEnd(&$token)
-    {
-        if (isset($token->start->attr['href'])) {
-            $url = $token->start->attr['href'];
-            unset($token->start->attr['href']);
-            $token = array($token, new HTMLPurifier_Token_Text(" ($url)"));
-        } else {
-            // nothing to display
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/Linkify.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/Linkify.php
deleted file mode 100644
index 531dde4ac..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/Linkify.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * Injector that converts http, https and ftp text URLs to actual links.
- */
-class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
-{
-    /**
-     * @type string
-     */
-    public $name = 'Linkify';
-
-    /**
-     * @type array
-     */
-    public $needed = array('a' => array('href'));
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleText(&$token)
-    {
-        if (!$this->allowsElement('a')) {
-            return;
-        }
-
-        if (strpos($token->data, '://') === false) {
-            // our really quick heuristic failed, abort
-            // this may not work so well if we want to match things like
-            // "google.com", but then again, most people don't
-            return;
-        }
-
-        // there is/are URL(s). Let's split the string.
-        // We use this regex:
-        // https://gist.github.com/gruber/249502
-        // but with @cscott's backtracking fix and also
-        // the Unicode characters un-Unicodified.
-        $bits = preg_split(
-            '/\\b((?:[a-z][\\w\\-]+:(?:\\/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\\/)(?:[^\\s()<>]|\\((?:[^\\s()<>]|(?:\\([^\\s()<>]+\\)))*\\))+(?:\\((?:[^\\s()<>]|(?:\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:\'".,<>?\x{00ab}\x{00bb}\x{201c}\x{201d}\x{2018}\x{2019}]))/iu',
-            $token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
-
-
-        $token = array();
-
-        // $i = index
-        // $c = count
-        // $l = is link
-        for ($i = 0, $c = count($bits), $l = false; $i < $c; $i++, $l = !$l) {
-            if (!$l) {
-                if ($bits[$i] === '') {
-                    continue;
-                }
-                $token[] = new HTMLPurifier_Token_Text($bits[$i]);
-            } else {
-                $token[] = new HTMLPurifier_Token_Start('a', array('href' => $bits[$i]));
-                $token[] = new HTMLPurifier_Token_Text($bits[$i]);
-                $token[] = new HTMLPurifier_Token_End('a');
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/PurifierLinkify.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/PurifierLinkify.php
deleted file mode 100644
index d7dd7d972..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/PurifierLinkify.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * Injector that converts configuration directive syntax %Namespace.Directive
- * to links
- */
-class HTMLPurifier_Injector_PurifierLinkify extends HTMLPurifier_Injector
-{
-    /**
-     * @type string
-     */
-    public $name = 'PurifierLinkify';
-
-    /**
-     * @type string
-     */
-    public $docURL;
-
-    /**
-     * @type array
-     */
-    public $needed = array('a' => array('href'));
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function prepare($config, $context)
-    {
-        $this->docURL = $config->get('AutoFormat.PurifierLinkify.DocURL');
-        return parent::prepare($config, $context);
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleText(&$token)
-    {
-        if (!$this->allowsElement('a')) {
-            return;
-        }
-        if (strpos($token->data, '%') === false) {
-            return;
-        }
-
-        $bits = preg_split('#%([a-z0-9]+\.[a-z0-9]+)#Si', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
-        $token = array();
-
-        // $i = index
-        // $c = count
-        // $l = is link
-        for ($i = 0, $c = count($bits), $l = false; $i < $c; $i++, $l = !$l) {
-            if (!$l) {
-                if ($bits[$i] === '') {
-                    continue;
-                }
-                $token[] = new HTMLPurifier_Token_Text($bits[$i]);
-            } else {
-                $token[] = new HTMLPurifier_Token_Start(
-                    'a',
-                    array('href' => str_replace('%s', $bits[$i], $this->docURL))
-                );
-                $token[] = new HTMLPurifier_Token_Text('%' . $bits[$i]);
-                $token[] = new HTMLPurifier_Token_End('a');
-            }
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveEmpty.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveEmpty.php
deleted file mode 100644
index aae2dca1a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveEmpty.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector
-{
-    /**
-     * @type HTMLPurifier_Context
-     */
-    private $context;
-
-    /**
-     * @type HTMLPurifier_Config
-     */
-    private $config;
-
-    /**
-     * @type HTMLPurifier_AttrValidator
-     */
-    private $attrValidator;
-
-    /**
-     * @type bool
-     */
-    private $removeNbsp;
-
-    /**
-     * @type bool
-     */
-    private $removeNbspExceptions;
-
-    /**
-     * Cached contents of %AutoFormat.RemoveEmpty.Predicate
-     * @type array
-     */
-    private $exclude;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return void
-     */
-    public function prepare($config, $context)
-    {
-        parent::prepare($config, $context);
-        $this->config = $config;
-        $this->context = $context;
-        $this->removeNbsp = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp');
-        $this->removeNbspExceptions = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions');
-        $this->exclude = $config->get('AutoFormat.RemoveEmpty.Predicate');
-        foreach ($this->exclude as $key => $attrs) {
-            if (!is_array($attrs)) {
-                // HACK, see HTMLPurifier/Printer/ConfigForm.php
-                $this->exclude[$key] = explode(';', $attrs);
-            }
-        }
-        $this->attrValidator = new HTMLPurifier_AttrValidator();
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleElement(&$token)
-    {
-        if (!$token instanceof HTMLPurifier_Token_Start) {
-            return;
-        }
-        $next = false;
-        $deleted = 1; // the current tag
-        for ($i = count($this->inputZipper->back) - 1; $i >= 0; $i--, $deleted++) {
-            $next = $this->inputZipper->back[$i];
-            if ($next instanceof HTMLPurifier_Token_Text) {
-                if ($next->is_whitespace) {
-                    continue;
-                }
-                if ($this->removeNbsp && !isset($this->removeNbspExceptions[$token->name])) {
-                    $plain = str_replace("\xC2\xA0", "", $next->data);
-                    $isWsOrNbsp = $plain === '' || ctype_space($plain);
-                    if ($isWsOrNbsp) {
-                        continue;
-                    }
-                }
-            }
-            break;
-        }
-        if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) {
-            $this->attrValidator->validateToken($token, $this->config, $this->context);
-            $token->armor['ValidateAttributes'] = true;
-            if (isset($this->exclude[$token->name])) {
-                $r = true;
-                foreach ($this->exclude[$token->name] as $elem) {
-                    if (!isset($token->attr[$elem])) $r = false;
-                }
-                if ($r) return;
-            }
-            if (isset($token->attr['id']) || isset($token->attr['name'])) {
-                return;
-            }
-            $token = $deleted + 1;
-            for ($b = 0, $c = count($this->inputZipper->front); $b < $c; $b++) {
-                $prev = $this->inputZipper->front[$b];
-                if ($prev instanceof HTMLPurifier_Token_Text && $prev->is_whitespace) {
-                    continue;
-                }
-                break;
-            }
-            // This is safe because we removed the token that triggered this.
-            $this->rewindOffset($b+$deleted);
-            return;
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php
deleted file mode 100644
index 270b7f828..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/**
- * Injector that removes spans with no attributes
- */
-class HTMLPurifier_Injector_RemoveSpansWithoutAttributes extends HTMLPurifier_Injector
-{
-    /**
-     * @type string
-     */
-    public $name = 'RemoveSpansWithoutAttributes';
-
-    /**
-     * @type array
-     */
-    public $needed = array('span');
-
-    /**
-     * @type HTMLPurifier_AttrValidator
-     */
-    private $attrValidator;
-
-    /**
-     * Used by AttrValidator.
-     * @type HTMLPurifier_Config
-     */
-    private $config;
-
-    /**
-     * @type HTMLPurifier_Context
-     */
-    private $context;
-
-    public function prepare($config, $context)
-    {
-        $this->attrValidator = new HTMLPurifier_AttrValidator();
-        $this->config = $config;
-        $this->context = $context;
-        return parent::prepare($config, $context);
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleElement(&$token)
-    {
-        if ($token->name !== 'span' || !$token instanceof HTMLPurifier_Token_Start) {
-            return;
-        }
-
-        // We need to validate the attributes now since this doesn't normally
-        // happen until after MakeWellFormed. If all the attributes are removed
-        // the span needs to be removed too.
-        $this->attrValidator->validateToken($token, $this->config, $this->context);
-        $token->armor['ValidateAttributes'] = true;
-
-        if (!empty($token->attr)) {
-            return;
-        }
-
-        $nesting = 0;
-        while ($this->forwardUntilEndToken($i, $current, $nesting)) {
-        }
-
-        if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') {
-            // Mark closing span tag for deletion
-            $current->markForDeletion = true;
-            // Delete open span tag
-            $token = false;
-        }
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleEnd(&$token)
-    {
-        if ($token->markForDeletion) {
-            $token = false;
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/SafeObject.php b/libraries/htmlpurifier410/library/HTMLPurifier/Injector/SafeObject.php
deleted file mode 100644
index 0b051101d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Injector/SafeObject.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-/**
- * Adds important param elements to inside of object in order to make
- * things safe.
- */
-class HTMLPurifier_Injector_SafeObject extends HTMLPurifier_Injector
-{
-    /**
-     * @type string
-     */
-    public $name = 'SafeObject';
-
-    /**
-     * @type array
-     */
-    public $needed = array('object', 'param');
-
-    /**
-     * @type array
-     */
-    protected $objectStack = array();
-
-    /**
-     * @type array
-     */
-    protected $paramStack = array();
-
-    /**
-     * Keep this synchronized with AttrTransform/SafeParam.php.
-     * @type array
-     */
-    protected $addParam = array(
-        'allowScriptAccess' => 'never',
-        'allowNetworking' => 'internal',
-    );
-
-    /**
-     * These are all lower-case keys.
-     * @type array
-     */
-    protected $allowedParam = array(
-        'wmode' => true,
-        'movie' => true,
-        'flashvars' => true,
-        'src' => true,
-        'allowfullscreen' => true, // if omitted, assume to be 'false'
-    );
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return void
-     */
-    public function prepare($config, $context)
-    {
-        parent::prepare($config, $context);
-    }
-
-    /**
-     * @param HTMLPurifier_Token $token
-     */
-    public function handleElement(&$token)
-    {
-        if ($token->name == 'object') {
-            $this->objectStack[] = $token;
-            $this->paramStack[] = array();
-            $new = array($token);
-            foreach ($this->addParam as $name => $value) {
-                $new[] = new HTMLPurifier_Token_Empty('param', array('name' => $name, 'value' => $value));
-            }
-            $token = $new;
-        } elseif ($token->name == 'param') {
-            $nest = count($this->currentNesting) - 1;
-            if ($nest >= 0 && $this->currentNesting[$nest]->name === 'object') {
-                $i = count($this->objectStack) - 1;
-                if (!isset($token->attr['name'])) {
-                    $token = false;
-                    return;
-                }
-                $n = $token->attr['name'];
-                // We need this fix because YouTube doesn't supply a data
-                // attribute, which we need if a type is specified. This is
-                // *very* Flash specific.
-                if (!isset($this->objectStack[$i]->attr['data']) &&
-                    ($token->attr['name'] == 'movie' || $token->attr['name'] == 'src')
-                ) {
-                    $this->objectStack[$i]->attr['data'] = $token->attr['value'];
-                }
-                // Check if the parameter is the correct value but has not
-                // already been added
-                if (!isset($this->paramStack[$i][$n]) &&
-                    isset($this->addParam[$n]) &&
-                    $token->attr['name'] === $this->addParam[$n]) {
-                    // keep token, and add to param stack
-                    $this->paramStack[$i][$n] = true;
-                } elseif (isset($this->allowedParam[strtolower($n)])) {
-                    // keep token, don't do anything to it
-                    // (could possibly check for duplicates here)
-                    // Note: In principle, parameters should be case sensitive.
-                    // But it seems they are not really; so accept any case.
-                } else {
-                    $token = false;
-                }
-            } else {
-                // not directly inside an object, DENY!
-                $token = false;
-            }
-        }
-    }
-
-    public function handleEnd(&$token)
-    {
-        // This is the WRONG way of handling the object and param stacks;
-        // we should be inserting them directly on the relevant object tokens
-        // so that the global stack handling handles it.
-        if ($token->name == 'object') {
-            array_pop($this->objectStack);
-            array_pop($this->paramStack);
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Language.php b/libraries/htmlpurifier410/library/HTMLPurifier/Language.php
deleted file mode 100644
index 35a13f785..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Language.php
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php
-
-/**
- * Represents a language and defines localizable string formatting and
- * other functions, as well as the localized messages for HTML Purifier.
- */
-class HTMLPurifier_Language
-{
-
-    /**
-     * ISO 639 language code of language. Prefers shortest possible version.
-     * @type string
-     */
-    public $code = 'en';
-
-    /**
-     * Fallback language code.
-     * @type bool|string
-     */
-    public $fallback = false;
-
-    /**
-     * Array of localizable messages.
-     * @type array
-     */
-    public $messages = array();
-
-    /**
-     * Array of localizable error codes.
-     * @type array
-     */
-    public $errorNames = array();
-
-    /**
-     * True if no message file was found for this language, so English
-     * is being used instead. Check this if you'd like to notify the
-     * user that they've used a non-supported language.
-     * @type bool
-     */
-    public $error = false;
-
-    /**
-     * Has the language object been loaded yet?
-     * @type bool
-     * @todo Make it private, fix usage in HTMLPurifier_LanguageTest
-     */
-    public $_loaded = false;
-
-    /**
-     * @type HTMLPurifier_Config
-     */
-    protected $config;
-
-    /**
-     * @type HTMLPurifier_Context
-     */
-    protected $context;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     */
-    public function __construct($config, $context)
-    {
-        $this->config  = $config;
-        $this->context = $context;
-    }
-
-    /**
-     * Loads language object with necessary info from factory cache
-     * @note This is a lazy loader
-     */
-    public function load()
-    {
-        if ($this->_loaded) {
-            return;
-        }
-        $factory = HTMLPurifier_LanguageFactory::instance();
-        $factory->loadLanguage($this->code);
-        foreach ($factory->keys as $key) {
-            $this->$key = $factory->cache[$this->code][$key];
-        }
-        $this->_loaded = true;
-    }
-
-    /**
-     * Retrieves a localised message.
-     * @param string $key string identifier of message
-     * @return string localised message
-     */
-    public function getMessage($key)
-    {
-        if (!$this->_loaded) {
-            $this->load();
-        }
-        if (!isset($this->messages[$key])) {
-            return "[$key]";
-        }
-        return $this->messages[$key];
-    }
-
-    /**
-     * Retrieves a localised error name.
-     * @param int $int error number, corresponding to PHP's error reporting
-     * @return string localised message
-     */
-    public function getErrorName($int)
-    {
-        if (!$this->_loaded) {
-            $this->load();
-        }
-        if (!isset($this->errorNames[$int])) {
-            return "[Error: $int]";
-        }
-        return $this->errorNames[$int];
-    }
-
-    /**
-     * Converts an array list into a string readable representation
-     * @param array $array
-     * @return string
-     */
-    public function listify($array)
-    {
-        $sep      = $this->getMessage('Item separator');
-        $sep_last = $this->getMessage('Item separator last');
-        $ret = '';
-        for ($i = 0, $c = count($array); $i < $c; $i++) {
-            if ($i == 0) {
-            } elseif ($i + 1 < $c) {
-                $ret .= $sep;
-            } else {
-                $ret .= $sep_last;
-            }
-            $ret .= $array[$i];
-        }
-        return $ret;
-    }
-
-    /**
-     * Formats a localised message with passed parameters
-     * @param string $key string identifier of message
-     * @param array $args Parameters to substitute in
-     * @return string localised message
-     * @todo Implement conditionals? Right now, some messages make
-     *     reference to line numbers, but those aren't always available
-     */
-    public function formatMessage($key, $args = array())
-    {
-        if (!$this->_loaded) {
-            $this->load();
-        }
-        if (!isset($this->messages[$key])) {
-            return "[$key]";
-        }
-        $raw = $this->messages[$key];
-        $subst = array();
-        $generator = false;
-        foreach ($args as $i => $value) {
-            if (is_object($value)) {
-                if ($value instanceof HTMLPurifier_Token) {
-                    // factor this out some time
-                    if (!$generator) {
-                        $generator = $this->context->get('Generator');
-                    }
-                    if (isset($value->name)) {
-                        $subst['$'.$i.'.Name'] = $value->name;
-                    }
-                    if (isset($value->data)) {
-                        $subst['$'.$i.'.Data'] = $value->data;
-                    }
-                    $subst['$'.$i.'.Compact'] =
-                    $subst['$'.$i.'.Serialized'] = $generator->generateFromToken($value);
-                    // a more complex algorithm for compact representation
-                    // could be introduced for all types of tokens. This
-                    // may need to be factored out into a dedicated class
-                    if (!empty($value->attr)) {
-                        $stripped_token = clone $value;
-                        $stripped_token->attr = array();
-                        $subst['$'.$i.'.Compact'] = $generator->generateFromToken($stripped_token);
-                    }
-                    $subst['$'.$i.'.Line'] = $value->line ? $value->line : 'unknown';
-                }
-                continue;
-            } elseif (is_array($value)) {
-                $keys = array_keys($value);
-                if (array_keys($keys) === $keys) {
-                    // list
-                    $subst['$'.$i] = $this->listify($value);
-                } else {
-                    // associative array
-                    // no $i implementation yet, sorry
-                    $subst['$'.$i.'.Keys'] = $this->listify($keys);
-                    $subst['$'.$i.'.Values'] = $this->listify(array_values($value));
-                }
-                continue;
-            }
-            $subst['$' . $i] = $value;
-        }
-        return strtr($raw, $subst);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Language/classes/en-x-test.php b/libraries/htmlpurifier410/library/HTMLPurifier/Language/classes/en-x-test.php
deleted file mode 100644
index a6f8d1634..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Language/classes/en-x-test.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-// private class for unit testing
-
-class HTMLPurifier_Language_en_x_test extends HTMLPurifier_Language
-{
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-test.php b/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-test.php
deleted file mode 100644
index e6a174a07..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-test.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-// private language message file for unit testing purposes
-
-$fallback = 'en';
-
-$messages = array(
-    'HTMLPurifier' => 'HTML Purifier X'
-);
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-testmini.php b/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-testmini.php
deleted file mode 100644
index ed8560fd5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en-x-testmini.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-// private language message file for unit testing purposes
-// this language file has no class associated with it
-
-$fallback = 'en';
-
-$messages = array(
-    'HTMLPurifier' => 'HTML Purifier XNone'
-);
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en.php b/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en.php
deleted file mode 100644
index 1fa30bdfe..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Language/messages/en.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-$fallback = false;
-
-$messages = array(
-
-    'HTMLPurifier' => 'HTML Purifier',
-// for unit testing purposes
-    'LanguageFactoryTest: Pizza' => 'Pizza',
-    'LanguageTest: List' => '$1',
-    'LanguageTest: Hash' => '$1.Keys; $1.Values',
-    'Item separator' => ', ',
-    'Item separator last' => ' and ', // non-Harvard style
-
-    'ErrorCollector: No errors' => 'No errors detected. However, because error reporting is still incomplete, there may have been errors that the error collector was not notified of; please inspect the output HTML carefully.',
-    'ErrorCollector: At line' => ' at line $line',
-    'ErrorCollector: Incidental errors' => 'Incidental errors',
-    'Lexer: Unclosed comment' => 'Unclosed comment',
-    'Lexer: Unescaped lt' => 'Unescaped less-than sign (<) should be &lt;',
-    'Lexer: Missing gt' => 'Missing greater-than sign (>), previous less-than sign (<) should be escaped',
-    'Lexer: Missing attribute key' => 'Attribute declaration has no key',
-    'Lexer: Missing end quote' => 'Attribute declaration has no end quote',
-    'Lexer: Extracted body' => 'Removed document metadata tags',
-    'Strategy_RemoveForeignElements: Tag transform' => '<$1> element transformed into $CurrentToken.Serialized',
-    'Strategy_RemoveForeignElements: Missing required attribute' => '$CurrentToken.Compact element missing required attribute $1',
-    'Strategy_RemoveForeignElements: Foreign element to text' => 'Unrecognized $CurrentToken.Serialized tag converted to text',
-    'Strategy_RemoveForeignElements: Foreign element removed' => 'Unrecognized $CurrentToken.Serialized tag removed',
-    'Strategy_RemoveForeignElements: Comment removed' => 'Comment containing "$CurrentToken.Data" removed',
-    'Strategy_RemoveForeignElements: Foreign meta element removed' => 'Unrecognized $CurrentToken.Serialized meta tag and all descendants removed',
-    'Strategy_RemoveForeignElements: Token removed to end' => 'Tags and text starting from $1 element where removed to end',
-    'Strategy_RemoveForeignElements: Trailing hyphen in comment removed' => 'Trailing hyphen(s) in comment removed',
-    'Strategy_RemoveForeignElements: Hyphens in comment collapsed' => 'Double hyphens in comments are not allowed, and were collapsed into single hyphens',
-    'Strategy_MakeWellFormed: Unnecessary end tag removed' => 'Unnecessary $CurrentToken.Serialized tag removed',
-    'Strategy_MakeWellFormed: Unnecessary end tag to text' => 'Unnecessary $CurrentToken.Serialized tag converted to text',
-    'Strategy_MakeWellFormed: Tag auto closed' => '$1.Compact started on line $1.Line auto-closed by $CurrentToken.Compact',
-    'Strategy_MakeWellFormed: Tag carryover' => '$1.Compact started on line $1.Line auto-continued into $CurrentToken.Compact',
-    'Strategy_MakeWellFormed: Stray end tag removed' => 'Stray $CurrentToken.Serialized tag removed',
-    'Strategy_MakeWellFormed: Stray end tag to text' => 'Stray $CurrentToken.Serialized tag converted to text',
-    'Strategy_MakeWellFormed: Tag closed by element end' => '$1.Compact tag started on line $1.Line closed by end of $CurrentToken.Serialized',
-    'Strategy_MakeWellFormed: Tag closed by document end' => '$1.Compact tag started on line $1.Line closed by end of document',
-    'Strategy_FixNesting: Node removed' => '$CurrentToken.Compact node removed',
-    'Strategy_FixNesting: Node excluded' => '$CurrentToken.Compact node removed due to descendant exclusion by ancestor element',
-    'Strategy_FixNesting: Node reorganized' => 'Contents of $CurrentToken.Compact node reorganized to enforce its content model',
-    'Strategy_FixNesting: Node contents removed' => 'Contents of $CurrentToken.Compact node removed',
-    'AttrValidator: Attributes transformed' => 'Attributes on $CurrentToken.Compact transformed from $1.Keys to $2.Keys',
-    'AttrValidator: Attribute removed' => '$CurrentAttr.Name attribute on $CurrentToken.Compact removed',
-);
-
-$errorNames = array(
-    E_ERROR => 'Error',
-    E_WARNING => 'Warning',
-    E_NOTICE => 'Notice'
-);
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/LanguageFactory.php b/libraries/htmlpurifier410/library/HTMLPurifier/LanguageFactory.php
deleted file mode 100644
index e3e7a3b8d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/LanguageFactory.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-
-/**
- * Class responsible for generating HTMLPurifier_Language objects, managing
- * caching and fallbacks.
- * @note Thanks to MediaWiki for the general logic, although this version
- *       has been entirely rewritten
- * @todo Serialized cache for languages
- */
-class HTMLPurifier_LanguageFactory
-{
-
-    /**
-     * Cache of language code information used to load HTMLPurifier_Language objects.
-     * Structure is: $factory->cache[$language_code][$key] = $value
-     * @type array
-     */
-    public $cache;
-
-    /**
-     * Valid keys in the HTMLPurifier_Language object. Designates which
-     * variables to slurp out of a message file.
-     * @type array
-     */
-    public $keys = array('fallback', 'messages', 'errorNames');
-
-    /**
-     * Instance to validate language codes.
-     * @type HTMLPurifier_AttrDef_Lang
-     *
-     */
-    protected $validator;
-
-    /**
-     * Cached copy of dirname(__FILE__), directory of current file without
-     * trailing slash.
-     * @type string
-     */
-    protected $dir;
-
-    /**
-     * Keys whose contents are a hash map and can be merged.
-     * @type array
-     */
-    protected $mergeable_keys_map = array('messages' => true, 'errorNames' => true);
-
-    /**
-     * Keys whose contents are a list and can be merged.
-     * @value array lookup
-     */
-    protected $mergeable_keys_list = array();
-
-    /**
-     * Retrieve sole instance of the factory.
-     * @param HTMLPurifier_LanguageFactory $prototype Optional prototype to overload sole instance with,
-     *                   or bool true to reset to default factory.
-     * @return HTMLPurifier_LanguageFactory
-     */
-    public static function instance($prototype = null)
-    {
-        static $instance = null;
-        if ($prototype !== null) {
-            $instance = $prototype;
-        } elseif ($instance === null || $prototype == true) {
-            $instance = new HTMLPurifier_LanguageFactory();
-            $instance->setup();
-        }
-        return $instance;
-    }
-
-    /**
-     * Sets up the singleton, much like a constructor
-     * @note Prevents people from getting this outside of the singleton
-     */
-    public function setup()
-    {
-        $this->validator = new HTMLPurifier_AttrDef_Lang();
-        $this->dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier';
-    }
-
-    /**
-     * Creates a language object, handles class fallbacks
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @param bool|string $code Code to override configuration with. Private parameter.
-     * @return HTMLPurifier_Language
-     */
-    public function create($config, $context, $code = false)
-    {
-        // validate language code
-        if ($code === false) {
-            $code = $this->validator->validate(
-                $config->get('Core.Language'),
-                $config,
-                $context
-            );
-        } else {
-            $code = $this->validator->validate($code, $config, $context);
-        }
-        if ($code === false) {
-            $code = 'en'; // malformed code becomes English
-        }
-
-        $pcode = str_replace('-', '_', $code); // make valid PHP classname
-        static $depth = 0; // recursion protection
-
-        if ($code == 'en') {
-            $lang = new HTMLPurifier_Language($config, $context);
-        } else {
-            $class = 'HTMLPurifier_Language_' . $pcode;
-            $file  = $this->dir . '/Language/classes/' . $code . '.php';
-            if (file_exists($file) || class_exists($class, false)) {
-                $lang = new $class($config, $context);
-            } else {
-                // Go fallback
-                $raw_fallback = $this->getFallbackFor($code);
-                $fallback = $raw_fallback ? $raw_fallback : 'en';
-                $depth++;
-                $lang = $this->create($config, $context, $fallback);
-                if (!$raw_fallback) {
-                    $lang->error = true;
-                }
-                $depth--;
-            }
-        }
-        $lang->code = $code;
-        return $lang;
-    }
-
-    /**
-     * Returns the fallback language for language
-     * @note Loads the original language into cache
-     * @param string $code language code
-     * @return string|bool
-     */
-    public function getFallbackFor($code)
-    {
-        $this->loadLanguage($code);
-        return $this->cache[$code]['fallback'];
-    }
-
-    /**
-     * Loads language into the cache, handles message file and fallbacks
-     * @param string $code language code
-     */
-    public function loadLanguage($code)
-    {
-        static $languages_seen = array(); // recursion guard
-
-        // abort if we've already loaded it
-        if (isset($this->cache[$code])) {
-            return;
-        }
-
-        // generate filename
-        $filename = $this->dir . '/Language/messages/' . $code . '.php';
-
-        // default fallback : may be overwritten by the ensuing include
-        $fallback = ($code != 'en') ? 'en' : false;
-
-        // load primary localisation
-        if (!file_exists($filename)) {
-            // skip the include: will rely solely on fallback
-            $filename = $this->dir . '/Language/messages/en.php';
-            $cache = array();
-        } else {
-            include $filename;
-            $cache = compact($this->keys);
-        }
-
-        // load fallback localisation
-        if (!empty($fallback)) {
-
-            // infinite recursion guard
-            if (isset($languages_seen[$code])) {
-                trigger_error(
-                    'Circular fallback reference in language ' .
-                    $code,
-                    E_USER_ERROR
-                );
-                $fallback = 'en';
-            }
-            $language_seen[$code] = true;
-
-            // load the fallback recursively
-            $this->loadLanguage($fallback);
-            $fallback_cache = $this->cache[$fallback];
-
-            // merge fallback with current language
-            foreach ($this->keys as $key) {
-                if (isset($cache[$key]) && isset($fallback_cache[$key])) {
-                    if (isset($this->mergeable_keys_map[$key])) {
-                        $cache[$key] = $cache[$key] + $fallback_cache[$key];
-                    } elseif (isset($this->mergeable_keys_list[$key])) {
-                        $cache[$key] = array_merge($fallback_cache[$key], $cache[$key]);
-                    }
-                } else {
-                    $cache[$key] = $fallback_cache[$key];
-                }
-            }
-        }
-
-        // save to cache for later retrieval
-        $this->cache[$code] = $cache;
-        return;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Length.php b/libraries/htmlpurifier410/library/HTMLPurifier/Length.php
deleted file mode 100644
index 9cc1bc750..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Length.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-
-/**
- * Represents a measurable length, with a string numeric magnitude
- * and a unit. This object is immutable.
- */
-class HTMLPurifier_Length
-{
-
-    /**
-     * String numeric magnitude.
-     * @type string
-     */
-    protected $n;
-
-    /**
-     * String unit. False is permitted if $n = 0.
-     * @type string|bool
-     */
-    protected $unit;
-
-    /**
-     * Whether or not this length is valid. Null if not calculated yet.
-     * @type bool
-     */
-    protected $isValid;
-
-    /**
-     * Array Lookup array of units recognized by CSS 3
-     * @type array
-     */
-    protected static $allowedUnits = array(
-        'em' => true, 'ex' => true, 'px' => true, 'in' => true,
-        'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true,
-        'ch' => true, 'rem' => true, 'vw' => true, 'vh' => true,
-        'vmin' => true, 'vmax' => true
-    );
-
-    /**
-     * @param string $n Magnitude
-     * @param bool|string $u Unit
-     */
-    public function __construct($n = '0', $u = false)
-    {
-        $this->n = (string) $n;
-        $this->unit = $u !== false ? (string) $u : false;
-    }
-
-    /**
-     * @param string $s Unit string, like '2em' or '3.4in'
-     * @return HTMLPurifier_Length
-     * @warning Does not perform validation.
-     */
-    public static function make($s)
-    {
-        if ($s instanceof HTMLPurifier_Length) {
-            return $s;
-        }
-        $n_length = strspn($s, '1234567890.+-');
-        $n = substr($s, 0, $n_length);
-        $unit = substr($s, $n_length);
-        if ($unit === '') {
-            $unit = false;
-        }
-        return new HTMLPurifier_Length($n, $unit);
-    }
-
-    /**
-     * Validates the number and unit.
-     * @return bool
-     */
-    protected function validate()
-    {
-        // Special case:
-        if ($this->n === '+0' || $this->n === '-0') {
-            $this->n = '0';
-        }
-        if ($this->n === '0' && $this->unit === false) {
-            return true;
-        }
-        if (!ctype_lower($this->unit)) {
-            $this->unit = strtolower($this->unit);
-        }
-        if (!isset(HTMLPurifier_Length::$allowedUnits[$this->unit])) {
-            return false;
-        }
-        // Hack:
-        $def = new HTMLPurifier_AttrDef_CSS_Number();
-        $result = $def->validate($this->n, false, false);
-        if ($result === false) {
-            return false;
-        }
-        $this->n = $result;
-        return true;
-    }
-
-    /**
-     * Returns string representation of number.
-     * @return string
-     */
-    public function toString()
-    {
-        if (!$this->isValid()) {
-            return false;
-        }
-        return $this->n . $this->unit;
-    }
-
-    /**
-     * Retrieves string numeric magnitude.
-     * @return string
-     */
-    public function getN()
-    {
-        return $this->n;
-    }
-
-    /**
-     * Retrieves string unit.
-     * @return string
-     */
-    public function getUnit()
-    {
-        return $this->unit;
-    }
-
-    /**
-     * Returns true if this length unit is valid.
-     * @return bool
-     */
-    public function isValid()
-    {
-        if ($this->isValid === null) {
-            $this->isValid = $this->validate();
-        }
-        return $this->isValid;
-    }
-
-    /**
-     * Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
-     * @param HTMLPurifier_Length $l
-     * @return int
-     * @warning If both values are too large or small, this calculation will
-     *          not work properly
-     */
-    public function compareTo($l)
-    {
-        if ($l === false) {
-            return false;
-        }
-        if ($l->unit !== $this->unit) {
-            $converter = new HTMLPurifier_UnitConverter();
-            $l = $converter->convert($l, $this->unit);
-            if ($l === false) {
-                return false;
-            }
-        }
-        return $this->n - $l->n;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer.php b/libraries/htmlpurifier410/library/HTMLPurifier/Lexer.php
deleted file mode 100644
index 1f48ab58c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer.php
+++ /dev/null
@@ -1,382 +0,0 @@
-<?php
-
-/**
- * Forgivingly lexes HTML (SGML-style) markup into tokens.
- *
- * A lexer parses a string of SGML-style markup and converts them into
- * corresponding tokens.  It doesn't check for well-formedness, although its
- * internal mechanism may make this automatic (such as the case of
- * HTMLPurifier_Lexer_DOMLex).  There are several implementations to choose
- * from.
- *
- * A lexer is HTML-oriented: it might work with XML, but it's not
- * recommended, as we adhere to a subset of the specification for optimization
- * reasons. This might change in the future. Also, most tokenizers are not
- * expected to handle DTDs or PIs.
- *
- * This class should not be directly instantiated, but you may use create() to
- * retrieve a default copy of the lexer.  Being a supertype, this class
- * does not actually define any implementation, but offers commonly used
- * convenience functions for subclasses.
- *
- * @note The unit tests will instantiate this class for testing purposes, as
- *       many of the utility functions require a class to be instantiated.
- *       This means that, even though this class is not runnable, it will
- *       not be declared abstract.
- *
- * @par
- *
- * @note
- * We use tokens rather than create a DOM representation because DOM would:
- *
- * @par
- *  -# Require more processing and memory to create,
- *  -# Is not streamable, and
- *  -# Has the entire document structure (html and body not needed).
- *
- * @par
- * However, DOM is helpful in that it makes it easy to move around nodes
- * without a lot of lookaheads to see when a tag is closed. This is a
- * limitation of the token system and some workarounds would be nice.
- */
-class HTMLPurifier_Lexer
-{
-
-    /**
-     * Whether or not this lexer implements line-number/column-number tracking.
-     * If it does, set to true.
-     */
-    public $tracksLineNumbers = false;
-
-    // -- STATIC ----------------------------------------------------------
-
-    /**
-     * Retrieves or sets the default Lexer as a Prototype Factory.
-     *
-     * By default HTMLPurifier_Lexer_DOMLex will be returned. There are
-     * a few exceptions involving special features that only DirectLex
-     * implements.
-     *
-     * @note The behavior of this class has changed, rather than accepting
-     *       a prototype object, it now accepts a configuration object.
-     *       To specify your own prototype, set %Core.LexerImpl to it.
-     *       This change in behavior de-singletonizes the lexer object.
-     *
-     * @param HTMLPurifier_Config $config
-     * @return HTMLPurifier_Lexer
-     * @throws HTMLPurifier_Exception
-     */
-    public static function create($config)
-    {
-        if (!($config instanceof HTMLPurifier_Config)) {
-            $lexer = $config;
-            trigger_error(
-                "Passing a prototype to
-                HTMLPurifier_Lexer::create() is deprecated, please instead
-                use %Core.LexerImpl",
-                E_USER_WARNING
-            );
-        } else {
-            $lexer = $config->get('Core.LexerImpl');
-        }
-
-        $needs_tracking =
-            $config->get('Core.MaintainLineNumbers') ||
-            $config->get('Core.CollectErrors');
-
-        $inst = null;
-        if (is_object($lexer)) {
-            $inst = $lexer;
-        } else {
-            if (is_null($lexer)) {
-                do {
-                    // auto-detection algorithm
-                    if ($needs_tracking) {
-                        $lexer = 'DirectLex';
-                        break;
-                    }
-
-                    if (class_exists('DOMDocument', false) &&
-                        method_exists('DOMDocument', 'loadHTML') &&
-                        !extension_loaded('domxml')
-                    ) {
-                        // check for DOM support, because while it's part of the
-                        // core, it can be disabled compile time. Also, the PECL
-                        // domxml extension overrides the default DOM, and is evil
-                        // and nasty and we shan't bother to support it
-                        $lexer = 'DOMLex';
-                    } else {
-                        $lexer = 'DirectLex';
-                    }
-                } while (0);
-            } // do..while so we can break
-
-            // instantiate recognized string names
-            switch ($lexer) {
-                case 'DOMLex':
-                    $inst = new HTMLPurifier_Lexer_DOMLex();
-                    break;
-                case 'DirectLex':
-                    $inst = new HTMLPurifier_Lexer_DirectLex();
-                    break;
-                case 'PH5P':
-                    $inst = new HTMLPurifier_Lexer_PH5P();
-                    break;
-                default:
-                    throw new HTMLPurifier_Exception(
-                        "Cannot instantiate unrecognized Lexer type " .
-                        htmlspecialchars($lexer)
-                    );
-            }
-        }
-
-        if (!$inst) {
-            throw new HTMLPurifier_Exception('No lexer was instantiated');
-        }
-
-        // once PHP DOM implements native line numbers, or we
-        // hack out something using XSLT, remove this stipulation
-        if ($needs_tracking && !$inst->tracksLineNumbers) {
-            throw new HTMLPurifier_Exception(
-                'Cannot use lexer that does not support line numbers with ' .
-                'Core.MaintainLineNumbers or Core.CollectErrors (use DirectLex instead)'
-            );
-        }
-
-        return $inst;
-
-    }
-
-    // -- CONVENIENCE MEMBERS ---------------------------------------------
-
-    public function __construct()
-    {
-        $this->_entity_parser = new HTMLPurifier_EntityParser();
-    }
-
-    /**
-     * Most common entity to raw value conversion table for special entities.
-     * @type array
-     */
-    protected $_special_entity2str =
-        array(
-            '&quot;' => '"',
-            '&amp;' => '&',
-            '&lt;' => '<',
-            '&gt;' => '>',
-            '&#39;' => "'",
-            '&#039;' => "'",
-            '&#x27;' => "'"
-        );
-
-    public function parseText($string, $config) {
-        return $this->parseData($string, false, $config);
-    }
-
-    public function parseAttr($string, $config) {
-        return $this->parseData($string, true, $config);
-    }
-
-    /**
-     * Parses special entities into the proper characters.
-     *
-     * This string will translate escaped versions of the special characters
-     * into the correct ones.
-     *
-     * @param string $string String character data to be parsed.
-     * @return string Parsed character data.
-     */
-    public function parseData($string, $is_attr, $config)
-    {
-        // following functions require at least one character
-        if ($string === '') {
-            return '';
-        }
-
-        // subtracts amps that cannot possibly be escaped
-        $num_amp = substr_count($string, '&') - substr_count($string, '& ') -
-            ($string[strlen($string) - 1] === '&' ? 1 : 0);
-
-        if (!$num_amp) {
-            return $string;
-        } // abort if no entities
-        $num_esc_amp = substr_count($string, '&amp;');
-        $string = strtr($string, $this->_special_entity2str);
-
-        // code duplication for sake of optimization, see above
-        $num_amp_2 = substr_count($string, '&') - substr_count($string, '& ') -
-            ($string[strlen($string) - 1] === '&' ? 1 : 0);
-
-        if ($num_amp_2 <= $num_esc_amp) {
-            return $string;
-        }
-
-        // hmm... now we have some uncommon entities. Use the callback.
-        if ($config->get('Core.LegacyEntityDecoder')) {
-            $string = $this->_entity_parser->substituteSpecialEntities($string);
-        } else {
-            if ($is_attr) {
-                $string = $this->_entity_parser->substituteAttrEntities($string);
-            } else {
-                $string = $this->_entity_parser->substituteTextEntities($string);
-            }
-        }
-        return $string;
-    }
-
-    /**
-     * Lexes an HTML string into tokens.
-     * @param $string String HTML.
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[] array representation of HTML.
-     */
-    public function tokenizeHTML($string, $config, $context)
-    {
-        trigger_error('Call to abstract class', E_USER_ERROR);
-    }
-
-    /**
-     * Translates CDATA sections into regular sections (through escaping).
-     * @param string $string HTML string to process.
-     * @return string HTML with CDATA sections escaped.
-     */
-    protected static function escapeCDATA($string)
-    {
-        return preg_replace_callback(
-            '/<!\[CDATA\[(.+?)\]\]>/s',
-            array('HTMLPurifier_Lexer', 'CDATACallback'),
-            $string
-        );
-    }
-
-    /**
-     * Special CDATA case that is especially convoluted for <script>
-     * @param string $string HTML string to process.
-     * @return string HTML with CDATA sections escaped.
-     */
-    protected static function escapeCommentedCDATA($string)
-    {
-        return preg_replace_callback(
-            '#<!--//--><!\[CDATA\[//><!--(.+?)//--><!\]\]>#s',
-            array('HTMLPurifier_Lexer', 'CDATACallback'),
-            $string
-        );
-    }
-
-    /**
-     * Special Internet Explorer conditional comments should be removed.
-     * @param string $string HTML string to process.
-     * @return string HTML with conditional comments removed.
-     */
-    protected static function removeIEConditional($string)
-    {
-        return preg_replace(
-            '#<!--\[if [^>]+\]>.*?<!\[endif\]-->#si', // probably should generalize for all strings
-            '',
-            $string
-        );
-    }
-
-    /**
-     * Callback function for escapeCDATA() that does the work.
-     *
-     * @warning Though this is public in order to let the callback happen,
-     *          calling it directly is not recommended.
-     * @param array $matches PCRE matches array, with index 0 the entire match
-     *                  and 1 the inside of the CDATA section.
-     * @return string Escaped internals of the CDATA section.
-     */
-    protected static function CDATACallback($matches)
-    {
-        // not exactly sure why the character set is needed, but whatever
-        return htmlspecialchars($matches[1], ENT_COMPAT, 'UTF-8');
-    }
-
-    /**
-     * Takes a piece of HTML and normalizes it by converting entities, fixing
-     * encoding, extracting bits, and other good stuff.
-     * @param string $html HTML.
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     * @todo Consider making protected
-     */
-    public function normalize($html, $config, $context)
-    {
-        // normalize newlines to \n
-        if ($config->get('Core.NormalizeNewlines')) {
-            $html = str_replace("\r\n", "\n", $html);
-            $html = str_replace("\r", "\n", $html);
-        }
-
-        if ($config->get('HTML.Trusted')) {
-            // escape convoluted CDATA
-            $html = $this->escapeCommentedCDATA($html);
-        }
-
-        // escape CDATA
-        $html = $this->escapeCDATA($html);
-
-        $html = $this->removeIEConditional($html);
-
-        // extract body from document if applicable
-        if ($config->get('Core.ConvertDocumentToFragment')) {
-            $e = false;
-            if ($config->get('Core.CollectErrors')) {
-                $e =& $context->get('ErrorCollector');
-            }
-            $new_html = $this->extractBody($html);
-            if ($e && $new_html != $html) {
-                $e->send(E_WARNING, 'Lexer: Extracted body');
-            }
-            $html = $new_html;
-        }
-
-        // expand entities that aren't the big five
-        if ($config->get('Core.LegacyEntityDecoder')) {
-            $html = $this->_entity_parser->substituteNonSpecialEntities($html);
-        }
-
-        // clean into wellformed UTF-8 string for an SGML context: this has
-        // to be done after entity expansion because the entities sometimes
-        // represent non-SGML characters (horror, horror!)
-        $html = HTMLPurifier_Encoder::cleanUTF8($html);
-
-        // if processing instructions are to removed, remove them now
-        if ($config->get('Core.RemoveProcessingInstructions')) {
-            $html = preg_replace('#<\?.+?\?>#s', '', $html);
-        }
-
-        $hidden_elements = $config->get('Core.HiddenElements');
-        if ($config->get('Core.AggressivelyRemoveScript') &&
-            !($config->get('HTML.Trusted') || !$config->get('Core.RemoveScriptContents')
-            || empty($hidden_elements["script"]))) {
-            $html = preg_replace('#<script[^>]*>.*?</script>#i', '', $html);
-        }
-
-        return $html;
-    }
-
-    /**
-     * Takes a string of HTML (fragment or document) and returns the content
-     * @todo Consider making protected
-     */
-    public function extractBody($html)
-    {
-        $matches = array();
-        $result = preg_match('|(.*?)<body[^>]*>(.*)</body>|is', $html, $matches);
-        if ($result) {
-            // Make sure it's not in a comment
-            $comment_start = strrpos($matches[1], '<!--');
-            $comment_end   = strrpos($matches[1], '-->');
-            if ($comment_start === false ||
-                ($comment_end !== false && $comment_end > $comment_start)) {
-                return $matches[2];
-            }
-        }
-        return $html;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DOMLex.php b/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DOMLex.php
deleted file mode 100644
index de352589c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DOMLex.php
+++ /dev/null
@@ -1,328 +0,0 @@
-<?php
-
-/**
- * Parser that uses PHP 5's DOM extension (part of the core).
- *
- * In PHP 5, the DOM XML extension was revamped into DOM and added to the core.
- * It gives us a forgiving HTML parser, which we use to transform the HTML
- * into a DOM, and then into the tokens.  It is blazingly fast (for large
- * documents, it performs twenty times faster than
- * HTMLPurifier_Lexer_DirectLex,and is the default choice for PHP 5.
- *
- * @note Any empty elements will have empty tokens associated with them, even if
- * this is prohibited by the spec. This is cannot be fixed until the spec
- * comes into play.
- *
- * @note PHP's DOM extension does not actually parse any entities, we use
- *       our own function to do that.
- *
- * @warning DOM tends to drop whitespace, which may wreak havoc on indenting.
- *          If this is a huge problem, due to the fact that HTML is hand
- *          edited and you are unable to get a parser cache that caches the
- *          the output of HTML Purifier while keeping the original HTML lying
- *          around, you may want to run Tidy on the resulting output or use
- *          HTMLPurifier_DirectLex
- */
-
-class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
-{
-
-    /**
-     * @type HTMLPurifier_TokenFactory
-     */
-    private $factory;
-
-    public function __construct()
-    {
-        // setup the factory
-        parent::__construct();
-        $this->factory = new HTMLPurifier_TokenFactory();
-    }
-
-    /**
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[]
-     */
-    public function tokenizeHTML($html, $config, $context)
-    {
-        $html = $this->normalize($html, $config, $context);
-
-        // attempt to armor stray angled brackets that cannot possibly
-        // form tags and thus are probably being used as emoticons
-        if ($config->get('Core.AggressivelyFixLt')) {
-            $char = '[^a-z!\/]';
-            $comment = "/<!--(.*?)(-->|\z)/is";
-            $html = preg_replace_callback($comment, array($this, 'callbackArmorCommentEntities'), $html);
-            do {
-                $old = $html;
-                $html = preg_replace("/<($char)/i", '&lt;\\1', $html);
-            } while ($html !== $old);
-            $html = preg_replace_callback($comment, array($this, 'callbackUndoCommentSubst'), $html); // fix comments
-        }
-
-        // preprocess html, essential for UTF-8
-        $html = $this->wrapHTML($html, $config, $context);
-
-        $doc = new DOMDocument();
-        $doc->encoding = 'UTF-8'; // theoretically, the above has this covered
-
-        set_error_handler(array($this, 'muteErrorHandler'));
-        $doc->loadHTML($html);
-        restore_error_handler();
-
-        $body = $doc->getElementsByTagName('html')->item(0)-> // <html>
-                      getElementsByTagName('body')->item(0);  // <body>
-
-        $div = $body->getElementsByTagName('div')->item(0); // <div>
-        $tokens = array();
-        $this->tokenizeDOM($div, $tokens, $config);
-        // If the div has a sibling, that means we tripped across
-        // a premature </div> tag.  So remove the div we parsed,
-        // and then tokenize the rest of body.  We can't tokenize
-        // the sibling directly as we'll lose the tags in that case.
-        if ($div->nextSibling) {
-            $body->removeChild($div);
-            $this->tokenizeDOM($body, $tokens, $config);
-        }
-        return $tokens;
-    }
-
-    /**
-     * Iterative function that tokenizes a node, putting it into an accumulator.
-     * To iterate is human, to recurse divine - L. Peter Deutsch
-     * @param DOMNode $node DOMNode to be tokenized.
-     * @param HTMLPurifier_Token[] $tokens   Array-list of already tokenized tokens.
-     * @return HTMLPurifier_Token of node appended to previously passed tokens.
-     */
-    protected function tokenizeDOM($node, &$tokens, $config)
-    {
-        $level = 0;
-        $nodes = array($level => new HTMLPurifier_Queue(array($node)));
-        $closingNodes = array();
-        do {
-            while (!$nodes[$level]->isEmpty()) {
-                $node = $nodes[$level]->shift(); // FIFO
-                $collect = $level > 0 ? true : false;
-                $needEndingTag = $this->createStartNode($node, $tokens, $collect, $config);
-                if ($needEndingTag) {
-                    $closingNodes[$level][] = $node;
-                }
-                if ($node->childNodes && $node->childNodes->length) {
-                    $level++;
-                    $nodes[$level] = new HTMLPurifier_Queue();
-                    foreach ($node->childNodes as $childNode) {
-                        $nodes[$level]->push($childNode);
-                    }
-                }
-            }
-            $level--;
-            if ($level && isset($closingNodes[$level])) {
-                while ($node = array_pop($closingNodes[$level])) {
-                    $this->createEndNode($node, $tokens);
-                }
-            }
-        } while ($level > 0);
-    }
-
-    /**
-     * Portably retrieve the tag name of a node; deals with older versions
-     * of libxml like 2.7.6
-     * @param DOMNode $node
-     */
-    protected function getTagName($node)
-    {
-        if (property_exists($node, 'tagName')) {
-            return $node->tagName;
-        } else if (property_exists($node, 'nodeName')) {
-            return $node->nodeName;
-        } else if (property_exists($node, 'localName')) {
-            return $node->localName;
-        }
-        return null;
-    }
-
-    /**
-     * Portably retrieve the data of a node; deals with older versions
-     * of libxml like 2.7.6
-     * @param DOMNode $node
-     */
-    protected function getData($node)
-    {
-        if (property_exists($node, 'data')) {
-            return $node->data;
-        } else if (property_exists($node, 'nodeValue')) {
-            return $node->nodeValue;
-        } else if (property_exists($node, 'textContent')) {
-            return $node->textContent;
-        }
-        return null;
-    }
-
-
-    /**
-     * @param DOMNode $node DOMNode to be tokenized.
-     * @param HTMLPurifier_Token[] $tokens   Array-list of already tokenized tokens.
-     * @param bool $collect  Says whether or start and close are collected, set to
-     *                    false at first recursion because it's the implicit DIV
-     *                    tag you're dealing with.
-     * @return bool if the token needs an endtoken
-     * @todo data and tagName properties don't seem to exist in DOMNode?
-     */
-    protected function createStartNode($node, &$tokens, $collect, $config)
-    {
-        // intercept non element nodes. WE MUST catch all of them,
-        // but we're not getting the character reference nodes because
-        // those should have been preprocessed
-        if ($node->nodeType === XML_TEXT_NODE) {
-            $data = $this->getData($node); // Handle variable data property
-            if ($data !== null) {
-              $tokens[] = $this->factory->createText($data);
-            }
-            return false;
-        } elseif ($node->nodeType === XML_CDATA_SECTION_NODE) {
-            // undo libxml's special treatment of <script> and <style> tags
-            $last = end($tokens);
-            $data = $node->data;
-            // (note $node->tagname is already normalized)
-            if ($last instanceof HTMLPurifier_Token_Start && ($last->name == 'script' || $last->name == 'style')) {
-                $new_data = trim($data);
-                if (substr($new_data, 0, 4) === '<!--') {
-                    $data = substr($new_data, 4);
-                    if (substr($data, -3) === '-->') {
-                        $data = substr($data, 0, -3);
-                    } else {
-                        // Highly suspicious! Not sure what to do...
-                    }
-                }
-            }
-            $tokens[] = $this->factory->createText($this->parseText($data, $config));
-            return false;
-        } elseif ($node->nodeType === XML_COMMENT_NODE) {
-            // this is code is only invoked for comments in script/style in versions
-            // of libxml pre-2.6.28 (regular comments, of course, are still
-            // handled regularly)
-            $tokens[] = $this->factory->createComment($node->data);
-            return false;
-        } elseif ($node->nodeType !== XML_ELEMENT_NODE) {
-            // not-well tested: there may be other nodes we have to grab
-            return false;
-        }
-        $attr = $node->hasAttributes() ? $this->transformAttrToAssoc($node->attributes) : array();
-        $tag_name = $this->getTagName($node); // Handle variable tagName property
-        if (empty($tag_name)) {
-            return (bool) $node->childNodes->length;
-        }
-        // We still have to make sure that the element actually IS empty
-        if (!$node->childNodes->length) {
-            if ($collect) {
-                $tokens[] = $this->factory->createEmpty($tag_name, $attr);
-            }
-            return false;
-        } else {
-            if ($collect) {
-                $tokens[] = $this->factory->createStart($tag_name, $attr);
-            }
-            return true;
-        }
-    }
-
-    /**
-     * @param DOMNode $node
-     * @param HTMLPurifier_Token[] $tokens
-     */
-    protected function createEndNode($node, &$tokens)
-    {
-        $tag_name = $this->getTagName($node); // Handle variable tagName property
-        $tokens[] = $this->factory->createEnd($tag_name);
-    }
-
-    /**
-     * Converts a DOMNamedNodeMap of DOMAttr objects into an assoc array.
-     *
-     * @param DOMNamedNodeMap $node_map DOMNamedNodeMap of DOMAttr objects.
-     * @return array Associative array of attributes.
-     */
-    protected function transformAttrToAssoc($node_map)
-    {
-        // NamedNodeMap is documented very well, so we're using undocumented
-        // features, namely, the fact that it implements Iterator and
-        // has a ->length attribute
-        if ($node_map->length === 0) {
-            return array();
-        }
-        $array = array();
-        foreach ($node_map as $attr) {
-            $array[$attr->name] = $attr->value;
-        }
-        return $array;
-    }
-
-    /**
-     * An error handler that mutes all errors
-     * @param int $errno
-     * @param string $errstr
-     */
-    public function muteErrorHandler($errno, $errstr)
-    {
-    }
-
-    /**
-     * Callback function for undoing escaping of stray angled brackets
-     * in comments
-     * @param array $matches
-     * @return string
-     */
-    public function callbackUndoCommentSubst($matches)
-    {
-        return '<!--' . strtr($matches[1], array('&amp;' => '&', '&lt;' => '<')) . $matches[2];
-    }
-
-    /**
-     * Callback function that entity-izes ampersands in comments so that
-     * callbackUndoCommentSubst doesn't clobber them
-     * @param array $matches
-     * @return string
-     */
-    public function callbackArmorCommentEntities($matches)
-    {
-        return '<!--' . str_replace('&', '&amp;', $matches[1]) . $matches[2];
-    }
-
-    /**
-     * Wraps an HTML fragment in the necessary HTML
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    protected function wrapHTML($html, $config, $context, $use_div = true)
-    {
-        $def = $config->getDefinition('HTML');
-        $ret = '';
-
-        if (!empty($def->doctype->dtdPublic) || !empty($def->doctype->dtdSystem)) {
-            $ret .= '<!DOCTYPE html ';
-            if (!empty($def->doctype->dtdPublic)) {
-                $ret .= 'PUBLIC "' . $def->doctype->dtdPublic . '" ';
-            }
-            if (!empty($def->doctype->dtdSystem)) {
-                $ret .= '"' . $def->doctype->dtdSystem . '" ';
-            }
-            $ret .= '>';
-        }
-
-        $ret .= '<html><head>';
-        $ret .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
-        // No protection if $html contains a stray </div>!
-        $ret .= '</head><body>';
-        if ($use_div) $ret .= '<div>';
-        $ret .= $html;
-        if ($use_div) $ret .= '</div>';
-        $ret .= '</body></html>';
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DirectLex.php b/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DirectLex.php
deleted file mode 100644
index 39d22f355..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/DirectLex.php
+++ /dev/null
@@ -1,539 +0,0 @@
-<?php
-
-/**
- * Our in-house implementation of a parser.
- *
- * A pure PHP parser, DirectLex has absolutely no dependencies, making
- * it a reasonably good default for PHP4.  Written with efficiency in mind,
- * it can be four times faster than HTMLPurifier_Lexer_PEARSax3, although it
- * pales in comparison to HTMLPurifier_Lexer_DOMLex.
- *
- * @todo Reread XML spec and document differences.
- */
-class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
-{
-    /**
-     * @type bool
-     */
-    public $tracksLineNumbers = true;
-
-    /**
-     * Whitespace characters for str(c)spn.
-     * @type string
-     */
-    protected $_whitespace = "\x20\x09\x0D\x0A";
-
-    /**
-     * Callback function for script CDATA fudge
-     * @param array $matches, in form of array(opening tag, contents, closing tag)
-     * @return string
-     */
-    protected function scriptCallback($matches)
-    {
-        return $matches[1] . htmlspecialchars($matches[2], ENT_COMPAT, 'UTF-8') . $matches[3];
-    }
-
-    /**
-     * @param String $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array|HTMLPurifier_Token[]
-     */
-    public function tokenizeHTML($html, $config, $context)
-    {
-        // special normalization for script tags without any armor
-        // our "armor" heurstic is a < sign any number of whitespaces after
-        // the first script tag
-        if ($config->get('HTML.Trusted')) {
-            $html = preg_replace_callback(
-                '#(<script[^>]*>)(\s*[^<].+?)(</script>)#si',
-                array($this, 'scriptCallback'),
-                $html
-            );
-        }
-
-        $html = $this->normalize($html, $config, $context);
-
-        $cursor = 0; // our location in the text
-        $inside_tag = false; // whether or not we're parsing the inside of a tag
-        $array = array(); // result array
-
-        // This is also treated to mean maintain *column* numbers too
-        $maintain_line_numbers = $config->get('Core.MaintainLineNumbers');
-
-        if ($maintain_line_numbers === null) {
-            // automatically determine line numbering by checking
-            // if error collection is on
-            $maintain_line_numbers = $config->get('Core.CollectErrors');
-        }
-
-        if ($maintain_line_numbers) {
-            $current_line = 1;
-            $current_col = 0;
-            $length = strlen($html);
-        } else {
-            $current_line = false;
-            $current_col = false;
-            $length = false;
-        }
-        $context->register('CurrentLine', $current_line);
-        $context->register('CurrentCol', $current_col);
-        $nl = "\n";
-        // how often to manually recalculate. This will ALWAYS be right,
-        // but it's pretty wasteful. Set to 0 to turn off
-        $synchronize_interval = $config->get('Core.DirectLexLineNumberSyncInterval');
-
-        $e = false;
-        if ($config->get('Core.CollectErrors')) {
-            $e =& $context->get('ErrorCollector');
-        }
-
-        // for testing synchronization
-        $loops = 0;
-
-        while (++$loops) {
-            // $cursor is either at the start of a token, or inside of
-            // a tag (i.e. there was a < immediately before it), as indicated
-            // by $inside_tag
-
-            if ($maintain_line_numbers) {
-                // $rcursor, however, is always at the start of a token.
-                $rcursor = $cursor - (int)$inside_tag;
-
-                // Column number is cheap, so we calculate it every round.
-                // We're interested at the *end* of the newline string, so
-                // we need to add strlen($nl) == 1 to $nl_pos before subtracting it
-                // from our "rcursor" position.
-                $nl_pos = strrpos($html, $nl, $rcursor - $length);
-                $current_col = $rcursor - (is_bool($nl_pos) ? 0 : $nl_pos + 1);
-
-                // recalculate lines
-                if ($synchronize_interval && // synchronization is on
-                    $cursor > 0 && // cursor is further than zero
-                    $loops % $synchronize_interval === 0) { // time to synchronize!
-                    $current_line = 1 + $this->substrCount($html, $nl, 0, $cursor);
-                }
-            }
-
-            $position_next_lt = strpos($html, '<', $cursor);
-            $position_next_gt = strpos($html, '>', $cursor);
-
-            // triggers on "<b>asdf</b>" but not "asdf <b></b>"
-            // special case to set up context
-            if ($position_next_lt === $cursor) {
-                $inside_tag = true;
-                $cursor++;
-            }
-
-            if (!$inside_tag && $position_next_lt !== false) {
-                // We are not inside tag and there still is another tag to parse
-                $token = new
-                HTMLPurifier_Token_Text(
-                    $this->parseText(
-                        substr(
-                            $html,
-                            $cursor,
-                            $position_next_lt - $cursor
-                        ), $config
-                    )
-                );
-                if ($maintain_line_numbers) {
-                    $token->rawPosition($current_line, $current_col);
-                    $current_line += $this->substrCount($html, $nl, $cursor, $position_next_lt - $cursor);
-                }
-                $array[] = $token;
-                $cursor = $position_next_lt + 1;
-                $inside_tag = true;
-                continue;
-            } elseif (!$inside_tag) {
-                // We are not inside tag but there are no more tags
-                // If we're already at the end, break
-                if ($cursor === strlen($html)) {
-                    break;
-                }
-                // Create Text of rest of string
-                $token = new
-                HTMLPurifier_Token_Text(
-                    $this->parseText(
-                        substr(
-                            $html,
-                            $cursor
-                        ), $config
-                    )
-                );
-                if ($maintain_line_numbers) {
-                    $token->rawPosition($current_line, $current_col);
-                }
-                $array[] = $token;
-                break;
-            } elseif ($inside_tag && $position_next_gt !== false) {
-                // We are in tag and it is well formed
-                // Grab the internals of the tag
-                $strlen_segment = $position_next_gt - $cursor;
-
-                if ($strlen_segment < 1) {
-                    // there's nothing to process!
-                    $token = new HTMLPurifier_Token_Text('<');
-                    $cursor++;
-                    continue;
-                }
-
-                $segment = substr($html, $cursor, $strlen_segment);
-
-                if ($segment === false) {
-                    // somehow, we attempted to access beyond the end of
-                    // the string, defense-in-depth, reported by Nate Abele
-                    break;
-                }
-
-                // Check if it's a comment
-                if (substr($segment, 0, 3) === '!--') {
-                    // re-determine segment length, looking for -->
-                    $position_comment_end = strpos($html, '-->', $cursor);
-                    if ($position_comment_end === false) {
-                        // uh oh, we have a comment that extends to
-                        // infinity. Can't be helped: set comment
-                        // end position to end of string
-                        if ($e) {
-                            $e->send(E_WARNING, 'Lexer: Unclosed comment');
-                        }
-                        $position_comment_end = strlen($html);
-                        $end = true;
-                    } else {
-                        $end = false;
-                    }
-                    $strlen_segment = $position_comment_end - $cursor;
-                    $segment = substr($html, $cursor, $strlen_segment);
-                    $token = new
-                    HTMLPurifier_Token_Comment(
-                        substr(
-                            $segment,
-                            3,
-                            $strlen_segment - 3
-                        )
-                    );
-                    if ($maintain_line_numbers) {
-                        $token->rawPosition($current_line, $current_col);
-                        $current_line += $this->substrCount($html, $nl, $cursor, $strlen_segment);
-                    }
-                    $array[] = $token;
-                    $cursor = $end ? $position_comment_end : $position_comment_end + 3;
-                    $inside_tag = false;
-                    continue;
-                }
-
-                // Check if it's an end tag
-                $is_end_tag = (strpos($segment, '/') === 0);
-                if ($is_end_tag) {
-                    $type = substr($segment, 1);
-                    $token = new HTMLPurifier_Token_End($type);
-                    if ($maintain_line_numbers) {
-                        $token->rawPosition($current_line, $current_col);
-                        $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor);
-                    }
-                    $array[] = $token;
-                    $inside_tag = false;
-                    $cursor = $position_next_gt + 1;
-                    continue;
-                }
-
-                // Check leading character is alnum, if not, we may
-                // have accidently grabbed an emoticon. Translate into
-                // text and go our merry way
-                if (!ctype_alpha($segment[0])) {
-                    // XML:  $segment[0] !== '_' && $segment[0] !== ':'
-                    if ($e) {
-                        $e->send(E_NOTICE, 'Lexer: Unescaped lt');
-                    }
-                    $token = new HTMLPurifier_Token_Text('<');
-                    if ($maintain_line_numbers) {
-                        $token->rawPosition($current_line, $current_col);
-                        $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor);
-                    }
-                    $array[] = $token;
-                    $inside_tag = false;
-                    continue;
-                }
-
-                // Check if it is explicitly self closing, if so, remove
-                // trailing slash. Remember, we could have a tag like <br>, so
-                // any later token processing scripts must convert improperly
-                // classified EmptyTags from StartTags.
-                $is_self_closing = (strrpos($segment, '/') === $strlen_segment - 1);
-                if ($is_self_closing) {
-                    $strlen_segment--;
-                    $segment = substr($segment, 0, $strlen_segment);
-                }
-
-                // Check if there are any attributes
-                $position_first_space = strcspn($segment, $this->_whitespace);
-
-                if ($position_first_space >= $strlen_segment) {
-                    if ($is_self_closing) {
-                        $token = new HTMLPurifier_Token_Empty($segment);
-                    } else {
-                        $token = new HTMLPurifier_Token_Start($segment);
-                    }
-                    if ($maintain_line_numbers) {
-                        $token->rawPosition($current_line, $current_col);
-                        $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor);
-                    }
-                    $array[] = $token;
-                    $inside_tag = false;
-                    $cursor = $position_next_gt + 1;
-                    continue;
-                }
-
-                // Grab out all the data
-                $type = substr($segment, 0, $position_first_space);
-                $attribute_string =
-                    trim(
-                        substr(
-                            $segment,
-                            $position_first_space
-                        )
-                    );
-                if ($attribute_string) {
-                    $attr = $this->parseAttributeString(
-                        $attribute_string,
-                        $config,
-                        $context
-                    );
-                } else {
-                    $attr = array();
-                }
-
-                if ($is_self_closing) {
-                    $token = new HTMLPurifier_Token_Empty($type, $attr);
-                } else {
-                    $token = new HTMLPurifier_Token_Start($type, $attr);
-                }
-                if ($maintain_line_numbers) {
-                    $token->rawPosition($current_line, $current_col);
-                    $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor);
-                }
-                $array[] = $token;
-                $cursor = $position_next_gt + 1;
-                $inside_tag = false;
-                continue;
-            } else {
-                // inside tag, but there's no ending > sign
-                if ($e) {
-                    $e->send(E_WARNING, 'Lexer: Missing gt');
-                }
-                $token = new
-                HTMLPurifier_Token_Text(
-                    '<' .
-                    $this->parseText(
-                        substr($html, $cursor), $config
-                    )
-                );
-                if ($maintain_line_numbers) {
-                    $token->rawPosition($current_line, $current_col);
-                }
-                // no cursor scroll? Hmm...
-                $array[] = $token;
-                break;
-            }
-            break;
-        }
-
-        $context->destroy('CurrentLine');
-        $context->destroy('CurrentCol');
-        return $array;
-    }
-
-    /**
-     * PHP 5.0.x compatible substr_count that implements offset and length
-     * @param string $haystack
-     * @param string $needle
-     * @param int $offset
-     * @param int $length
-     * @return int
-     */
-    protected function substrCount($haystack, $needle, $offset, $length)
-    {
-        static $oldVersion;
-        if ($oldVersion === null) {
-            $oldVersion = version_compare(PHP_VERSION, '5.1', '<');
-        }
-        if ($oldVersion) {
-            $haystack = substr($haystack, $offset, $length);
-            return substr_count($haystack, $needle);
-        } else {
-            return substr_count($haystack, $needle, $offset, $length);
-        }
-    }
-
-    /**
-     * Takes the inside of an HTML tag and makes an assoc array of attributes.
-     *
-     * @param string $string Inside of tag excluding name.
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array Assoc array of attributes.
-     */
-    public function parseAttributeString($string, $config, $context)
-    {
-        $string = (string)$string; // quick typecast
-
-        if ($string == '') {
-            return array();
-        } // no attributes
-
-        $e = false;
-        if ($config->get('Core.CollectErrors')) {
-            $e =& $context->get('ErrorCollector');
-        }
-
-        // let's see if we can abort as quickly as possible
-        // one equal sign, no spaces => one attribute
-        $num_equal = substr_count($string, '=');
-        $has_space = strpos($string, ' ');
-        if ($num_equal === 0 && !$has_space) {
-            // bool attribute
-            return array($string => $string);
-        } elseif ($num_equal === 1 && !$has_space) {
-            // only one attribute
-            list($key, $quoted_value) = explode('=', $string);
-            $quoted_value = trim($quoted_value);
-            if (!$key) {
-                if ($e) {
-                    $e->send(E_ERROR, 'Lexer: Missing attribute key');
-                }
-                return array();
-            }
-            if (!$quoted_value) {
-                return array($key => '');
-            }
-            $first_char = @$quoted_value[0];
-            $last_char = @$quoted_value[strlen($quoted_value) - 1];
-
-            $same_quote = ($first_char == $last_char);
-            $open_quote = ($first_char == '"' || $first_char == "'");
-
-            if ($same_quote && $open_quote) {
-                // well behaved
-                $value = substr($quoted_value, 1, strlen($quoted_value) - 2);
-            } else {
-                // not well behaved
-                if ($open_quote) {
-                    if ($e) {
-                        $e->send(E_ERROR, 'Lexer: Missing end quote');
-                    }
-                    $value = substr($quoted_value, 1);
-                } else {
-                    $value = $quoted_value;
-                }
-            }
-            if ($value === false) {
-                $value = '';
-            }
-            return array($key => $this->parseAttr($value, $config));
-        }
-
-        // setup loop environment
-        $array = array(); // return assoc array of attributes
-        $cursor = 0; // current position in string (moves forward)
-        $size = strlen($string); // size of the string (stays the same)
-
-        // if we have unquoted attributes, the parser expects a terminating
-        // space, so let's guarantee that there's always a terminating space.
-        $string .= ' ';
-
-        $old_cursor = -1;
-        while ($cursor < $size) {
-            if ($old_cursor >= $cursor) {
-                throw new Exception("Infinite loop detected");
-            }
-            $old_cursor = $cursor;
-
-            $cursor += ($value = strspn($string, $this->_whitespace, $cursor));
-            // grab the key
-
-            $key_begin = $cursor; //we're currently at the start of the key
-
-            // scroll past all characters that are the key (not whitespace or =)
-            $cursor += strcspn($string, $this->_whitespace . '=', $cursor);
-
-            $key_end = $cursor; // now at the end of the key
-
-            $key = substr($string, $key_begin, $key_end - $key_begin);
-
-            if (!$key) {
-                if ($e) {
-                    $e->send(E_ERROR, 'Lexer: Missing attribute key');
-                }
-                $cursor += 1 + strcspn($string, $this->_whitespace, $cursor + 1); // prevent infinite loop
-                continue; // empty key
-            }
-
-            // scroll past all whitespace
-            $cursor += strspn($string, $this->_whitespace, $cursor);
-
-            if ($cursor >= $size) {
-                $array[$key] = $key;
-                break;
-            }
-
-            // if the next character is an equal sign, we've got a regular
-            // pair, otherwise, it's a bool attribute
-            $first_char = @$string[$cursor];
-
-            if ($first_char == '=') {
-                // key="value"
-
-                $cursor++;
-                $cursor += strspn($string, $this->_whitespace, $cursor);
-
-                if ($cursor === false) {
-                    $array[$key] = '';
-                    break;
-                }
-
-                // we might be in front of a quote right now
-
-                $char = @$string[$cursor];
-
-                if ($char == '"' || $char == "'") {
-                    // it's quoted, end bound is $char
-                    $cursor++;
-                    $value_begin = $cursor;
-                    $cursor = strpos($string, $char, $cursor);
-                    $value_end = $cursor;
-                } else {
-                    // it's not quoted, end bound is whitespace
-                    $value_begin = $cursor;
-                    $cursor += strcspn($string, $this->_whitespace, $cursor);
-                    $value_end = $cursor;
-                }
-
-                // we reached a premature end
-                if ($cursor === false) {
-                    $cursor = $size;
-                    $value_end = $cursor;
-                }
-
-                $value = substr($string, $value_begin, $value_end - $value_begin);
-                if ($value === false) {
-                    $value = '';
-                }
-                $array[$key] = $this->parseAttr($value, $config);
-                $cursor++;
-            } else {
-                // boolattr
-                if ($key !== '') {
-                    $array[$key] = $key;
-                } else {
-                    // purely theoretical
-                    if ($e) {
-                        $e->send(E_ERROR, 'Lexer: Missing attribute key');
-                    }
-                }
-            }
-        }
-        return $array;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/PH5P.php b/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/PH5P.php
deleted file mode 100644
index 6b281a542..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Lexer/PH5P.php
+++ /dev/null
@@ -1,4788 +0,0 @@
-<?php
-
-/**
- * Experimental HTML5-based parser using Jeroen van der Meer's PH5P library.
- * Occupies space in the HTML5 pseudo-namespace, which may cause conflicts.
- *
- * @note
- *    Recent changes to PHP's DOM extension have resulted in some fatal
- *    error conditions with the original version of PH5P. Pending changes,
- *    this lexer will punt to DirectLex if DOM throws an exception.
- */
-
-class HTMLPurifier_Lexer_PH5P extends HTMLPurifier_Lexer_DOMLex
-{
-    /**
-     * @param string $html
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[]
-     */
-    public function tokenizeHTML($html, $config, $context)
-    {
-        $new_html = $this->normalize($html, $config, $context);
-        $new_html = $this->wrapHTML($new_html, $config, $context, false /* no div */);
-        try {
-            $parser = new HTML5($new_html);
-            $doc = $parser->save();
-        } catch (DOMException $e) {
-            // Uh oh, it failed. Punt to DirectLex.
-            $lexer = new HTMLPurifier_Lexer_DirectLex();
-            $context->register('PH5PError', $e); // save the error, so we can detect it
-            return $lexer->tokenizeHTML($html, $config, $context); // use original HTML
-        }
-        $tokens = array();
-        $this->tokenizeDOM(
-            $doc->getElementsByTagName('html')->item(0)-> // <html>
-                  getElementsByTagName('body')->item(0) //   <body>
-            ,
-            $tokens, $config
-        );
-        return $tokens;
-    }
-}
-
-/*
-
-Copyright 2007 Jeroen van der Meer <http://jero.net/>
-
-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.
-
-*/
-
-class HTML5
-{
-    private $data;
-    private $char;
-    private $EOF;
-    private $state;
-    private $tree;
-    private $token;
-    private $content_model;
-    private $escape = false;
-    private $entities = array(
-        'AElig;',
-        'AElig',
-        'AMP;',
-        'AMP',
-        'Aacute;',
-        'Aacute',
-        'Acirc;',
-        'Acirc',
-        'Agrave;',
-        'Agrave',
-        'Alpha;',
-        'Aring;',
-        'Aring',
-        'Atilde;',
-        'Atilde',
-        'Auml;',
-        'Auml',
-        'Beta;',
-        'COPY;',
-        'COPY',
-        'Ccedil;',
-        'Ccedil',
-        'Chi;',
-        'Dagger;',
-        'Delta;',
-        'ETH;',
-        'ETH',
-        'Eacute;',
-        'Eacute',
-        'Ecirc;',
-        'Ecirc',
-        'Egrave;',
-        'Egrave',
-        'Epsilon;',
-        'Eta;',
-        'Euml;',
-        'Euml',
-        'GT;',
-        'GT',
-        'Gamma;',
-        'Iacute;',
-        'Iacute',
-        'Icirc;',
-        'Icirc',
-        'Igrave;',
-        'Igrave',
-        'Iota;',
-        'Iuml;',
-        'Iuml',
-        'Kappa;',
-        'LT;',
-        'LT',
-        'Lambda;',
-        'Mu;',
-        'Ntilde;',
-        'Ntilde',
-        'Nu;',
-        'OElig;',
-        'Oacute;',
-        'Oacute',
-        'Ocirc;',
-        'Ocirc',
-        'Ograve;',
-        'Ograve',
-        'Omega;',
-        'Omicron;',
-        'Oslash;',
-        'Oslash',
-        'Otilde;',
-        'Otilde',
-        'Ouml;',
-        'Ouml',
-        'Phi;',
-        'Pi;',
-        'Prime;',
-        'Psi;',
-        'QUOT;',
-        'QUOT',
-        'REG;',
-        'REG',
-        'Rho;',
-        'Scaron;',
-        'Sigma;',
-        'THORN;',
-        'THORN',
-        'TRADE;',
-        'Tau;',
-        'Theta;',
-        'Uacute;',
-        'Uacute',
-        'Ucirc;',
-        'Ucirc',
-        'Ugrave;',
-        'Ugrave',
-        'Upsilon;',
-        'Uuml;',
-        'Uuml',
-        'Xi;',
-        'Yacute;',
-        'Yacute',
-        'Yuml;',
-        'Zeta;',
-        'aacute;',
-        'aacute',
-        'acirc;',
-        'acirc',
-        'acute;',
-        'acute',
-        'aelig;',
-        'aelig',
-        'agrave;',
-        'agrave',
-        'alefsym;',
-        'alpha;',
-        'amp;',
-        'amp',
-        'and;',
-        'ang;',
-        'apos;',
-        'aring;',
-        'aring',
-        'asymp;',
-        'atilde;',
-        'atilde',
-        'auml;',
-        'auml',
-        'bdquo;',
-        'beta;',
-        'brvbar;',
-        'brvbar',
-        'bull;',
-        'cap;',
-        'ccedil;',
-        'ccedil',
-        'cedil;',
-        'cedil',
-        'cent;',
-        'cent',
-        'chi;',
-        'circ;',
-        'clubs;',
-        'cong;',
-        'copy;',
-        'copy',
-        'crarr;',
-        'cup;',
-        'curren;',
-        'curren',
-        'dArr;',
-        'dagger;',
-        'darr;',
-        'deg;',
-        'deg',
-        'delta;',
-        'diams;',
-        'divide;',
-        'divide',
-        'eacute;',
-        'eacute',
-        'ecirc;',
-        'ecirc',
-        'egrave;',
-        'egrave',
-        'empty;',
-        'emsp;',
-        'ensp;',
-        'epsilon;',
-        'equiv;',
-        'eta;',
-        'eth;',
-        'eth',
-        'euml;',
-        'euml',
-        'euro;',
-        'exist;',
-        'fnof;',
-        'forall;',
-        'frac12;',
-        'frac12',
-        'frac14;',
-        'frac14',
-        'frac34;',
-        'frac34',
-        'frasl;',
-        'gamma;',
-        'ge;',
-        'gt;',
-        'gt',
-        'hArr;',
-        'harr;',
-        'hearts;',
-        'hellip;',
-        'iacute;',
-        'iacute',
-        'icirc;',
-        'icirc',
-        'iexcl;',
-        'iexcl',
-        'igrave;',
-        'igrave',
-        'image;',
-        'infin;',
-        'int;',
-        'iota;',
-        'iquest;',
-        'iquest',
-        'isin;',
-        'iuml;',
-        'iuml',
-        'kappa;',
-        'lArr;',
-        'lambda;',
-        'lang;',
-        'laquo;',
-        'laquo',
-        'larr;',
-        'lceil;',
-        'ldquo;',
-        'le;',
-        'lfloor;',
-        'lowast;',
-        'loz;',
-        'lrm;',
-        'lsaquo;',
-        'lsquo;',
-        'lt;',
-        'lt',
-        'macr;',
-        'macr',
-        'mdash;',
-        'micro;',
-        'micro',
-        'middot;',
-        'middot',
-        'minus;',
-        'mu;',
-        'nabla;',
-        'nbsp;',
-        'nbsp',
-        'ndash;',
-        'ne;',
-        'ni;',
-        'not;',
-        'not',
-        'notin;',
-        'nsub;',
-        'ntilde;',
-        'ntilde',
-        'nu;',
-        'oacute;',
-        'oacute',
-        'ocirc;',
-        'ocirc',
-        'oelig;',
-        'ograve;',
-        'ograve',
-        'oline;',
-        'omega;',
-        'omicron;',
-        'oplus;',
-        'or;',
-        'ordf;',
-        'ordf',
-        'ordm;',
-        'ordm',
-        'oslash;',
-        'oslash',
-        'otilde;',
-        'otilde',
-        'otimes;',
-        'ouml;',
-        'ouml',
-        'para;',
-        'para',
-        'part;',
-        'permil;',
-        'perp;',
-        'phi;',
-        'pi;',
-        'piv;',
-        'plusmn;',
-        'plusmn',
-        'pound;',
-        'pound',
-        'prime;',
-        'prod;',
-        'prop;',
-        'psi;',
-        'quot;',
-        'quot',
-        'rArr;',
-        'radic;',
-        'rang;',
-        'raquo;',
-        'raquo',
-        'rarr;',
-        'rceil;',
-        'rdquo;',
-        'real;',
-        'reg;',
-        'reg',
-        'rfloor;',
-        'rho;',
-        'rlm;',
-        'rsaquo;',
-        'rsquo;',
-        'sbquo;',
-        'scaron;',
-        'sdot;',
-        'sect;',
-        'sect',
-        'shy;',
-        'shy',
-        'sigma;',
-        'sigmaf;',
-        'sim;',
-        'spades;',
-        'sub;',
-        'sube;',
-        'sum;',
-        'sup1;',
-        'sup1',
-        'sup2;',
-        'sup2',
-        'sup3;',
-        'sup3',
-        'sup;',
-        'supe;',
-        'szlig;',
-        'szlig',
-        'tau;',
-        'there4;',
-        'theta;',
-        'thetasym;',
-        'thinsp;',
-        'thorn;',
-        'thorn',
-        'tilde;',
-        'times;',
-        'times',
-        'trade;',
-        'uArr;',
-        'uacute;',
-        'uacute',
-        'uarr;',
-        'ucirc;',
-        'ucirc',
-        'ugrave;',
-        'ugrave',
-        'uml;',
-        'uml',
-        'upsih;',
-        'upsilon;',
-        'uuml;',
-        'uuml',
-        'weierp;',
-        'xi;',
-        'yacute;',
-        'yacute',
-        'yen;',
-        'yen',
-        'yuml;',
-        'yuml',
-        'zeta;',
-        'zwj;',
-        'zwnj;'
-    );
-
-    const PCDATA = 0;
-    const RCDATA = 1;
-    const CDATA = 2;
-    const PLAINTEXT = 3;
-
-    const DOCTYPE = 0;
-    const STARTTAG = 1;
-    const ENDTAG = 2;
-    const COMMENT = 3;
-    const CHARACTR = 4;
-    const EOF = 5;
-
-    public function __construct($data)
-    {
-        $this->data = $data;
-        $this->char = -1;
-        $this->EOF = strlen($data);
-        $this->tree = new HTML5TreeConstructer;
-        $this->content_model = self::PCDATA;
-
-        $this->state = 'data';
-
-        while ($this->state !== null) {
-            $this->{$this->state . 'State'}();
-        }
-    }
-
-    public function save()
-    {
-        return $this->tree->save();
-    }
-
-    private function char()
-    {
-        return ($this->char < $this->EOF)
-            ? $this->data[$this->char]
-            : false;
-    }
-
-    private function character($s, $l = 0)
-    {
-        if ($s + $l < $this->EOF) {
-            if ($l === 0) {
-                return $this->data[$s];
-            } else {
-                return substr($this->data, $s, $l);
-            }
-        }
-    }
-
-    private function characters($char_class, $start)
-    {
-        return preg_replace('#^([' . $char_class . ']+).*#s', '\\1', substr($this->data, $start));
-    }
-
-    private function dataState()
-    {
-        // Consume the next input character
-        $this->char++;
-        $char = $this->char();
-
-        if ($char === '&' && ($this->content_model === self::PCDATA || $this->content_model === self::RCDATA)) {
-            /* U+0026 AMPERSAND (&)
-            When the content model flag is set to one of the PCDATA or RCDATA
-            states: switch to the entity data state. Otherwise: treat it as per
-            the "anything else"    entry below. */
-            $this->state = 'entityData';
-
-        } elseif ($char === '-') {
-            /* If the content model flag is set to either the RCDATA state or
-            the CDATA state, and the escape flag is false, and there are at
-            least three characters before this one in the input stream, and the
-            last four characters in the input stream, including this one, are
-            U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS,
-            and U+002D HYPHEN-MINUS ("<!--"), then set the escape flag to true. */
-            if (($this->content_model === self::RCDATA || $this->content_model ===
-                    self::CDATA) && $this->escape === false &&
-                $this->char >= 3 && $this->character($this->char - 4, 4) === '<!--'
-            ) {
-                $this->escape = true;
-            }
-
-            /* In any case, emit the input character as a character token. Stay
-            in the data state. */
-            $this->emitToken(
-                array(
-                    'type' => self::CHARACTR,
-                    'data' => $char
-                )
-            );
-
-            /* U+003C LESS-THAN SIGN (<) */
-        } elseif ($char === '<' && ($this->content_model === self::PCDATA ||
-                (($this->content_model === self::RCDATA ||
-                        $this->content_model === self::CDATA) && $this->escape === false))
-        ) {
-            /* When the content model flag is set to the PCDATA state: switch
-            to the tag open state.
-
-            When the content model flag is set to either the RCDATA state or
-            the CDATA state and the escape flag is false: switch to the tag
-            open state.
-
-            Otherwise: treat it as per the "anything else" entry below. */
-            $this->state = 'tagOpen';
-
-            /* U+003E GREATER-THAN SIGN (>) */
-        } elseif ($char === '>') {
-            /* If the content model flag is set to either the RCDATA state or
-            the CDATA state, and the escape flag is true, and the last three
-            characters in the input stream including this one are U+002D
-            HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN ("-->"),
-            set the escape flag to false. */
-            if (($this->content_model === self::RCDATA ||
-                    $this->content_model === self::CDATA) && $this->escape === true &&
-                $this->character($this->char, 3) === '-->'
-            ) {
-                $this->escape = false;
-            }
-
-            /* In any case, emit the input character as a character token.
-            Stay in the data state. */
-            $this->emitToken(
-                array(
-                    'type' => self::CHARACTR,
-                    'data' => $char
-                )
-            );
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Emit an end-of-file token. */
-            $this->EOF();
-
-        } elseif ($this->content_model === self::PLAINTEXT) {
-            /* When the content model flag is set to the PLAINTEXT state
-            THIS DIFFERS GREATLY FROM THE SPEC: Get the remaining characters of
-            the text and emit it as a character token. */
-            $this->emitToken(
-                array(
-                    'type' => self::CHARACTR,
-                    'data' => substr($this->data, $this->char)
-                )
-            );
-
-            $this->EOF();
-
-        } else {
-            /* Anything else
-            THIS DIFFERS GREATLY FROM THE SPEC: Get as many character that
-            otherwise would also be treated as a character token and emit it
-            as a single character token. Stay in the data state. */
-            $len = strcspn($this->data, '<&', $this->char);
-            $char = substr($this->data, $this->char, $len);
-            $this->char += $len - 1;
-
-            $this->emitToken(
-                array(
-                    'type' => self::CHARACTR,
-                    'data' => $char
-                )
-            );
-
-            $this->state = 'data';
-        }
-    }
-
-    private function entityDataState()
-    {
-        // Attempt to consume an entity.
-        $entity = $this->entity();
-
-        // If nothing is returned, emit a U+0026 AMPERSAND character token.
-        // Otherwise, emit the character token that was returned.
-        $char = (!$entity) ? '&' : $entity;
-        $this->emitToken(
-            array(
-                'type' => self::CHARACTR,
-                'data' => $char
-            )
-        );
-
-        // Finally, switch to the data state.
-        $this->state = 'data';
-    }
-
-    private function tagOpenState()
-    {
-        switch ($this->content_model) {
-            case self::RCDATA:
-            case self::CDATA:
-                /* If the next input character is a U+002F SOLIDUS (/) character,
-                consume it and switch to the close tag open state. If the next
-                input character is not a U+002F SOLIDUS (/) character, emit a
-                U+003C LESS-THAN SIGN character token and switch to the data
-                state to process the next input character. */
-                if ($this->character($this->char + 1) === '/') {
-                    $this->char++;
-                    $this->state = 'closeTagOpen';
-
-                } else {
-                    $this->emitToken(
-                        array(
-                            'type' => self::CHARACTR,
-                            'data' => '<'
-                        )
-                    );
-
-                    $this->state = 'data';
-                }
-                break;
-
-            case self::PCDATA:
-                // If the content model flag is set to the PCDATA state
-                // Consume the next input character:
-                $this->char++;
-                $char = $this->char();
-
-                if ($char === '!') {
-                    /* U+0021 EXCLAMATION MARK (!)
-                    Switch to the markup declaration open state. */
-                    $this->state = 'markupDeclarationOpen';
-
-                } elseif ($char === '/') {
-                    /* U+002F SOLIDUS (/)
-                    Switch to the close tag open state. */
-                    $this->state = 'closeTagOpen';
-
-                } elseif (preg_match('/^[A-Za-z]$/', $char)) {
-                    /* U+0041 LATIN LETTER A through to U+005A LATIN LETTER Z
-                    Create a new start tag token, set its tag name to the lowercase
-                    version of the input character (add 0x0020 to the character's code
-                    point), then switch to the tag name state. (Don't emit the token
-                    yet; further details will be filled in before it is emitted.) */
-                    $this->token = array(
-                        'name' => strtolower($char),
-                        'type' => self::STARTTAG,
-                        'attr' => array()
-                    );
-
-                    $this->state = 'tagName';
-
-                } elseif ($char === '>') {
-                    /* U+003E GREATER-THAN SIGN (>)
-                    Parse error. Emit a U+003C LESS-THAN SIGN character token and a
-                    U+003E GREATER-THAN SIGN character token. Switch to the data state. */
-                    $this->emitToken(
-                        array(
-                            'type' => self::CHARACTR,
-                            'data' => '<>'
-                        )
-                    );
-
-                    $this->state = 'data';
-
-                } elseif ($char === '?') {
-                    /* U+003F QUESTION MARK (?)
-                    Parse error. Switch to the bogus comment state. */
-                    $this->state = 'bogusComment';
-
-                } else {
-                    /* Anything else
-                    Parse error. Emit a U+003C LESS-THAN SIGN character token and
-                    reconsume the current input character in the data state. */
-                    $this->emitToken(
-                        array(
-                            'type' => self::CHARACTR,
-                            'data' => '<'
-                        )
-                    );
-
-                    $this->char--;
-                    $this->state = 'data';
-                }
-                break;
-        }
-    }
-
-    private function closeTagOpenState()
-    {
-        $next_node = strtolower($this->characters('A-Za-z', $this->char + 1));
-        $the_same = count($this->tree->stack) > 0 && $next_node === end($this->tree->stack)->nodeName;
-
-        if (($this->content_model === self::RCDATA || $this->content_model === self::CDATA) &&
-            (!$the_same || ($the_same && (!preg_match(
-                            '/[\t\n\x0b\x0c >\/]/',
-                            $this->character($this->char + 1 + strlen($next_node))
-                        ) || $this->EOF === $this->char)))
-        ) {
-            /* If the content model flag is set to the RCDATA or CDATA states then
-            examine the next few characters. If they do not match the tag name of
-            the last start tag token emitted (case insensitively), or if they do but
-            they are not immediately followed by one of the following characters:
-                * U+0009 CHARACTER TABULATION
-                * U+000A LINE FEED (LF)
-                * U+000B LINE TABULATION
-                * U+000C FORM FEED (FF)
-                * U+0020 SPACE
-                * U+003E GREATER-THAN SIGN (>)
-                * U+002F SOLIDUS (/)
-                * EOF
-            ...then there is a parse error. Emit a U+003C LESS-THAN SIGN character
-            token, a U+002F SOLIDUS character token, and switch to the data state
-            to process the next input character. */
-            $this->emitToken(
-                array(
-                    'type' => self::CHARACTR,
-                    'data' => '</'
-                )
-            );
-
-            $this->state = 'data';
-
-        } else {
-            /* Otherwise, if the content model flag is set to the PCDATA state,
-            or if the next few characters do match that tag name, consume the
-            next input character: */
-            $this->char++;
-            $char = $this->char();
-
-            if (preg_match('/^[A-Za-z]$/', $char)) {
-                /* U+0041 LATIN LETTER A through to U+005A LATIN LETTER Z
-                Create a new end tag token, set its tag name to the lowercase version
-                of the input character (add 0x0020 to the character's code point), then
-                switch to the tag name state. (Don't emit the token yet; further details
-                will be filled in before it is emitted.) */
-                $this->token = array(
-                    'name' => strtolower($char),
-                    'type' => self::ENDTAG
-                );
-
-                $this->state = 'tagName';
-
-            } elseif ($char === '>') {
-                /* U+003E GREATER-THAN SIGN (>)
-                Parse error. Switch to the data state. */
-                $this->state = 'data';
-
-            } elseif ($this->char === $this->EOF) {
-                /* EOF
-                Parse error. Emit a U+003C LESS-THAN SIGN character token and a U+002F
-                SOLIDUS character token. Reconsume the EOF character in the data state. */
-                $this->emitToken(
-                    array(
-                        'type' => self::CHARACTR,
-                        'data' => '</'
-                    )
-                );
-
-                $this->char--;
-                $this->state = 'data';
-
-            } else {
-                /* Parse error. Switch to the bogus comment state. */
-                $this->state = 'bogusComment';
-            }
-        }
-    }
-
-    private function tagNameState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            /* U+0009 CHARACTER TABULATION
-            U+000A LINE FEED (LF)
-            U+000B LINE TABULATION
-            U+000C FORM FEED (FF)
-            U+0020 SPACE
-            Switch to the before attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($char === '>') {
-            /* U+003E GREATER-THAN SIGN (>)
-            Emit the current tag token. Switch to the data state. */
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Parse error. Emit the current tag token. Reconsume the EOF
-            character in the data state. */
-            $this->emitToken($this->token);
-
-            $this->char--;
-            $this->state = 'data';
-
-        } elseif ($char === '/') {
-            /* U+002F SOLIDUS (/)
-            Parse error unless this is a permitted slash. Switch to the before
-            attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } else {
-            /* Anything else
-            Append the current input character to the current tag token's tag name.
-            Stay in the tag name state. */
-            $this->token['name'] .= strtolower($char);
-            $this->state = 'tagName';
-        }
-    }
-
-    private function beforeAttributeNameState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            /* U+0009 CHARACTER TABULATION
-            U+000A LINE FEED (LF)
-            U+000B LINE TABULATION
-            U+000C FORM FEED (FF)
-            U+0020 SPACE
-            Stay in the before attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($char === '>') {
-            /* U+003E GREATER-THAN SIGN (>)
-            Emit the current tag token. Switch to the data state. */
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($char === '/') {
-            /* U+002F SOLIDUS (/)
-            Parse error unless this is a permitted slash. Stay in the before
-            attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Parse error. Emit the current tag token. Reconsume the EOF
-            character in the data state. */
-            $this->emitToken($this->token);
-
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Start a new attribute in the current tag token. Set that attribute's
-            name to the current input character, and its value to the empty string.
-            Switch to the attribute name state. */
-            $this->token['attr'][] = array(
-                'name' => strtolower($char),
-                'value' => null
-            );
-
-            $this->state = 'attributeName';
-        }
-    }
-
-    private function attributeNameState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            /* U+0009 CHARACTER TABULATION
-            U+000A LINE FEED (LF)
-            U+000B LINE TABULATION
-            U+000C FORM FEED (FF)
-            U+0020 SPACE
-            Stay in the before attribute name state. */
-            $this->state = 'afterAttributeName';
-
-        } elseif ($char === '=') {
-            /* U+003D EQUALS SIGN (=)
-            Switch to the before attribute value state. */
-            $this->state = 'beforeAttributeValue';
-
-        } elseif ($char === '>') {
-            /* U+003E GREATER-THAN SIGN (>)
-            Emit the current tag token. Switch to the data state. */
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($char === '/' && $this->character($this->char + 1) !== '>') {
-            /* U+002F SOLIDUS (/)
-            Parse error unless this is a permitted slash. Switch to the before
-            attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Parse error. Emit the current tag token. Reconsume the EOF
-            character in the data state. */
-            $this->emitToken($this->token);
-
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Append the current input character to the current attribute's name.
-            Stay in the attribute name state. */
-            $last = count($this->token['attr']) - 1;
-            $this->token['attr'][$last]['name'] .= strtolower($char);
-
-            $this->state = 'attributeName';
-        }
-    }
-
-    private function afterAttributeNameState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            /* U+0009 CHARACTER TABULATION
-            U+000A LINE FEED (LF)
-            U+000B LINE TABULATION
-            U+000C FORM FEED (FF)
-            U+0020 SPACE
-            Stay in the after attribute name state. */
-            $this->state = 'afterAttributeName';
-
-        } elseif ($char === '=') {
-            /* U+003D EQUALS SIGN (=)
-            Switch to the before attribute value state. */
-            $this->state = 'beforeAttributeValue';
-
-        } elseif ($char === '>') {
-            /* U+003E GREATER-THAN SIGN (>)
-            Emit the current tag token. Switch to the data state. */
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($char === '/' && $this->character($this->char + 1) !== '>') {
-            /* U+002F SOLIDUS (/)
-            Parse error unless this is a permitted slash. Switch to the
-            before attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Parse error. Emit the current tag token. Reconsume the EOF
-            character in the data state. */
-            $this->emitToken($this->token);
-
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Start a new attribute in the current tag token. Set that attribute's
-            name to the current input character, and its value to the empty string.
-            Switch to the attribute name state. */
-            $this->token['attr'][] = array(
-                'name' => strtolower($char),
-                'value' => null
-            );
-
-            $this->state = 'attributeName';
-        }
-    }
-
-    private function beforeAttributeValueState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            /* U+0009 CHARACTER TABULATION
-            U+000A LINE FEED (LF)
-            U+000B LINE TABULATION
-            U+000C FORM FEED (FF)
-            U+0020 SPACE
-            Stay in the before attribute value state. */
-            $this->state = 'beforeAttributeValue';
-
-        } elseif ($char === '"') {
-            /* U+0022 QUOTATION MARK (")
-            Switch to the attribute value (double-quoted) state. */
-            $this->state = 'attributeValueDoubleQuoted';
-
-        } elseif ($char === '&') {
-            /* U+0026 AMPERSAND (&)
-            Switch to the attribute value (unquoted) state and reconsume
-            this input character. */
-            $this->char--;
-            $this->state = 'attributeValueUnquoted';
-
-        } elseif ($char === '\'') {
-            /* U+0027 APOSTROPHE (')
-            Switch to the attribute value (single-quoted) state. */
-            $this->state = 'attributeValueSingleQuoted';
-
-        } elseif ($char === '>') {
-            /* U+003E GREATER-THAN SIGN (>)
-            Emit the current tag token. Switch to the data state. */
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Append the current input character to the current attribute's value.
-            Switch to the attribute value (unquoted) state. */
-            $last = count($this->token['attr']) - 1;
-            $this->token['attr'][$last]['value'] .= $char;
-
-            $this->state = 'attributeValueUnquoted';
-        }
-    }
-
-    private function attributeValueDoubleQuotedState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if ($char === '"') {
-            /* U+0022 QUOTATION MARK (")
-            Switch to the before attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($char === '&') {
-            /* U+0026 AMPERSAND (&)
-            Switch to the entity in attribute value state. */
-            $this->entityInAttributeValueState('double');
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Parse error. Emit the current tag token. Reconsume the character
-            in the data state. */
-            $this->emitToken($this->token);
-
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Append the current input character to the current attribute's value.
-            Stay in the attribute value (double-quoted) state. */
-            $last = count($this->token['attr']) - 1;
-            $this->token['attr'][$last]['value'] .= $char;
-
-            $this->state = 'attributeValueDoubleQuoted';
-        }
-    }
-
-    private function attributeValueSingleQuotedState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if ($char === '\'') {
-            /* U+0022 QUOTATION MARK (')
-            Switch to the before attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($char === '&') {
-            /* U+0026 AMPERSAND (&)
-            Switch to the entity in attribute value state. */
-            $this->entityInAttributeValueState('single');
-
-        } elseif ($this->char === $this->EOF) {
-            /* EOF
-            Parse error. Emit the current tag token. Reconsume the character
-            in the data state. */
-            $this->emitToken($this->token);
-
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Append the current input character to the current attribute's value.
-            Stay in the attribute value (single-quoted) state. */
-            $last = count($this->token['attr']) - 1;
-            $this->token['attr'][$last]['value'] .= $char;
-
-            $this->state = 'attributeValueSingleQuoted';
-        }
-    }
-
-    private function attributeValueUnquotedState()
-    {
-        // Consume the next input character:
-        $this->char++;
-        $char = $this->character($this->char);
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            /* U+0009 CHARACTER TABULATION
-            U+000A LINE FEED (LF)
-            U+000B LINE TABULATION
-            U+000C FORM FEED (FF)
-            U+0020 SPACE
-            Switch to the before attribute name state. */
-            $this->state = 'beforeAttributeName';
-
-        } elseif ($char === '&') {
-            /* U+0026 AMPERSAND (&)
-            Switch to the entity in attribute value state. */
-            $this->entityInAttributeValueState();
-
-        } elseif ($char === '>') {
-            /* U+003E GREATER-THAN SIGN (>)
-            Emit the current tag token. Switch to the data state. */
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } else {
-            /* Anything else
-            Append the current input character to the current attribute's value.
-            Stay in the attribute value (unquoted) state. */
-            $last = count($this->token['attr']) - 1;
-            $this->token['attr'][$last]['value'] .= $char;
-
-            $this->state = 'attributeValueUnquoted';
-        }
-    }
-
-    private function entityInAttributeValueState()
-    {
-        // Attempt to consume an entity.
-        $entity = $this->entity();
-
-        // If nothing is returned, append a U+0026 AMPERSAND character to the
-        // current attribute's value. Otherwise, emit the character token that
-        // was returned.
-        $char = (!$entity)
-            ? '&'
-            : $entity;
-
-        $last = count($this->token['attr']) - 1;
-        $this->token['attr'][$last]['value'] .= $char;
-    }
-
-    private function bogusCommentState()
-    {
-        /* Consume every character up to the first U+003E GREATER-THAN SIGN
-        character (>) or the end of the file (EOF), whichever comes first. Emit
-        a comment token whose data is the concatenation of all the characters
-        starting from and including the character that caused the state machine
-        to switch into the bogus comment state, up to and including the last
-        consumed character before the U+003E character, if any, or up to the
-        end of the file otherwise. (If the comment was started by the end of
-        the file (EOF), the token is empty.) */
-        $data = $this->characters('^>', $this->char);
-        $this->emitToken(
-            array(
-                'data' => $data,
-                'type' => self::COMMENT
-            )
-        );
-
-        $this->char += strlen($data);
-
-        /* Switch to the data state. */
-        $this->state = 'data';
-
-        /* If the end of the file was reached, reconsume the EOF character. */
-        if ($this->char === $this->EOF) {
-            $this->char = $this->EOF - 1;
-        }
-    }
-
-    private function markupDeclarationOpenState()
-    {
-        /* If the next two characters are both U+002D HYPHEN-MINUS (-)
-        characters, consume those two characters, create a comment token whose
-        data is the empty string, and switch to the comment state. */
-        if ($this->character($this->char + 1, 2) === '--') {
-            $this->char += 2;
-            $this->state = 'comment';
-            $this->token = array(
-                'data' => null,
-                'type' => self::COMMENT
-            );
-
-            /* Otherwise if the next seven chacacters are a case-insensitive match
-            for the word "DOCTYPE", then consume those characters and switch to the
-            DOCTYPE state. */
-        } elseif (strtolower($this->character($this->char + 1, 7)) === 'doctype') {
-            $this->char += 7;
-            $this->state = 'doctype';
-
-            /* Otherwise, is is a parse error. Switch to the bogus comment state.
-            The next character that is consumed, if any, is the first character
-            that will be in the comment. */
-        } else {
-            $this->char++;
-            $this->state = 'bogusComment';
-        }
-    }
-
-    private function commentState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        /* U+002D HYPHEN-MINUS (-) */
-        if ($char === '-') {
-            /* Switch to the comment dash state  */
-            $this->state = 'commentDash';
-
-            /* EOF */
-        } elseif ($this->char === $this->EOF) {
-            /* Parse error. Emit the comment token. Reconsume the EOF character
-            in the data state. */
-            $this->emitToken($this->token);
-            $this->char--;
-            $this->state = 'data';
-
-            /* Anything else */
-        } else {
-            /* Append the input character to the comment token's data. Stay in
-            the comment state. */
-            $this->token['data'] .= $char;
-        }
-    }
-
-    private function commentDashState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        /* U+002D HYPHEN-MINUS (-) */
-        if ($char === '-') {
-            /* Switch to the comment end state  */
-            $this->state = 'commentEnd';
-
-            /* EOF */
-        } elseif ($this->char === $this->EOF) {
-            /* Parse error. Emit the comment token. Reconsume the EOF character
-            in the data state. */
-            $this->emitToken($this->token);
-            $this->char--;
-            $this->state = 'data';
-
-            /* Anything else */
-        } else {
-            /* Append a U+002D HYPHEN-MINUS (-) character and the input
-            character to the comment token's data. Switch to the comment state. */
-            $this->token['data'] .= '-' . $char;
-            $this->state = 'comment';
-        }
-    }
-
-    private function commentEndState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        if ($char === '>') {
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($char === '-') {
-            $this->token['data'] .= '-';
-
-        } elseif ($this->char === $this->EOF) {
-            $this->emitToken($this->token);
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            $this->token['data'] .= '--' . $char;
-            $this->state = 'comment';
-        }
-    }
-
-    private function doctypeState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            $this->state = 'beforeDoctypeName';
-
-        } else {
-            $this->char--;
-            $this->state = 'beforeDoctypeName';
-        }
-    }
-
-    private function beforeDoctypeNameState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            // Stay in the before DOCTYPE name state.
-
-        } elseif (preg_match('/^[a-z]$/', $char)) {
-            $this->token = array(
-                'name' => strtoupper($char),
-                'type' => self::DOCTYPE,
-                'error' => true
-            );
-
-            $this->state = 'doctypeName';
-
-        } elseif ($char === '>') {
-            $this->emitToken(
-                array(
-                    'name' => null,
-                    'type' => self::DOCTYPE,
-                    'error' => true
-                )
-            );
-
-            $this->state = 'data';
-
-        } elseif ($this->char === $this->EOF) {
-            $this->emitToken(
-                array(
-                    'name' => null,
-                    'type' => self::DOCTYPE,
-                    'error' => true
-                )
-            );
-
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            $this->token = array(
-                'name' => $char,
-                'type' => self::DOCTYPE,
-                'error' => true
-            );
-
-            $this->state = 'doctypeName';
-        }
-    }
-
-    private function doctypeNameState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            $this->state = 'AfterDoctypeName';
-
-        } elseif ($char === '>') {
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif (preg_match('/^[a-z]$/', $char)) {
-            $this->token['name'] .= strtoupper($char);
-
-        } elseif ($this->char === $this->EOF) {
-            $this->emitToken($this->token);
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            $this->token['name'] .= $char;
-        }
-
-        $this->token['error'] = ($this->token['name'] === 'HTML')
-            ? false
-            : true;
-    }
-
-    private function afterDoctypeNameState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        if (preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
-            // Stay in the DOCTYPE name state.
-
-        } elseif ($char === '>') {
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($this->char === $this->EOF) {
-            $this->emitToken($this->token);
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            $this->token['error'] = true;
-            $this->state = 'bogusDoctype';
-        }
-    }
-
-    private function bogusDoctypeState()
-    {
-        /* Consume the next input character: */
-        $this->char++;
-        $char = $this->char();
-
-        if ($char === '>') {
-            $this->emitToken($this->token);
-            $this->state = 'data';
-
-        } elseif ($this->char === $this->EOF) {
-            $this->emitToken($this->token);
-            $this->char--;
-            $this->state = 'data';
-
-        } else {
-            // Stay in the bogus DOCTYPE state.
-        }
-    }
-
-    private function entity()
-    {
-        $start = $this->char;
-
-        // This section defines how to consume an entity. This definition is
-        // used when parsing entities in text and in attributes.
-
-        // The behaviour depends on the identity of the next character (the
-        // one immediately after the U+0026 AMPERSAND character):
-
-        switch ($this->character($this->char + 1)) {
-            // U+0023 NUMBER SIGN (#)
-            case '#':
-
-                // The behaviour further depends on the character after the
-                // U+0023 NUMBER SIGN:
-                switch ($this->character($this->char + 1)) {
-                    // U+0078 LATIN SMALL LETTER X
-                    // U+0058 LATIN CAPITAL LETTER X
-                    case 'x':
-                    case 'X':
-                        // Follow the steps below, but using the range of
-                        // characters U+0030 DIGIT ZERO through to U+0039 DIGIT
-                        // NINE, U+0061 LATIN SMALL LETTER A through to U+0066
-                        // LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL LETTER
-                        // A, through to U+0046 LATIN CAPITAL LETTER F (in other
-                        // words, 0-9, A-F, a-f).
-                        $char = 1;
-                        $char_class = '0-9A-Fa-f';
-                        break;
-
-                    // Anything else
-                    default:
-                        // Follow the steps below, but using the range of
-                        // characters U+0030 DIGIT ZERO through to U+0039 DIGIT
-                        // NINE (i.e. just 0-9).
-                        $char = 0;
-                        $char_class = '0-9';
-                        break;
-                }
-
-                // Consume as many characters as match the range of characters
-                // given above.
-                $this->char++;
-                $e_name = $this->characters($char_class, $this->char + $char + 1);
-                $entity = $this->character($start, $this->char);
-                $cond = strlen($e_name) > 0;
-
-                // The rest of the parsing happens below.
-                break;
-
-            // Anything else
-            default:
-                // Consume the maximum number of characters possible, with the
-                // consumed characters case-sensitively matching one of the
-                // identifiers in the first column of the entities table.
-
-                $e_name = $this->characters('0-9A-Za-z;', $this->char + 1);
-                $len = strlen($e_name);
-
-                for ($c = 1; $c <= $len; $c++) {
-                    $id = substr($e_name, 0, $c);
-                    $this->char++;
-
-                    if (in_array($id, $this->entities)) {
-                        if ($e_name[$c - 1] !== ';') {
-                            if ($c < $len && $e_name[$c] == ';') {
-                                $this->char++; // consume extra semicolon
-                            }
-                        }
-                        $entity = $id;
-                        break;
-                    }
-                }
-
-                $cond = isset($entity);
-                // The rest of the parsing happens below.
-                break;
-        }
-
-        if (!$cond) {
-            // If no match can be made, then this is a parse error. No
-            // characters are consumed, and nothing is returned.
-            $this->char = $start;
-            return false;
-        }
-
-        // Return a character token for the character corresponding to the
-        // entity name (as given by the second column of the entities table).
-        return html_entity_decode('&' . rtrim($entity, ';') . ';', ENT_QUOTES, 'UTF-8');
-    }
-
-    private function emitToken($token)
-    {
-        $emit = $this->tree->emitToken($token);
-
-        if (is_int($emit)) {
-            $this->content_model = $emit;
-
-        } elseif ($token['type'] === self::ENDTAG) {
-            $this->content_model = self::PCDATA;
-        }
-    }
-
-    private function EOF()
-    {
-        $this->state = null;
-        $this->tree->emitToken(
-            array(
-                'type' => self::EOF
-            )
-        );
-    }
-}
-
-class HTML5TreeConstructer
-{
-    public $stack = array();
-
-    private $phase;
-    private $mode;
-    private $dom;
-    private $foster_parent = null;
-    private $a_formatting = array();
-
-    private $head_pointer = null;
-    private $form_pointer = null;
-
-    private $scoping = array('button', 'caption', 'html', 'marquee', 'object', 'table', 'td', 'th');
-    private $formatting = array(
-        'a',
-        'b',
-        'big',
-        'em',
-        'font',
-        'i',
-        'nobr',
-        's',
-        'small',
-        'strike',
-        'strong',
-        'tt',
-        'u'
-    );
-    private $special = array(
-        'address',
-        'area',
-        'base',
-        'basefont',
-        'bgsound',
-        'blockquote',
-        'body',
-        'br',
-        'center',
-        'col',
-        'colgroup',
-        'dd',
-        'dir',
-        'div',
-        'dl',
-        'dt',
-        'embed',
-        'fieldset',
-        'form',
-        'frame',
-        'frameset',
-        'h1',
-        'h2',
-        'h3',
-        'h4',
-        'h5',
-        'h6',
-        'head',
-        'hr',
-        'iframe',
-        'image',
-        'img',
-        'input',
-        'isindex',
-        'li',
-        'link',
-        'listing',
-        'menu',
-        'meta',
-        'noembed',
-        'noframes',
-        'noscript',
-        'ol',
-        'optgroup',
-        'option',
-        'p',
-        'param',
-        'plaintext',
-        'pre',
-        'script',
-        'select',
-        'spacer',
-        'style',
-        'tbody',
-        'textarea',
-        'tfoot',
-        'thead',
-        'title',
-        'tr',
-        'ul',
-        'wbr'
-    );
-
-    // The different phases.
-    const INIT_PHASE = 0;
-    const ROOT_PHASE = 1;
-    const MAIN_PHASE = 2;
-    const END_PHASE = 3;
-
-    // The different insertion modes for the main phase.
-    const BEFOR_HEAD = 0;
-    const IN_HEAD = 1;
-    const AFTER_HEAD = 2;
-    const IN_BODY = 3;
-    const IN_TABLE = 4;
-    const IN_CAPTION = 5;
-    const IN_CGROUP = 6;
-    const IN_TBODY = 7;
-    const IN_ROW = 8;
-    const IN_CELL = 9;
-    const IN_SELECT = 10;
-    const AFTER_BODY = 11;
-    const IN_FRAME = 12;
-    const AFTR_FRAME = 13;
-
-    // The different types of elements.
-    const SPECIAL = 0;
-    const SCOPING = 1;
-    const FORMATTING = 2;
-    const PHRASING = 3;
-
-    const MARKER = 0;
-
-    public function __construct()
-    {
-        $this->phase = self::INIT_PHASE;
-        $this->mode = self::BEFOR_HEAD;
-        $this->dom = new DOMDocument;
-
-        $this->dom->encoding = 'UTF-8';
-        $this->dom->preserveWhiteSpace = true;
-        $this->dom->substituteEntities = true;
-        $this->dom->strictErrorChecking = false;
-    }
-
-    // Process tag tokens
-    public function emitToken($token)
-    {
-        switch ($this->phase) {
-            case self::INIT_PHASE:
-                return $this->initPhase($token);
-                break;
-            case self::ROOT_PHASE:
-                return $this->rootElementPhase($token);
-                break;
-            case self::MAIN_PHASE:
-                return $this->mainPhase($token);
-                break;
-            case self::END_PHASE :
-                return $this->trailingEndPhase($token);
-                break;
-        }
-    }
-
-    private function initPhase($token)
-    {
-        /* Initially, the tree construction stage must handle each token
-        emitted from the tokenisation stage as follows: */
-
-        /* A DOCTYPE token that is marked as being in error
-        A comment token
-        A start tag token
-        An end tag token
-        A character token that is not one of one of U+0009 CHARACTER TABULATION,
-            U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-            or U+0020 SPACE
-        An end-of-file token */
-        if ((isset($token['error']) && $token['error']) ||
-            $token['type'] === HTML5::COMMENT ||
-            $token['type'] === HTML5::STARTTAG ||
-            $token['type'] === HTML5::ENDTAG ||
-            $token['type'] === HTML5::EOF ||
-            ($token['type'] === HTML5::CHARACTR && isset($token['data']) &&
-                !preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data']))
-        ) {
-            /* This specification does not define how to handle this case. In
-            particular, user agents may ignore the entirety of this specification
-            altogether for such documents, and instead invoke special parse modes
-            with a greater emphasis on backwards compatibility. */
-
-            $this->phase = self::ROOT_PHASE;
-            return $this->rootElementPhase($token);
-
-            /* A DOCTYPE token marked as being correct */
-        } elseif (isset($token['error']) && !$token['error']) {
-            /* Append a DocumentType node to the Document  node, with the name
-            attribute set to the name given in the DOCTYPE token (which will be
-            "HTML"), and the other attributes specific to DocumentType objects
-            set to null, empty lists, or the empty string as appropriate. */
-            $doctype = new DOMDocumentType(null, null, 'HTML');
-
-            /* Then, switch to the root element phase of the tree construction
-            stage. */
-            $this->phase = self::ROOT_PHASE;
-
-            /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-            U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-            or U+0020 SPACE */
-        } elseif (isset($token['data']) && preg_match(
-                '/^[\t\n\x0b\x0c ]+$/',
-                $token['data']
-            )
-        ) {
-            /* Append that character  to the Document node. */
-            $text = $this->dom->createTextNode($token['data']);
-            $this->dom->appendChild($text);
-        }
-    }
-
-    private function rootElementPhase($token)
-    {
-        /* After the initial phase, as each token is emitted from the tokenisation
-        stage, it must be processed as described in this section. */
-
-        /* A DOCTYPE token */
-        if ($token['type'] === HTML5::DOCTYPE) {
-            // Parse error. Ignore the token.
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the Document object with the data
-            attribute set to the data given in the comment token. */
-            $comment = $this->dom->createComment($token['data']);
-            $this->dom->appendChild($comment);
-
-            /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-            U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-            or U+0020 SPACE */
-        } elseif ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append that character  to the Document node. */
-            $text = $this->dom->createTextNode($token['data']);
-            $this->dom->appendChild($text);
-
-            /* A character token that is not one of U+0009 CHARACTER TABULATION,
-                U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED
-                (FF), or U+0020 SPACE
-            A start tag token
-            An end tag token
-            An end-of-file token */
-        } elseif (($token['type'] === HTML5::CHARACTR &&
-                !preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) ||
-            $token['type'] === HTML5::STARTTAG ||
-            $token['type'] === HTML5::ENDTAG ||
-            $token['type'] === HTML5::EOF
-        ) {
-            /* Create an HTMLElement node with the tag name html, in the HTML
-            namespace. Append it to the Document object. Switch to the main
-            phase and reprocess the current token. */
-            $html = $this->dom->createElement('html');
-            $this->dom->appendChild($html);
-            $this->stack[] = $html;
-
-            $this->phase = self::MAIN_PHASE;
-            return $this->mainPhase($token);
-        }
-    }
-
-    private function mainPhase($token)
-    {
-        /* Tokens in the main phase must be handled as follows: */
-
-        /* A DOCTYPE token */
-        if ($token['type'] === HTML5::DOCTYPE) {
-            // Parse error. Ignore the token.
-
-            /* A start tag token with the tag name "html" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'html') {
-            /* If this start tag token was not the first start tag token, then
-            it is a parse error. */
-
-            /* For each attribute on the token, check to see if the attribute
-            is already present on the top element of the stack of open elements.
-            If it is not, add the attribute and its corresponding value to that
-            element. */
-            foreach ($token['attr'] as $attr) {
-                if (!$this->stack[0]->hasAttribute($attr['name'])) {
-                    $this->stack[0]->setAttribute($attr['name'], $attr['value']);
-                }
-            }
-
-            /* An end-of-file token */
-        } elseif ($token['type'] === HTML5::EOF) {
-            /* Generate implied end tags. */
-            $this->generateImpliedEndTags();
-
-            /* Anything else. */
-        } else {
-            /* Depends on the insertion mode: */
-            switch ($this->mode) {
-                case self::BEFOR_HEAD:
-                    return $this->beforeHead($token);
-                    break;
-                case self::IN_HEAD:
-                    return $this->inHead($token);
-                    break;
-                case self::AFTER_HEAD:
-                    return $this->afterHead($token);
-                    break;
-                case self::IN_BODY:
-                    return $this->inBody($token);
-                    break;
-                case self::IN_TABLE:
-                    return $this->inTable($token);
-                    break;
-                case self::IN_CAPTION:
-                    return $this->inCaption($token);
-                    break;
-                case self::IN_CGROUP:
-                    return $this->inColumnGroup($token);
-                    break;
-                case self::IN_TBODY:
-                    return $this->inTableBody($token);
-                    break;
-                case self::IN_ROW:
-                    return $this->inRow($token);
-                    break;
-                case self::IN_CELL:
-                    return $this->inCell($token);
-                    break;
-                case self::IN_SELECT:
-                    return $this->inSelect($token);
-                    break;
-                case self::AFTER_BODY:
-                    return $this->afterBody($token);
-                    break;
-                case self::IN_FRAME:
-                    return $this->inFrameset($token);
-                    break;
-                case self::AFTR_FRAME:
-                    return $this->afterFrameset($token);
-                    break;
-                case self::END_PHASE:
-                    return $this->trailingEndPhase($token);
-                    break;
-            }
-        }
-    }
-
-    private function beforeHead($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append the character to the current node. */
-            $this->insertText($token['data']);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data attribute
-            set to the data given in the comment token. */
-            $this->insertComment($token['data']);
-
-            /* A start tag token with the tag name "head" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'head') {
-            /* Create an element for the token, append the new element to the
-            current node and push it onto the stack of open elements. */
-            $element = $this->insertElement($token);
-
-            /* Set the head element pointer to this new element node. */
-            $this->head_pointer = $element;
-
-            /* Change the insertion mode to "in head". */
-            $this->mode = self::IN_HEAD;
-
-            /* A start tag token whose tag name is one of: "base", "link", "meta",
-            "script", "style", "title". Or an end tag with the tag name "html".
-            Or a character token that is not one of U+0009 CHARACTER TABULATION,
-            U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-            or U+0020 SPACE. Or any other start tag token */
-        } elseif ($token['type'] === HTML5::STARTTAG ||
-            ($token['type'] === HTML5::ENDTAG && $token['name'] === 'html') ||
-            ($token['type'] === HTML5::CHARACTR && !preg_match(
-                    '/^[\t\n\x0b\x0c ]$/',
-                    $token['data']
-                ))
-        ) {
-            /* Act as if a start tag token with the tag name "head" and no
-            attributes had been seen, then reprocess the current token. */
-            $this->beforeHead(
-                array(
-                    'name' => 'head',
-                    'type' => HTML5::STARTTAG,
-                    'attr' => array()
-                )
-            );
-
-            return $this->inHead($token);
-
-            /* Any other end tag */
-        } elseif ($token['type'] === HTML5::ENDTAG) {
-            /* Parse error. Ignore the token. */
-        }
-    }
-
-    private function inHead($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        or U+0020 SPACE.
-
-        THIS DIFFERS FROM THE SPEC: If the current node is either a title, style
-        or script element, append the character to the current node regardless
-        of its content. */
-        if (($token['type'] === HTML5::CHARACTR &&
-                preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) || (
-                $token['type'] === HTML5::CHARACTR && in_array(
-                    end($this->stack)->nodeName,
-                    array('title', 'style', 'script')
-                ))
-        ) {
-            /* Append the character to the current node. */
-            $this->insertText($token['data']);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data attribute
-            set to the data given in the comment token. */
-            $this->insertComment($token['data']);
-
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            in_array($token['name'], array('title', 'style', 'script'))
-        ) {
-            array_pop($this->stack);
-            return HTML5::PCDATA;
-
-            /* A start tag with the tag name "title" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'title') {
-            /* Create an element for the token and append the new element to the
-            node pointed to by the head element pointer, or, if that is null
-            (innerHTML case), to the current node. */
-            if ($this->head_pointer !== null) {
-                $element = $this->insertElement($token, false);
-                $this->head_pointer->appendChild($element);
-
-            } else {
-                $element = $this->insertElement($token);
-            }
-
-            /* Switch the tokeniser's content model flag  to the RCDATA state. */
-            return HTML5::RCDATA;
-
-            /* A start tag with the tag name "style" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'style') {
-            /* Create an element for the token and append the new element to the
-            node pointed to by the head element pointer, or, if that is null
-            (innerHTML case), to the current node. */
-            if ($this->head_pointer !== null) {
-                $element = $this->insertElement($token, false);
-                $this->head_pointer->appendChild($element);
-
-            } else {
-                $this->insertElement($token);
-            }
-
-            /* Switch the tokeniser's content model flag  to the CDATA state. */
-            return HTML5::CDATA;
-
-            /* A start tag with the tag name "script" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'script') {
-            /* Create an element for the token. */
-            $element = $this->insertElement($token, false);
-            $this->head_pointer->appendChild($element);
-
-            /* Switch the tokeniser's content model flag  to the CDATA state. */
-            return HTML5::CDATA;
-
-            /* A start tag with the tag name "base", "link", or "meta" */
-        } elseif ($token['type'] === HTML5::STARTTAG && in_array(
-                $token['name'],
-                array('base', 'link', 'meta')
-            )
-        ) {
-            /* Create an element for the token and append the new element to the
-            node pointed to by the head element pointer, or, if that is null
-            (innerHTML case), to the current node. */
-            if ($this->head_pointer !== null) {
-                $element = $this->insertElement($token, false);
-                $this->head_pointer->appendChild($element);
-                array_pop($this->stack);
-
-            } else {
-                $this->insertElement($token);
-            }
-
-            /* An end tag with the tag name "head" */
-        } elseif ($token['type'] === HTML5::ENDTAG && $token['name'] === 'head') {
-            /* If the current node is a head element, pop the current node off
-            the stack of open elements. */
-            if ($this->head_pointer->isSameNode(end($this->stack))) {
-                array_pop($this->stack);
-
-                /* Otherwise, this is a parse error. */
-            } else {
-                // k
-            }
-
-            /* Change the insertion mode to "after head". */
-            $this->mode = self::AFTER_HEAD;
-
-            /* A start tag with the tag name "head" or an end tag except "html". */
-        } elseif (($token['type'] === HTML5::STARTTAG && $token['name'] === 'head') ||
-            ($token['type'] === HTML5::ENDTAG && $token['name'] !== 'html')
-        ) {
-            // Parse error. Ignore the token.
-
-            /* Anything else */
-        } else {
-            /* If the current node is a head element, act as if an end tag
-            token with the tag name "head" had been seen. */
-            if ($this->head_pointer->isSameNode(end($this->stack))) {
-                $this->inHead(
-                    array(
-                        'name' => 'head',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-
-                /* Otherwise, change the insertion mode to "after head". */
-            } else {
-                $this->mode = self::AFTER_HEAD;
-            }
-
-            /* Then, reprocess the current token. */
-            return $this->afterHead($token);
-        }
-    }
-
-    private function afterHead($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append the character to the current node. */
-            $this->insertText($token['data']);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data attribute
-            set to the data given in the comment token. */
-            $this->insertComment($token['data']);
-
-            /* A start tag token with the tag name "body" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'body') {
-            /* Insert a body element for the token. */
-            $this->insertElement($token);
-
-            /* Change the insertion mode to "in body". */
-            $this->mode = self::IN_BODY;
-
-            /* A start tag token with the tag name "frameset" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'frameset') {
-            /* Insert a frameset element for the token. */
-            $this->insertElement($token);
-
-            /* Change the insertion mode to "in frameset". */
-            $this->mode = self::IN_FRAME;
-
-            /* A start tag token whose tag name is one of: "base", "link", "meta",
-            "script", "style", "title" */
-        } elseif ($token['type'] === HTML5::STARTTAG && in_array(
-                $token['name'],
-                array('base', 'link', 'meta', 'script', 'style', 'title')
-            )
-        ) {
-            /* Parse error. Switch the insertion mode back to "in head" and
-            reprocess the token. */
-            $this->mode = self::IN_HEAD;
-            return $this->inHead($token);
-
-            /* Anything else */
-        } else {
-            /* Act as if a start tag token with the tag name "body" and no
-            attributes had been seen, and then reprocess the current token. */
-            $this->afterHead(
-                array(
-                    'name' => 'body',
-                    'type' => HTML5::STARTTAG,
-                    'attr' => array()
-                )
-            );
-
-            return $this->inBody($token);
-        }
-    }
-
-    private function inBody($token)
-    {
-        /* Handle the token as follows: */
-
-        switch ($token['type']) {
-            /* A character token */
-            case HTML5::CHARACTR:
-                /* Reconstruct the active formatting elements, if any. */
-                $this->reconstructActiveFormattingElements();
-
-                /* Append the token's character to the current node. */
-                $this->insertText($token['data']);
-                break;
-
-            /* A comment token */
-            case HTML5::COMMENT:
-                /* Append a Comment node to the current node with the data
-                attribute set to the data given in the comment token. */
-                $this->insertComment($token['data']);
-                break;
-
-            case HTML5::STARTTAG:
-                switch ($token['name']) {
-                    /* A start tag token whose tag name is one of: "script",
-                    "style" */
-                    case 'script':
-                    case 'style':
-                        /* Process the token as if the insertion mode had been "in
-                        head". */
-                        return $this->inHead($token);
-                        break;
-
-                    /* A start tag token whose tag name is one of: "base", "link",
-                    "meta", "title" */
-                    case 'base':
-                    case 'link':
-                    case 'meta':
-                    case 'title':
-                        /* Parse error. Process the token as if the insertion mode
-                        had    been "in head". */
-                        return $this->inHead($token);
-                        break;
-
-                    /* A start tag token with the tag name "body" */
-                    case 'body':
-                        /* Parse error. If the second element on the stack of open
-                        elements is not a body element, or, if the stack of open
-                        elements has only one node on it, then ignore the token.
-                        (innerHTML case) */
-                        if (count($this->stack) === 1 || $this->stack[1]->nodeName !== 'body') {
-                            // Ignore
-
-                            /* Otherwise, for each attribute on the token, check to see
-                            if the attribute is already present on the body element (the
-                            second element)    on the stack of open elements. If it is not,
-                            add the attribute and its corresponding value to that
-                            element. */
-                        } else {
-                            foreach ($token['attr'] as $attr) {
-                                if (!$this->stack[1]->hasAttribute($attr['name'])) {
-                                    $this->stack[1]->setAttribute($attr['name'], $attr['value']);
-                                }
-                            }
-                        }
-                        break;
-
-                    /* A start tag whose tag name is one of: "address",
-                    "blockquote", "center", "dir", "div", "dl", "fieldset",
-                    "listing", "menu", "ol", "p", "ul" */
-                    case 'address':
-                    case 'blockquote':
-                    case 'center':
-                    case 'dir':
-                    case 'div':
-                    case 'dl':
-                    case 'fieldset':
-                    case 'listing':
-                    case 'menu':
-                    case 'ol':
-                    case 'p':
-                    case 'ul':
-                        /* If the stack of open elements has a p element in scope,
-                        then act as if an end tag with the tag name p had been
-                        seen. */
-                        if ($this->elementInScope('p')) {
-                            $this->emitToken(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-                        break;
-
-                    /* A start tag whose tag name is "form" */
-                    case 'form':
-                        /* If the form element pointer is not null, ignore the
-                        token with a parse error. */
-                        if ($this->form_pointer !== null) {
-                            // Ignore.
-
-                            /* Otherwise: */
-                        } else {
-                            /* If the stack of open elements has a p element in
-                            scope, then act as if an end tag with the tag name p
-                            had been seen. */
-                            if ($this->elementInScope('p')) {
-                                $this->emitToken(
-                                    array(
-                                        'name' => 'p',
-                                        'type' => HTML5::ENDTAG
-                                    )
-                                );
-                            }
-
-                            /* Insert an HTML element for the token, and set the
-                            form element pointer to point to the element created. */
-                            $element = $this->insertElement($token);
-                            $this->form_pointer = $element;
-                        }
-                        break;
-
-                    /* A start tag whose tag name is "li", "dd" or "dt" */
-                    case 'li':
-                    case 'dd':
-                    case 'dt':
-                        /* If the stack of open elements has a p  element in scope,
-                        then act as if an end tag with the tag name p had been
-                        seen. */
-                        if ($this->elementInScope('p')) {
-                            $this->emitToken(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        $stack_length = count($this->stack) - 1;
-
-                        for ($n = $stack_length; 0 <= $n; $n--) {
-                            /* 1. Initialise node to be the current node (the
-                            bottommost node of the stack). */
-                            $stop = false;
-                            $node = $this->stack[$n];
-                            $cat = $this->getElementCategory($node->tagName);
-
-                            /* 2. If node is an li, dd or dt element, then pop all
-                            the    nodes from the current node up to node, including
-                            node, then stop this algorithm. */
-                            if ($token['name'] === $node->tagName || ($token['name'] !== 'li'
-                                    && ($node->tagName === 'dd' || $node->tagName === 'dt'))
-                            ) {
-                                for ($x = $stack_length; $x >= $n; $x--) {
-                                    array_pop($this->stack);
-                                }
-
-                                break;
-                            }
-
-                            /* 3. If node is not in the formatting category, and is
-                            not    in the phrasing category, and is not an address or
-                            div element, then stop this algorithm. */
-                            if ($cat !== self::FORMATTING && $cat !== self::PHRASING &&
-                                $node->tagName !== 'address' && $node->tagName !== 'div'
-                            ) {
-                                break;
-                            }
-                        }
-
-                        /* Finally, insert an HTML element with the same tag
-                        name as the    token's. */
-                        $this->insertElement($token);
-                        break;
-
-                    /* A start tag token whose tag name is "plaintext" */
-                    case 'plaintext':
-                        /* If the stack of open elements has a p  element in scope,
-                        then act as if an end tag with the tag name p had been
-                        seen. */
-                        if ($this->elementInScope('p')) {
-                            $this->emitToken(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        return HTML5::PLAINTEXT;
-                        break;
-
-                    /* A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
-                    "h5", "h6" */
-                    case 'h1':
-                    case 'h2':
-                    case 'h3':
-                    case 'h4':
-                    case 'h5':
-                    case 'h6':
-                        /* If the stack of open elements has a p  element in scope,
-                        then act as if an end tag with the tag name p had been seen. */
-                        if ($this->elementInScope('p')) {
-                            $this->emitToken(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        /* If the stack of open elements has in scope an element whose
-                        tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then
-                        this is a parse error; pop elements from the stack until an
-                        element with one of those tag names has been popped from the
-                        stack. */
-                        while ($this->elementInScope(array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'))) {
-                            array_pop($this->stack);
-                        }
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-                        break;
-
-                    /* A start tag whose tag name is "a" */
-                    case 'a':
-                        /* If the list of active formatting elements contains
-                        an element whose tag name is "a" between the end of the
-                        list and the last marker on the list (or the start of
-                        the list if there is no marker on the list), then this
-                        is a parse error; act as if an end tag with the tag name
-                        "a" had been seen, then remove that element from the list
-                        of active formatting elements and the stack of open
-                        elements if the end tag didn't already remove it (it
-                        might not have if the element is not in table scope). */
-                        $leng = count($this->a_formatting);
-
-                        for ($n = $leng - 1; $n >= 0; $n--) {
-                            if ($this->a_formatting[$n] === self::MARKER) {
-                                break;
-
-                            } elseif ($this->a_formatting[$n]->nodeName === 'a') {
-                                $this->emitToken(
-                                    array(
-                                        'name' => 'a',
-                                        'type' => HTML5::ENDTAG
-                                    )
-                                );
-                                break;
-                            }
-                        }
-
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $el = $this->insertElement($token);
-
-                        /* Add that element to the list of active formatting
-                        elements. */
-                        $this->a_formatting[] = $el;
-                        break;
-
-                    /* A start tag whose tag name is one of: "b", "big", "em", "font",
-                    "i", "nobr", "s", "small", "strike", "strong", "tt", "u" */
-                    case 'b':
-                    case 'big':
-                    case 'em':
-                    case 'font':
-                    case 'i':
-                    case 'nobr':
-                    case 's':
-                    case 'small':
-                    case 'strike':
-                    case 'strong':
-                    case 'tt':
-                    case 'u':
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $el = $this->insertElement($token);
-
-                        /* Add that element to the list of active formatting
-                        elements. */
-                        $this->a_formatting[] = $el;
-                        break;
-
-                    /* A start tag token whose tag name is "button" */
-                    case 'button':
-                        /* If the stack of open elements has a button element in scope,
-                        then this is a parse error; act as if an end tag with the tag
-                        name "button" had been seen, then reprocess the token. (We don't
-                        do that. Unnecessary.) */
-                        if ($this->elementInScope('button')) {
-                            $this->inBody(
-                                array(
-                                    'name' => 'button',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Insert a marker at the end of the list of active
-                        formatting elements. */
-                        $this->a_formatting[] = self::MARKER;
-                        break;
-
-                    /* A start tag token whose tag name is one of: "marquee", "object" */
-                    case 'marquee':
-                    case 'object':
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Insert a marker at the end of the list of active
-                        formatting elements. */
-                        $this->a_formatting[] = self::MARKER;
-                        break;
-
-                    /* A start tag token whose tag name is "xmp" */
-                    case 'xmp':
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Switch the content model flag to the CDATA state. */
-                        return HTML5::CDATA;
-                        break;
-
-                    /* A start tag whose tag name is "table" */
-                    case 'table':
-                        /* If the stack of open elements has a p element in scope,
-                        then act as if an end tag with the tag name p had been seen. */
-                        if ($this->elementInScope('p')) {
-                            $this->emitToken(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Change the insertion mode to "in table". */
-                        $this->mode = self::IN_TABLE;
-                        break;
-
-                    /* A start tag whose tag name is one of: "area", "basefont",
-                    "bgsound", "br", "embed", "img", "param", "spacer", "wbr" */
-                    case 'area':
-                    case 'basefont':
-                    case 'bgsound':
-                    case 'br':
-                    case 'embed':
-                    case 'img':
-                    case 'param':
-                    case 'spacer':
-                    case 'wbr':
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Immediately pop the current node off the stack of open elements. */
-                        array_pop($this->stack);
-                        break;
-
-                    /* A start tag whose tag name is "hr" */
-                    case 'hr':
-                        /* If the stack of open elements has a p element in scope,
-                        then act as if an end tag with the tag name p had been seen. */
-                        if ($this->elementInScope('p')) {
-                            $this->emitToken(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Immediately pop the current node off the stack of open elements. */
-                        array_pop($this->stack);
-                        break;
-
-                    /* A start tag whose tag name is "image" */
-                    case 'image':
-                        /* Parse error. Change the token's tag name to "img" and
-                        reprocess it. (Don't ask.) */
-                        $token['name'] = 'img';
-                        return $this->inBody($token);
-                        break;
-
-                    /* A start tag whose tag name is "input" */
-                    case 'input':
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an input element for the token. */
-                        $element = $this->insertElement($token, false);
-
-                        /* If the form element pointer is not null, then associate the
-                        input element with the form element pointed to by the form
-                        element pointer. */
-                        $this->form_pointer !== null
-                            ? $this->form_pointer->appendChild($element)
-                            : end($this->stack)->appendChild($element);
-
-                        /* Pop that input element off the stack of open elements. */
-                        array_pop($this->stack);
-                        break;
-
-                    /* A start tag whose tag name is "isindex" */
-                    case 'isindex':
-                        /* Parse error. */
-                        // w/e
-
-                        /* If the form element pointer is not null,
-                        then ignore the token. */
-                        if ($this->form_pointer === null) {
-                            /* Act as if a start tag token with the tag name "form" had
-                            been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'body',
-                                    'type' => HTML5::STARTTAG,
-                                    'attr' => array()
-                                )
-                            );
-
-                            /* Act as if a start tag token with the tag name "hr" had
-                            been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'hr',
-                                    'type' => HTML5::STARTTAG,
-                                    'attr' => array()
-                                )
-                            );
-
-                            /* Act as if a start tag token with the tag name "p" had
-                            been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::STARTTAG,
-                                    'attr' => array()
-                                )
-                            );
-
-                            /* Act as if a start tag token with the tag name "label"
-                            had been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'label',
-                                    'type' => HTML5::STARTTAG,
-                                    'attr' => array()
-                                )
-                            );
-
-                            /* Act as if a stream of character tokens had been seen. */
-                            $this->insertText(
-                                'This is a searchable index. ' .
-                                'Insert your search keywords here: '
-                            );
-
-                            /* Act as if a start tag token with the tag name "input"
-                            had been seen, with all the attributes from the "isindex"
-                            token, except with the "name" attribute set to the value
-                            "isindex" (ignoring any explicit "name" attribute). */
-                            $attr = $token['attr'];
-                            $attr[] = array('name' => 'name', 'value' => 'isindex');
-
-                            $this->inBody(
-                                array(
-                                    'name' => 'input',
-                                    'type' => HTML5::STARTTAG,
-                                    'attr' => $attr
-                                )
-                            );
-
-                            /* Act as if a stream of character tokens had been seen
-                            (see below for what they should say). */
-                            $this->insertText(
-                                'This is a searchable index. ' .
-                                'Insert your search keywords here: '
-                            );
-
-                            /* Act as if an end tag token with the tag name "label"
-                            had been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'label',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-
-                            /* Act as if an end tag token with the tag name "p" had
-                            been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'p',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-
-                            /* Act as if a start tag token with the tag name "hr" had
-                            been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'hr',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-
-                            /* Act as if an end tag token with the tag name "form" had
-                            been seen. */
-                            $this->inBody(
-                                array(
-                                    'name' => 'form',
-                                    'type' => HTML5::ENDTAG
-                                )
-                            );
-                        }
-                        break;
-
-                    /* A start tag whose tag name is "textarea" */
-                    case 'textarea':
-                        $this->insertElement($token);
-
-                        /* Switch the tokeniser's content model flag to the
-                        RCDATA state. */
-                        return HTML5::RCDATA;
-                        break;
-
-                    /* A start tag whose tag name is one of: "iframe", "noembed",
-                    "noframes" */
-                    case 'iframe':
-                    case 'noembed':
-                    case 'noframes':
-                        $this->insertElement($token);
-
-                        /* Switch the tokeniser's content model flag to the CDATA state. */
-                        return HTML5::CDATA;
-                        break;
-
-                    /* A start tag whose tag name is "select" */
-                    case 'select':
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        /* Insert an HTML element for the token. */
-                        $this->insertElement($token);
-
-                        /* Change the insertion mode to "in select". */
-                        $this->mode = self::IN_SELECT;
-                        break;
-
-                    /* A start or end tag whose tag name is one of: "caption", "col",
-                    "colgroup", "frame", "frameset", "head", "option", "optgroup",
-                    "tbody", "td", "tfoot", "th", "thead", "tr". */
-                    case 'caption':
-                    case 'col':
-                    case 'colgroup':
-                    case 'frame':
-                    case 'frameset':
-                    case 'head':
-                    case 'option':
-                    case 'optgroup':
-                    case 'tbody':
-                    case 'td':
-                    case 'tfoot':
-                    case 'th':
-                    case 'thead':
-                    case 'tr':
-                        // Parse error. Ignore the token.
-                        break;
-
-                    /* A start or end tag whose tag name is one of: "event-source",
-                    "section", "nav", "article", "aside", "header", "footer",
-                    "datagrid", "command" */
-                    case 'event-source':
-                    case 'section':
-                    case 'nav':
-                    case 'article':
-                    case 'aside':
-                    case 'header':
-                    case 'footer':
-                    case 'datagrid':
-                    case 'command':
-                        // Work in progress!
-                        break;
-
-                    /* A start tag token not covered by the previous entries */
-                    default:
-                        /* Reconstruct the active formatting elements, if any. */
-                        $this->reconstructActiveFormattingElements();
-
-                        $this->insertElement($token, true, true);
-                        break;
-                }
-                break;
-
-            case HTML5::ENDTAG:
-                switch ($token['name']) {
-                    /* An end tag with the tag name "body" */
-                    case 'body':
-                        /* If the second element in the stack of open elements is
-                        not a body element, this is a parse error. Ignore the token.
-                        (innerHTML case) */
-                        if (count($this->stack) < 2 || $this->stack[1]->nodeName !== 'body') {
-                            // Ignore.
-
-                            /* If the current node is not the body element, then this
-                            is a parse error. */
-                        } elseif (end($this->stack)->nodeName !== 'body') {
-                            // Parse error.
-                        }
-
-                        /* Change the insertion mode to "after body". */
-                        $this->mode = self::AFTER_BODY;
-                        break;
-
-                    /* An end tag with the tag name "html" */
-                    case 'html':
-                        /* Act as if an end tag with tag name "body" had been seen,
-                        then, if that token wasn't ignored, reprocess the current
-                        token. */
-                        $this->inBody(
-                            array(
-                                'name' => 'body',
-                                'type' => HTML5::ENDTAG
-                            )
-                        );
-
-                        return $this->afterBody($token);
-                        break;
-
-                    /* An end tag whose tag name is one of: "address", "blockquote",
-                    "center", "dir", "div", "dl", "fieldset", "listing", "menu",
-                    "ol", "pre", "ul" */
-                    case 'address':
-                    case 'blockquote':
-                    case 'center':
-                    case 'dir':
-                    case 'div':
-                    case 'dl':
-                    case 'fieldset':
-                    case 'listing':
-                    case 'menu':
-                    case 'ol':
-                    case 'pre':
-                    case 'ul':
-                        /* If the stack of open elements has an element in scope
-                        with the same tag name as that of the token, then generate
-                        implied end tags. */
-                        if ($this->elementInScope($token['name'])) {
-                            $this->generateImpliedEndTags();
-
-                            /* Now, if the current node is not an element with
-                            the same tag name as that of the token, then this
-                            is a parse error. */
-                            // w/e
-
-                            /* If the stack of open elements has an element in
-                            scope with the same tag name as that of the token,
-                            then pop elements from this stack until an element
-                            with that tag name has been popped from the stack. */
-                            for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                                if ($this->stack[$n]->nodeName === $token['name']) {
-                                    $n = -1;
-                                }
-
-                                array_pop($this->stack);
-                            }
-                        }
-                        break;
-
-                    /* An end tag whose tag name is "form" */
-                    case 'form':
-                        /* If the stack of open elements has an element in scope
-                        with the same tag name as that of the token, then generate
-                        implied    end tags. */
-                        if ($this->elementInScope($token['name'])) {
-                            $this->generateImpliedEndTags();
-
-                        }
-
-                        if (end($this->stack)->nodeName !== $token['name']) {
-                            /* Now, if the current node is not an element with the
-                            same tag name as that of the token, then this is a parse
-                            error. */
-                            // w/e
-
-                        } else {
-                            /* Otherwise, if the current node is an element with
-                            the same tag name as that of the token pop that element
-                            from the stack. */
-                            array_pop($this->stack);
-                        }
-
-                        /* In any case, set the form element pointer to null. */
-                        $this->form_pointer = null;
-                        break;
-
-                    /* An end tag whose tag name is "p" */
-                    case 'p':
-                        /* If the stack of open elements has a p element in scope,
-                        then generate implied end tags, except for p elements. */
-                        if ($this->elementInScope('p')) {
-                            $this->generateImpliedEndTags(array('p'));
-
-                            /* If the current node is not a p element, then this is
-                            a parse error. */
-                            // k
-
-                            /* If the stack of open elements has a p element in
-                            scope, then pop elements from this stack until the stack
-                            no longer has a p element in scope. */
-                            for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                                if ($this->elementInScope('p')) {
-                                    array_pop($this->stack);
-
-                                } else {
-                                    break;
-                                }
-                            }
-                        }
-                        break;
-
-                    /* An end tag whose tag name is "dd", "dt", or "li" */
-                    case 'dd':
-                    case 'dt':
-                    case 'li':
-                        /* If the stack of open elements has an element in scope
-                        whose tag name matches the tag name of the token, then
-                        generate implied end tags, except for elements with the
-                        same tag name as the token. */
-                        if ($this->elementInScope($token['name'])) {
-                            $this->generateImpliedEndTags(array($token['name']));
-
-                            /* If the current node is not an element with the same
-                            tag name as the token, then this is a parse error. */
-                            // w/e
-
-                            /* If the stack of open elements has an element in scope
-                            whose tag name matches the tag name of the token, then
-                            pop elements from this stack until an element with that
-                            tag name has been popped from the stack. */
-                            for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                                if ($this->stack[$n]->nodeName === $token['name']) {
-                                    $n = -1;
-                                }
-
-                                array_pop($this->stack);
-                            }
-                        }
-                        break;
-
-                    /* An end tag whose tag name is one of: "h1", "h2", "h3", "h4",
-                    "h5", "h6" */
-                    case 'h1':
-                    case 'h2':
-                    case 'h3':
-                    case 'h4':
-                    case 'h5':
-                    case 'h6':
-                        $elements = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6');
-
-                        /* If the stack of open elements has in scope an element whose
-                        tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then
-                        generate implied end tags. */
-                        if ($this->elementInScope($elements)) {
-                            $this->generateImpliedEndTags();
-
-                            /* Now, if the current node is not an element with the same
-                            tag name as that of the token, then this is a parse error. */
-                            // w/e
-
-                            /* If the stack of open elements has in scope an element
-                            whose tag name is one of "h1", "h2", "h3", "h4", "h5", or
-                            "h6", then pop elements from the stack until an element
-                            with one of those tag names has been popped from the stack. */
-                            while ($this->elementInScope($elements)) {
-                                array_pop($this->stack);
-                            }
-                        }
-                        break;
-
-                    /* An end tag whose tag name is one of: "a", "b", "big", "em",
-                    "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u" */
-                    case 'a':
-                    case 'b':
-                    case 'big':
-                    case 'em':
-                    case 'font':
-                    case 'i':
-                    case 'nobr':
-                    case 's':
-                    case 'small':
-                    case 'strike':
-                    case 'strong':
-                    case 'tt':
-                    case 'u':
-                        /* 1. Let the formatting element be the last element in
-                        the list of active formatting elements that:
-                            * is between the end of the list and the last scope
-                            marker in the list, if any, or the start of the list
-                            otherwise, and
-                            * has the same tag name as the token.
-                        */
-                        while (true) {
-                            for ($a = count($this->a_formatting) - 1; $a >= 0; $a--) {
-                                if ($this->a_formatting[$a] === self::MARKER) {
-                                    break;
-
-                                } elseif ($this->a_formatting[$a]->tagName === $token['name']) {
-                                    $formatting_element = $this->a_formatting[$a];
-                                    $in_stack = in_array($formatting_element, $this->stack, true);
-                                    $fe_af_pos = $a;
-                                    break;
-                                }
-                            }
-
-                            /* If there is no such node, or, if that node is
-                            also in the stack of open elements but the element
-                            is not in scope, then this is a parse error. Abort
-                            these steps. The token is ignored. */
-                            if (!isset($formatting_element) || ($in_stack &&
-                                    !$this->elementInScope($token['name']))
-                            ) {
-                                break;
-
-                                /* Otherwise, if there is such a node, but that node
-                                is not in the stack of open elements, then this is a
-                                parse error; remove the element from the list, and
-                                abort these steps. */
-                            } elseif (isset($formatting_element) && !$in_stack) {
-                                unset($this->a_formatting[$fe_af_pos]);
-                                $this->a_formatting = array_merge($this->a_formatting);
-                                break;
-                            }
-
-                            /* 2. Let the furthest block be the topmost node in the
-                            stack of open elements that is lower in the stack
-                            than the formatting element, and is not an element in
-                            the phrasing or formatting categories. There might
-                            not be one. */
-                            $fe_s_pos = array_search($formatting_element, $this->stack, true);
-                            $length = count($this->stack);
-
-                            for ($s = $fe_s_pos + 1; $s < $length; $s++) {
-                                $category = $this->getElementCategory($this->stack[$s]->nodeName);
-
-                                if ($category !== self::PHRASING && $category !== self::FORMATTING) {
-                                    $furthest_block = $this->stack[$s];
-                                }
-                            }
-
-                            /* 3. If there is no furthest block, then the UA must
-                            skip the subsequent steps and instead just pop all
-                            the nodes from the bottom of the stack of open
-                            elements, from the current node up to the formatting
-                            element, and remove the formatting element from the
-                            list of active formatting elements. */
-                            if (!isset($furthest_block)) {
-                                for ($n = $length - 1; $n >= $fe_s_pos; $n--) {
-                                    array_pop($this->stack);
-                                }
-
-                                unset($this->a_formatting[$fe_af_pos]);
-                                $this->a_formatting = array_merge($this->a_formatting);
-                                break;
-                            }
-
-                            /* 4. Let the common ancestor be the element
-                            immediately above the formatting element in the stack
-                            of open elements. */
-                            $common_ancestor = $this->stack[$fe_s_pos - 1];
-
-                            /* 5. If the furthest block has a parent node, then
-                            remove the furthest block from its parent node. */
-                            if ($furthest_block->parentNode !== null) {
-                                $furthest_block->parentNode->removeChild($furthest_block);
-                            }
-
-                            /* 6. Let a bookmark note the position of the
-                            formatting element in the list of active formatting
-                            elements relative to the elements on either side
-                            of it in the list. */
-                            $bookmark = $fe_af_pos;
-
-                            /* 7. Let node and last node  be the furthest block.
-                            Follow these steps: */
-                            $node = $furthest_block;
-                            $last_node = $furthest_block;
-
-                            while (true) {
-                                for ($n = array_search($node, $this->stack, true) - 1; $n >= 0; $n--) {
-                                    /* 7.1 Let node be the element immediately
-                                    prior to node in the stack of open elements. */
-                                    $node = $this->stack[$n];
-
-                                    /* 7.2 If node is not in the list of active
-                                    formatting elements, then remove node from
-                                    the stack of open elements and then go back
-                                    to step 1. */
-                                    if (!in_array($node, $this->a_formatting, true)) {
-                                        unset($this->stack[$n]);
-                                        $this->stack = array_merge($this->stack);
-
-                                    } else {
-                                        break;
-                                    }
-                                }
-
-                                /* 7.3 Otherwise, if node is the formatting
-                                element, then go to the next step in the overall
-                                algorithm. */
-                                if ($node === $formatting_element) {
-                                    break;
-
-                                    /* 7.4 Otherwise, if last node is the furthest
-                                    block, then move the aforementioned bookmark to
-                                    be immediately after the node in the list of
-                                    active formatting elements. */
-                                } elseif ($last_node === $furthest_block) {
-                                    $bookmark = array_search($node, $this->a_formatting, true) + 1;
-                                }
-
-                                /* 7.5 If node has any children, perform a
-                                shallow clone of node, replace the entry for
-                                node in the list of active formatting elements
-                                with an entry for the clone, replace the entry
-                                for node in the stack of open elements with an
-                                entry for the clone, and let node be the clone. */
-                                if ($node->hasChildNodes()) {
-                                    $clone = $node->cloneNode();
-                                    $s_pos = array_search($node, $this->stack, true);
-                                    $a_pos = array_search($node, $this->a_formatting, true);
-
-                                    $this->stack[$s_pos] = $clone;
-                                    $this->a_formatting[$a_pos] = $clone;
-                                    $node = $clone;
-                                }
-
-                                /* 7.6 Insert last node into node, first removing
-                                it from its previous parent node if any. */
-                                if ($last_node->parentNode !== null) {
-                                    $last_node->parentNode->removeChild($last_node);
-                                }
-
-                                $node->appendChild($last_node);
-
-                                /* 7.7 Let last node be node. */
-                                $last_node = $node;
-                            }
-
-                            /* 8. Insert whatever last node ended up being in
-                            the previous step into the common ancestor node,
-                            first removing it from its previous parent node if
-                            any. */
-                            if ($last_node->parentNode !== null) {
-                                $last_node->parentNode->removeChild($last_node);
-                            }
-
-                            $common_ancestor->appendChild($last_node);
-
-                            /* 9. Perform a shallow clone of the formatting
-                            element. */
-                            $clone = $formatting_element->cloneNode();
-
-                            /* 10. Take all of the child nodes of the furthest
-                            block and append them to the clone created in the
-                            last step. */
-                            while ($furthest_block->hasChildNodes()) {
-                                $child = $furthest_block->firstChild;
-                                $furthest_block->removeChild($child);
-                                $clone->appendChild($child);
-                            }
-
-                            /* 11. Append that clone to the furthest block. */
-                            $furthest_block->appendChild($clone);
-
-                            /* 12. Remove the formatting element from the list
-                            of active formatting elements, and insert the clone
-                            into the list of active formatting elements at the
-                            position of the aforementioned bookmark. */
-                            $fe_af_pos = array_search($formatting_element, $this->a_formatting, true);
-                            unset($this->a_formatting[$fe_af_pos]);
-                            $this->a_formatting = array_merge($this->a_formatting);
-
-                            $af_part1 = array_slice($this->a_formatting, 0, $bookmark - 1);
-                            $af_part2 = array_slice($this->a_formatting, $bookmark, count($this->a_formatting));
-                            $this->a_formatting = array_merge($af_part1, array($clone), $af_part2);
-
-                            /* 13. Remove the formatting element from the stack
-                            of open elements, and insert the clone into the stack
-                            of open elements immediately after (i.e. in a more
-                            deeply nested position than) the position of the
-                            furthest block in that stack. */
-                            $fe_s_pos = array_search($formatting_element, $this->stack, true);
-                            $fb_s_pos = array_search($furthest_block, $this->stack, true);
-                            unset($this->stack[$fe_s_pos]);
-
-                            $s_part1 = array_slice($this->stack, 0, $fb_s_pos);
-                            $s_part2 = array_slice($this->stack, $fb_s_pos + 1, count($this->stack));
-                            $this->stack = array_merge($s_part1, array($clone), $s_part2);
-
-                            /* 14. Jump back to step 1 in this series of steps. */
-                            unset($formatting_element, $fe_af_pos, $fe_s_pos, $furthest_block);
-                        }
-                        break;
-
-                    /* An end tag token whose tag name is one of: "button",
-                    "marquee", "object" */
-                    case 'button':
-                    case 'marquee':
-                    case 'object':
-                        /* If the stack of open elements has an element in scope whose
-                        tag name matches the tag name of the token, then generate implied
-                        tags. */
-                        if ($this->elementInScope($token['name'])) {
-                            $this->generateImpliedEndTags();
-
-                            /* Now, if the current node is not an element with the same
-                            tag name as the token, then this is a parse error. */
-                            // k
-
-                            /* Now, if the stack of open elements has an element in scope
-                            whose tag name matches the tag name of the token, then pop
-                            elements from the stack until that element has been popped from
-                            the stack, and clear the list of active formatting elements up
-                            to the last marker. */
-                            for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                                if ($this->stack[$n]->nodeName === $token['name']) {
-                                    $n = -1;
-                                }
-
-                                array_pop($this->stack);
-                            }
-
-                            $marker = end(array_keys($this->a_formatting, self::MARKER, true));
-
-                            for ($n = count($this->a_formatting) - 1; $n > $marker; $n--) {
-                                array_pop($this->a_formatting);
-                            }
-                        }
-                        break;
-
-                    /* Or an end tag whose tag name is one of: "area", "basefont",
-                    "bgsound", "br", "embed", "hr", "iframe", "image", "img",
-                    "input", "isindex", "noembed", "noframes", "param", "select",
-                    "spacer", "table", "textarea", "wbr" */
-                    case 'area':
-                    case 'basefont':
-                    case 'bgsound':
-                    case 'br':
-                    case 'embed':
-                    case 'hr':
-                    case 'iframe':
-                    case 'image':
-                    case 'img':
-                    case 'input':
-                    case 'isindex':
-                    case 'noembed':
-                    case 'noframes':
-                    case 'param':
-                    case 'select':
-                    case 'spacer':
-                    case 'table':
-                    case 'textarea':
-                    case 'wbr':
-                        // Parse error. Ignore the token.
-                        break;
-
-                    /* An end tag token not covered by the previous entries */
-                    default:
-                        for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                            /* Initialise node to be the current node (the bottommost
-                            node of the stack). */
-                            $node = end($this->stack);
-
-                            /* If node has the same tag name as the end tag token,
-                            then: */
-                            if ($token['name'] === $node->nodeName) {
-                                /* Generate implied end tags. */
-                                $this->generateImpliedEndTags();
-
-                                /* If the tag name of the end tag token does not
-                                match the tag name of the current node, this is a
-                                parse error. */
-                                // k
-
-                                /* Pop all the nodes from the current node up to
-                                node, including node, then stop this algorithm. */
-                                for ($x = count($this->stack) - $n; $x >= $n; $x--) {
-                                    array_pop($this->stack);
-                                }
-
-                            } else {
-                                $category = $this->getElementCategory($node);
-
-                                if ($category !== self::SPECIAL && $category !== self::SCOPING) {
-                                    /* Otherwise, if node is in neither the formatting
-                                    category nor the phrasing category, then this is a
-                                    parse error. Stop this algorithm. The end tag token
-                                    is ignored. */
-                                    return false;
-                                }
-                            }
-                        }
-                        break;
-                }
-                break;
-        }
-    }
-
-    private function inTable($token)
-    {
-        $clear = array('html', 'table');
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append the character to the current node. */
-            $text = $this->dom->createTextNode($token['data']);
-            end($this->stack)->appendChild($text);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data
-            attribute set to the data given in the comment token. */
-            $comment = $this->dom->createComment($token['data']);
-            end($this->stack)->appendChild($comment);
-
-            /* A start tag whose tag name is "caption" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            $token['name'] === 'caption'
-        ) {
-            /* Clear the stack back to a table context. */
-            $this->clearStackToTableContext($clear);
-
-            /* Insert a marker at the end of the list of active
-            formatting elements. */
-            $this->a_formatting[] = self::MARKER;
-
-            /* Insert an HTML element for the token, then switch the
-            insertion mode to "in caption". */
-            $this->insertElement($token);
-            $this->mode = self::IN_CAPTION;
-
-            /* A start tag whose tag name is "colgroup" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            $token['name'] === 'colgroup'
-        ) {
-            /* Clear the stack back to a table context. */
-            $this->clearStackToTableContext($clear);
-
-            /* Insert an HTML element for the token, then switch the
-            insertion mode to "in column group". */
-            $this->insertElement($token);
-            $this->mode = self::IN_CGROUP;
-
-            /* A start tag whose tag name is "col" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            $token['name'] === 'col'
-        ) {
-            $this->inTable(
-                array(
-                    'name' => 'colgroup',
-                    'type' => HTML5::STARTTAG,
-                    'attr' => array()
-                )
-            );
-
-            $this->inColumnGroup($token);
-
-            /* A start tag whose tag name is one of: "tbody", "tfoot", "thead" */
-        } elseif ($token['type'] === HTML5::STARTTAG && in_array(
-                $token['name'],
-                array('tbody', 'tfoot', 'thead')
-            )
-        ) {
-            /* Clear the stack back to a table context. */
-            $this->clearStackToTableContext($clear);
-
-            /* Insert an HTML element for the token, then switch the insertion
-            mode to "in table body". */
-            $this->insertElement($token);
-            $this->mode = self::IN_TBODY;
-
-            /* A start tag whose tag name is one of: "td", "th", "tr" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            in_array($token['name'], array('td', 'th', 'tr'))
-        ) {
-            /* Act as if a start tag token with the tag name "tbody" had been
-            seen, then reprocess the current token. */
-            $this->inTable(
-                array(
-                    'name' => 'tbody',
-                    'type' => HTML5::STARTTAG,
-                    'attr' => array()
-                )
-            );
-
-            return $this->inTableBody($token);
-
-            /* A start tag whose tag name is "table" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            $token['name'] === 'table'
-        ) {
-            /* Parse error. Act as if an end tag token with the tag name "table"
-            had been seen, then, if that token wasn't ignored, reprocess the
-            current token. */
-            $this->inTable(
-                array(
-                    'name' => 'table',
-                    'type' => HTML5::ENDTAG
-                )
-            );
-
-            return $this->mainPhase($token);
-
-            /* An end tag whose tag name is "table" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            $token['name'] === 'table'
-        ) {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as the token, this is a parse error.
-            Ignore the token. (innerHTML case) */
-            if (!$this->elementInScope($token['name'], true)) {
-                return false;
-
-                /* Otherwise: */
-            } else {
-                /* Generate implied end tags. */
-                $this->generateImpliedEndTags();
-
-                /* Now, if the current node is not a table element, then this
-                is a parse error. */
-                // w/e
-
-                /* Pop elements from this stack until a table element has been
-                popped from the stack. */
-                while (true) {
-                    $current = end($this->stack)->nodeName;
-                    array_pop($this->stack);
-
-                    if ($current === 'table') {
-                        break;
-                    }
-                }
-
-                /* Reset the insertion mode appropriately. */
-                $this->resetInsertionMode();
-            }
-
-            /* An end tag whose tag name is one of: "body", "caption", "col",
-            "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr" */
-        } elseif ($token['type'] === HTML5::ENDTAG && in_array(
-                $token['name'],
-                array(
-                    'body',
-                    'caption',
-                    'col',
-                    'colgroup',
-                    'html',
-                    'tbody',
-                    'td',
-                    'tfoot',
-                    'th',
-                    'thead',
-                    'tr'
-                )
-            )
-        ) {
-            // Parse error. Ignore the token.
-
-            /* Anything else */
-        } else {
-            /* Parse error. Process the token as if the insertion mode was "in
-            body", with the following exception: */
-
-            /* If the current node is a table, tbody, tfoot, thead, or tr
-            element, then, whenever a node would be inserted into the current
-            node, it must instead be inserted into the foster parent element. */
-            if (in_array(
-                end($this->stack)->nodeName,
-                array('table', 'tbody', 'tfoot', 'thead', 'tr')
-            )
-            ) {
-                /* The foster parent element is the parent element of the last
-                table element in the stack of open elements, if there is a
-                table element and it has such a parent element. If there is no
-                table element in the stack of open elements (innerHTML case),
-                then the foster parent element is the first element in the
-                stack of open elements (the html  element). Otherwise, if there
-                is a table element in the stack of open elements, but the last
-                table element in the stack of open elements has no parent, or
-                its parent node is not an element, then the foster parent
-                element is the element before the last table element in the
-                stack of open elements. */
-                for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                    if ($this->stack[$n]->nodeName === 'table') {
-                        $table = $this->stack[$n];
-                        break;
-                    }
-                }
-
-                if (isset($table) && $table->parentNode !== null) {
-                    $this->foster_parent = $table->parentNode;
-
-                } elseif (!isset($table)) {
-                    $this->foster_parent = $this->stack[0];
-
-                } elseif (isset($table) && ($table->parentNode === null ||
-                        $table->parentNode->nodeType !== XML_ELEMENT_NODE)
-                ) {
-                    $this->foster_parent = $this->stack[$n - 1];
-                }
-            }
-
-            $this->inBody($token);
-        }
-    }
-
-    private function inCaption($token)
-    {
-        /* An end tag whose tag name is "caption" */
-        if ($token['type'] === HTML5::ENDTAG && $token['name'] === 'caption') {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as the token, this is a parse error.
-            Ignore the token. (innerHTML case) */
-            if (!$this->elementInScope($token['name'], true)) {
-                // Ignore
-
-                /* Otherwise: */
-            } else {
-                /* Generate implied end tags. */
-                $this->generateImpliedEndTags();
-
-                /* Now, if the current node is not a caption element, then this
-                is a parse error. */
-                // w/e
-
-                /* Pop elements from this stack until a caption element has
-                been popped from the stack. */
-                while (true) {
-                    $node = end($this->stack)->nodeName;
-                    array_pop($this->stack);
-
-                    if ($node === 'caption') {
-                        break;
-                    }
-                }
-
-                /* Clear the list of active formatting elements up to the last
-                marker. */
-                $this->clearTheActiveFormattingElementsUpToTheLastMarker();
-
-                /* Switch the insertion mode to "in table". */
-                $this->mode = self::IN_TABLE;
-            }
-
-            /* A start tag whose tag name is one of: "caption", "col", "colgroup",
-            "tbody", "td", "tfoot", "th", "thead", "tr", or an end tag whose tag
-            name is "table" */
-        } elseif (($token['type'] === HTML5::STARTTAG && in_array(
-                    $token['name'],
-                    array(
-                        'caption',
-                        'col',
-                        'colgroup',
-                        'tbody',
-                        'td',
-                        'tfoot',
-                        'th',
-                        'thead',
-                        'tr'
-                    )
-                )) || ($token['type'] === HTML5::ENDTAG &&
-                $token['name'] === 'table')
-        ) {
-            /* Parse error. Act as if an end tag with the tag name "caption"
-            had been seen, then, if that token wasn't ignored, reprocess the
-            current token. */
-            $this->inCaption(
-                array(
-                    'name' => 'caption',
-                    'type' => HTML5::ENDTAG
-                )
-            );
-
-            return $this->inTable($token);
-
-            /* An end tag whose tag name is one of: "body", "col", "colgroup",
-            "html", "tbody", "td", "tfoot", "th", "thead", "tr" */
-        } elseif ($token['type'] === HTML5::ENDTAG && in_array(
-                $token['name'],
-                array(
-                    'body',
-                    'col',
-                    'colgroup',
-                    'html',
-                    'tbody',
-                    'tfoot',
-                    'th',
-                    'thead',
-                    'tr'
-                )
-            )
-        ) {
-            // Parse error. Ignore the token.
-
-            /* Anything else */
-        } else {
-            /* Process the token as if the insertion mode was "in body". */
-            $this->inBody($token);
-        }
-    }
-
-    private function inColumnGroup($token)
-    {
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append the character to the current node. */
-            $text = $this->dom->createTextNode($token['data']);
-            end($this->stack)->appendChild($text);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data
-            attribute set to the data given in the comment token. */
-            $comment = $this->dom->createComment($token['data']);
-            end($this->stack)->appendChild($comment);
-
-            /* A start tag whose tag name is "col" */
-        } elseif ($token['type'] === HTML5::STARTTAG && $token['name'] === 'col') {
-            /* Insert a col element for the token. Immediately pop the current
-            node off the stack of open elements. */
-            $this->insertElement($token);
-            array_pop($this->stack);
-
-            /* An end tag whose tag name is "colgroup" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            $token['name'] === 'colgroup'
-        ) {
-            /* If the current node is the root html element, then this is a
-            parse error, ignore the token. (innerHTML case) */
-            if (end($this->stack)->nodeName === 'html') {
-                // Ignore
-
-                /* Otherwise, pop the current node (which will be a colgroup
-                element) from the stack of open elements. Switch the insertion
-                mode to "in table". */
-            } else {
-                array_pop($this->stack);
-                $this->mode = self::IN_TABLE;
-            }
-
-            /* An end tag whose tag name is "col" */
-        } elseif ($token['type'] === HTML5::ENDTAG && $token['name'] === 'col') {
-            /* Parse error. Ignore the token. */
-
-            /* Anything else */
-        } else {
-            /* Act as if an end tag with the tag name "colgroup" had been seen,
-            and then, if that token wasn't ignored, reprocess the current token. */
-            $this->inColumnGroup(
-                array(
-                    'name' => 'colgroup',
-                    'type' => HTML5::ENDTAG
-                )
-            );
-
-            return $this->inTable($token);
-        }
-    }
-
-    private function inTableBody($token)
-    {
-        $clear = array('tbody', 'tfoot', 'thead', 'html');
-
-        /* A start tag whose tag name is "tr" */
-        if ($token['type'] === HTML5::STARTTAG && $token['name'] === 'tr') {
-            /* Clear the stack back to a table body context. */
-            $this->clearStackToTableContext($clear);
-
-            /* Insert a tr element for the token, then switch the insertion
-            mode to "in row". */
-            $this->insertElement($token);
-            $this->mode = self::IN_ROW;
-
-            /* A start tag whose tag name is one of: "th", "td" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            ($token['name'] === 'th' || $token['name'] === 'td')
-        ) {
-            /* Parse error. Act as if a start tag with the tag name "tr" had
-            been seen, then reprocess the current token. */
-            $this->inTableBody(
-                array(
-                    'name' => 'tr',
-                    'type' => HTML5::STARTTAG,
-                    'attr' => array()
-                )
-            );
-
-            return $this->inRow($token);
-
-            /* An end tag whose tag name is one of: "tbody", "tfoot", "thead" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            in_array($token['name'], array('tbody', 'tfoot', 'thead'))
-        ) {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as the token, this is a parse error.
-            Ignore the token. */
-            if (!$this->elementInScope($token['name'], true)) {
-                // Ignore
-
-                /* Otherwise: */
-            } else {
-                /* Clear the stack back to a table body context. */
-                $this->clearStackToTableContext($clear);
-
-                /* Pop the current node from the stack of open elements. Switch
-                the insertion mode to "in table". */
-                array_pop($this->stack);
-                $this->mode = self::IN_TABLE;
-            }
-
-            /* A start tag whose tag name is one of: "caption", "col", "colgroup",
-            "tbody", "tfoot", "thead", or an end tag whose tag name is "table" */
-        } elseif (($token['type'] === HTML5::STARTTAG && in_array(
-                    $token['name'],
-                    array('caption', 'col', 'colgroup', 'tbody', 'tfoor', 'thead')
-                )) ||
-            ($token['type'] === HTML5::STARTTAG && $token['name'] === 'table')
-        ) {
-            /* If the stack of open elements does not have a tbody, thead, or
-            tfoot element in table scope, this is a parse error. Ignore the
-            token. (innerHTML case) */
-            if (!$this->elementInScope(array('tbody', 'thead', 'tfoot'), true)) {
-                // Ignore.
-
-                /* Otherwise: */
-            } else {
-                /* Clear the stack back to a table body context. */
-                $this->clearStackToTableContext($clear);
-
-                /* Act as if an end tag with the same tag name as the current
-                node ("tbody", "tfoot", or "thead") had been seen, then
-                reprocess the current token. */
-                $this->inTableBody(
-                    array(
-                        'name' => end($this->stack)->nodeName,
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-
-                return $this->mainPhase($token);
-            }
-
-            /* An end tag whose tag name is one of: "body", "caption", "col",
-            "colgroup", "html", "td", "th", "tr" */
-        } elseif ($token['type'] === HTML5::ENDTAG && in_array(
-                $token['name'],
-                array('body', 'caption', 'col', 'colgroup', 'html', 'td', 'th', 'tr')
-            )
-        ) {
-            /* Parse error. Ignore the token. */
-
-            /* Anything else */
-        } else {
-            /* Process the token as if the insertion mode was "in table". */
-            $this->inTable($token);
-        }
-    }
-
-    private function inRow($token)
-    {
-        $clear = array('tr', 'html');
-
-        /* A start tag whose tag name is one of: "th", "td" */
-        if ($token['type'] === HTML5::STARTTAG &&
-            ($token['name'] === 'th' || $token['name'] === 'td')
-        ) {
-            /* Clear the stack back to a table row context. */
-            $this->clearStackToTableContext($clear);
-
-            /* Insert an HTML element for the token, then switch the insertion
-            mode to "in cell". */
-            $this->insertElement($token);
-            $this->mode = self::IN_CELL;
-
-            /* Insert a marker at the end of the list of active formatting
-            elements. */
-            $this->a_formatting[] = self::MARKER;
-
-            /* An end tag whose tag name is "tr" */
-        } elseif ($token['type'] === HTML5::ENDTAG && $token['name'] === 'tr') {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as the token, this is a parse error.
-            Ignore the token. (innerHTML case) */
-            if (!$this->elementInScope($token['name'], true)) {
-                // Ignore.
-
-                /* Otherwise: */
-            } else {
-                /* Clear the stack back to a table row context. */
-                $this->clearStackToTableContext($clear);
-
-                /* Pop the current node (which will be a tr element) from the
-                stack of open elements. Switch the insertion mode to "in table
-                body". */
-                array_pop($this->stack);
-                $this->mode = self::IN_TBODY;
-            }
-
-            /* A start tag whose tag name is one of: "caption", "col", "colgroup",
-            "tbody", "tfoot", "thead", "tr" or an end tag whose tag name is "table" */
-        } elseif ($token['type'] === HTML5::STARTTAG && in_array(
-                $token['name'],
-                array('caption', 'col', 'colgroup', 'tbody', 'tfoot', 'thead', 'tr')
-            )
-        ) {
-            /* Act as if an end tag with the tag name "tr" had been seen, then,
-            if that token wasn't ignored, reprocess the current token. */
-            $this->inRow(
-                array(
-                    'name' => 'tr',
-                    'type' => HTML5::ENDTAG
-                )
-            );
-
-            return $this->inCell($token);
-
-            /* An end tag whose tag name is one of: "tbody", "tfoot", "thead" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            in_array($token['name'], array('tbody', 'tfoot', 'thead'))
-        ) {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as the token, this is a parse error.
-            Ignore the token. */
-            if (!$this->elementInScope($token['name'], true)) {
-                // Ignore.
-
-                /* Otherwise: */
-            } else {
-                /* Otherwise, act as if an end tag with the tag name "tr" had
-                been seen, then reprocess the current token. */
-                $this->inRow(
-                    array(
-                        'name' => 'tr',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-
-                return $this->inCell($token);
-            }
-
-            /* An end tag whose tag name is one of: "body", "caption", "col",
-            "colgroup", "html", "td", "th" */
-        } elseif ($token['type'] === HTML5::ENDTAG && in_array(
-                $token['name'],
-                array('body', 'caption', 'col', 'colgroup', 'html', 'td', 'th', 'tr')
-            )
-        ) {
-            /* Parse error. Ignore the token. */
-
-            /* Anything else */
-        } else {
-            /* Process the token as if the insertion mode was "in table". */
-            $this->inTable($token);
-        }
-    }
-
-    private function inCell($token)
-    {
-        /* An end tag whose tag name is one of: "td", "th" */
-        if ($token['type'] === HTML5::ENDTAG &&
-            ($token['name'] === 'td' || $token['name'] === 'th')
-        ) {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as that of the token, then this is a
-            parse error and the token must be ignored. */
-            if (!$this->elementInScope($token['name'], true)) {
-                // Ignore.
-
-                /* Otherwise: */
-            } else {
-                /* Generate implied end tags, except for elements with the same
-                tag name as the token. */
-                $this->generateImpliedEndTags(array($token['name']));
-
-                /* Now, if the current node is not an element with the same tag
-                name as the token, then this is a parse error. */
-                // k
-
-                /* Pop elements from this stack until an element with the same
-                tag name as the token has been popped from the stack. */
-                while (true) {
-                    $node = end($this->stack)->nodeName;
-                    array_pop($this->stack);
-
-                    if ($node === $token['name']) {
-                        break;
-                    }
-                }
-
-                /* Clear the list of active formatting elements up to the last
-                marker. */
-                $this->clearTheActiveFormattingElementsUpToTheLastMarker();
-
-                /* Switch the insertion mode to "in row". (The current node
-                will be a tr element at this point.) */
-                $this->mode = self::IN_ROW;
-            }
-
-            /* A start tag whose tag name is one of: "caption", "col", "colgroup",
-            "tbody", "td", "tfoot", "th", "thead", "tr" */
-        } elseif ($token['type'] === HTML5::STARTTAG && in_array(
-                $token['name'],
-                array(
-                    'caption',
-                    'col',
-                    'colgroup',
-                    'tbody',
-                    'td',
-                    'tfoot',
-                    'th',
-                    'thead',
-                    'tr'
-                )
-            )
-        ) {
-            /* If the stack of open elements does not have a td or th element
-            in table scope, then this is a parse error; ignore the token.
-            (innerHTML case) */
-            if (!$this->elementInScope(array('td', 'th'), true)) {
-                // Ignore.
-
-                /* Otherwise, close the cell (see below) and reprocess the current
-                token. */
-            } else {
-                $this->closeCell();
-                return $this->inRow($token);
-            }
-
-            /* A start tag whose tag name is one of: "caption", "col", "colgroup",
-            "tbody", "td", "tfoot", "th", "thead", "tr" */
-        } elseif ($token['type'] === HTML5::STARTTAG && in_array(
-                $token['name'],
-                array(
-                    'caption',
-                    'col',
-                    'colgroup',
-                    'tbody',
-                    'td',
-                    'tfoot',
-                    'th',
-                    'thead',
-                    'tr'
-                )
-            )
-        ) {
-            /* If the stack of open elements does not have a td or th element
-            in table scope, then this is a parse error; ignore the token.
-            (innerHTML case) */
-            if (!$this->elementInScope(array('td', 'th'), true)) {
-                // Ignore.
-
-                /* Otherwise, close the cell (see below) and reprocess the current
-                token. */
-            } else {
-                $this->closeCell();
-                return $this->inRow($token);
-            }
-
-            /* An end tag whose tag name is one of: "body", "caption", "col",
-            "colgroup", "html" */
-        } elseif ($token['type'] === HTML5::ENDTAG && in_array(
-                $token['name'],
-                array('body', 'caption', 'col', 'colgroup', 'html')
-            )
-        ) {
-            /* Parse error. Ignore the token. */
-
-            /* An end tag whose tag name is one of: "table", "tbody", "tfoot",
-            "thead", "tr" */
-        } elseif ($token['type'] === HTML5::ENDTAG && in_array(
-                $token['name'],
-                array('table', 'tbody', 'tfoot', 'thead', 'tr')
-            )
-        ) {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as that of the token (which can only
-            happen for "tbody", "tfoot" and "thead", or, in the innerHTML case),
-            then this is a parse error and the token must be ignored. */
-            if (!$this->elementInScope($token['name'], true)) {
-                // Ignore.
-
-                /* Otherwise, close the cell (see below) and reprocess the current
-                token. */
-            } else {
-                $this->closeCell();
-                return $this->inRow($token);
-            }
-
-            /* Anything else */
-        } else {
-            /* Process the token as if the insertion mode was "in body". */
-            $this->inBody($token);
-        }
-    }
-
-    private function inSelect($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token */
-        if ($token['type'] === HTML5::CHARACTR) {
-            /* Append the token's character to the current node. */
-            $this->insertText($token['data']);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data
-            attribute set to the data given in the comment token. */
-            $this->insertComment($token['data']);
-
-            /* A start tag token whose tag name is "option" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            $token['name'] === 'option'
-        ) {
-            /* If the current node is an option element, act as if an end tag
-            with the tag name "option" had been seen. */
-            if (end($this->stack)->nodeName === 'option') {
-                $this->inSelect(
-                    array(
-                        'name' => 'option',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-            }
-
-            /* Insert an HTML element for the token. */
-            $this->insertElement($token);
-
-            /* A start tag token whose tag name is "optgroup" */
-        } elseif ($token['type'] === HTML5::STARTTAG &&
-            $token['name'] === 'optgroup'
-        ) {
-            /* If the current node is an option element, act as if an end tag
-            with the tag name "option" had been seen. */
-            if (end($this->stack)->nodeName === 'option') {
-                $this->inSelect(
-                    array(
-                        'name' => 'option',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-            }
-
-            /* If the current node is an optgroup element, act as if an end tag
-            with the tag name "optgroup" had been seen. */
-            if (end($this->stack)->nodeName === 'optgroup') {
-                $this->inSelect(
-                    array(
-                        'name' => 'optgroup',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-            }
-
-            /* Insert an HTML element for the token. */
-            $this->insertElement($token);
-
-            /* An end tag token whose tag name is "optgroup" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            $token['name'] === 'optgroup'
-        ) {
-            /* First, if the current node is an option element, and the node
-            immediately before it in the stack of open elements is an optgroup
-            element, then act as if an end tag with the tag name "option" had
-            been seen. */
-            $elements_in_stack = count($this->stack);
-
-            if ($this->stack[$elements_in_stack - 1]->nodeName === 'option' &&
-                $this->stack[$elements_in_stack - 2]->nodeName === 'optgroup'
-            ) {
-                $this->inSelect(
-                    array(
-                        'name' => 'option',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-            }
-
-            /* If the current node is an optgroup element, then pop that node
-            from the stack of open elements. Otherwise, this is a parse error,
-            ignore the token. */
-            if ($this->stack[$elements_in_stack - 1] === 'optgroup') {
-                array_pop($this->stack);
-            }
-
-            /* An end tag token whose tag name is "option" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            $token['name'] === 'option'
-        ) {
-            /* If the current node is an option element, then pop that node
-            from the stack of open elements. Otherwise, this is a parse error,
-            ignore the token. */
-            if (end($this->stack)->nodeName === 'option') {
-                array_pop($this->stack);
-            }
-
-            /* An end tag whose tag name is "select" */
-        } elseif ($token['type'] === HTML5::ENDTAG &&
-            $token['name'] === 'select'
-        ) {
-            /* If the stack of open elements does not have an element in table
-            scope with the same tag name as the token, this is a parse error.
-            Ignore the token. (innerHTML case) */
-            if (!$this->elementInScope($token['name'], true)) {
-                // w/e
-
-                /* Otherwise: */
-            } else {
-                /* Pop elements from the stack of open elements until a select
-                element has been popped from the stack. */
-                while (true) {
-                    $current = end($this->stack)->nodeName;
-                    array_pop($this->stack);
-
-                    if ($current === 'select') {
-                        break;
-                    }
-                }
-
-                /* Reset the insertion mode appropriately. */
-                $this->resetInsertionMode();
-            }
-
-            /* A start tag whose tag name is "select" */
-        } elseif ($token['name'] === 'select' &&
-            $token['type'] === HTML5::STARTTAG
-        ) {
-            /* Parse error. Act as if the token had been an end tag with the
-            tag name "select" instead. */
-            $this->inSelect(
-                array(
-                    'name' => 'select',
-                    'type' => HTML5::ENDTAG
-                )
-            );
-
-            /* An end tag whose tag name is one of: "caption", "table", "tbody",
-            "tfoot", "thead", "tr", "td", "th" */
-        } elseif (in_array(
-                $token['name'],
-                array(
-                    'caption',
-                    'table',
-                    'tbody',
-                    'tfoot',
-                    'thead',
-                    'tr',
-                    'td',
-                    'th'
-                )
-            ) && $token['type'] === HTML5::ENDTAG
-        ) {
-            /* Parse error. */
-            // w/e
-
-            /* If the stack of open elements has an element in table scope with
-            the same tag name as that of the token, then act as if an end tag
-            with the tag name "select" had been seen, and reprocess the token.
-            Otherwise, ignore the token. */
-            if ($this->elementInScope($token['name'], true)) {
-                $this->inSelect(
-                    array(
-                        'name' => 'select',
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-
-                $this->mainPhase($token);
-            }
-
-            /* Anything else */
-        } else {
-            /* Parse error. Ignore the token. */
-        }
-    }
-
-    private function afterBody($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Process the token as it would be processed if the insertion mode
-            was "in body". */
-            $this->inBody($token);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the first element in the stack of open
-            elements (the html element), with the data attribute set to the
-            data given in the comment token. */
-            $comment = $this->dom->createComment($token['data']);
-            $this->stack[0]->appendChild($comment);
-
-            /* An end tag with the tag name "html" */
-        } elseif ($token['type'] === HTML5::ENDTAG && $token['name'] === 'html') {
-            /* If the parser was originally created in order to handle the
-            setting of an element's innerHTML attribute, this is a parse error;
-            ignore the token. (The element will be an html element in this
-            case.) (innerHTML case) */
-
-            /* Otherwise, switch to the trailing end phase. */
-            $this->phase = self::END_PHASE;
-
-            /* Anything else */
-        } else {
-            /* Parse error. Set the insertion mode to "in body" and reprocess
-            the token. */
-            $this->mode = self::IN_BODY;
-            return $this->inBody($token);
-        }
-    }
-
-    private function inFrameset($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        U+000D CARRIAGE RETURN (CR), or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append the character to the current node. */
-            $this->insertText($token['data']);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data
-            attribute set to the data given in the comment token. */
-            $this->insertComment($token['data']);
-
-            /* A start tag with the tag name "frameset" */
-        } elseif ($token['name'] === 'frameset' &&
-            $token['type'] === HTML5::STARTTAG
-        ) {
-            $this->insertElement($token);
-
-            /* An end tag with the tag name "frameset" */
-        } elseif ($token['name'] === 'frameset' &&
-            $token['type'] === HTML5::ENDTAG
-        ) {
-            /* If the current node is the root html element, then this is a
-            parse error; ignore the token. (innerHTML case) */
-            if (end($this->stack)->nodeName === 'html') {
-                // Ignore
-
-            } else {
-                /* Otherwise, pop the current node from the stack of open
-                elements. */
-                array_pop($this->stack);
-
-                /* If the parser was not originally created in order to handle
-                the setting of an element's innerHTML attribute (innerHTML case),
-                and the current node is no longer a frameset element, then change
-                the insertion mode to "after frameset". */
-                $this->mode = self::AFTR_FRAME;
-            }
-
-            /* A start tag with the tag name "frame" */
-        } elseif ($token['name'] === 'frame' &&
-            $token['type'] === HTML5::STARTTAG
-        ) {
-            /* Insert an HTML element for the token. */
-            $this->insertElement($token);
-
-            /* Immediately pop the current node off the stack of open elements. */
-            array_pop($this->stack);
-
-            /* A start tag with the tag name "noframes" */
-        } elseif ($token['name'] === 'noframes' &&
-            $token['type'] === HTML5::STARTTAG
-        ) {
-            /* Process the token as if the insertion mode had been "in body". */
-            $this->inBody($token);
-
-            /* Anything else */
-        } else {
-            /* Parse error. Ignore the token. */
-        }
-    }
-
-    private function afterFrameset($token)
-    {
-        /* Handle the token as follows: */
-
-        /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-        U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-        U+000D CARRIAGE RETURN (CR), or U+0020 SPACE */
-        if ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Append the character to the current node. */
-            $this->insertText($token['data']);
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the current node with the data
-            attribute set to the data given in the comment token. */
-            $this->insertComment($token['data']);
-
-            /* An end tag with the tag name "html" */
-        } elseif ($token['name'] === 'html' &&
-            $token['type'] === HTML5::ENDTAG
-        ) {
-            /* Switch to the trailing end phase. */
-            $this->phase = self::END_PHASE;
-
-            /* A start tag with the tag name "noframes" */
-        } elseif ($token['name'] === 'noframes' &&
-            $token['type'] === HTML5::STARTTAG
-        ) {
-            /* Process the token as if the insertion mode had been "in body". */
-            $this->inBody($token);
-
-            /* Anything else */
-        } else {
-            /* Parse error. Ignore the token. */
-        }
-    }
-
-    private function trailingEndPhase($token)
-    {
-        /* After the main phase, as each token is emitted from the tokenisation
-        stage, it must be processed as described in this section. */
-
-        /* A DOCTYPE token */
-        if ($token['type'] === HTML5::DOCTYPE) {
-            // Parse error. Ignore the token.
-
-            /* A comment token */
-        } elseif ($token['type'] === HTML5::COMMENT) {
-            /* Append a Comment node to the Document object with the data
-            attribute set to the data given in the comment token. */
-            $comment = $this->dom->createComment($token['data']);
-            $this->dom->appendChild($comment);
-
-            /* A character token that is one of one of U+0009 CHARACTER TABULATION,
-            U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-            or U+0020 SPACE */
-        } elseif ($token['type'] === HTML5::CHARACTR &&
-            preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])
-        ) {
-            /* Process the token as it would be processed in the main phase. */
-            $this->mainPhase($token);
-
-            /* A character token that is not one of U+0009 CHARACTER TABULATION,
-            U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF),
-            or U+0020 SPACE. Or a start tag token. Or an end tag token. */
-        } elseif (($token['type'] === HTML5::CHARACTR &&
-                preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) ||
-            $token['type'] === HTML5::STARTTAG || $token['type'] === HTML5::ENDTAG
-        ) {
-            /* Parse error. Switch back to the main phase and reprocess the
-            token. */
-            $this->phase = self::MAIN_PHASE;
-            return $this->mainPhase($token);
-
-            /* An end-of-file token */
-        } elseif ($token['type'] === HTML5::EOF) {
-            /* OMG DONE!! */
-        }
-    }
-
-    private function insertElement($token, $append = true, $check = false)
-    {
-        // Proprietary workaround for libxml2's limitations with tag names
-        if ($check) {
-            // Slightly modified HTML5 tag-name modification,
-            // removing anything that's not an ASCII letter, digit, or hyphen
-            $token['name'] = preg_replace('/[^a-z0-9-]/i', '', $token['name']);
-            // Remove leading hyphens and numbers
-            $token['name'] = ltrim($token['name'], '-0..9');
-            // In theory, this should ever be needed, but just in case
-            if ($token['name'] === '') {
-                $token['name'] = 'span';
-            } // arbitrary generic choice
-        }
-
-        $el = $this->dom->createElement($token['name']);
-
-        foreach ($token['attr'] as $attr) {
-            if (!$el->hasAttribute($attr['name'])) {
-                $el->setAttribute($attr['name'], $attr['value']);
-            }
-        }
-
-        $this->appendToRealParent($el);
-        $this->stack[] = $el;
-
-        return $el;
-    }
-
-    private function insertText($data)
-    {
-        $text = $this->dom->createTextNode($data);
-        $this->appendToRealParent($text);
-    }
-
-    private function insertComment($data)
-    {
-        $comment = $this->dom->createComment($data);
-        $this->appendToRealParent($comment);
-    }
-
-    private function appendToRealParent($node)
-    {
-        if ($this->foster_parent === null) {
-            end($this->stack)->appendChild($node);
-
-        } elseif ($this->foster_parent !== null) {
-            /* If the foster parent element is the parent element of the
-            last table element in the stack of open elements, then the new
-            node must be inserted immediately before the last table element
-            in the stack of open elements in the foster parent element;
-            otherwise, the new node must be appended to the foster parent
-            element. */
-            for ($n = count($this->stack) - 1; $n >= 0; $n--) {
-                if ($this->stack[$n]->nodeName === 'table' &&
-                    $this->stack[$n]->parentNode !== null
-                ) {
-                    $table = $this->stack[$n];
-                    break;
-                }
-            }
-
-            if (isset($table) && $this->foster_parent->isSameNode($table->parentNode)) {
-                $this->foster_parent->insertBefore($node, $table);
-            } else {
-                $this->foster_parent->appendChild($node);
-            }
-
-            $this->foster_parent = null;
-        }
-    }
-
-    private function elementInScope($el, $table = false)
-    {
-        if (is_array($el)) {
-            foreach ($el as $element) {
-                if ($this->elementInScope($element, $table)) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-
-        $leng = count($this->stack);
-
-        for ($n = 0; $n < $leng; $n++) {
-            /* 1. Initialise node to be the current node (the bottommost node of
-            the stack). */
-            $node = $this->stack[$leng - 1 - $n];
-
-            if ($node->tagName === $el) {
-                /* 2. If node is the target node, terminate in a match state. */
-                return true;
-
-            } elseif ($node->tagName === 'table') {
-                /* 3. Otherwise, if node is a table element, terminate in a failure
-                state. */
-                return false;
-
-            } elseif ($table === true && in_array(
-                    $node->tagName,
-                    array(
-                        'caption',
-                        'td',
-                        'th',
-                        'button',
-                        'marquee',
-                        'object'
-                    )
-                )
-            ) {
-                /* 4. Otherwise, if the algorithm is the "has an element in scope"
-                variant (rather than the "has an element in table scope" variant),
-                and node is one of the following, terminate in a failure state. */
-                return false;
-
-            } elseif ($node === $node->ownerDocument->documentElement) {
-                /* 5. Otherwise, if node is an html element (root element), terminate
-                in a failure state. (This can only happen if the node is the topmost
-                node of the    stack of open elements, and prevents the next step from
-                being invoked if there are no more elements in the stack.) */
-                return false;
-            }
-
-            /* Otherwise, set node to the previous entry in the stack of open
-            elements and return to step 2. (This will never fail, since the loop
-            will always terminate in the previous step if the top of the stack
-            is reached.) */
-        }
-    }
-
-    private function reconstructActiveFormattingElements()
-    {
-        /* 1. If there are no entries in the list of active formatting elements,
-        then there is nothing to reconstruct; stop this algorithm. */
-        $formatting_elements = count($this->a_formatting);
-
-        if ($formatting_elements === 0) {
-            return false;
-        }
-
-        /* 3. Let entry be the last (most recently added) element in the list
-        of active formatting elements. */
-        $entry = end($this->a_formatting);
-
-        /* 2. If the last (most recently added) entry in the list of active
-        formatting elements is a marker, or if it is an element that is in the
-        stack of open elements, then there is nothing to reconstruct; stop this
-        algorithm. */
-        if ($entry === self::MARKER || in_array($entry, $this->stack, true)) {
-            return false;
-        }
-
-        for ($a = $formatting_elements - 1; $a >= 0; true) {
-            /* 4. If there are no entries before entry in the list of active
-            formatting elements, then jump to step 8. */
-            if ($a === 0) {
-                $step_seven = false;
-                break;
-            }
-
-            /* 5. Let entry be the entry one earlier than entry in the list of
-            active formatting elements. */
-            $a--;
-            $entry = $this->a_formatting[$a];
-
-            /* 6. If entry is neither a marker nor an element that is also in
-            thetack of open elements, go to step 4. */
-            if ($entry === self::MARKER || in_array($entry, $this->stack, true)) {
-                break;
-            }
-        }
-
-        while (true) {
-            /* 7. Let entry be the element one later than entry in the list of
-            active formatting elements. */
-            if (isset($step_seven) && $step_seven === true) {
-                $a++;
-                $entry = $this->a_formatting[$a];
-            }
-
-            /* 8. Perform a shallow clone of the element entry to obtain clone. */
-            $clone = $entry->cloneNode();
-
-            /* 9. Append clone to the current node and push it onto the stack
-            of open elements  so that it is the new current node. */
-            end($this->stack)->appendChild($clone);
-            $this->stack[] = $clone;
-
-            /* 10. Replace the entry for entry in the list with an entry for
-            clone. */
-            $this->a_formatting[$a] = $clone;
-
-            /* 11. If the entry for clone in the list of active formatting
-            elements is not the last entry in the list, return to step 7. */
-            if (end($this->a_formatting) !== $clone) {
-                $step_seven = true;
-            } else {
-                break;
-            }
-        }
-    }
-
-    private function clearTheActiveFormattingElementsUpToTheLastMarker()
-    {
-        /* When the steps below require the UA to clear the list of active
-        formatting elements up to the last marker, the UA must perform the
-        following steps: */
-
-        while (true) {
-            /* 1. Let entry be the last (most recently added) entry in the list
-            of active formatting elements. */
-            $entry = end($this->a_formatting);
-
-            /* 2. Remove entry from the list of active formatting elements. */
-            array_pop($this->a_formatting);
-
-            /* 3. If entry was a marker, then stop the algorithm at this point.
-            The list has been cleared up to the last marker. */
-            if ($entry === self::MARKER) {
-                break;
-            }
-        }
-    }
-
-    private function generateImpliedEndTags($exclude = array())
-    {
-        /* When the steps below require the UA to generate implied end tags,
-        then, if the current node is a dd element, a dt element, an li element,
-        a p element, a td element, a th  element, or a tr element, the UA must
-        act as if an end tag with the respective tag name had been seen and
-        then generate implied end tags again. */
-        $node = end($this->stack);
-        $elements = array_diff(array('dd', 'dt', 'li', 'p', 'td', 'th', 'tr'), $exclude);
-
-        while (in_array(end($this->stack)->nodeName, $elements)) {
-            array_pop($this->stack);
-        }
-    }
-
-    private function getElementCategory($node)
-    {
-        $name = $node->tagName;
-        if (in_array($name, $this->special)) {
-            return self::SPECIAL;
-        } elseif (in_array($name, $this->scoping)) {
-            return self::SCOPING;
-        } elseif (in_array($name, $this->formatting)) {
-            return self::FORMATTING;
-        } else {
-            return self::PHRASING;
-        }
-    }
-
-    private function clearStackToTableContext($elements)
-    {
-        /* When the steps above require the UA to clear the stack back to a
-        table context, it means that the UA must, while the current node is not
-        a table element or an html element, pop elements from the stack of open
-        elements. If this causes any elements to be popped from the stack, then
-        this is a parse error. */
-        while (true) {
-            $node = end($this->stack)->nodeName;
-
-            if (in_array($node, $elements)) {
-                break;
-            } else {
-                array_pop($this->stack);
-            }
-        }
-    }
-
-    private function resetInsertionMode()
-    {
-        /* 1. Let last be false. */
-        $last = false;
-        $leng = count($this->stack);
-
-        for ($n = $leng - 1; $n >= 0; $n--) {
-            /* 2. Let node be the last node in the stack of open elements. */
-            $node = $this->stack[$n];
-
-            /* 3. If node is the first node in the stack of open elements, then
-            set last to true. If the element whose innerHTML  attribute is being
-            set is neither a td  element nor a th element, then set node to the
-            element whose innerHTML  attribute is being set. (innerHTML  case) */
-            if ($this->stack[0]->isSameNode($node)) {
-                $last = true;
-            }
-
-            /* 4. If node is a select element, then switch the insertion mode to
-            "in select" and abort these steps. (innerHTML case) */
-            if ($node->nodeName === 'select') {
-                $this->mode = self::IN_SELECT;
-                break;
-
-                /* 5. If node is a td or th element, then switch the insertion mode
-                to "in cell" and abort these steps. */
-            } elseif ($node->nodeName === 'td' || $node->nodeName === 'th') {
-                $this->mode = self::IN_CELL;
-                break;
-
-                /* 6. If node is a tr element, then switch the insertion mode to
-                "in    row" and abort these steps. */
-            } elseif ($node->nodeName === 'tr') {
-                $this->mode = self::IN_ROW;
-                break;
-
-                /* 7. If node is a tbody, thead, or tfoot element, then switch the
-                insertion mode to "in table body" and abort these steps. */
-            } elseif (in_array($node->nodeName, array('tbody', 'thead', 'tfoot'))) {
-                $this->mode = self::IN_TBODY;
-                break;
-
-                /* 8. If node is a caption element, then switch the insertion mode
-                to "in caption" and abort these steps. */
-            } elseif ($node->nodeName === 'caption') {
-                $this->mode = self::IN_CAPTION;
-                break;
-
-                /* 9. If node is a colgroup element, then switch the insertion mode
-                to "in column group" and abort these steps. (innerHTML case) */
-            } elseif ($node->nodeName === 'colgroup') {
-                $this->mode = self::IN_CGROUP;
-                break;
-
-                /* 10. If node is a table element, then switch the insertion mode
-                to "in table" and abort these steps. */
-            } elseif ($node->nodeName === 'table') {
-                $this->mode = self::IN_TABLE;
-                break;
-
-                /* 11. If node is a head element, then switch the insertion mode
-                to "in body" ("in body"! not "in head"!) and abort these steps.
-                (innerHTML case) */
-            } elseif ($node->nodeName === 'head') {
-                $this->mode = self::IN_BODY;
-                break;
-
-                /* 12. If node is a body element, then switch the insertion mode to
-                "in body" and abort these steps. */
-            } elseif ($node->nodeName === 'body') {
-                $this->mode = self::IN_BODY;
-                break;
-
-                /* 13. If node is a frameset element, then switch the insertion
-                mode to "in frameset" and abort these steps. (innerHTML case) */
-            } elseif ($node->nodeName === 'frameset') {
-                $this->mode = self::IN_FRAME;
-                break;
-
-                /* 14. If node is an html element, then: if the head element
-                pointer is null, switch the insertion mode to "before head",
-                otherwise, switch the insertion mode to "after head". In either
-                case, abort these steps. (innerHTML case) */
-            } elseif ($node->nodeName === 'html') {
-                $this->mode = ($this->head_pointer === null)
-                    ? self::BEFOR_HEAD
-                    : self::AFTER_HEAD;
-
-                break;
-
-                /* 15. If last is true, then set the insertion mode to "in body"
-                and    abort these steps. (innerHTML case) */
-            } elseif ($last) {
-                $this->mode = self::IN_BODY;
-                break;
-            }
-        }
-    }
-
-    private function closeCell()
-    {
-        /* If the stack of open elements has a td or th element in table scope,
-        then act as if an end tag token with that tag name had been seen. */
-        foreach (array('td', 'th') as $cell) {
-            if ($this->elementInScope($cell, true)) {
-                $this->inCell(
-                    array(
-                        'name' => $cell,
-                        'type' => HTML5::ENDTAG
-                    )
-                );
-
-                break;
-            }
-        }
-    }
-
-    public function save()
-    {
-        return $this->dom;
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Node.php b/libraries/htmlpurifier410/library/HTMLPurifier/Node.php
deleted file mode 100644
index d7dcf6239..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Node.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * Abstract base node class that all others inherit from.
- *
- * Why do we not use the DOM extension?  (1) It is not always available,
- * (2) it has funny constraints on the data it can represent,
- * whereas we want a maximally flexible representation, and (3) its
- * interface is a bit cumbersome.
- */
-abstract class HTMLPurifier_Node
-{
-    /**
-     * Line number of the start token in the source document
-     * @type int
-     */
-    public $line;
-
-    /**
-     * Column number of the start token in the source document. Null if unknown.
-     * @type int
-     */
-    public $col;
-
-    /**
-     * Lookup array of processing that this token is exempt from.
-     * Currently, valid values are "ValidateAttributes".
-     * @type array
-     */
-    public $armor = array();
-
-    /**
-     * When true, this node should be ignored as non-existent.
-     *
-     * Who is responsible for ignoring dead nodes?  FixNesting is
-     * responsible for removing them before passing on to child
-     * validators.
-     */
-    public $dead = false;
-
-    /**
-     * Returns a pair of start and end tokens, where the end token
-     * is null if it is not necessary. Does not include children.
-     * @type array
-     */
-    abstract public function toTokenPair();
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Node/Comment.php b/libraries/htmlpurifier410/library/HTMLPurifier/Node/Comment.php
deleted file mode 100644
index 11f3245d8..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Node/Comment.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Concrete comment node class.
- */
-class HTMLPurifier_Node_Comment extends HTMLPurifier_Node
-{
-    /**
-     * Character data within comment.
-     * @type string
-     */
-    public $data;
-
-    /**
-     * @type bool
-     */
-    public $is_whitespace = true;
-
-    /**
-     * Transparent constructor.
-     *
-     * @param string $data String comment data.
-     * @param int $line
-     * @param int $col
-     */
-    public function __construct($data, $line = null, $col = null)
-    {
-        $this->data = $data;
-        $this->line = $line;
-        $this->col = $col;
-    }
-
-    public function toTokenPair() {
-        return array(new HTMLPurifier_Token_Comment($this->data, $this->line, $this->col), null);
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Node/Element.php b/libraries/htmlpurifier410/library/HTMLPurifier/Node/Element.php
deleted file mode 100644
index 7db4d0253..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Node/Element.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-/**
- * Concrete element node class.
- */
-class HTMLPurifier_Node_Element extends HTMLPurifier_Node
-{
-    /**
-     * The lower-case name of the tag, like 'a', 'b' or 'blockquote'.
-     *
-     * @note Strictly speaking, XML tags are case sensitive, so we shouldn't
-     * be lower-casing them, but these tokens cater to HTML tags, which are
-     * insensitive.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * Associative array of the node's attributes.
-     * @type array
-     */
-    public $attr = array();
-
-    /**
-     * List of child elements.
-     * @type array
-     */
-    public $children = array();
-
-    /**
-     * Does this use the <a></a> form or the </a> form, i.e.
-     * is it a pair of start/end tokens or an empty token.
-     * @bool
-     */
-    public $empty = false;
-
-    public $endCol = null, $endLine = null, $endArmor = array();
-
-    public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array()) {
-        $this->name = $name;
-        $this->attr = $attr;
-        $this->line = $line;
-        $this->col = $col;
-        $this->armor = $armor;
-    }
-
-    public function toTokenPair() {
-        // XXX inefficiency here, normalization is not necessary
-        if ($this->empty) {
-            return array(new HTMLPurifier_Token_Empty($this->name, $this->attr, $this->line, $this->col, $this->armor), null);
-        } else {
-            $start = new HTMLPurifier_Token_Start($this->name, $this->attr, $this->line, $this->col, $this->armor);
-            $end = new HTMLPurifier_Token_End($this->name, array(), $this->endLine, $this->endCol, $this->endArmor);
-            //$end->start = $start;
-            return array($start, $end);
-        }
-    }
-}
-
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Node/Text.php b/libraries/htmlpurifier410/library/HTMLPurifier/Node/Text.php
deleted file mode 100644
index f51d861af..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Node/Text.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * Concrete text token class.
- *
- * Text tokens comprise of regular parsed character data (PCDATA) and raw
- * character data (from the CDATA sections). Internally, their
- * data is parsed with all entities expanded. Surprisingly, the text token
- * does have a "tag name" called #PCDATA, which is how the DTD represents it
- * in permissible child nodes.
- */
-class HTMLPurifier_Node_Text extends HTMLPurifier_Node
-{
-
-    /**
-     * PCDATA tag name compatible with DTD, see
-     * HTMLPurifier_ChildDef_Custom for details.
-     * @type string
-     */
-    public $name = '#PCDATA';
-
-    /**
-     * @type string
-     */
-    public $data;
-    /**< Parsed character data of text. */
-
-    /**
-     * @type bool
-     */
-    public $is_whitespace;
-
-    /**< Bool indicating if node is whitespace. */
-
-    /**
-     * Constructor, accepts data and determines if it is whitespace.
-     * @param string $data String parsed character data.
-     * @param int $line
-     * @param int $col
-     */
-    public function __construct($data, $is_whitespace, $line = null, $col = null)
-    {
-        $this->data = $data;
-        $this->is_whitespace = $is_whitespace;
-        $this->line = $line;
-        $this->col = $col;
-    }
-
-    public function toTokenPair() {
-        return array(new HTMLPurifier_Token_Text($this->data, $this->line, $this->col), null);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/PercentEncoder.php b/libraries/htmlpurifier410/library/HTMLPurifier/PercentEncoder.php
deleted file mode 100644
index fb9fd1fc9..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/PercentEncoder.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * Class that handles operations involving percent-encoding in URIs.
- *
- * @warning
- *      Be careful when reusing instances of PercentEncoder. The object
- *      you use for normalize() SHOULD NOT be used for encode(), or
- *      vice-versa.
- */
-class HTMLPurifier_PercentEncoder
-{
-
-    /**
-     * Reserved characters to preserve when using encode().
-     * @type array
-     */
-    protected $preserve = array();
-
-    /**
-     * String of characters that should be preserved while using encode().
-     * @param bool $preserve
-     */
-    public function __construct($preserve = false)
-    {
-        // unreserved letters, ought to const-ify
-        for ($i = 48; $i <= 57; $i++) { // digits
-            $this->preserve[$i] = true;
-        }
-        for ($i = 65; $i <= 90; $i++) { // upper-case
-            $this->preserve[$i] = true;
-        }
-        for ($i = 97; $i <= 122; $i++) { // lower-case
-            $this->preserve[$i] = true;
-        }
-        $this->preserve[45] = true; // Dash         -
-        $this->preserve[46] = true; // Period       .
-        $this->preserve[95] = true; // Underscore   _
-        $this->preserve[126]= true; // Tilde        ~
-
-        // extra letters not to escape
-        if ($preserve !== false) {
-            for ($i = 0, $c = strlen($preserve); $i < $c; $i++) {
-                $this->preserve[ord($preserve[$i])] = true;
-            }
-        }
-    }
-
-    /**
-     * Our replacement for urlencode, it encodes all non-reserved characters,
-     * as well as any extra characters that were instructed to be preserved.
-     * @note
-     *      Assumes that the string has already been normalized, making any
-     *      and all percent escape sequences valid. Percents will not be
-     *      re-escaped, regardless of their status in $preserve
-     * @param string $string String to be encoded
-     * @return string Encoded string.
-     */
-    public function encode($string)
-    {
-        $ret = '';
-        for ($i = 0, $c = strlen($string); $i < $c; $i++) {
-            if ($string[$i] !== '%' && !isset($this->preserve[$int = ord($string[$i])])) {
-                $ret .= '%' . sprintf('%02X', $int);
-            } else {
-                $ret .= $string[$i];
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Fix up percent-encoding by decoding unreserved characters and normalizing.
-     * @warning This function is affected by $preserve, even though the
-     *          usual desired behavior is for this not to preserve those
-     *          characters. Be careful when reusing instances of PercentEncoder!
-     * @param string $string String to normalize
-     * @return string
-     */
-    public function normalize($string)
-    {
-        if ($string == '') {
-            return '';
-        }
-        $parts = explode('%', $string);
-        $ret = array_shift($parts);
-        foreach ($parts as $part) {
-            $length = strlen($part);
-            if ($length < 2) {
-                $ret .= '%25' . $part;
-                continue;
-            }
-            $encoding = substr($part, 0, 2);
-            $text     = substr($part, 2);
-            if (!ctype_xdigit($encoding)) {
-                $ret .= '%25' . $part;
-                continue;
-            }
-            $int = hexdec($encoding);
-            if (isset($this->preserve[$int])) {
-                $ret .= chr($int) . $text;
-                continue;
-            }
-            $encoding = strtoupper($encoding);
-            $ret .= '%' . $encoding . $text;
-        }
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Printer.php b/libraries/htmlpurifier410/library/HTMLPurifier/Printer.php
deleted file mode 100644
index 16acd4157..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Printer.php
+++ /dev/null
@@ -1,218 +0,0 @@
-<?php
-
-// OUT OF DATE, NEEDS UPDATING!
-// USE XMLWRITER!
-
-class HTMLPurifier_Printer
-{
-
-    /**
-     * For HTML generation convenience funcs.
-     * @type HTMLPurifier_Generator
-     */
-    protected $generator;
-
-    /**
-     * For easy access.
-     * @type HTMLPurifier_Config
-     */
-    protected $config;
-
-    /**
-     * Initialize $generator.
-     */
-    public function __construct()
-    {
-    }
-
-    /**
-     * Give generator necessary configuration if possible
-     * @param HTMLPurifier_Config $config
-     */
-    public function prepareGenerator($config)
-    {
-        $all = $config->getAll();
-        $context = new HTMLPurifier_Context();
-        $this->generator = new HTMLPurifier_Generator($config, $context);
-    }
-
-    /**
-     * Main function that renders object or aspect of that object
-     * @note Parameters vary depending on printer
-     */
-    // function render() {}
-
-    /**
-     * Returns a start tag
-     * @param string $tag Tag name
-     * @param array $attr Attribute array
-     * @return string
-     */
-    protected function start($tag, $attr = array())
-    {
-        return $this->generator->generateFromToken(
-            new HTMLPurifier_Token_Start($tag, $attr ? $attr : array())
-        );
-    }
-
-    /**
-     * Returns an end tag
-     * @param string $tag Tag name
-     * @return string
-     */
-    protected function end($tag)
-    {
-        return $this->generator->generateFromToken(
-            new HTMLPurifier_Token_End($tag)
-        );
-    }
-
-    /**
-     * Prints a complete element with content inside
-     * @param string $tag Tag name
-     * @param string $contents Element contents
-     * @param array $attr Tag attributes
-     * @param bool $escape whether or not to escape contents
-     * @return string
-     */
-    protected function element($tag, $contents, $attr = array(), $escape = true)
-    {
-        return $this->start($tag, $attr) .
-            ($escape ? $this->escape($contents) : $contents) .
-            $this->end($tag);
-    }
-
-    /**
-     * @param string $tag
-     * @param array $attr
-     * @return string
-     */
-    protected function elementEmpty($tag, $attr = array())
-    {
-        return $this->generator->generateFromToken(
-            new HTMLPurifier_Token_Empty($tag, $attr)
-        );
-    }
-
-    /**
-     * @param string $text
-     * @return string
-     */
-    protected function text($text)
-    {
-        return $this->generator->generateFromToken(
-            new HTMLPurifier_Token_Text($text)
-        );
-    }
-
-    /**
-     * Prints a simple key/value row in a table.
-     * @param string $name Key
-     * @param mixed $value Value
-     * @return string
-     */
-    protected function row($name, $value)
-    {
-        if (is_bool($value)) {
-            $value = $value ? 'On' : 'Off';
-        }
-        return
-            $this->start('tr') . "\n" .
-            $this->element('th', $name) . "\n" .
-            $this->element('td', $value) . "\n" .
-            $this->end('tr');
-    }
-
-    /**
-     * Escapes a string for HTML output.
-     * @param string $string String to escape
-     * @return string
-     */
-    protected function escape($string)
-    {
-        $string = HTMLPurifier_Encoder::cleanUTF8($string);
-        $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
-        return $string;
-    }
-
-    /**
-     * Takes a list of strings and turns them into a single list
-     * @param string[] $array List of strings
-     * @param bool $polite Bool whether or not to add an end before the last
-     * @return string
-     */
-    protected function listify($array, $polite = false)
-    {
-        if (empty($array)) {
-            return 'None';
-        }
-        $ret = '';
-        $i = count($array);
-        foreach ($array as $value) {
-            $i--;
-            $ret .= $value;
-            if ($i > 0 && !($polite && $i == 1)) {
-                $ret .= ', ';
-            }
-            if ($polite && $i == 1) {
-                $ret .= 'and ';
-            }
-        }
-        return $ret;
-    }
-
-    /**
-     * Retrieves the class of an object without prefixes, as well as metadata
-     * @param object $obj Object to determine class of
-     * @param string $sec_prefix Further prefix to remove
-     * @return string
-     */
-    protected function getClass($obj, $sec_prefix = '')
-    {
-        static $five = null;
-        if ($five === null) {
-            $five = version_compare(PHP_VERSION, '5', '>=');
-        }
-        $prefix = 'HTMLPurifier_' . $sec_prefix;
-        if (!$five) {
-            $prefix = strtolower($prefix);
-        }
-        $class = str_replace($prefix, '', get_class($obj));
-        $lclass = strtolower($class);
-        $class .= '(';
-        switch ($lclass) {
-            case 'enum':
-                $values = array();
-                foreach ($obj->valid_values as $value => $bool) {
-                    $values[] = $value;
-                }
-                $class .= implode(', ', $values);
-                break;
-            case 'css_composite':
-                $values = array();
-                foreach ($obj->defs as $def) {
-                    $values[] = $this->getClass($def, $sec_prefix);
-                }
-                $class .= implode(', ', $values);
-                break;
-            case 'css_multiple':
-                $class .= $this->getClass($obj->single, $sec_prefix) . ', ';
-                $class .= $obj->max;
-                break;
-            case 'css_denyelementdecorator':
-                $class .= $this->getClass($obj->def, $sec_prefix) . ', ';
-                $class .= $obj->element;
-                break;
-            case 'css_importantdecorator':
-                $class .= $this->getClass($obj->def, $sec_prefix);
-                if ($obj->allow) {
-                    $class .= ', !important';
-                }
-                break;
-        }
-        $class .= ')';
-        return $class;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/CSSDefinition.php b/libraries/htmlpurifier410/library/HTMLPurifier/Printer/CSSDefinition.php
deleted file mode 100644
index afc8c18ab..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/CSSDefinition.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-class HTMLPurifier_Printer_CSSDefinition extends HTMLPurifier_Printer
-{
-    /**
-     * @type HTMLPurifier_CSSDefinition
-     */
-    protected $def;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return string
-     */
-    public function render($config)
-    {
-        $this->def = $config->getCSSDefinition();
-        $ret = '';
-
-        $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));
-        $ret .= $this->start('table');
-
-        $ret .= $this->element('caption', 'Properties ($info)');
-
-        $ret .= $this->start('thead');
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', 'Property', array('class' => 'heavy'));
-        $ret .= $this->element('th', 'Definition', array('class' => 'heavy', 'style' => 'width:auto;'));
-        $ret .= $this->end('tr');
-        $ret .= $this->end('thead');
-
-        ksort($this->def->info);
-        foreach ($this->def->info as $property => $obj) {
-            $name = $this->getClass($obj, 'AttrDef_');
-            $ret .= $this->row($property, $name);
-        }
-
-        $ret .= $this->end('table');
-        $ret .= $this->end('div');
-
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.css b/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.css
deleted file mode 100644
index 7af30fc3a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.css
+++ /dev/null
@@ -1,10 +0,0 @@
-
-.hp-config {}
-
-.hp-config tbody th {text-align:right; padding-right:0.5em;}
-.hp-config thead, .hp-config .namespace {background:#3C578C; color:#FFF;}
-.hp-config .namespace th {text-align:center;}
-.hp-config .verbose {display:none;}
-.hp-config .controls {text-align:center;}
-
-/* vim: et sw=4 sts=4 */
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.js b/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.js
deleted file mode 100644
index 83e065531..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function toggleWriteability(id_of_patient, checked) {
-    document.getElementById(id_of_patient).disabled = checked;
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.php b/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.php
deleted file mode 100644
index 3bc417366..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/ConfigForm.php
+++ /dev/null
@@ -1,451 +0,0 @@
-<?php
-
-/**
- * @todo Rewrite to use Interchange objects
- */
-class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
-{
-
-    /**
-     * Printers for specific fields.
-     * @type HTMLPurifier_Printer[]
-     */
-    protected $fields = array();
-
-    /**
-     * Documentation URL, can have fragment tagged on end.
-     * @type string
-     */
-    protected $docURL;
-
-    /**
-     * Name of form element to stuff config in.
-     * @type string
-     */
-    protected $name;
-
-    /**
-     * Whether or not to compress directive names, clipping them off
-     * after a certain amount of letters. False to disable or integer letters
-     * before clipping.
-     * @type bool
-     */
-    protected $compress = false;
-
-    /**
-     * @param string $name Form element name for directives to be stuffed into
-     * @param string $doc_url String documentation URL, will have fragment tagged on
-     * @param bool $compress Integer max length before compressing a directive name, set to false to turn off
-     */
-    public function __construct(
-        $name,
-        $doc_url = null,
-        $compress = false
-    ) {
-        parent::__construct();
-        $this->docURL = $doc_url;
-        $this->name = $name;
-        $this->compress = $compress;
-        // initialize sub-printers
-        $this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default();
-        $this->fields[HTMLPurifier_VarParser::BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
-    }
-
-    /**
-     * Sets default column and row size for textareas in sub-printers
-     * @param $cols Integer columns of textarea, null to use default
-     * @param $rows Integer rows of textarea, null to use default
-     */
-    public function setTextareaDimensions($cols = null, $rows = null)
-    {
-        if ($cols) {
-            $this->fields['default']->cols = $cols;
-        }
-        if ($rows) {
-            $this->fields['default']->rows = $rows;
-        }
-    }
-
-    /**
-     * Retrieves styling, in case it is not accessible by webserver
-     */
-    public static function getCSS()
-    {
-        return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');
-    }
-
-    /**
-     * Retrieves JavaScript, in case it is not accessible by webserver
-     */
-    public static function getJavaScript()
-    {
-        return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js');
-    }
-
-    /**
-     * Returns HTML output for a configuration form
-     * @param HTMLPurifier_Config|array $config Configuration object of current form state, or an array
-     *        where [0] has an HTML namespace and [1] is being rendered.
-     * @param array|bool $allowed Optional namespace(s) and directives to restrict form to.
-     * @param bool $render_controls
-     * @return string
-     */
-    public function render($config, $allowed = true, $render_controls = true)
-    {
-        if (is_array($config) && isset($config[0])) {
-            $gen_config = $config[0];
-            $config = $config[1];
-        } else {
-            $gen_config = $config;
-        }
-
-        $this->config = $config;
-        $this->genConfig = $gen_config;
-        $this->prepareGenerator($gen_config);
-
-        $allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $config->def);
-        $all = array();
-        foreach ($allowed as $key) {
-            list($ns, $directive) = $key;
-            $all[$ns][$directive] = $config->get($ns . '.' . $directive);
-        }
-
-        $ret = '';
-        $ret .= $this->start('table', array('class' => 'hp-config'));
-        $ret .= $this->start('thead');
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', 'Directive', array('class' => 'hp-directive'));
-        $ret .= $this->element('th', 'Value', array('class' => 'hp-value'));
-        $ret .= $this->end('tr');
-        $ret .= $this->end('thead');
-        foreach ($all as $ns => $directives) {
-            $ret .= $this->renderNamespace($ns, $directives);
-        }
-        if ($render_controls) {
-            $ret .= $this->start('tbody');
-            $ret .= $this->start('tr');
-            $ret .= $this->start('td', array('colspan' => 2, 'class' => 'controls'));
-            $ret .= $this->elementEmpty('input', array('type' => 'submit', 'value' => 'Submit'));
-            $ret .= '[<a href="?">Reset</a>]';
-            $ret .= $this->end('td');
-            $ret .= $this->end('tr');
-            $ret .= $this->end('tbody');
-        }
-        $ret .= $this->end('table');
-        return $ret;
-    }
-
-    /**
-     * Renders a single namespace
-     * @param $ns String namespace name
-     * @param array $directives array of directives to values
-     * @return string
-     */
-    protected function renderNamespace($ns, $directives)
-    {
-        $ret = '';
-        $ret .= $this->start('tbody', array('class' => 'namespace'));
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', $ns, array('colspan' => 2));
-        $ret .= $this->end('tr');
-        $ret .= $this->end('tbody');
-        $ret .= $this->start('tbody');
-        foreach ($directives as $directive => $value) {
-            $ret .= $this->start('tr');
-            $ret .= $this->start('th');
-            if ($this->docURL) {
-                $url = str_replace('%s', urlencode("$ns.$directive"), $this->docURL);
-                $ret .= $this->start('a', array('href' => $url));
-            }
-            $attr = array('for' => "{$this->name}:$ns.$directive");
-
-            // crop directive name if it's too long
-            if (!$this->compress || (strlen($directive) < $this->compress)) {
-                $directive_disp = $directive;
-            } else {
-                $directive_disp = substr($directive, 0, $this->compress - 2) . '...';
-                $attr['title'] = $directive;
-            }
-
-            $ret .= $this->element(
-                'label',
-                $directive_disp,
-                // component printers must create an element with this id
-                $attr
-            );
-            if ($this->docURL) {
-                $ret .= $this->end('a');
-            }
-            $ret .= $this->end('th');
-
-            $ret .= $this->start('td');
-            $def = $this->config->def->info["$ns.$directive"];
-            if (is_int($def)) {
-                $allow_null = $def < 0;
-                $type = abs($def);
-            } else {
-                $type = $def->type;
-                $allow_null = isset($def->allow_null);
-            }
-            if (!isset($this->fields[$type])) {
-                $type = 0;
-            } // default
-            $type_obj = $this->fields[$type];
-            if ($allow_null) {
-                $type_obj = new HTMLPurifier_Printer_ConfigForm_NullDecorator($type_obj);
-            }
-            $ret .= $type_obj->render($ns, $directive, $value, $this->name, array($this->genConfig, $this->config));
-            $ret .= $this->end('td');
-            $ret .= $this->end('tr');
-        }
-        $ret .= $this->end('tbody');
-        return $ret;
-    }
-
-}
-
-/**
- * Printer decorator for directives that accept null
- */
-class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer
-{
-    /**
-     * Printer being decorated
-     * @type HTMLPurifier_Printer
-     */
-    protected $obj;
-
-    /**
-     * @param HTMLPurifier_Printer $obj Printer to decorate
-     */
-    public function __construct($obj)
-    {
-        parent::__construct();
-        $this->obj = $obj;
-    }
-
-    /**
-     * @param string $ns
-     * @param string $directive
-     * @param string $value
-     * @param string $name
-     * @param HTMLPurifier_Config|array $config
-     * @return string
-     */
-    public function render($ns, $directive, $value, $name, $config)
-    {
-        if (is_array($config) && isset($config[0])) {
-            $gen_config = $config[0];
-            $config = $config[1];
-        } else {
-            $gen_config = $config;
-        }
-        $this->prepareGenerator($gen_config);
-
-        $ret = '';
-        $ret .= $this->start('label', array('for' => "$name:Null_$ns.$directive"));
-        $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
-        $ret .= $this->text(' Null/Disabled');
-        $ret .= $this->end('label');
-        $attr = array(
-            'type' => 'checkbox',
-            'value' => '1',
-            'class' => 'null-toggle',
-            'name' => "$name" . "[Null_$ns.$directive]",
-            'id' => "$name:Null_$ns.$directive",
-            'onclick' => "toggleWriteability('$name:$ns.$directive',checked)" // INLINE JAVASCRIPT!!!!
-        );
-        if ($this->obj instanceof HTMLPurifier_Printer_ConfigForm_bool) {
-            // modify inline javascript slightly
-            $attr['onclick'] =
-                "toggleWriteability('$name:Yes_$ns.$directive',checked);" .
-                "toggleWriteability('$name:No_$ns.$directive',checked)";
-        }
-        if ($value === null) {
-            $attr['checked'] = 'checked';
-        }
-        $ret .= $this->elementEmpty('input', $attr);
-        $ret .= $this->text(' or ');
-        $ret .= $this->elementEmpty('br');
-        $ret .= $this->obj->render($ns, $directive, $value, $name, array($gen_config, $config));
-        return $ret;
-    }
-}
-
-/**
- * Swiss-army knife configuration form field printer
- */
-class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer
-{
-    /**
-     * @type int
-     */
-    public $cols = 18;
-
-    /**
-     * @type int
-     */
-    public $rows = 5;
-
-    /**
-     * @param string $ns
-     * @param string $directive
-     * @param string $value
-     * @param string $name
-     * @param HTMLPurifier_Config|array $config
-     * @return string
-     */
-    public function render($ns, $directive, $value, $name, $config)
-    {
-        if (is_array($config) && isset($config[0])) {
-            $gen_config = $config[0];
-            $config = $config[1];
-        } else {
-            $gen_config = $config;
-        }
-        $this->prepareGenerator($gen_config);
-        // this should probably be split up a little
-        $ret = '';
-        $def = $config->def->info["$ns.$directive"];
-        if (is_int($def)) {
-            $type = abs($def);
-        } else {
-            $type = $def->type;
-        }
-        if (is_array($value)) {
-            switch ($type) {
-                case HTMLPurifier_VarParser::LOOKUP:
-                    $array = $value;
-                    $value = array();
-                    foreach ($array as $val => $b) {
-                        $value[] = $val;
-                    }
-                    //TODO does this need a break?
-                case HTMLPurifier_VarParser::ALIST:
-                    $value = implode(PHP_EOL, $value);
-                    break;
-                case HTMLPurifier_VarParser::HASH:
-                    $nvalue = '';
-                    foreach ($value as $i => $v) {
-                        if (is_array($v)) {
-                            // HACK
-                            $v = implode(";", $v);
-                        }
-                        $nvalue .= "$i:$v" . PHP_EOL;
-                    }
-                    $value = $nvalue;
-                    break;
-                default:
-                    $value = '';
-            }
-        }
-        if ($type === HTMLPurifier_VarParser::MIXED) {
-            return 'Not supported';
-            $value = serialize($value);
-        }
-        $attr = array(
-            'name' => "$name" . "[$ns.$directive]",
-            'id' => "$name:$ns.$directive"
-        );
-        if ($value === null) {
-            $attr['disabled'] = 'disabled';
-        }
-        if (isset($def->allowed)) {
-            $ret .= $this->start('select', $attr);
-            foreach ($def->allowed as $val => $b) {
-                $attr = array();
-                if ($value == $val) {
-                    $attr['selected'] = 'selected';
-                }
-                $ret .= $this->element('option', $val, $attr);
-            }
-            $ret .= $this->end('select');
-        } elseif ($type === HTMLPurifier_VarParser::TEXT ||
-                $type === HTMLPurifier_VarParser::ITEXT ||
-                $type === HTMLPurifier_VarParser::ALIST ||
-                $type === HTMLPurifier_VarParser::HASH ||
-                $type === HTMLPurifier_VarParser::LOOKUP) {
-            $attr['cols'] = $this->cols;
-            $attr['rows'] = $this->rows;
-            $ret .= $this->start('textarea', $attr);
-            $ret .= $this->text($value);
-            $ret .= $this->end('textarea');
-        } else {
-            $attr['value'] = $value;
-            $attr['type'] = 'text';
-            $ret .= $this->elementEmpty('input', $attr);
-        }
-        return $ret;
-    }
-}
-
-/**
- * Bool form field printer
- */
-class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer
-{
-    /**
-     * @param string $ns
-     * @param string $directive
-     * @param string $value
-     * @param string $name
-     * @param HTMLPurifier_Config|array $config
-     * @return string
-     */
-    public function render($ns, $directive, $value, $name, $config)
-    {
-        if (is_array($config) && isset($config[0])) {
-            $gen_config = $config[0];
-            $config = $config[1];
-        } else {
-            $gen_config = $config;
-        }
-        $this->prepareGenerator($gen_config);
-        $ret = '';
-        $ret .= $this->start('div', array('id' => "$name:$ns.$directive"));
-
-        $ret .= $this->start('label', array('for' => "$name:Yes_$ns.$directive"));
-        $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
-        $ret .= $this->text(' Yes');
-        $ret .= $this->end('label');
-
-        $attr = array(
-            'type' => 'radio',
-            'name' => "$name" . "[$ns.$directive]",
-            'id' => "$name:Yes_$ns.$directive",
-            'value' => '1'
-        );
-        if ($value === true) {
-            $attr['checked'] = 'checked';
-        }
-        if ($value === null) {
-            $attr['disabled'] = 'disabled';
-        }
-        $ret .= $this->elementEmpty('input', $attr);
-
-        $ret .= $this->start('label', array('for' => "$name:No_$ns.$directive"));
-        $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
-        $ret .= $this->text(' No');
-        $ret .= $this->end('label');
-
-        $attr = array(
-            'type' => 'radio',
-            'name' => "$name" . "[$ns.$directive]",
-            'id' => "$name:No_$ns.$directive",
-            'value' => '0'
-        );
-        if ($value === false) {
-            $attr['checked'] = 'checked';
-        }
-        if ($value === null) {
-            $attr['disabled'] = 'disabled';
-        }
-        $ret .= $this->elementEmpty('input', $attr);
-
-        $ret .= $this->end('div');
-
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/HTMLDefinition.php b/libraries/htmlpurifier410/library/HTMLPurifier/Printer/HTMLDefinition.php
deleted file mode 100644
index c18cd95d5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Printer/HTMLDefinition.php
+++ /dev/null
@@ -1,324 +0,0 @@
-<?php
-
-class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
-{
-
-    /**
-     * @type HTMLPurifier_HTMLDefinition, for easy access
-     */
-    protected $def;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return string
-     */
-    public function render($config)
-    {
-        $ret = '';
-        $this->config =& $config;
-
-        $this->def = $config->getHTMLDefinition();
-
-        $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));
-
-        $ret .= $this->renderDoctype();
-        $ret .= $this->renderEnvironment();
-        $ret .= $this->renderContentSets();
-        $ret .= $this->renderInfo();
-
-        $ret .= $this->end('div');
-
-        return $ret;
-    }
-
-    /**
-     * Renders the Doctype table
-     * @return string
-     */
-    protected function renderDoctype()
-    {
-        $doctype = $this->def->doctype;
-        $ret = '';
-        $ret .= $this->start('table');
-        $ret .= $this->element('caption', 'Doctype');
-        $ret .= $this->row('Name', $doctype->name);
-        $ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No');
-        $ret .= $this->row('Default Modules', implode(', ', $doctype->modules));
-        $ret .= $this->row('Default Tidy Modules', implode(', ', $doctype->tidyModules));
-        $ret .= $this->end('table');
-        return $ret;
-    }
-
-
-    /**
-     * Renders environment table, which is miscellaneous info
-     * @return string
-     */
-    protected function renderEnvironment()
-    {
-        $def = $this->def;
-
-        $ret = '';
-
-        $ret .= $this->start('table');
-        $ret .= $this->element('caption', 'Environment');
-
-        $ret .= $this->row('Parent of fragment', $def->info_parent);
-        $ret .= $this->renderChildren($def->info_parent_def->child);
-        $ret .= $this->row('Block wrap name', $def->info_block_wrapper);
-
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', 'Global attributes');
-        $ret .= $this->element('td', $this->listifyAttr($def->info_global_attr), null, 0);
-        $ret .= $this->end('tr');
-
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', 'Tag transforms');
-        $list = array();
-        foreach ($def->info_tag_transform as $old => $new) {
-            $new = $this->getClass($new, 'TagTransform_');
-            $list[] = "<$old> with $new";
-        }
-        $ret .= $this->element('td', $this->listify($list));
-        $ret .= $this->end('tr');
-
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', 'Pre-AttrTransform');
-        $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre));
-        $ret .= $this->end('tr');
-
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', 'Post-AttrTransform');
-        $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post));
-        $ret .= $this->end('tr');
-
-        $ret .= $this->end('table');
-        return $ret;
-    }
-
-    /**
-     * Renders the Content Sets table
-     * @return string
-     */
-    protected function renderContentSets()
-    {
-        $ret = '';
-        $ret .= $this->start('table');
-        $ret .= $this->element('caption', 'Content Sets');
-        foreach ($this->def->info_content_sets as $name => $lookup) {
-            $ret .= $this->heavyHeader($name);
-            $ret .= $this->start('tr');
-            $ret .= $this->element('td', $this->listifyTagLookup($lookup));
-            $ret .= $this->end('tr');
-        }
-        $ret .= $this->end('table');
-        return $ret;
-    }
-
-    /**
-     * Renders the Elements ($info) table
-     * @return string
-     */
-    protected function renderInfo()
-    {
-        $ret = '';
-        $ret .= $this->start('table');
-        $ret .= $this->element('caption', 'Elements ($info)');
-        ksort($this->def->info);
-        $ret .= $this->heavyHeader('Allowed tags', 2);
-        $ret .= $this->start('tr');
-        $ret .= $this->element('td', $this->listifyTagLookup($this->def->info), array('colspan' => 2));
-        $ret .= $this->end('tr');
-        foreach ($this->def->info as $name => $def) {
-            $ret .= $this->start('tr');
-            $ret .= $this->element('th', "<$name>", array('class' => 'heavy', 'colspan' => 2));
-            $ret .= $this->end('tr');
-            $ret .= $this->start('tr');
-            $ret .= $this->element('th', 'Inline content');
-            $ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No');
-            $ret .= $this->end('tr');
-            if (!empty($def->excludes)) {
-                $ret .= $this->start('tr');
-                $ret .= $this->element('th', 'Excludes');
-                $ret .= $this->element('td', $this->listifyTagLookup($def->excludes));
-                $ret .= $this->end('tr');
-            }
-            if (!empty($def->attr_transform_pre)) {
-                $ret .= $this->start('tr');
-                $ret .= $this->element('th', 'Pre-AttrTransform');
-                $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
-                $ret .= $this->end('tr');
-            }
-            if (!empty($def->attr_transform_post)) {
-                $ret .= $this->start('tr');
-                $ret .= $this->element('th', 'Post-AttrTransform');
-                $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
-                $ret .= $this->end('tr');
-            }
-            if (!empty($def->auto_close)) {
-                $ret .= $this->start('tr');
-                $ret .= $this->element('th', 'Auto closed by');
-                $ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
-                $ret .= $this->end('tr');
-            }
-            $ret .= $this->start('tr');
-            $ret .= $this->element('th', 'Allowed attributes');
-            $ret .= $this->element('td', $this->listifyAttr($def->attr), array(), 0);
-            $ret .= $this->end('tr');
-
-            if (!empty($def->required_attr)) {
-                $ret .= $this->row('Required attributes', $this->listify($def->required_attr));
-            }
-
-            $ret .= $this->renderChildren($def->child);
-        }
-        $ret .= $this->end('table');
-        return $ret;
-    }
-
-    /**
-     * Renders a row describing the allowed children of an element
-     * @param HTMLPurifier_ChildDef $def HTMLPurifier_ChildDef of pertinent element
-     * @return string
-     */
-    protected function renderChildren($def)
-    {
-        $context = new HTMLPurifier_Context();
-        $ret = '';
-        $ret .= $this->start('tr');
-        $elements = array();
-        $attr = array();
-        if (isset($def->elements)) {
-            if ($def->type == 'strictblockquote') {
-                $def->validateChildren(array(), $this->config, $context);
-            }
-            $elements = $def->elements;
-        }
-        if ($def->type == 'chameleon') {
-            $attr['rowspan'] = 2;
-        } elseif ($def->type == 'empty') {
-            $elements = array();
-        } elseif ($def->type == 'table') {
-            $elements = array_flip(
-                array(
-                    'col',
-                    'caption',
-                    'colgroup',
-                    'thead',
-                    'tfoot',
-                    'tbody',
-                    'tr'
-                )
-            );
-        }
-        $ret .= $this->element('th', 'Allowed children', $attr);
-
-        if ($def->type == 'chameleon') {
-
-            $ret .= $this->element(
-                'td',
-                '<em>Block</em>: ' .
-                $this->escape($this->listifyTagLookup($def->block->elements)),
-                null,
-                0
-            );
-            $ret .= $this->end('tr');
-            $ret .= $this->start('tr');
-            $ret .= $this->element(
-                'td',
-                '<em>Inline</em>: ' .
-                $this->escape($this->listifyTagLookup($def->inline->elements)),
-                null,
-                0
-            );
-
-        } elseif ($def->type == 'custom') {
-
-            $ret .= $this->element(
-                'td',
-                '<em>' . ucfirst($def->type) . '</em>: ' .
-                $def->dtd_regex
-            );
-
-        } else {
-            $ret .= $this->element(
-                'td',
-                '<em>' . ucfirst($def->type) . '</em>: ' .
-                $this->escape($this->listifyTagLookup($elements)),
-                null,
-                0
-            );
-        }
-        $ret .= $this->end('tr');
-        return $ret;
-    }
-
-    /**
-     * Listifies a tag lookup table.
-     * @param array $array Tag lookup array in form of array('tagname' => true)
-     * @return string
-     */
-    protected function listifyTagLookup($array)
-    {
-        ksort($array);
-        $list = array();
-        foreach ($array as $name => $discard) {
-            if ($name !== '#PCDATA' && !isset($this->def->info[$name])) {
-                continue;
-            }
-            $list[] = $name;
-        }
-        return $this->listify($list);
-    }
-
-    /**
-     * Listifies a list of objects by retrieving class names and internal state
-     * @param array $array List of objects
-     * @return string
-     * @todo Also add information about internal state
-     */
-    protected function listifyObjectList($array)
-    {
-        ksort($array);
-        $list = array();
-        foreach ($array as $obj) {
-            $list[] = $this->getClass($obj, 'AttrTransform_');
-        }
-        return $this->listify($list);
-    }
-
-    /**
-     * Listifies a hash of attributes to AttrDef classes
-     * @param array $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef)
-     * @return string
-     */
-    protected function listifyAttr($array)
-    {
-        ksort($array);
-        $list = array();
-        foreach ($array as $name => $obj) {
-            if ($obj === false) {
-                continue;
-            }
-            $list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
-        }
-        return $this->listify($list);
-    }
-
-    /**
-     * Creates a heavy header row
-     * @param string $text
-     * @param int $num
-     * @return string
-     */
-    protected function heavyHeader($text, $num = 1)
-    {
-        $ret = '';
-        $ret .= $this->start('tr');
-        $ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy'));
-        $ret .= $this->end('tr');
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/PropertyList.php b/libraries/htmlpurifier410/library/HTMLPurifier/PropertyList.php
deleted file mode 100644
index d27fd53ec..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/PropertyList.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/**
- * Generic property list implementation
- */
-class HTMLPurifier_PropertyList
-{
-    /**
-     * Internal data-structure for properties.
-     * @type array
-     */
-    protected $data = array();
-
-    /**
-     * Parent plist.
-     * @type HTMLPurifier_PropertyList
-     */
-    protected $parent;
-
-    /**
-     * Cache.
-     * @type array
-     */
-    protected $cache;
-
-    /**
-     * @param HTMLPurifier_PropertyList $parent Parent plist
-     */
-    public function __construct($parent = null)
-    {
-        $this->parent = $parent;
-    }
-
-    /**
-     * Recursively retrieves the value for a key
-     * @param string $name
-     * @throws HTMLPurifier_Exception
-     */
-    public function get($name)
-    {
-        if ($this->has($name)) {
-            return $this->data[$name];
-        }
-        // possible performance bottleneck, convert to iterative if necessary
-        if ($this->parent) {
-            return $this->parent->get($name);
-        }
-        throw new HTMLPurifier_Exception("Key '$name' not found");
-    }
-
-    /**
-     * Sets the value of a key, for this plist
-     * @param string $name
-     * @param mixed $value
-     */
-    public function set($name, $value)
-    {
-        $this->data[$name] = $value;
-    }
-
-    /**
-     * Returns true if a given key exists
-     * @param string $name
-     * @return bool
-     */
-    public function has($name)
-    {
-        return array_key_exists($name, $this->data);
-    }
-
-    /**
-     * Resets a value to the value of it's parent, usually the default. If
-     * no value is specified, the entire plist is reset.
-     * @param string $name
-     */
-    public function reset($name = null)
-    {
-        if ($name == null) {
-            $this->data = array();
-        } else {
-            unset($this->data[$name]);
-        }
-    }
-
-    /**
-     * Squashes this property list and all of its property lists into a single
-     * array, and returns the array. This value is cached by default.
-     * @param bool $force If true, ignores the cache and regenerates the array.
-     * @return array
-     */
-    public function squash($force = false)
-    {
-        if ($this->cache !== null && !$force) {
-            return $this->cache;
-        }
-        if ($this->parent) {
-            return $this->cache = array_merge($this->parent->squash($force), $this->data);
-        } else {
-            return $this->cache = $this->data;
-        }
-    }
-
-    /**
-     * Returns the parent plist.
-     * @return HTMLPurifier_PropertyList
-     */
-    public function getParent()
-    {
-        return $this->parent;
-    }
-
-    /**
-     * Sets the parent plist.
-     * @param HTMLPurifier_PropertyList $plist Parent plist
-     */
-    public function setParent($plist)
-    {
-        $this->parent = $plist;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/PropertyListIterator.php b/libraries/htmlpurifier410/library/HTMLPurifier/PropertyListIterator.php
deleted file mode 100644
index 1e707e2ae..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/PropertyListIterator.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-/**
- * Property list iterator. Do not instantiate this class directly.
- */
-class HTMLPurifier_PropertyListIterator extends FilterIterator
-{
-
-    /**
-     * @type int
-     */
-    protected $l;
-    /**
-     * @type string
-     */
-    protected $filter;
-
-    /**
-     * @param Iterator $iterator Array of data to iterate over
-     * @param string $filter Optional prefix to only allow values of
-     */
-    public function __construct(Iterator $iterator, $filter = null)
-    {
-        parent::__construct($iterator);
-        $this->l = strlen($filter);
-        $this->filter = $filter;
-    }
-
-    /**
-     * @return bool
-     */
-    public function accept()
-    {
-        $key = $this->getInnerIterator()->key();
-        if (strncmp($key, $this->filter, $this->l) !== 0) {
-            return false;
-        }
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Queue.php b/libraries/htmlpurifier410/library/HTMLPurifier/Queue.php
deleted file mode 100644
index a75894d45..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Queue.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/**
- * A simple array-backed queue, based off of the classic Okasaki
- * persistent amortized queue.  The basic idea is to maintain two
- * stacks: an input stack and an output stack.  When the output
- * stack runs out, reverse the input stack and use it as the output
- * stack.
- *
- * We don't use the SPL implementation because it's only supported
- * on PHP 5.3 and later.
- *
- * Exercise: Prove that push/pop on this queue take amortized O(1) time.
- *
- * Exercise: Extend this queue to be a deque, while preserving amortized
- * O(1) time.  Some care must be taken on rebalancing to avoid quadratic
- * behaviour caused by repeatedly shuffling data from the input stack
- * to the output stack and back.
- */
-class HTMLPurifier_Queue {
-    private $input;
-    private $output;
-
-    public function __construct($input = array()) {
-        $this->input = $input;
-        $this->output = array();
-    }
-
-    /**
-     * Shifts an element off the front of the queue.
-     */
-    public function shift() {
-        if (empty($this->output)) {
-            $this->output = array_reverse($this->input);
-            $this->input = array();
-        }
-        if (empty($this->output)) {
-            return NULL;
-        }
-        return array_pop($this->output);
-    }
-
-    /**
-     * Pushes an element onto the front of the queue.
-     */
-    public function push($x) {
-        array_push($this->input, $x);
-    }
-
-    /**
-     * Checks if it's empty.
-     */
-    public function isEmpty() {
-        return empty($this->input) && empty($this->output);
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy.php
deleted file mode 100644
index 291eb83c9..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * Supertype for classes that define a strategy for modifying/purifying tokens.
- *
- * While HTMLPurifier's core purpose is fixing HTML into something proper,
- * strategies provide plug points for extra configuration or even extra
- * features, such as custom tags, custom parsing of text, etc.
- */
-
-
-abstract class HTMLPurifier_Strategy
-{
-
-    /**
-     * Executes the strategy on the tokens.
-     *
-     * @param HTMLPurifier_Token[] $tokens Array of HTMLPurifier_Token objects to be operated on.
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[] Processed array of token objects.
-     */
-    abstract public function execute($tokens, $config, $context);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Composite.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Composite.php
deleted file mode 100644
index 9de812dff..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Composite.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * Composite strategy that runs multiple strategies on tokens.
- */
-abstract class HTMLPurifier_Strategy_Composite extends HTMLPurifier_Strategy
-{
-
-    /**
-     * List of strategies to run tokens through.
-     * @type HTMLPurifier_Strategy[]
-     */
-    protected $strategies = array();
-
-    /**
-     * @param HTMLPurifier_Token[] $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[]
-     */
-    public function execute($tokens, $config, $context)
-    {
-        foreach ($this->strategies as $strategy) {
-            $tokens = $strategy->execute($tokens, $config, $context);
-        }
-        return $tokens;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Core.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Core.php
deleted file mode 100644
index 077521523..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/Core.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-/**
- * Core strategy composed of the big four strategies.
- */
-class HTMLPurifier_Strategy_Core extends HTMLPurifier_Strategy_Composite
-{
-    public function __construct()
-    {
-        $this->strategies[] = new HTMLPurifier_Strategy_RemoveForeignElements();
-        $this->strategies[] = new HTMLPurifier_Strategy_MakeWellFormed();
-        $this->strategies[] = new HTMLPurifier_Strategy_FixNesting();
-        $this->strategies[] = new HTMLPurifier_Strategy_ValidateAttributes();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/FixNesting.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/FixNesting.php
deleted file mode 100644
index 8b1eb20fb..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/FixNesting.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-/**
- * Takes a well formed list of tokens and fixes their nesting.
- *
- * HTML elements dictate which elements are allowed to be their children,
- * for example, you can't have a p tag in a span tag.  Other elements have
- * much more rigorous definitions: tables, for instance, require a specific
- * order for their elements.  There are also constraints not expressible by
- * document type definitions, such as the chameleon nature of ins/del
- * tags and global child exclusions.
- *
- * The first major objective of this strategy is to iterate through all
- * the nodes and determine whether or not their children conform to the
- * element's definition.  If they do not, the child definition may
- * optionally supply an amended list of elements that is valid or
- * require that the entire node be deleted (and the previous node
- * rescanned).
- *
- * The second objective is to ensure that explicitly excluded elements of
- * an element do not appear in its children.  Code that accomplishes this
- * task is pervasive through the strategy, though the two are distinct tasks
- * and could, theoretically, be seperated (although it's not recommended).
- *
- * @note Whether or not unrecognized children are silently dropped or
- *       translated into text depends on the child definitions.
- *
- * @todo Enable nodes to be bubbled out of the structure.  This is
- *       easier with our new algorithm.
- */
-
-class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
-{
-
-    /**
-     * @param HTMLPurifier_Token[] $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array|HTMLPurifier_Token[]
-     */
-    public function execute($tokens, $config, $context)
-    {
-
-        //####################################################################//
-        // Pre-processing
-
-        // O(n) pass to convert to a tree, so that we can efficiently
-        // refer to substrings
-        $top_node = HTMLPurifier_Arborize::arborize($tokens, $config, $context);
-
-        // get a copy of the HTML definition
-        $definition = $config->getHTMLDefinition();
-
-        $excludes_enabled = !$config->get('Core.DisableExcludes');
-
-        // setup the context variable 'IsInline', for chameleon processing
-        // is 'false' when we are not inline, 'true' when it must always
-        // be inline, and an integer when it is inline for a certain
-        // branch of the document tree
-        $is_inline = $definition->info_parent_def->descendants_are_inline;
-        $context->register('IsInline', $is_inline);
-
-        // setup error collector
-        $e =& $context->get('ErrorCollector', true);
-
-        //####################################################################//
-        // Loop initialization
-
-        // stack that contains all elements that are excluded
-        // it is organized by parent elements, similar to $stack,
-        // but it is only populated when an element with exclusions is
-        // processed, i.e. there won't be empty exclusions.
-        $exclude_stack = array($definition->info_parent_def->excludes);
-
-        // variable that contains the start token while we are processing
-        // nodes. This enables error reporting to do its job
-        $node = $top_node;
-        // dummy token
-        list($token, $d) = $node->toTokenPair();
-        $context->register('CurrentNode', $node);
-        $context->register('CurrentToken', $token);
-
-        //####################################################################//
-        // Loop
-
-        // We need to implement a post-order traversal iteratively, to
-        // avoid running into stack space limits.  This is pretty tricky
-        // to reason about, so we just manually stack-ify the recursive
-        // variant:
-        //
-        //  function f($node) {
-        //      foreach ($node->children as $child) {
-        //          f($child);
-        //      }
-        //      validate($node);
-        //  }
-        //
-        // Thus, we will represent a stack frame as array($node,
-        // $is_inline, stack of children)
-        // e.g. array_reverse($node->children) - already processed
-        // children.
-
-        $parent_def = $definition->info_parent_def;
-        $stack = array(
-            array($top_node,
-                  $parent_def->descendants_are_inline,
-                  $parent_def->excludes, // exclusions
-                  0)
-            );
-
-        while (!empty($stack)) {
-            list($node, $is_inline, $excludes, $ix) = array_pop($stack);
-            // recursive call
-            $go = false;
-            $def = empty($stack) ? $definition->info_parent_def : $definition->info[$node->name];
-            while (isset($node->children[$ix])) {
-                $child = $node->children[$ix++];
-                if ($child instanceof HTMLPurifier_Node_Element) {
-                    $go = true;
-                    $stack[] = array($node, $is_inline, $excludes, $ix);
-                    $stack[] = array($child,
-                        // ToDo: I don't think it matters if it's def or
-                        // child_def, but double check this...
-                        $is_inline || $def->descendants_are_inline,
-                        empty($def->excludes) ? $excludes
-                                              : array_merge($excludes, $def->excludes),
-                        0);
-                    break;
-                }
-            };
-            if ($go) continue;
-            list($token, $d) = $node->toTokenPair();
-            // base case
-            if ($excludes_enabled && isset($excludes[$node->name])) {
-                $node->dead = true;
-                if ($e) $e->send(E_ERROR, 'Strategy_FixNesting: Node excluded');
-            } else {
-                // XXX I suppose it would be slightly more efficient to
-                // avoid the allocation here and have children
-                // strategies handle it
-                $children = array();
-                foreach ($node->children as $child) {
-                    if (!$child->dead) $children[] = $child;
-                }
-                $result = $def->child->validateChildren($children, $config, $context);
-                if ($result === true) {
-                    // nop
-                    $node->children = $children;
-                } elseif ($result === false) {
-                    $node->dead = true;
-                    if ($e) $e->send(E_ERROR, 'Strategy_FixNesting: Node removed');
-                } else {
-                    $node->children = $result;
-                    if ($e) {
-                        // XXX This will miss mutations of internal nodes. Perhaps defer to the child validators
-                        if (empty($result) && !empty($children)) {
-                            $e->send(E_ERROR, 'Strategy_FixNesting: Node contents removed');
-                        } else if ($result != $children) {
-                            $e->send(E_WARNING, 'Strategy_FixNesting: Node reorganized');
-                        }
-                    }
-                }
-            }
-        }
-
-        //####################################################################//
-        // Post-processing
-
-        // remove context variables
-        $context->destroy('IsInline');
-        $context->destroy('CurrentNode');
-        $context->destroy('CurrentToken');
-
-        //####################################################################//
-        // Return
-
-        return HTMLPurifier_Arborize::flatten($node, $config, $context);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/MakeWellFormed.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/MakeWellFormed.php
deleted file mode 100644
index 144122f0e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/MakeWellFormed.php
+++ /dev/null
@@ -1,659 +0,0 @@
-<?php
-
-/**
- * Takes tokens makes them well-formed (balance end tags, etc.)
- *
- * Specification of the armor attributes this strategy uses:
- *
- *      - MakeWellFormed_TagClosedError: This armor field is used to
- *        suppress tag closed errors for certain tokens [TagClosedSuppress],
- *        in particular, if a tag was generated automatically by HTML
- *        Purifier, we may rely on our infrastructure to close it for us
- *        and shouldn't report an error to the user [TagClosedAuto].
- */
-class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
-{
-
-    /**
-     * Array stream of tokens being processed.
-     * @type HTMLPurifier_Token[]
-     */
-    protected $tokens;
-
-    /**
-     * Current token.
-     * @type HTMLPurifier_Token
-     */
-    protected $token;
-
-    /**
-     * Zipper managing the true state.
-     * @type HTMLPurifier_Zipper
-     */
-    protected $zipper;
-
-    /**
-     * Current nesting of elements.
-     * @type array
-     */
-    protected $stack;
-
-    /**
-     * Injectors active in this stream processing.
-     * @type HTMLPurifier_Injector[]
-     */
-    protected $injectors;
-
-    /**
-     * Current instance of HTMLPurifier_Config.
-     * @type HTMLPurifier_Config
-     */
-    protected $config;
-
-    /**
-     * Current instance of HTMLPurifier_Context.
-     * @type HTMLPurifier_Context
-     */
-    protected $context;
-
-    /**
-     * @param HTMLPurifier_Token[] $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[]
-     * @throws HTMLPurifier_Exception
-     */
-    public function execute($tokens, $config, $context)
-    {
-        $definition = $config->getHTMLDefinition();
-
-        // local variables
-        $generator = new HTMLPurifier_Generator($config, $context);
-        $escape_invalid_tags = $config->get('Core.EscapeInvalidTags');
-        // used for autoclose early abortion
-        $global_parent_allowed_elements = $definition->info_parent_def->child->getAllowedElements($config);
-        $e = $context->get('ErrorCollector', true);
-        $i = false; // injector index
-        list($zipper, $token) = HTMLPurifier_Zipper::fromArray($tokens);
-        if ($token === NULL) {
-            return array();
-        }
-        $reprocess = false; // whether or not to reprocess the same token
-        $stack = array();
-
-        // member variables
-        $this->stack =& $stack;
-        $this->tokens =& $tokens;
-        $this->token =& $token;
-        $this->zipper =& $zipper;
-        $this->config = $config;
-        $this->context = $context;
-
-        // context variables
-        $context->register('CurrentNesting', $stack);
-        $context->register('InputZipper', $zipper);
-        $context->register('CurrentToken', $token);
-
-        // -- begin INJECTOR --
-
-        $this->injectors = array();
-
-        $injectors = $config->getBatch('AutoFormat');
-        $def_injectors = $definition->info_injector;
-        $custom_injectors = $injectors['Custom'];
-        unset($injectors['Custom']); // special case
-        foreach ($injectors as $injector => $b) {
-            // XXX: Fix with a legitimate lookup table of enabled filters
-            if (strpos($injector, '.') !== false) {
-                continue;
-            }
-            $injector = "HTMLPurifier_Injector_$injector";
-            if (!$b) {
-                continue;
-            }
-            $this->injectors[] = new $injector;
-        }
-        foreach ($def_injectors as $injector) {
-            // assumed to be objects
-            $this->injectors[] = $injector;
-        }
-        foreach ($custom_injectors as $injector) {
-            if (!$injector) {
-                continue;
-            }
-            if (is_string($injector)) {
-                $injector = "HTMLPurifier_Injector_$injector";
-                $injector = new $injector;
-            }
-            $this->injectors[] = $injector;
-        }
-
-        // give the injectors references to the definition and context
-        // variables for performance reasons
-        foreach ($this->injectors as $ix => $injector) {
-            $error = $injector->prepare($config, $context);
-            if (!$error) {
-                continue;
-            }
-            array_splice($this->injectors, $ix, 1); // rm the injector
-            trigger_error("Cannot enable {$injector->name} injector because $error is not allowed", E_USER_WARNING);
-        }
-
-        // -- end INJECTOR --
-
-        // a note on reprocessing:
-        //      In order to reduce code duplication, whenever some code needs
-        //      to make HTML changes in order to make things "correct", the
-        //      new HTML gets sent through the purifier, regardless of its
-        //      status. This means that if we add a start token, because it
-        //      was totally necessary, we don't have to update nesting; we just
-        //      punt ($reprocess = true; continue;) and it does that for us.
-
-        // isset is in loop because $tokens size changes during loop exec
-        for (;;
-             // only increment if we don't need to reprocess
-             $reprocess ? $reprocess = false : $token = $zipper->next($token)) {
-
-            // check for a rewind
-            if (is_int($i)) {
-                // possibility: disable rewinding if the current token has a
-                // rewind set on it already. This would offer protection from
-                // infinite loop, but might hinder some advanced rewinding.
-                $rewind_offset = $this->injectors[$i]->getRewindOffset();
-                if (is_int($rewind_offset)) {
-                    for ($j = 0; $j < $rewind_offset; $j++) {
-                        if (empty($zipper->front)) break;
-                        $token = $zipper->prev($token);
-                        // indicate that other injectors should not process this token,
-                        // but we need to reprocess it.  See Note [Injector skips]
-                        unset($token->skip[$i]);
-                        $token->rewind = $i;
-                        if ($token instanceof HTMLPurifier_Token_Start) {
-                            array_pop($this->stack);
-                        } elseif ($token instanceof HTMLPurifier_Token_End) {
-                            $this->stack[] = $token->start;
-                        }
-                    }
-                }
-                $i = false;
-            }
-
-            // handle case of document end
-            if ($token === NULL) {
-                // kill processing if stack is empty
-                if (empty($this->stack)) {
-                    break;
-                }
-
-                // peek
-                $top_nesting = array_pop($this->stack);
-                $this->stack[] = $top_nesting;
-
-                // send error [TagClosedSuppress]
-                if ($e && !isset($top_nesting->armor['MakeWellFormed_TagClosedError'])) {
-                    $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by document end', $top_nesting);
-                }
-
-                // append, don't splice, since this is the end
-                $token = new HTMLPurifier_Token_End($top_nesting->name);
-
-                // punt!
-                $reprocess = true;
-                continue;
-            }
-
-            //echo '<br>'; printZipper($zipper, $token);//printTokens($this->stack);
-            //flush();
-
-            // quick-check: if it's not a tag, no need to process
-            if (empty($token->is_tag)) {
-                if ($token instanceof HTMLPurifier_Token_Text) {
-                    foreach ($this->injectors as $i => $injector) {
-                        if (isset($token->skip[$i])) {
-                            // See Note [Injector skips]
-                            continue;
-                        }
-                        if ($token->rewind !== null && $token->rewind !== $i) {
-                            continue;
-                        }
-                        // XXX fuckup
-                        $r = $token;
-                        $injector->handleText($r);
-                        $token = $this->processToken($r, $i);
-                        $reprocess = true;
-                        break;
-                    }
-                }
-                // another possibility is a comment
-                continue;
-            }
-
-            if (isset($definition->info[$token->name])) {
-                $type = $definition->info[$token->name]->child->type;
-            } else {
-                $type = false; // Type is unknown, treat accordingly
-            }
-
-            // quick tag checks: anything that's *not* an end tag
-            $ok = false;
-            if ($type === 'empty' && $token instanceof HTMLPurifier_Token_Start) {
-                // claims to be a start tag but is empty
-                $token = new HTMLPurifier_Token_Empty(
-                    $token->name,
-                    $token->attr,
-                    $token->line,
-                    $token->col,
-                    $token->armor
-                );
-                $ok = true;
-            } elseif ($type && $type !== 'empty' && $token instanceof HTMLPurifier_Token_Empty) {
-                // claims to be empty but really is a start tag
-                // NB: this assignment is required
-                $old_token = $token;
-                $token = new HTMLPurifier_Token_End($token->name);
-                $token = $this->insertBefore(
-                    new HTMLPurifier_Token_Start($old_token->name, $old_token->attr, $old_token->line, $old_token->col, $old_token->armor)
-                );
-                // punt (since we had to modify the input stream in a non-trivial way)
-                $reprocess = true;
-                continue;
-            } elseif ($token instanceof HTMLPurifier_Token_Empty) {
-                // real empty token
-                $ok = true;
-            } elseif ($token instanceof HTMLPurifier_Token_Start) {
-                // start tag
-
-                // ...unless they also have to close their parent
-                if (!empty($this->stack)) {
-
-                    // Performance note: you might think that it's rather
-                    // inefficient, recalculating the autoclose information
-                    // for every tag that a token closes (since when we
-                    // do an autoclose, we push a new token into the
-                    // stream and then /process/ that, before
-                    // re-processing this token.)  But this is
-                    // necessary, because an injector can make an
-                    // arbitrary transformations to the autoclosing
-                    // tokens we introduce, so things may have changed
-                    // in the meantime.  Also, doing the inefficient thing is
-                    // "easy" to reason about (for certain perverse definitions
-                    // of "easy")
-
-                    $parent = array_pop($this->stack);
-                    $this->stack[] = $parent;
-
-                    $parent_def = null;
-                    $parent_elements = null;
-                    $autoclose = false;
-                    if (isset($definition->info[$parent->name])) {
-                        $parent_def = $definition->info[$parent->name];
-                        $parent_elements = $parent_def->child->getAllowedElements($config);
-                        $autoclose = !isset($parent_elements[$token->name]);
-                    }
-
-                    if ($autoclose && $definition->info[$token->name]->wrap) {
-                        // Check if an element can be wrapped by another
-                        // element to make it valid in a context (for
-                        // example, <ul><ul> needs a <li> in between)
-                        $wrapname = $definition->info[$token->name]->wrap;
-                        $wrapdef = $definition->info[$wrapname];
-                        $elements = $wrapdef->child->getAllowedElements($config);
-                        if (isset($elements[$token->name]) && isset($parent_elements[$wrapname])) {
-                            $newtoken = new HTMLPurifier_Token_Start($wrapname);
-                            $token = $this->insertBefore($newtoken);
-                            $reprocess = true;
-                            continue;
-                        }
-                    }
-
-                    $carryover = false;
-                    if ($autoclose && $parent_def->formatting) {
-                        $carryover = true;
-                    }
-
-                    if ($autoclose) {
-                        // check if this autoclose is doomed to fail
-                        // (this rechecks $parent, which his harmless)
-                        $autoclose_ok = isset($global_parent_allowed_elements[$token->name]);
-                        if (!$autoclose_ok) {
-                            foreach ($this->stack as $ancestor) {
-                                $elements = $definition->info[$ancestor->name]->child->getAllowedElements($config);
-                                if (isset($elements[$token->name])) {
-                                    $autoclose_ok = true;
-                                    break;
-                                }
-                                if ($definition->info[$token->name]->wrap) {
-                                    $wrapname = $definition->info[$token->name]->wrap;
-                                    $wrapdef = $definition->info[$wrapname];
-                                    $wrap_elements = $wrapdef->child->getAllowedElements($config);
-                                    if (isset($wrap_elements[$token->name]) && isset($elements[$wrapname])) {
-                                        $autoclose_ok = true;
-                                        break;
-                                    }
-                                }
-                            }
-                        }
-                        if ($autoclose_ok) {
-                            // errors need to be updated
-                            $new_token = new HTMLPurifier_Token_End($parent->name);
-                            $new_token->start = $parent;
-                            // [TagClosedSuppress]
-                            if ($e && !isset($parent->armor['MakeWellFormed_TagClosedError'])) {
-                                if (!$carryover) {
-                                    $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag auto closed', $parent);
-                                } else {
-                                    $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag carryover', $parent);
-                                }
-                            }
-                            if ($carryover) {
-                                $element = clone $parent;
-                                // [TagClosedAuto]
-                                $element->armor['MakeWellFormed_TagClosedError'] = true;
-                                $element->carryover = true;
-                                $token = $this->processToken(array($new_token, $token, $element));
-                            } else {
-                                $token = $this->insertBefore($new_token);
-                            }
-                        } else {
-                            $token = $this->remove();
-                        }
-                        $reprocess = true;
-                        continue;
-                    }
-
-                }
-                $ok = true;
-            }
-
-            if ($ok) {
-                foreach ($this->injectors as $i => $injector) {
-                    if (isset($token->skip[$i])) {
-                        // See Note [Injector skips]
-                        continue;
-                    }
-                    if ($token->rewind !== null && $token->rewind !== $i) {
-                        continue;
-                    }
-                    $r = $token;
-                    $injector->handleElement($r);
-                    $token = $this->processToken($r, $i);
-                    $reprocess = true;
-                    break;
-                }
-                if (!$reprocess) {
-                    // ah, nothing interesting happened; do normal processing
-                    if ($token instanceof HTMLPurifier_Token_Start) {
-                        $this->stack[] = $token;
-                    } elseif ($token instanceof HTMLPurifier_Token_End) {
-                        throw new HTMLPurifier_Exception(
-                            'Improper handling of end tag in start code; possible error in MakeWellFormed'
-                        );
-                    }
-                }
-                continue;
-            }
-
-            // sanity check: we should be dealing with a closing tag
-            if (!$token instanceof HTMLPurifier_Token_End) {
-                throw new HTMLPurifier_Exception('Unaccounted for tag token in input stream, bug in HTML Purifier');
-            }
-
-            // make sure that we have something open
-            if (empty($this->stack)) {
-                if ($escape_invalid_tags) {
-                    if ($e) {
-                        $e->send(E_WARNING, 'Strategy_MakeWellFormed: Unnecessary end tag to text');
-                    }
-                    $token = new HTMLPurifier_Token_Text($generator->generateFromToken($token));
-                } else {
-                    if ($e) {
-                        $e->send(E_WARNING, 'Strategy_MakeWellFormed: Unnecessary end tag removed');
-                    }
-                    $token = $this->remove();
-                }
-                $reprocess = true;
-                continue;
-            }
-
-            // first, check for the simplest case: everything closes neatly.
-            // Eventually, everything passes through here; if there are problems
-            // we modify the input stream accordingly and then punt, so that
-            // the tokens get processed again.
-            $current_parent = array_pop($this->stack);
-            if ($current_parent->name == $token->name) {
-                $token->start = $current_parent;
-                foreach ($this->injectors as $i => $injector) {
-                    if (isset($token->skip[$i])) {
-                        // See Note [Injector skips]
-                        continue;
-                    }
-                    if ($token->rewind !== null && $token->rewind !== $i) {
-                        continue;
-                    }
-                    $r = $token;
-                    $injector->handleEnd($r);
-                    $token = $this->processToken($r, $i);
-                    $this->stack[] = $current_parent;
-                    $reprocess = true;
-                    break;
-                }
-                continue;
-            }
-
-            // okay, so we're trying to close the wrong tag
-
-            // undo the pop previous pop
-            $this->stack[] = $current_parent;
-
-            // scroll back the entire nest, trying to find our tag.
-            // (feature could be to specify how far you'd like to go)
-            $size = count($this->stack);
-            // -2 because -1 is the last element, but we already checked that
-            $skipped_tags = false;
-            for ($j = $size - 2; $j >= 0; $j--) {
-                if ($this->stack[$j]->name == $token->name) {
-                    $skipped_tags = array_slice($this->stack, $j);
-                    break;
-                }
-            }
-
-            // we didn't find the tag, so remove
-            if ($skipped_tags === false) {
-                if ($escape_invalid_tags) {
-                    if ($e) {
-                        $e->send(E_WARNING, 'Strategy_MakeWellFormed: Stray end tag to text');
-                    }
-                    $token = new HTMLPurifier_Token_Text($generator->generateFromToken($token));
-                } else {
-                    if ($e) {
-                        $e->send(E_WARNING, 'Strategy_MakeWellFormed: Stray end tag removed');
-                    }
-                    $token = $this->remove();
-                }
-                $reprocess = true;
-                continue;
-            }
-
-            // do errors, in REVERSE $j order: a,b,c with </a></b></c>
-            $c = count($skipped_tags);
-            if ($e) {
-                for ($j = $c - 1; $j > 0; $j--) {
-                    // notice we exclude $j == 0, i.e. the current ending tag, from
-                    // the errors... [TagClosedSuppress]
-                    if (!isset($skipped_tags[$j]->armor['MakeWellFormed_TagClosedError'])) {
-                        $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by element end', $skipped_tags[$j]);
-                    }
-                }
-            }
-
-            // insert tags, in FORWARD $j order: c,b,a with </a></b></c>
-            $replace = array($token);
-            for ($j = 1; $j < $c; $j++) {
-                // ...as well as from the insertions
-                $new_token = new HTMLPurifier_Token_End($skipped_tags[$j]->name);
-                $new_token->start = $skipped_tags[$j];
-                array_unshift($replace, $new_token);
-                if (isset($definition->info[$new_token->name]) && $definition->info[$new_token->name]->formatting) {
-                    // [TagClosedAuto]
-                    $element = clone $skipped_tags[$j];
-                    $element->carryover = true;
-                    $element->armor['MakeWellFormed_TagClosedError'] = true;
-                    $replace[] = $element;
-                }
-            }
-            $token = $this->processToken($replace);
-            $reprocess = true;
-            continue;
-        }
-
-        $context->destroy('CurrentToken');
-        $context->destroy('CurrentNesting');
-        $context->destroy('InputZipper');
-
-        unset($this->injectors, $this->stack, $this->tokens);
-        return $zipper->toArray($token);
-    }
-
-    /**
-     * Processes arbitrary token values for complicated substitution patterns.
-     * In general:
-     *
-     * If $token is an array, it is a list of tokens to substitute for the
-     * current token. These tokens then get individually processed. If there
-     * is a leading integer in the list, that integer determines how many
-     * tokens from the stream should be removed.
-     *
-     * If $token is a regular token, it is swapped with the current token.
-     *
-     * If $token is false, the current token is deleted.
-     *
-     * If $token is an integer, that number of tokens (with the first token
-     * being the current one) will be deleted.
-     *
-     * @param HTMLPurifier_Token|array|int|bool $token Token substitution value
-     * @param HTMLPurifier_Injector|int $injector Injector that performed the substitution; default is if
-     *        this is not an injector related operation.
-     * @throws HTMLPurifier_Exception
-     */
-    protected function processToken($token, $injector = -1)
-    {
-        // Zend OpCache miscompiles $token = array($token), so
-        // avoid this pattern.  See: https://github.com/ezyang/htmlpurifier/issues/108
-
-        // normalize forms of token
-        if (is_object($token)) {
-            $tmp = $token;
-            $token = array(1, $tmp);
-        }
-        if (is_int($token)) {
-            $tmp = $token;
-            $token = array($tmp);
-        }
-        if ($token === false) {
-            $token = array(1);
-        }
-        if (!is_array($token)) {
-            throw new HTMLPurifier_Exception('Invalid token type from injector');
-        }
-        if (!is_int($token[0])) {
-            array_unshift($token, 1);
-        }
-        if ($token[0] === 0) {
-            throw new HTMLPurifier_Exception('Deleting zero tokens is not valid');
-        }
-
-        // $token is now an array with the following form:
-        // array(number nodes to delete, new node 1, new node 2, ...)
-
-        $delete = array_shift($token);
-        list($old, $r) = $this->zipper->splice($this->token, $delete, $token);
-
-        if ($injector > -1) {
-            // See Note [Injector skips]
-            // Determine appropriate skips.  Here's what the code does:
-            //  *If* we deleted one or more tokens, copy the skips
-            //  of those tokens into the skips of the new tokens (in $token).
-            //  Also, mark the newly inserted tokens as having come from
-            //  $injector.
-            $oldskip = isset($old[0]) ? $old[0]->skip : array();
-            foreach ($token as $object) {
-                $object->skip = $oldskip;
-                $object->skip[$injector] = true;
-            }
-        }
-
-        return $r;
-
-    }
-
-    /**
-     * Inserts a token before the current token. Cursor now points to
-     * this token.  You must reprocess after this.
-     * @param HTMLPurifier_Token $token
-     */
-    private function insertBefore($token)
-    {
-        // NB not $this->zipper->insertBefore(), due to positioning
-        // differences
-        $splice = $this->zipper->splice($this->token, 0, array($token));
-
-        return $splice[1];
-    }
-
-    /**
-     * Removes current token. Cursor now points to new token occupying previously
-     * occupied space.  You must reprocess after this.
-     */
-    private function remove()
-    {
-        return $this->zipper->delete();
-    }
-}
-
-// Note [Injector skips]
-// ~~~~~~~~~~~~~~~~~~~~~
-// When I originally designed this class, the idea behind the 'skip'
-// property of HTMLPurifier_Token was to help avoid infinite loops
-// in injector processing.  For example, suppose you wrote an injector
-// that bolded swear words.  Naively, you might write it so that
-// whenever you saw ****, you replaced it with <strong>****</strong>.
-//
-// When this happens, we will reprocess all of the tokens with the
-// other injectors.  Now there is an opportunity for infinite loop:
-// if we rerun the swear-word injector on these tokens, we might
-// see **** and then reprocess again to get
-// <strong><strong>****</strong></strong> ad infinitum.
-//
-// Thus, the idea of a skip is that once we process a token with
-// an injector, we mark all of those tokens as having "come from"
-// the injector, and we never run the injector again on these
-// tokens.
-//
-// There were two more complications, however:
-//
-//  - With HTMLPurifier_Injector_RemoveEmpty, we noticed that if
-//    you had <b><i></i></b>, after you removed the <i></i>, you
-//    really would like this injector to go back and reprocess
-//    the <b> tag, discovering that it is now empty and can be
-//    removed.  So we reintroduced the possibility of infinite looping
-//    by adding a "rewind" function, which let you go back to an
-//    earlier point in the token stream and reprocess it with injectors.
-//    Needless to say, we need to UN-skip the token so it gets
-//    reprocessed.
-//
-//  - Suppose that you successfuly process a token, replace it with
-//    one with your skip mark, but now another injector wants to
-//    process the skipped token with another token.  Should you continue
-//    to skip that new token, or reprocess it?  If you reprocess,
-//    you can end up with an infinite loop where one injector converts
-//    <a> to <b>, and then another injector converts it back.  So
-//    we inherit the skips, but for some reason, I thought that we
-//    should inherit the skip from the first token of the token
-//    that we deleted.  Why?  Well, it seems to work OK.
-//
-// If I were to redesign this functionality, I would absolutely not
-// go about doing it this way: the semantics are just not very well
-// defined, and in any case you probably wanted to operate on trees,
-// not token streams.
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/RemoveForeignElements.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/RemoveForeignElements.php
deleted file mode 100644
index d1adf59f2..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/RemoveForeignElements.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-
-/**
- * Removes all unrecognized tags from the list of tokens.
- *
- * This strategy iterates through all the tokens and removes unrecognized
- * tokens. If a token is not recognized but a TagTransform is defined for
- * that element, the element will be transformed accordingly.
- */
-
-class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
-{
-
-    /**
-     * @param HTMLPurifier_Token[] $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return array|HTMLPurifier_Token[]
-     */
-    public function execute($tokens, $config, $context)
-    {
-        $definition = $config->getHTMLDefinition();
-        $generator = new HTMLPurifier_Generator($config, $context);
-        $result = array();
-
-        $escape_invalid_tags = $config->get('Core.EscapeInvalidTags');
-        $remove_invalid_img = $config->get('Core.RemoveInvalidImg');
-
-        // currently only used to determine if comments should be kept
-        $trusted = $config->get('HTML.Trusted');
-        $comment_lookup = $config->get('HTML.AllowedComments');
-        $comment_regexp = $config->get('HTML.AllowedCommentsRegexp');
-        $check_comments = $comment_lookup !== array() || $comment_regexp !== null;
-
-        $remove_script_contents = $config->get('Core.RemoveScriptContents');
-        $hidden_elements = $config->get('Core.HiddenElements');
-
-        // remove script contents compatibility
-        if ($remove_script_contents === true) {
-            $hidden_elements['script'] = true;
-        } elseif ($remove_script_contents === false && isset($hidden_elements['script'])) {
-            unset($hidden_elements['script']);
-        }
-
-        $attr_validator = new HTMLPurifier_AttrValidator();
-
-        // removes tokens until it reaches a closing tag with its value
-        $remove_until = false;
-
-        // converts comments into text tokens when this is equal to a tag name
-        $textify_comments = false;
-
-        $token = false;
-        $context->register('CurrentToken', $token);
-
-        $e = false;
-        if ($config->get('Core.CollectErrors')) {
-            $e =& $context->get('ErrorCollector');
-        }
-
-        foreach ($tokens as $token) {
-            if ($remove_until) {
-                if (empty($token->is_tag) || $token->name !== $remove_until) {
-                    continue;
-                }
-            }
-            if (!empty($token->is_tag)) {
-                // DEFINITION CALL
-
-                // before any processing, try to transform the element
-                if (isset($definition->info_tag_transform[$token->name])) {
-                    $original_name = $token->name;
-                    // there is a transformation for this tag
-                    // DEFINITION CALL
-                    $token = $definition->
-                        info_tag_transform[$token->name]->transform($token, $config, $context);
-                    if ($e) {
-                        $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Tag transform', $original_name);
-                    }
-                }
-
-                if (isset($definition->info[$token->name])) {
-                    // mostly everything's good, but
-                    // we need to make sure required attributes are in order
-                    if (($token instanceof HTMLPurifier_Token_Start || $token instanceof HTMLPurifier_Token_Empty) &&
-                        $definition->info[$token->name]->required_attr &&
-                        ($token->name != 'img' || $remove_invalid_img) // ensure config option still works
-                    ) {
-                        $attr_validator->validateToken($token, $config, $context);
-                        $ok = true;
-                        foreach ($definition->info[$token->name]->required_attr as $name) {
-                            if (!isset($token->attr[$name])) {
-                                $ok = false;
-                                break;
-                            }
-                        }
-                        if (!$ok) {
-                            if ($e) {
-                                $e->send(
-                                    E_ERROR,
-                                    'Strategy_RemoveForeignElements: Missing required attribute',
-                                    $name
-                                );
-                            }
-                            continue;
-                        }
-                        $token->armor['ValidateAttributes'] = true;
-                    }
-
-                    if (isset($hidden_elements[$token->name]) && $token instanceof HTMLPurifier_Token_Start) {
-                        $textify_comments = $token->name;
-                    } elseif ($token->name === $textify_comments && $token instanceof HTMLPurifier_Token_End) {
-                        $textify_comments = false;
-                    }
-
-                } elseif ($escape_invalid_tags) {
-                    // invalid tag, generate HTML representation and insert in
-                    if ($e) {
-                        $e->send(E_WARNING, 'Strategy_RemoveForeignElements: Foreign element to text');
-                    }
-                    $token = new HTMLPurifier_Token_Text(
-                        $generator->generateFromToken($token)
-                    );
-                } else {
-                    // check if we need to destroy all of the tag's children
-                    // CAN BE GENERICIZED
-                    if (isset($hidden_elements[$token->name])) {
-                        if ($token instanceof HTMLPurifier_Token_Start) {
-                            $remove_until = $token->name;
-                        } elseif ($token instanceof HTMLPurifier_Token_Empty) {
-                            // do nothing: we're still looking
-                        } else {
-                            $remove_until = false;
-                        }
-                        if ($e) {
-                            $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Foreign meta element removed');
-                        }
-                    } else {
-                        if ($e) {
-                            $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Foreign element removed');
-                        }
-                    }
-                    continue;
-                }
-            } elseif ($token instanceof HTMLPurifier_Token_Comment) {
-                // textify comments in script tags when they are allowed
-                if ($textify_comments !== false) {
-                    $data = $token->data;
-                    $token = new HTMLPurifier_Token_Text($data);
-                } elseif ($trusted || $check_comments) {
-                    // always cleanup comments
-                    $trailing_hyphen = false;
-                    if ($e) {
-                        // perform check whether or not there's a trailing hyphen
-                        if (substr($token->data, -1) == '-') {
-                            $trailing_hyphen = true;
-                        }
-                    }
-                    $token->data = rtrim($token->data, '-');
-                    $found_double_hyphen = false;
-                    while (strpos($token->data, '--') !== false) {
-                        $found_double_hyphen = true;
-                        $token->data = str_replace('--', '-', $token->data);
-                    }
-                    if ($trusted || !empty($comment_lookup[trim($token->data)]) ||
-                        ($comment_regexp !== null && preg_match($comment_regexp, trim($token->data)))) {
-                        // OK good
-                        if ($e) {
-                            if ($trailing_hyphen) {
-                                $e->send(
-                                    E_NOTICE,
-                                    'Strategy_RemoveForeignElements: Trailing hyphen in comment removed'
-                                );
-                            }
-                            if ($found_double_hyphen) {
-                                $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Hyphens in comment collapsed');
-                            }
-                        }
-                    } else {
-                        if ($e) {
-                            $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Comment removed');
-                        }
-                        continue;
-                    }
-                } else {
-                    // strip comments
-                    if ($e) {
-                        $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Comment removed');
-                    }
-                    continue;
-                }
-            } elseif ($token instanceof HTMLPurifier_Token_Text) {
-            } else {
-                continue;
-            }
-            $result[] = $token;
-        }
-        if ($remove_until && $e) {
-            // we removed tokens until the end, throw error
-            $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Token removed to end', $remove_until);
-        }
-        $context->destroy('CurrentToken');
-        return $result;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/ValidateAttributes.php b/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/ValidateAttributes.php
deleted file mode 100644
index 428f975fc..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Strategy/ValidateAttributes.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Validate all attributes in the tokens.
- */
-
-class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
-{
-
-    /**
-     * @param HTMLPurifier_Token[] $tokens
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token[]
-     */
-    public function execute($tokens, $config, $context)
-    {
-        // setup validator
-        $validator = new HTMLPurifier_AttrValidator();
-
-        $token = false;
-        $context->register('CurrentToken', $token);
-
-        foreach ($tokens as $key => $token) {
-
-            // only process tokens that have attributes,
-            //   namely start and empty tags
-            if (!$token instanceof HTMLPurifier_Token_Start && !$token instanceof HTMLPurifier_Token_Empty) {
-                continue;
-            }
-
-            // skip tokens that are armored
-            if (!empty($token->armor['ValidateAttributes'])) {
-                continue;
-            }
-
-            // note that we have no facilities here for removing tokens
-            $validator->validateToken($token, $config, $context);
-        }
-        $context->destroy('CurrentToken');
-        return $tokens;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/StringHash.php b/libraries/htmlpurifier410/library/HTMLPurifier/StringHash.php
deleted file mode 100644
index 8d0740cdc..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/StringHash.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * This is in almost every respect equivalent to an array except
- * that it keeps track of which keys were accessed.
- *
- * @warning For the sake of backwards compatibility with early versions
- *     of PHP 5, you must not use the $hash[$key] syntax; if you do
- *     our version of offsetGet is never called.
- */
-class HTMLPurifier_StringHash extends ArrayObject
-{
-    /**
-     * @type array
-     */
-    protected $accessed = array();
-
-    /**
-     * Retrieves a value, and logs the access.
-     * @param mixed $index
-     * @return mixed
-     */
-    public function offsetGet($index)
-    {
-        $this->accessed[$index] = true;
-        return parent::offsetGet($index);
-    }
-
-    /**
-     * Returns a lookup array of all array indexes that have been accessed.
-     * @return array in form array($index => true).
-     */
-    public function getAccessed()
-    {
-        return $this->accessed;
-    }
-
-    /**
-     * Resets the access array.
-     */
-    public function resetAccessed()
-    {
-        $this->accessed = array();
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/StringHashParser.php b/libraries/htmlpurifier410/library/HTMLPurifier/StringHashParser.php
deleted file mode 100644
index 05abd837e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/StringHashParser.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-/**
- * Parses string hash files. File format is as such:
- *
- *      DefaultKeyValue
- *      KEY: Value
- *      KEY2: Value2
- *      --MULTILINE-KEY--
- *      Multiline
- *      value.
- *
- * Which would output something similar to:
- *
- *      array(
- *          'ID' => 'DefaultKeyValue',
- *          'KEY' => 'Value',
- *          'KEY2' => 'Value2',
- *          'MULTILINE-KEY' => "Multiline\nvalue.\n",
- *      )
- *
- * We use this as an easy to use file-format for configuration schema
- * files, but the class itself is usage agnostic.
- *
- * You can use ---- to forcibly terminate parsing of a single string-hash;
- * this marker is used in multi string-hashes to delimit boundaries.
- */
-class HTMLPurifier_StringHashParser
-{
-
-    /**
-     * @type string
-     */
-    public $default = 'ID';
-
-    /**
-     * Parses a file that contains a single string-hash.
-     * @param string $file
-     * @return array
-     */
-    public function parseFile($file)
-    {
-        if (!file_exists($file)) {
-            return false;
-        }
-        $fh = fopen($file, 'r');
-        if (!$fh) {
-            return false;
-        }
-        $ret = $this->parseHandle($fh);
-        fclose($fh);
-        return $ret;
-    }
-
-    /**
-     * Parses a file that contains multiple string-hashes delimited by '----'
-     * @param string $file
-     * @return array
-     */
-    public function parseMultiFile($file)
-    {
-        if (!file_exists($file)) {
-            return false;
-        }
-        $ret = array();
-        $fh = fopen($file, 'r');
-        if (!$fh) {
-            return false;
-        }
-        while (!feof($fh)) {
-            $ret[] = $this->parseHandle($fh);
-        }
-        fclose($fh);
-        return $ret;
-    }
-
-    /**
-     * Internal parser that acepts a file handle.
-     * @note While it's possible to simulate in-memory parsing by using
-     *       custom stream wrappers, if such a use-case arises we should
-     *       factor out the file handle into its own class.
-     * @param resource $fh File handle with pointer at start of valid string-hash
-     *            block.
-     * @return array
-     */
-    protected function parseHandle($fh)
-    {
-        $state   = false;
-        $single  = false;
-        $ret     = array();
-        do {
-            $line = fgets($fh);
-            if ($line === false) {
-                break;
-            }
-            $line = rtrim($line, "\n\r");
-            if (!$state && $line === '') {
-                continue;
-            }
-            if ($line === '----') {
-                break;
-            }
-            if (strncmp('--#', $line, 3) === 0) {
-                // Comment
-                continue;
-            } elseif (strncmp('--', $line, 2) === 0) {
-                // Multiline declaration
-                $state = trim($line, '- ');
-                if (!isset($ret[$state])) {
-                    $ret[$state] = '';
-                }
-                continue;
-            } elseif (!$state) {
-                $single = true;
-                if (strpos($line, ':') !== false) {
-                    // Single-line declaration
-                    list($state, $line) = explode(':', $line, 2);
-                    $line = trim($line);
-                } else {
-                    // Use default declaration
-                    $state  = $this->default;
-                }
-            }
-            if ($single) {
-                $ret[$state] = $line;
-                $single = false;
-                $state  = false;
-            } else {
-                $ret[$state] .= "$line\n";
-            }
-        } while (!feof($fh));
-        return $ret;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform.php b/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform.php
deleted file mode 100644
index 0f481bfd1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
- * Defines a mutation of an obsolete tag into a valid tag.
- */
-abstract class HTMLPurifier_TagTransform
-{
-
-    /**
-     * Tag name to transform the tag to.
-     * @type string
-     */
-    public $transform_to;
-
-    /**
-     * Transforms the obsolete tag into the valid tag.
-     * @param HTMLPurifier_Token_Tag $tag Tag to be transformed.
-     * @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object
-     * @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object
-     */
-    abstract public function transform($tag, $config, $context);
-
-    /**
-     * Prepends CSS properties to the style attribute, creating the
-     * attribute if it doesn't exist.
-     * @warning Copied over from AttrTransform, be sure to keep in sync
-     * @param array $attr Attribute array to process (passed by reference)
-     * @param string $css CSS to prepend
-     */
-    protected function prependCSS(&$attr, $css)
-    {
-        $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
-        $attr['style'] = $css . $attr['style'];
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Font.php b/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Font.php
deleted file mode 100644
index 99e01658c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Font.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-
-/**
- * Transforms FONT tags to the proper form (SPAN with CSS styling)
- *
- * This transformation takes the three proprietary attributes of FONT and
- * transforms them into their corresponding CSS attributes.  These are color,
- * face, and size.
- *
- * @note Size is an interesting case because it doesn't map cleanly to CSS.
- *       Thanks to
- *       http://style.cleverchimp.com/font_size_intervals/altintervals.html
- *       for reasonable mappings.
- * @warning This doesn't work completely correctly; specifically, this
- *          TagTransform operates before well-formedness is enforced, so
- *          the "active formatting elements" algorithm doesn't get applied.
- */
-class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
-{
-    /**
-     * @type string
-     */
-    public $transform_to = 'span';
-
-    /**
-     * @type array
-     */
-    protected $_size_lookup = array(
-        '0' => 'xx-small',
-        '1' => 'xx-small',
-        '2' => 'small',
-        '3' => 'medium',
-        '4' => 'large',
-        '5' => 'x-large',
-        '6' => 'xx-large',
-        '7' => '300%',
-        '-1' => 'smaller',
-        '-2' => '60%',
-        '+1' => 'larger',
-        '+2' => '150%',
-        '+3' => '200%',
-        '+4' => '300%'
-    );
-
-    /**
-     * @param HTMLPurifier_Token_Tag $tag
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_Token_End|string
-     */
-    public function transform($tag, $config, $context)
-    {
-        if ($tag instanceof HTMLPurifier_Token_End) {
-            $new_tag = clone $tag;
-            $new_tag->name = $this->transform_to;
-            return $new_tag;
-        }
-
-        $attr = $tag->attr;
-        $prepend_style = '';
-
-        // handle color transform
-        if (isset($attr['color'])) {
-            $prepend_style .= 'color:' . $attr['color'] . ';';
-            unset($attr['color']);
-        }
-
-        // handle face transform
-        if (isset($attr['face'])) {
-            $prepend_style .= 'font-family:' . $attr['face'] . ';';
-            unset($attr['face']);
-        }
-
-        // handle size transform
-        if (isset($attr['size'])) {
-            // normalize large numbers
-            if ($attr['size'] !== '') {
-                if ($attr['size'][0] == '+' || $attr['size'][0] == '-') {
-                    $size = (int)$attr['size'];
-                    if ($size < -2) {
-                        $attr['size'] = '-2';
-                    }
-                    if ($size > 4) {
-                        $attr['size'] = '+4';
-                    }
-                } else {
-                    $size = (int)$attr['size'];
-                    if ($size > 7) {
-                        $attr['size'] = '7';
-                    }
-                }
-            }
-            if (isset($this->_size_lookup[$attr['size']])) {
-                $prepend_style .= 'font-size:' .
-                    $this->_size_lookup[$attr['size']] . ';';
-            }
-            unset($attr['size']);
-        }
-
-        if ($prepend_style) {
-            $attr['style'] = isset($attr['style']) ?
-                $prepend_style . $attr['style'] :
-                $prepend_style;
-        }
-
-        $new_tag = clone $tag;
-        $new_tag->name = $this->transform_to;
-        $new_tag->attr = $attr;
-
-        return $new_tag;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Simple.php b/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Simple.php
deleted file mode 100644
index d21b634e9..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/TagTransform/Simple.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Simple transformation, just change tag name to something else,
- * and possibly add some styling. This will cover most of the deprecated
- * tag cases.
- */
-class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform
-{
-    /**
-     * @type string
-     */
-    protected $style;
-
-    /**
-     * @param string $transform_to Tag name to transform to.
-     * @param string $style CSS style to add to the tag
-     */
-    public function __construct($transform_to, $style = null)
-    {
-        $this->transform_to = $transform_to;
-        $this->style = $style;
-    }
-
-    /**
-     * @param HTMLPurifier_Token_Tag $tag
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return string
-     */
-    public function transform($tag, $config, $context)
-    {
-        $new_tag = clone $tag;
-        $new_tag->name = $this->transform_to;
-        if (!is_null($this->style) &&
-            ($new_tag instanceof HTMLPurifier_Token_Start || $new_tag instanceof HTMLPurifier_Token_Empty)
-        ) {
-            $this->prependCSS($new_tag->attr, $this->style);
-        }
-        return $new_tag;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token.php
deleted file mode 100644
index a765cf10e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-/**
- * Abstract base token class that all others inherit from.
- */
-abstract class HTMLPurifier_Token
-{
-    /**
-     * Line number node was on in source document. Null if unknown.
-     * @type int
-     */
-    public $line;
-
-    /**
-     * Column of line node was on in source document. Null if unknown.
-     * @type int
-     */
-    public $col;
-
-    /**
-     * Lookup array of processing that this token is exempt from.
-     * Currently, valid values are "ValidateAttributes" and
-     * "MakeWellFormed_TagClosedError"
-     * @type array
-     */
-    public $armor = array();
-
-    /**
-     * Used during MakeWellFormed.  See Note [Injector skips]
-     * @type
-     */
-    public $skip;
-
-    /**
-     * @type
-     */
-    public $rewind;
-
-    /**
-     * @type
-     */
-    public $carryover;
-
-    /**
-     * @param string $n
-     * @return null|string
-     */
-    public function __get($n)
-    {
-        if ($n === 'type') {
-            trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE);
-            switch (get_class($this)) {
-                case 'HTMLPurifier_Token_Start':
-                    return 'start';
-                case 'HTMLPurifier_Token_Empty':
-                    return 'empty';
-                case 'HTMLPurifier_Token_End':
-                    return 'end';
-                case 'HTMLPurifier_Token_Text':
-                    return 'text';
-                case 'HTMLPurifier_Token_Comment':
-                    return 'comment';
-                default:
-                    return null;
-            }
-        }
-    }
-
-    /**
-     * Sets the position of the token in the source document.
-     * @param int $l
-     * @param int $c
-     */
-    public function position($l = null, $c = null)
-    {
-        $this->line = $l;
-        $this->col = $c;
-    }
-
-    /**
-     * Convenience function for DirectLex settings line/col position.
-     * @param int $l
-     * @param int $c
-     */
-    public function rawPosition($l, $c)
-    {
-        if ($c === -1) {
-            $l++;
-        }
-        $this->line = $l;
-        $this->col = $c;
-    }
-
-    /**
-     * Converts a token into its corresponding node.
-     */
-    abstract public function toNode();
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Comment.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token/Comment.php
deleted file mode 100644
index 3fd273b16..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Comment.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Concrete comment token class. Generally will be ignored.
- */
-class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
-{
-    /**
-     * Character data within comment.
-     * @type string
-     */
-    public $data;
-
-    /**
-     * @type bool
-     */
-    public $is_whitespace = true;
-
-    /**
-     * Transparent constructor.
-     *
-     * @param string $data String comment data.
-     * @param int $line
-     * @param int $col
-     */
-    public function __construct($data, $line = null, $col = null)
-    {
-        $this->data = $data;
-        $this->line = $line;
-        $this->col = $col;
-    }
-
-    public function toNode() {
-        return new HTMLPurifier_Node_Comment($this->data, $this->line, $this->col);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Empty.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token/Empty.php
deleted file mode 100644
index bd35024ab..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Empty.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-/**
- * Concrete empty token class.
- */
-class HTMLPurifier_Token_Empty extends HTMLPurifier_Token_Tag
-{
-    public function toNode() {
-        $n = parent::toNode();
-        $n->empty = true;
-        return $n;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token/End.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token/End.php
deleted file mode 100644
index 99c34e750..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token/End.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * Concrete end token class.
- *
- * @warning This class accepts attributes even though end tags cannot. This
- * is for optimization reasons, as under normal circumstances, the Lexers
- * do not pass attributes.
- */
-class HTMLPurifier_Token_End extends HTMLPurifier_Token_Tag
-{
-    /**
-     * Token that started this node.
-     * Added by MakeWellFormed. Please do not edit this!
-     * @type HTMLPurifier_Token
-     */
-    public $start;
-
-    public function toNode() {
-        throw new Exception("HTMLPurifier_Token_End->toNode not supported!");
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Start.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token/Start.php
deleted file mode 100644
index 574745b60..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Start.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-/**
- * Concrete start token class.
- */
-class HTMLPurifier_Token_Start extends HTMLPurifier_Token_Tag
-{
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Tag.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token/Tag.php
deleted file mode 100644
index 284e32ee3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Tag.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Abstract class of a tag token (start, end or empty), and its behavior.
- */
-abstract class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
-{
-    /**
-     * Static bool marker that indicates the class is a tag.
-     *
-     * This allows us to check objects with <tt>!empty($obj->is_tag)</tt>
-     * without having to use a function call <tt>is_a()</tt>.
-     * @type bool
-     */
-    public $is_tag = true;
-
-    /**
-     * The lower-case name of the tag, like 'a', 'b' or 'blockquote'.
-     *
-     * @note Strictly speaking, XML tags are case sensitive, so we shouldn't
-     * be lower-casing them, but these tokens cater to HTML tags, which are
-     * insensitive.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * Associative array of the tag's attributes.
-     * @type array
-     */
-    public $attr = array();
-
-    /**
-     * Non-overloaded constructor, which lower-cases passed tag name.
-     *
-     * @param string $name String name.
-     * @param array $attr Associative array of attributes.
-     * @param int $line
-     * @param int $col
-     * @param array $armor
-     */
-    public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array())
-    {
-        $this->name = ctype_lower($name) ? $name : strtolower($name);
-        foreach ($attr as $key => $value) {
-            // normalization only necessary when key is not lowercase
-            if (!ctype_lower($key)) {
-                $new_key = strtolower($key);
-                if (!isset($attr[$new_key])) {
-                    $attr[$new_key] = $attr[$key];
-                }
-                if ($new_key !== $key) {
-                    unset($attr[$key]);
-                }
-            }
-        }
-        $this->attr = $attr;
-        $this->line = $line;
-        $this->col = $col;
-        $this->armor = $armor;
-    }
-
-    public function toNode() {
-        return new HTMLPurifier_Node_Element($this->name, $this->attr, $this->line, $this->col, $this->armor);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Text.php b/libraries/htmlpurifier410/library/HTMLPurifier/Token/Text.php
deleted file mode 100644
index ff45125a5..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Token/Text.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/**
- * Concrete text token class.
- *
- * Text tokens comprise of regular parsed character data (PCDATA) and raw
- * character data (from the CDATA sections). Internally, their
- * data is parsed with all entities expanded. Surprisingly, the text token
- * does have a "tag name" called #PCDATA, which is how the DTD represents it
- * in permissible child nodes.
- */
-class HTMLPurifier_Token_Text extends HTMLPurifier_Token
-{
-
-    /**
-     * @type string
-     */
-    public $name = '#PCDATA';
-    /**< PCDATA tag name compatible with DTD. */
-
-    /**
-     * @type string
-     */
-    public $data;
-    /**< Parsed character data of text. */
-
-    /**
-     * @type bool
-     */
-    public $is_whitespace;
-
-    /**< Bool indicating if node is whitespace. */
-
-    /**
-     * Constructor, accepts data and determines if it is whitespace.
-     * @param string $data String parsed character data.
-     * @param int $line
-     * @param int $col
-     */
-    public function __construct($data, $line = null, $col = null)
-    {
-        $this->data = $data;
-        $this->is_whitespace = ctype_space($data);
-        $this->line = $line;
-        $this->col = $col;
-    }
-
-    public function toNode() {
-        return new HTMLPurifier_Node_Text($this->data, $this->is_whitespace, $this->line, $this->col);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/TokenFactory.php b/libraries/htmlpurifier410/library/HTMLPurifier/TokenFactory.php
deleted file mode 100644
index e016b80ea..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/TokenFactory.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-
-/**
- * Factory for token generation.
- *
- * @note Doing some benchmarking indicates that the new operator is much
- *       slower than the clone operator (even discounting the cost of the
- *       constructor).  This class is for that optimization.
- *       Other then that, there's not much point as we don't
- *       maintain parallel HTMLPurifier_Token hierarchies (the main reason why
- *       you'd want to use an abstract factory).
- * @todo Port DirectLex to use this
- */
-class HTMLPurifier_TokenFactory
-{
-    // p stands for prototype
-
-    /**
-     * @type HTMLPurifier_Token_Start
-     */
-    private $p_start;
-
-    /**
-     * @type HTMLPurifier_Token_End
-     */
-    private $p_end;
-
-    /**
-     * @type HTMLPurifier_Token_Empty
-     */
-    private $p_empty;
-
-    /**
-     * @type HTMLPurifier_Token_Text
-     */
-    private $p_text;
-
-    /**
-     * @type HTMLPurifier_Token_Comment
-     */
-    private $p_comment;
-
-    /**
-     * Generates blank prototypes for cloning.
-     */
-    public function __construct()
-    {
-        $this->p_start = new HTMLPurifier_Token_Start('', array());
-        $this->p_end = new HTMLPurifier_Token_End('');
-        $this->p_empty = new HTMLPurifier_Token_Empty('', array());
-        $this->p_text = new HTMLPurifier_Token_Text('');
-        $this->p_comment = new HTMLPurifier_Token_Comment('');
-    }
-
-    /**
-     * Creates a HTMLPurifier_Token_Start.
-     * @param string $name Tag name
-     * @param array $attr Associative array of attributes
-     * @return HTMLPurifier_Token_Start Generated HTMLPurifier_Token_Start
-     */
-    public function createStart($name, $attr = array())
-    {
-        $p = clone $this->p_start;
-        $p->__construct($name, $attr);
-        return $p;
-    }
-
-    /**
-     * Creates a HTMLPurifier_Token_End.
-     * @param string $name Tag name
-     * @return HTMLPurifier_Token_End Generated HTMLPurifier_Token_End
-     */
-    public function createEnd($name)
-    {
-        $p = clone $this->p_end;
-        $p->__construct($name);
-        return $p;
-    }
-
-    /**
-     * Creates a HTMLPurifier_Token_Empty.
-     * @param string $name Tag name
-     * @param array $attr Associative array of attributes
-     * @return HTMLPurifier_Token_Empty Generated HTMLPurifier_Token_Empty
-     */
-    public function createEmpty($name, $attr = array())
-    {
-        $p = clone $this->p_empty;
-        $p->__construct($name, $attr);
-        return $p;
-    }
-
-    /**
-     * Creates a HTMLPurifier_Token_Text.
-     * @param string $data Data of text token
-     * @return HTMLPurifier_Token_Text Generated HTMLPurifier_Token_Text
-     */
-    public function createText($data)
-    {
-        $p = clone $this->p_text;
-        $p->__construct($data);
-        return $p;
-    }
-
-    /**
-     * Creates a HTMLPurifier_Token_Comment.
-     * @param string $data Data of comment token
-     * @return HTMLPurifier_Token_Comment Generated HTMLPurifier_Token_Comment
-     */
-    public function createComment($data)
-    {
-        $p = clone $this->p_comment;
-        $p->__construct($data);
-        return $p;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URI.php b/libraries/htmlpurifier410/library/HTMLPurifier/URI.php
deleted file mode 100644
index 1a4705a0c..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URI.php
+++ /dev/null
@@ -1,316 +0,0 @@
-<?php
-
-/**
- * HTML Purifier's internal representation of a URI.
- * @note
- *      Internal data-structures are completely escaped. If the data needs
- *      to be used in a non-URI context (which is very unlikely), be sure
- *      to decode it first. The URI may not necessarily be well-formed until
- *      validate() is called.
- */
-class HTMLPurifier_URI
-{
-    /**
-     * @type string
-     */
-    public $scheme;
-
-    /**
-     * @type string
-     */
-    public $userinfo;
-
-    /**
-     * @type string
-     */
-    public $host;
-
-    /**
-     * @type int
-     */
-    public $port;
-
-    /**
-     * @type string
-     */
-    public $path;
-
-    /**
-     * @type string
-     */
-    public $query;
-
-    /**
-     * @type string
-     */
-    public $fragment;
-
-    /**
-     * @param string $scheme
-     * @param string $userinfo
-     * @param string $host
-     * @param int $port
-     * @param string $path
-     * @param string $query
-     * @param string $fragment
-     * @note Automatically normalizes scheme and port
-     */
-    public function __construct($scheme, $userinfo, $host, $port, $path, $query, $fragment)
-    {
-        $this->scheme = is_null($scheme) || ctype_lower($scheme) ? $scheme : strtolower($scheme);
-        $this->userinfo = $userinfo;
-        $this->host = $host;
-        $this->port = is_null($port) ? $port : (int)$port;
-        $this->path = $path;
-        $this->query = $query;
-        $this->fragment = $fragment;
-    }
-
-    /**
-     * Retrieves a scheme object corresponding to the URI's scheme/default
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_URIScheme Scheme object appropriate for validating this URI
-     */
-    public function getSchemeObj($config, $context)
-    {
-        $registry = HTMLPurifier_URISchemeRegistry::instance();
-        if ($this->scheme !== null) {
-            $scheme_obj = $registry->getScheme($this->scheme, $config, $context);
-            if (!$scheme_obj) {
-                return false;
-            } // invalid scheme, clean it out
-        } else {
-            // no scheme: retrieve the default one
-            $def = $config->getDefinition('URI');
-            $scheme_obj = $def->getDefaultScheme($config, $context);
-            if (!$scheme_obj) {
-                if ($def->defaultScheme !== null) {
-                    // something funky happened to the default scheme object
-                    trigger_error(
-                        'Default scheme object "' . $def->defaultScheme . '" was not readable',
-                        E_USER_WARNING
-                    );
-                } // suppress error if it's null
-                return false;
-            }
-        }
-        return $scheme_obj;
-    }
-
-    /**
-     * Generic validation method applicable for all schemes. May modify
-     * this URI in order to get it into a compliant form.
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool True if validation/filtering succeeds, false if failure
-     */
-    public function validate($config, $context)
-    {
-        // ABNF definitions from RFC 3986
-        $chars_sub_delims = '!$&\'()*+,;=';
-        $chars_gen_delims = ':/?#[]@';
-        $chars_pchar = $chars_sub_delims . ':@';
-
-        // validate host
-        if (!is_null($this->host)) {
-            $host_def = new HTMLPurifier_AttrDef_URI_Host();
-            $this->host = $host_def->validate($this->host, $config, $context);
-            if ($this->host === false) {
-                $this->host = null;
-            }
-        }
-
-        // validate scheme
-        // NOTE: It's not appropriate to check whether or not this
-        // scheme is in our registry, since a URIFilter may convert a
-        // URI that we don't allow into one we do.  So instead, we just
-        // check if the scheme can be dropped because there is no host
-        // and it is our default scheme.
-        if (!is_null($this->scheme) && is_null($this->host) || $this->host === '') {
-            // support for relative paths is pretty abysmal when the
-            // scheme is present, so axe it when possible
-            $def = $config->getDefinition('URI');
-            if ($def->defaultScheme === $this->scheme) {
-                $this->scheme = null;
-            }
-        }
-
-        // validate username
-        if (!is_null($this->userinfo)) {
-            $encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims . ':');
-            $this->userinfo = $encoder->encode($this->userinfo);
-        }
-
-        // validate port
-        if (!is_null($this->port)) {
-            if ($this->port < 1 || $this->port > 65535) {
-                $this->port = null;
-            }
-        }
-
-        // validate path
-        $segments_encoder = new HTMLPurifier_PercentEncoder($chars_pchar . '/');
-        if (!is_null($this->host)) { // this catches $this->host === ''
-            // path-abempty (hier and relative)
-            // http://www.example.com/my/path
-            // //www.example.com/my/path (looks odd, but works, and
-            //                            recognized by most browsers)
-            // (this set is valid or invalid on a scheme by scheme
-            // basis, so we'll deal with it later)
-            // file:///my/path
-            // ///my/path
-            $this->path = $segments_encoder->encode($this->path);
-        } elseif ($this->path !== '') {
-            if ($this->path[0] === '/') {
-                // path-absolute (hier and relative)
-                // http:/my/path
-                // /my/path
-                if (strlen($this->path) >= 2 && $this->path[1] === '/') {
-                    // This could happen if both the host gets stripped
-                    // out
-                    // http://my/path
-                    // //my/path
-                    $this->path = '';
-                } else {
-                    $this->path = $segments_encoder->encode($this->path);
-                }
-            } elseif (!is_null($this->scheme)) {
-                // path-rootless (hier)
-                // http:my/path
-                // Short circuit evaluation means we don't need to check nz
-                $this->path = $segments_encoder->encode($this->path);
-            } else {
-                // path-noscheme (relative)
-                // my/path
-                // (once again, not checking nz)
-                $segment_nc_encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims . '@');
-                $c = strpos($this->path, '/');
-                if ($c !== false) {
-                    $this->path =
-                        $segment_nc_encoder->encode(substr($this->path, 0, $c)) .
-                        $segments_encoder->encode(substr($this->path, $c));
-                } else {
-                    $this->path = $segment_nc_encoder->encode($this->path);
-                }
-            }
-        } else {
-            // path-empty (hier and relative)
-            $this->path = ''; // just to be safe
-        }
-
-        // qf = query and fragment
-        $qf_encoder = new HTMLPurifier_PercentEncoder($chars_pchar . '/?');
-
-        if (!is_null($this->query)) {
-            $this->query = $qf_encoder->encode($this->query);
-        }
-
-        if (!is_null($this->fragment)) {
-            $this->fragment = $qf_encoder->encode($this->fragment);
-        }
-        return true;
-    }
-
-    /**
-     * Convert URI back to string
-     * @return string URI appropriate for output
-     */
-    public function toString()
-    {
-        // reconstruct authority
-        $authority = null;
-        // there is a rendering difference between a null authority
-        // (http:foo-bar) and an empty string authority
-        // (http:///foo-bar).
-        if (!is_null($this->host)) {
-            $authority = '';
-            if (!is_null($this->userinfo)) {
-                $authority .= $this->userinfo . '@';
-            }
-            $authority .= $this->host;
-            if (!is_null($this->port)) {
-                $authority .= ':' . $this->port;
-            }
-        }
-
-        // Reconstruct the result
-        // One might wonder about parsing quirks from browsers after
-        // this reconstruction.  Unfortunately, parsing behavior depends
-        // on what *scheme* was employed (file:///foo is handled *very*
-        // differently than http:///foo), so unfortunately we have to
-        // defer to the schemes to do the right thing.
-        $result = '';
-        if (!is_null($this->scheme)) {
-            $result .= $this->scheme . ':';
-        }
-        if (!is_null($authority)) {
-            $result .= '//' . $authority;
-        }
-        $result .= $this->path;
-        if (!is_null($this->query)) {
-            $result .= '?' . $this->query;
-        }
-        if (!is_null($this->fragment)) {
-            $result .= '#' . $this->fragment;
-        }
-
-        return $result;
-    }
-
-    /**
-     * Returns true if this URL might be considered a 'local' URL given
-     * the current context.  This is true when the host is null, or
-     * when it matches the host supplied to the configuration.
-     *
-     * Note that this does not do any scheme checking, so it is mostly
-     * only appropriate for metadata that doesn't care about protocol
-     * security.  isBenign is probably what you actually want.
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function isLocal($config, $context)
-    {
-        if ($this->host === null) {
-            return true;
-        }
-        $uri_def = $config->getDefinition('URI');
-        if ($uri_def->host === $this->host) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Returns true if this URL should be considered a 'benign' URL,
-     * that is:
-     *
-     *      - It is a local URL (isLocal), and
-     *      - It has a equal or better level of security
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function isBenign($config, $context)
-    {
-        if (!$this->isLocal($config, $context)) {
-            return false;
-        }
-
-        $scheme_obj = $this->getSchemeObj($config, $context);
-        if (!$scheme_obj) {
-            return false;
-        } // conservative approach
-
-        $current_scheme_obj = $config->getDefinition('URI')->getDefaultScheme($config, $context);
-        if ($current_scheme_obj->secure) {
-            if (!$scheme_obj->secure) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIDefinition.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIDefinition.php
deleted file mode 100644
index dbc2a752e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIDefinition.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
-{
-
-    public $type = 'URI';
-    protected $filters = array();
-    protected $postFilters = array();
-    protected $registeredFilters = array();
-
-    /**
-     * HTMLPurifier_URI object of the base specified at %URI.Base
-     */
-    public $base;
-
-    /**
-     * String host to consider "home" base, derived off of $base
-     */
-    public $host;
-
-    /**
-     * Name of default scheme based on %URI.DefaultScheme and %URI.Base
-     */
-    public $defaultScheme;
-
-    public function __construct()
-    {
-        $this->registerFilter(new HTMLPurifier_URIFilter_DisableExternal());
-        $this->registerFilter(new HTMLPurifier_URIFilter_DisableExternalResources());
-        $this->registerFilter(new HTMLPurifier_URIFilter_DisableResources());
-        $this->registerFilter(new HTMLPurifier_URIFilter_HostBlacklist());
-        $this->registerFilter(new HTMLPurifier_URIFilter_SafeIframe());
-        $this->registerFilter(new HTMLPurifier_URIFilter_MakeAbsolute());
-        $this->registerFilter(new HTMLPurifier_URIFilter_Munge());
-    }
-
-    public function registerFilter($filter)
-    {
-        $this->registeredFilters[$filter->name] = $filter;
-    }
-
-    public function addFilter($filter, $config)
-    {
-        $r = $filter->prepare($config);
-        if ($r === false) return; // null is ok, for backwards compat
-        if ($filter->post) {
-            $this->postFilters[$filter->name] = $filter;
-        } else {
-            $this->filters[$filter->name] = $filter;
-        }
-    }
-
-    protected function doSetup($config)
-    {
-        $this->setupMemberVariables($config);
-        $this->setupFilters($config);
-    }
-
-    protected function setupFilters($config)
-    {
-        foreach ($this->registeredFilters as $name => $filter) {
-            if ($filter->always_load) {
-                $this->addFilter($filter, $config);
-            } else {
-                $conf = $config->get('URI.' . $name);
-                if ($conf !== false && $conf !== null) {
-                    $this->addFilter($filter, $config);
-                }
-            }
-        }
-        unset($this->registeredFilters);
-    }
-
-    protected function setupMemberVariables($config)
-    {
-        $this->host = $config->get('URI.Host');
-        $base_uri = $config->get('URI.Base');
-        if (!is_null($base_uri)) {
-            $parser = new HTMLPurifier_URIParser();
-            $this->base = $parser->parse($base_uri);
-            $this->defaultScheme = $this->base->scheme;
-            if (is_null($this->host)) $this->host = $this->base->host;
-        }
-        if (is_null($this->defaultScheme)) $this->defaultScheme = $config->get('URI.DefaultScheme');
-    }
-
-    public function getDefaultScheme($config, $context)
-    {
-        return HTMLPurifier_URISchemeRegistry::instance()->getScheme($this->defaultScheme, $config, $context);
-    }
-
-    public function filter(&$uri, $config, $context)
-    {
-        foreach ($this->filters as $name => $f) {
-            $result = $f->filter($uri, $config, $context);
-            if (!$result) return false;
-        }
-        return true;
-    }
-
-    public function postFilter(&$uri, $config, $context)
-    {
-        foreach ($this->postFilters as $name => $f) {
-            $result = $f->filter($uri, $config, $context);
-            if (!$result) return false;
-        }
-        return true;
-    }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter.php
deleted file mode 100644
index 0333ea341..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-/**
- * Chainable filters for custom URI processing.
- *
- * These filters can perform custom actions on a URI filter object,
- * including transformation or blacklisting.  A filter named Foo
- * must have a corresponding configuration directive %URI.Foo,
- * unless always_load is specified to be true.
- *
- * The following contexts may be available while URIFilters are being
- * processed:
- *
- *      - EmbeddedURI: true if URI is an embedded resource that will
- *        be loaded automatically on page load
- *      - CurrentToken: a reference to the token that is currently
- *        being processed
- *      - CurrentAttr: the name of the attribute that is currently being
- *        processed
- *      - CurrentCSSProperty: the name of the CSS property that is
- *        currently being processed (if applicable)
- *
- * @warning This filter is called before scheme object validation occurs.
- *          Make sure, if you require a specific scheme object, you
- *          you check that it exists. This allows filters to convert
- *          proprietary URI schemes into regular ones.
- */
-abstract class HTMLPurifier_URIFilter
-{
-
-    /**
-     * Unique identifier of filter.
-     * @type string
-     */
-    public $name;
-
-    /**
-     * True if this filter should be run after scheme validation.
-     * @type bool
-     */
-    public $post = false;
-
-    /**
-     * True if this filter should always be loaded.
-     * This permits a filter to be named Foo without the corresponding
-     * %URI.Foo directive existing.
-     * @type bool
-     */
-    public $always_load = false;
-
-    /**
-     * Performs initialization for the filter.  If the filter returns
-     * false, this means that it shouldn't be considered active.
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function prepare($config)
-    {
-        return true;
-    }
-
-    /**
-     * Filter a URI object
-     * @param HTMLPurifier_URI $uri Reference to URI object variable
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool Whether or not to continue processing: false indicates
-     *         URL is no good, true indicates continue processing. Note that
-     *         all changes are committed directly on the URI object
-     */
-    abstract public function filter(&$uri, $config, $context);
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternal.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternal.php
deleted file mode 100644
index 52e12977e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternal.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-class HTMLPurifier_URIFilter_DisableExternal extends HTMLPurifier_URIFilter
-{
-    /**
-     * @type string
-     */
-    public $name = 'DisableExternal';
-
-    /**
-     * @type array
-     */
-    protected $ourHostParts = false;
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return void
-     */
-    public function prepare($config)
-    {
-        $our_host = $config->getDefinition('URI')->host;
-        if ($our_host !== null) {
-            $this->ourHostParts = array_reverse(explode('.', $our_host));
-        }
-    }
-
-    /**
-     * @param HTMLPurifier_URI $uri Reference
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        if (is_null($uri->host)) {
-            return true;
-        }
-        if ($this->ourHostParts === false) {
-            return false;
-        }
-        $host_parts = array_reverse(explode('.', $uri->host));
-        foreach ($this->ourHostParts as $i => $x) {
-            if (!isset($host_parts[$i])) {
-                return false;
-            }
-            if ($host_parts[$i] != $this->ourHostParts[$i]) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternalResources.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternalResources.php
deleted file mode 100644
index 22697d71e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableExternalResources.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-class HTMLPurifier_URIFilter_DisableExternalResources extends HTMLPurifier_URIFilter_DisableExternal
-{
-    /**
-     * @type string
-     */
-    public $name = 'DisableExternalResources';
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        if (!$context->get('EmbeddedURI', true)) {
-            return true;
-        }
-        return parent::filter($uri, $config, $context);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableResources.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableResources.php
deleted file mode 100644
index bdae95529..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/DisableResources.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-class HTMLPurifier_URIFilter_DisableResources extends HTMLPurifier_URIFilter
-{
-    /**
-     * @type string
-     */
-    public $name = 'DisableResources';
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        return !$context->get('EmbeddedURI', true);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/HostBlacklist.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/HostBlacklist.php
deleted file mode 100644
index 54980b6eb..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/HostBlacklist.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-// It's not clear to me whether or not Punycode means that hostnames
-// do not have canonical forms anymore. As far as I can tell, it's
-// not a problem (punycoding should be identity when no Unicode
-// points are involved), but I'm not 100% sure
-class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter
-{
-    /**
-     * @type string
-     */
-    public $name = 'HostBlacklist';
-
-    /**
-     * @type array
-     */
-    protected $blacklist = array();
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function prepare($config)
-    {
-        $this->blacklist = $config->get('URI.HostBlacklist');
-        return true;
-    }
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        foreach ($this->blacklist as $blacklisted_host_fragment) {
-            if (strpos($uri->host, $blacklisted_host_fragment) !== false) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/MakeAbsolute.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/MakeAbsolute.php
deleted file mode 100644
index c873bce96..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/MakeAbsolute.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-
-// does not support network paths
-
-class HTMLPurifier_URIFilter_MakeAbsolute extends HTMLPurifier_URIFilter
-{
-    /**
-     * @type string
-     */
-    public $name = 'MakeAbsolute';
-
-    /**
-     * @type
-     */
-    protected $base;
-
-    /**
-     * @type array
-     */
-    protected $basePathStack = array();
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function prepare($config)
-    {
-        $def = $config->getDefinition('URI');
-        $this->base = $def->base;
-        if (is_null($this->base)) {
-            trigger_error(
-                'URI.MakeAbsolute is being ignored due to lack of ' .
-                'value for URI.Base configuration',
-                E_USER_WARNING
-            );
-            return false;
-        }
-        $this->base->fragment = null; // fragment is invalid for base URI
-        $stack = explode('/', $this->base->path);
-        array_pop($stack); // discard last segment
-        $stack = $this->_collapseStack($stack); // do pre-parsing
-        $this->basePathStack = $stack;
-        return true;
-    }
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        if (is_null($this->base)) {
-            return true;
-        } // abort early
-        if ($uri->path === '' && is_null($uri->scheme) &&
-            is_null($uri->host) && is_null($uri->query) && is_null($uri->fragment)) {
-            // reference to current document
-            $uri = clone $this->base;
-            return true;
-        }
-        if (!is_null($uri->scheme)) {
-            // absolute URI already: don't change
-            if (!is_null($uri->host)) {
-                return true;
-            }
-            $scheme_obj = $uri->getSchemeObj($config, $context);
-            if (!$scheme_obj) {
-                // scheme not recognized
-                return false;
-            }
-            if (!$scheme_obj->hierarchical) {
-                // non-hierarchal URI with explicit scheme, don't change
-                return true;
-            }
-            // special case: had a scheme but always is hierarchical and had no authority
-        }
-        if (!is_null($uri->host)) {
-            // network path, don't bother
-            return true;
-        }
-        if ($uri->path === '') {
-            $uri->path = $this->base->path;
-        } elseif ($uri->path[0] !== '/') {
-            // relative path, needs more complicated processing
-            $stack = explode('/', $uri->path);
-            $new_stack = array_merge($this->basePathStack, $stack);
-            if ($new_stack[0] !== '' && !is_null($this->base->host)) {
-                array_unshift($new_stack, '');
-            }
-            $new_stack = $this->_collapseStack($new_stack);
-            $uri->path = implode('/', $new_stack);
-        } else {
-            // absolute path, but still we should collapse
-            $uri->path = implode('/', $this->_collapseStack(explode('/', $uri->path)));
-        }
-        // re-combine
-        $uri->scheme = $this->base->scheme;
-        if (is_null($uri->userinfo)) {
-            $uri->userinfo = $this->base->userinfo;
-        }
-        if (is_null($uri->host)) {
-            $uri->host = $this->base->host;
-        }
-        if (is_null($uri->port)) {
-            $uri->port = $this->base->port;
-        }
-        return true;
-    }
-
-    /**
-     * Resolve dots and double-dots in a path stack
-     * @param array $stack
-     * @return array
-     */
-    private function _collapseStack($stack)
-    {
-        $result = array();
-        $is_folder = false;
-        for ($i = 0; isset($stack[$i]); $i++) {
-            $is_folder = false;
-            // absorb an internally duplicated slash
-            if ($stack[$i] == '' && $i && isset($stack[$i + 1])) {
-                continue;
-            }
-            if ($stack[$i] == '..') {
-                if (!empty($result)) {
-                    $segment = array_pop($result);
-                    if ($segment === '' && empty($result)) {
-                        // error case: attempted to back out too far:
-                        // restore the leading slash
-                        $result[] = '';
-                    } elseif ($segment === '..') {
-                        $result[] = '..'; // cannot remove .. with ..
-                    }
-                } else {
-                    // relative path, preserve the double-dots
-                    $result[] = '..';
-                }
-                $is_folder = true;
-                continue;
-            }
-            if ($stack[$i] == '.') {
-                // silently absorb
-                $is_folder = true;
-                continue;
-            }
-            $result[] = $stack[$i];
-        }
-        if ($is_folder) {
-            $result[] = '';
-        }
-        return $result;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/Munge.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/Munge.php
deleted file mode 100644
index 4b4f0cf72..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/Munge.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-
-class HTMLPurifier_URIFilter_Munge extends HTMLPurifier_URIFilter
-{
-    /**
-     * @type string
-     */
-    public $name = 'Munge';
-
-    /**
-     * @type bool
-     */
-    public $post = true;
-
-    /**
-     * @type string
-     */
-    private $target;
-
-    /**
-     * @type HTMLPurifier_URIParser
-     */
-    private $parser;
-
-    /**
-     * @type bool
-     */
-    private $doEmbed;
-
-    /**
-     * @type string
-     */
-    private $secretKey;
-
-    /**
-     * @type array
-     */
-    protected $replace = array();
-
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function prepare($config)
-    {
-        $this->target = $config->get('URI.' . $this->name);
-        $this->parser = new HTMLPurifier_URIParser();
-        $this->doEmbed = $config->get('URI.MungeResources');
-        $this->secretKey = $config->get('URI.MungeSecretKey');
-        if ($this->secretKey && !function_exists('hash_hmac')) {
-            throw new Exception("Cannot use %URI.MungeSecretKey without hash_hmac support.");
-        }
-        return true;
-    }
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        if ($context->get('EmbeddedURI', true) && !$this->doEmbed) {
-            return true;
-        }
-
-        $scheme_obj = $uri->getSchemeObj($config, $context);
-        if (!$scheme_obj) {
-            return true;
-        } // ignore unknown schemes, maybe another postfilter did it
-        if (!$scheme_obj->browsable) {
-            return true;
-        } // ignore non-browseable schemes, since we can't munge those in a reasonable way
-        if ($uri->isBenign($config, $context)) {
-            return true;
-        } // don't redirect if a benign URL
-
-        $this->makeReplace($uri, $config, $context);
-        $this->replace = array_map('rawurlencode', $this->replace);
-
-        $new_uri = strtr($this->target, $this->replace);
-        $new_uri = $this->parser->parse($new_uri);
-        // don't redirect if the target host is the same as the
-        // starting host
-        if ($uri->host === $new_uri->host) {
-            return true;
-        }
-        $uri = $new_uri; // overwrite
-        return true;
-    }
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     */
-    protected function makeReplace($uri, $config, $context)
-    {
-        $string = $uri->toString();
-        // always available
-        $this->replace['%s'] = $string;
-        $this->replace['%r'] = $context->get('EmbeddedURI', true);
-        $token = $context->get('CurrentToken', true);
-        $this->replace['%n'] = $token ? $token->name : null;
-        $this->replace['%m'] = $context->get('CurrentAttr', true);
-        $this->replace['%p'] = $context->get('CurrentCSSProperty', true);
-        // not always available
-        if ($this->secretKey) {
-            $this->replace['%t'] = hash_hmac("sha256", $string, $this->secretKey);
-        }
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/SafeIframe.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/SafeIframe.php
deleted file mode 100644
index 5ecb9567b..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIFilter/SafeIframe.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Implements safety checks for safe iframes.
- *
- * @warning This filter is *critical* for ensuring that %HTML.SafeIframe
- * works safely.
- */
-class HTMLPurifier_URIFilter_SafeIframe extends HTMLPurifier_URIFilter
-{
-    /**
-     * @type string
-     */
-    public $name = 'SafeIframe';
-
-    /**
-     * @type bool
-     */
-    public $always_load = true;
-
-    /**
-     * @type string
-     */
-    protected $regexp = null;
-
-    // XXX: The not so good bit about how this is all set up now is we
-    // can't check HTML.SafeIframe in the 'prepare' step: we have to
-    // defer till the actual filtering.
-    /**
-     * @param HTMLPurifier_Config $config
-     * @return bool
-     */
-    public function prepare($config)
-    {
-        $this->regexp = $config->get('URI.SafeIframeRegexp');
-        return true;
-    }
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function filter(&$uri, $config, $context)
-    {
-        // check if filter not applicable
-        if (!$config->get('HTML.SafeIframe')) {
-            return true;
-        }
-        // check if the filter should actually trigger
-        if (!$context->get('EmbeddedURI', true)) {
-            return true;
-        }
-        $token = $context->get('CurrentToken', true);
-        if (!($token && $token->name == 'iframe')) {
-            return true;
-        }
-        // check if we actually have some whitelists enabled
-        if ($this->regexp === null) {
-            return false;
-        }
-        // actually check the whitelists
-        return preg_match($this->regexp, $uri->toString());
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIParser.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIParser.php
deleted file mode 100644
index 699978dcb..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIParser.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * Parses a URI into the components and fragment identifier as specified
- * by RFC 3986.
- */
-class HTMLPurifier_URIParser
-{
-
-    /**
-     * Instance of HTMLPurifier_PercentEncoder to do normalization with.
-     */
-    protected $percentEncoder;
-
-    public function __construct()
-    {
-        $this->percentEncoder = new HTMLPurifier_PercentEncoder();
-    }
-
-    /**
-     * Parses a URI.
-     * @param $uri string URI to parse
-     * @return HTMLPurifier_URI representation of URI. This representation has
-     *         not been validated yet and may not conform to RFC.
-     */
-    public function parse($uri)
-    {
-        $uri = $this->percentEncoder->normalize($uri);
-
-        // Regexp is as per Appendix B.
-        // Note that ["<>] are an addition to the RFC's recommended
-        // characters, because they represent external delimeters.
-        $r_URI = '!'.
-            '(([a-zA-Z0-9\.\+\-]+):)?'. // 2. Scheme
-            '(//([^/?#"<>]*))?'. // 4. Authority
-            '([^?#"<>]*)'.       // 5. Path
-            '(\?([^#"<>]*))?'.   // 7. Query
-            '(#([^"<>]*))?'.     // 8. Fragment
-            '!';
-
-        $matches = array();
-        $result = preg_match($r_URI, $uri, $matches);
-
-        if (!$result) return false; // *really* invalid URI
-
-        // seperate out parts
-        $scheme     = !empty($matches[1]) ? $matches[2] : null;
-        $authority  = !empty($matches[3]) ? $matches[4] : null;
-        $path       = $matches[5]; // always present, can be empty
-        $query      = !empty($matches[6]) ? $matches[7] : null;
-        $fragment   = !empty($matches[8]) ? $matches[9] : null;
-
-        // further parse authority
-        if ($authority !== null) {
-            $r_authority = "/^((.+?)@)?(\[[^\]]+\]|[^:]*)(:(\d*))?/";
-            $matches = array();
-            preg_match($r_authority, $authority, $matches);
-            $userinfo   = !empty($matches[1]) ? $matches[2] : null;
-            $host       = !empty($matches[3]) ? $matches[3] : '';
-            $port       = !empty($matches[4]) ? (int) $matches[5] : null;
-        } else {
-            $port = $host = $userinfo = null;
-        }
-
-        return new HTMLPurifier_URI(
-            $scheme, $userinfo, $host, $port, $path, $query, $fragment);
-    }
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme.php
deleted file mode 100644
index 03602abe6..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * Validator for the components of a URI for a specific scheme
- */
-abstract class HTMLPurifier_URIScheme
-{
-
-    /**
-     * Scheme's default port (integer). If an explicit port number is
-     * specified that coincides with the default port, it will be
-     * elided.
-     * @type int
-     */
-    public $default_port = null;
-
-    /**
-     * Whether or not URIs of this scheme are locatable by a browser
-     * http and ftp are accessible, while mailto and news are not.
-     * @type bool
-     */
-    public $browsable = false;
-
-    /**
-     * Whether or not data transmitted over this scheme is encrypted.
-     * https is secure, http is not.
-     * @type bool
-     */
-    public $secure = false;
-
-    /**
-     * Whether or not the URI always uses <hier_part>, resolves edge cases
-     * with making relative URIs absolute
-     * @type bool
-     */
-    public $hierarchical = false;
-
-    /**
-     * Whether or not the URI may omit a hostname when the scheme is
-     * explicitly specified, ala file:///path/to/file. As of writing,
-     * 'file' is the only scheme that browsers support his properly.
-     * @type bool
-     */
-    public $may_omit_host = false;
-
-    /**
-     * Validates the components of a URI for a specific scheme.
-     * @param HTMLPurifier_URI $uri Reference to a HTMLPurifier_URI object
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool success or failure
-     */
-    abstract public function doValidate(&$uri, $config, $context);
-
-    /**
-     * Public interface for validating components of a URI.  Performs a
-     * bunch of default actions. Don't overload this method.
-     * @param HTMLPurifier_URI $uri Reference to a HTMLPurifier_URI object
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool success or failure
-     */
-    public function validate(&$uri, $config, $context)
-    {
-        if ($this->default_port == $uri->port) {
-            $uri->port = null;
-        }
-        // kludge: browsers do funny things when the scheme but not the
-        // authority is set
-        if (!$this->may_omit_host &&
-            // if the scheme is present, a missing host is always in error
-            (!is_null($uri->scheme) && ($uri->host === '' || is_null($uri->host))) ||
-            // if the scheme is not present, a *blank* host is in error,
-            // since this translates into '///path' which most browsers
-            // interpret as being 'http://path'.
-            (is_null($uri->scheme) && $uri->host === '')
-        ) {
-            do {
-                if (is_null($uri->scheme)) {
-                    if (substr($uri->path, 0, 2) != '//') {
-                        $uri->host = null;
-                        break;
-                    }
-                    // URI is '////path', so we cannot nullify the
-                    // host to preserve semantics.  Try expanding the
-                    // hostname instead (fall through)
-                }
-                // first see if we can manually insert a hostname
-                $host = $config->get('URI.Host');
-                if (!is_null($host)) {
-                    $uri->host = $host;
-                } else {
-                    // we can't do anything sensible, reject the URL.
-                    return false;
-                }
-            } while (false);
-        }
-        return $this->doValidate($uri, $config, $context);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/data.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/data.php
deleted file mode 100644
index f854ba052..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/data.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-/**
- * Implements data: URI for base64 encoded images supported by GD.
- */
-class HTMLPurifier_URIScheme_data extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type bool
-     */
-    public $browsable = true;
-
-    /**
-     * @type array
-     */
-    public $allowed_types = array(
-        // you better write validation code for other types if you
-        // decide to allow them
-        'image/jpeg' => true,
-        'image/gif' => true,
-        'image/png' => true,
-    );
-    // this is actually irrelevant since we only write out the path
-    // component
-    /**
-     * @type bool
-     */
-    public $may_omit_host = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $result = explode(',', $uri->path, 2);
-        $is_base64 = false;
-        $charset = null;
-        $content_type = null;
-        if (count($result) == 2) {
-            list($metadata, $data) = $result;
-            // do some legwork on the metadata
-            $metas = explode(';', $metadata);
-            while (!empty($metas)) {
-                $cur = array_shift($metas);
-                if ($cur == 'base64') {
-                    $is_base64 = true;
-                    break;
-                }
-                if (substr($cur, 0, 8) == 'charset=') {
-                    // doesn't match if there are arbitrary spaces, but
-                    // whatever dude
-                    if ($charset !== null) {
-                        continue;
-                    } // garbage
-                    $charset = substr($cur, 8); // not used
-                } else {
-                    if ($content_type !== null) {
-                        continue;
-                    } // garbage
-                    $content_type = $cur;
-                }
-            }
-        } else {
-            $data = $result[0];
-        }
-        if ($content_type !== null && empty($this->allowed_types[$content_type])) {
-            return false;
-        }
-        if ($charset !== null) {
-            // error; we don't allow plaintext stuff
-            $charset = null;
-        }
-        $data = rawurldecode($data);
-        if ($is_base64) {
-            $raw_data = base64_decode($data);
-        } else {
-            $raw_data = $data;
-        }
-        if ( strlen($raw_data) < 12 ) {
-            // error; exif_imagetype throws exception with small files,
-            // and this likely indicates a corrupt URI/failed parse anyway
-            return false;
-        }
-        // XXX probably want to refactor this into a general mechanism
-        // for filtering arbitrary content types
-        if (function_exists('sys_get_temp_dir')) {
-            $file = tempnam(sys_get_temp_dir(), "");
-        } else {
-            $file = tempnam("/tmp", "");
-        }
-        file_put_contents($file, $raw_data);
-        if (function_exists('exif_imagetype')) {
-            $image_code = exif_imagetype($file);
-            unlink($file);
-        } elseif (function_exists('getimagesize')) {
-            set_error_handler(array($this, 'muteErrorHandler'));
-            $info = getimagesize($file);
-            restore_error_handler();
-            unlink($file);
-            if ($info == false) {
-                return false;
-            }
-            $image_code = $info[2];
-        } else {
-            trigger_error("could not find exif_imagetype or getimagesize functions", E_USER_ERROR);
-        }
-        $real_content_type = image_type_to_mime_type($image_code);
-        if ($real_content_type != $content_type) {
-            // we're nice guys; if the content type is something else we
-            // support, change it over
-            if (empty($this->allowed_types[$real_content_type])) {
-                return false;
-            }
-            $content_type = $real_content_type;
-        }
-        // ok, it's kosher, rewrite what we need
-        $uri->userinfo = null;
-        $uri->host = null;
-        $uri->port = null;
-        $uri->fragment = null;
-        $uri->query = null;
-        $uri->path = "$content_type;base64," . base64_encode($raw_data);
-        return true;
-    }
-
-    /**
-     * @param int $errno
-     * @param string $errstr
-     */
-    public function muteErrorHandler($errno, $errstr)
-    {
-    }
-}
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/file.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/file.php
deleted file mode 100644
index a220a6ad4..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/file.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * Validates file as defined by RFC 1630 and RFC 1738.
- */
-class HTMLPurifier_URIScheme_file extends HTMLPurifier_URIScheme
-{
-    /**
-     * Generally file:// URLs are not accessible from most
-     * machines, so placing them as an img src is incorrect.
-     * @type bool
-     */
-    public $browsable = false;
-
-    /**
-     * Basically the *only* URI scheme for which this is true, since
-     * accessing files on the local machine is very common.  In fact,
-     * browsers on some operating systems don't understand the
-     * authority, though I hear it is used on Windows to refer to
-     * network shares.
-     * @type bool
-     */
-    public $may_omit_host = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        // Authentication method is not supported
-        $uri->userinfo = null;
-        // file:// makes no provisions for accessing the resource
-        $uri->port = null;
-        // While it seems to work on Firefox, the querystring has
-        // no possible effect and is thus stripped.
-        $uri->query = null;
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/ftp.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/ftp.php
deleted file mode 100644
index 8e7fb8c34..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/ftp.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/**
- * Validates ftp (File Transfer Protocol) URIs as defined by generic RFC 1738.
- */
-class HTMLPurifier_URIScheme_ftp extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type int
-     */
-    public $default_port = 21;
-
-    /**
-     * @type bool
-     */
-    public $browsable = true; // usually
-
-    /**
-     * @type bool
-     */
-    public $hierarchical = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $uri->query = null;
-
-        // typecode check
-        $semicolon_pos = strrpos($uri->path, ';'); // reverse
-        if ($semicolon_pos !== false) {
-            $type = substr($uri->path, $semicolon_pos + 1); // no semicolon
-            $uri->path = substr($uri->path, 0, $semicolon_pos);
-            $type_ret = '';
-            if (strpos($type, '=') !== false) {
-                // figure out whether or not the declaration is correct
-                list($key, $typecode) = explode('=', $type, 2);
-                if ($key !== 'type') {
-                    // invalid key, tack it back on encoded
-                    $uri->path .= '%3B' . $type;
-                } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') {
-                    $type_ret = ";type=$typecode";
-                }
-            } else {
-                $uri->path .= '%3B' . $type;
-            }
-            $uri->path = str_replace(';', '%3B', $uri->path);
-            $uri->path .= $type_ret;
-        }
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/http.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/http.php
deleted file mode 100644
index 63c8c928e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/http.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * Validates http (HyperText Transfer Protocol) as defined by RFC 2616
- */
-class HTMLPurifier_URIScheme_http extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type int
-     */
-    public $default_port = 80;
-
-    /**
-     * @type bool
-     */
-    public $browsable = true;
-
-    /**
-     * @type bool
-     */
-    public $hierarchical = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $uri->userinfo = null;
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/https.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/https.php
deleted file mode 100644
index 4de39090d..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/https.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-/**
- * Validates https (Secure HTTP) according to http scheme.
- */
-class HTMLPurifier_URIScheme_https extends HTMLPurifier_URIScheme_http
-{
-    /**
-     * @type int
-     */
-    public $default_port = 443;
-    /**
-     * @type bool
-     */
-    public $secure = true;
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/mailto.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/mailto.php
deleted file mode 100644
index b8a40d7e0..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/mailto.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-// VERY RELAXED! Shouldn't cause problems, not even Firefox checks if the
-// email is valid, but be careful!
-
-/**
- * Validates mailto (for E-mail) according to RFC 2368
- * @todo Validate the email address
- * @todo Filter allowed query parameters
- */
-
-class HTMLPurifier_URIScheme_mailto extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type bool
-     */
-    public $browsable = false;
-
-    /**
-     * @type bool
-     */
-    public $may_omit_host = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $uri->userinfo = null;
-        $uri->host     = null;
-        $uri->port     = null;
-        // we need to validate path against RFC 2368's addr-spec
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/news.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/news.php
deleted file mode 100644
index 22c9ebc53..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/news.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * Validates news (Usenet) as defined by generic RFC 1738
- */
-class HTMLPurifier_URIScheme_news extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type bool
-     */
-    public $browsable = false;
-
-    /**
-     * @type bool
-     */
-    public $may_omit_host = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $uri->userinfo = null;
-        $uri->host = null;
-        $uri->port = null;
-        $uri->query = null;
-        // typecode check needed on path
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/nntp.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/nntp.php
deleted file mode 100644
index 803ed1381..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/nntp.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Validates nntp (Network News Transfer Protocol) as defined by generic RFC 1738
- */
-class HTMLPurifier_URIScheme_nntp extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type int
-     */
-    public $default_port = 119;
-
-    /**
-     * @type bool
-     */
-    public $browsable = false;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $uri->userinfo = null;
-        $uri->query = null;
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/tel.php b/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/tel.php
deleted file mode 100644
index 02f223bb3..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URIScheme/tel.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Validates tel (for phone numbers).
- *
- * The relevant specifications for this protocol are RFC 3966 and RFC 5341,
- * but this class takes a much simpler approach: we normalize phone
- * numbers so that they only include (possibly) a leading plus,
- * and then any number of digits and x'es.
- */
-
-class HTMLPurifier_URIScheme_tel extends HTMLPurifier_URIScheme
-{
-    /**
-     * @type bool
-     */
-    public $browsable = false;
-
-    /**
-     * @type bool
-     */
-    public $may_omit_host = true;
-
-    /**
-     * @param HTMLPurifier_URI $uri
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return bool
-     */
-    public function doValidate(&$uri, $config, $context)
-    {
-        $uri->userinfo = null;
-        $uri->host     = null;
-        $uri->port     = null;
-
-        // Delete all non-numeric characters, non-x characters
-        // from phone number, EXCEPT for a leading plus sign.
-        $uri->path = preg_replace('/(?!^\+)[^\dx]/', '',
-                     // Normalize e(x)tension to lower-case
-                     str_replace('X', 'x', $uri->path));
-
-        return true;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/URISchemeRegistry.php b/libraries/htmlpurifier410/library/HTMLPurifier/URISchemeRegistry.php
deleted file mode 100644
index 24280638a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/URISchemeRegistry.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-/**
- * Registry for retrieving specific URI scheme validator objects.
- */
-class HTMLPurifier_URISchemeRegistry
-{
-
-    /**
-     * Retrieve sole instance of the registry.
-     * @param HTMLPurifier_URISchemeRegistry $prototype Optional prototype to overload sole instance with,
-     *                   or bool true to reset to default registry.
-     * @return HTMLPurifier_URISchemeRegistry
-     * @note Pass a registry object $prototype with a compatible interface and
-     *       the function will copy it and return it all further times.
-     */
-    public static function instance($prototype = null)
-    {
-        static $instance = null;
-        if ($prototype !== null) {
-            $instance = $prototype;
-        } elseif ($instance === null || $prototype == true) {
-            $instance = new HTMLPurifier_URISchemeRegistry();
-        }
-        return $instance;
-    }
-
-    /**
-     * Cache of retrieved schemes.
-     * @type HTMLPurifier_URIScheme[]
-     */
-    protected $schemes = array();
-
-    /**
-     * Retrieves a scheme validator object
-     * @param string $scheme String scheme name like http or mailto
-     * @param HTMLPurifier_Config $config
-     * @param HTMLPurifier_Context $context
-     * @return HTMLPurifier_URIScheme
-     */
-    public function getScheme($scheme, $config, $context)
-    {
-        if (!$config) {
-            $config = HTMLPurifier_Config::createDefault();
-        }
-
-        // important, otherwise attacker could include arbitrary file
-        $allowed_schemes = $config->get('URI.AllowedSchemes');
-        if (!$config->get('URI.OverrideAllowedSchemes') &&
-            !isset($allowed_schemes[$scheme])
-        ) {
-            return;
-        }
-
-        if (isset($this->schemes[$scheme])) {
-            return $this->schemes[$scheme];
-        }
-        if (!isset($allowed_schemes[$scheme])) {
-            return;
-        }
-
-        $class = 'HTMLPurifier_URIScheme_' . $scheme;
-        if (!class_exists($class)) {
-            return;
-        }
-        $this->schemes[$scheme] = new $class();
-        return $this->schemes[$scheme];
-    }
-
-    /**
-     * Registers a custom scheme to the cache, bypassing reflection.
-     * @param string $scheme Scheme name
-     * @param HTMLPurifier_URIScheme $scheme_obj
-     */
-    public function register($scheme, $scheme_obj)
-    {
-        $this->schemes[$scheme] = $scheme_obj;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/UnitConverter.php b/libraries/htmlpurifier410/library/HTMLPurifier/UnitConverter.php
deleted file mode 100644
index e663b3271..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/UnitConverter.php
+++ /dev/null
@@ -1,307 +0,0 @@
-<?php
-
-/**
- * Class for converting between different unit-lengths as specified by
- * CSS.
- */
-class HTMLPurifier_UnitConverter
-{
-
-    const ENGLISH = 1;
-    const METRIC = 2;
-    const DIGITAL = 3;
-
-    /**
-     * Units information array. Units are grouped into measuring systems
-     * (English, Metric), and are assigned an integer representing
-     * the conversion factor between that unit and the smallest unit in
-     * the system. Numeric indexes are actually magical constants that
-     * encode conversion data from one system to the next, with a O(n^2)
-     * constraint on memory (this is generally not a problem, since
-     * the number of measuring systems is small.)
-     */
-    protected static $units = array(
-        self::ENGLISH => array(
-            'px' => 3, // This is as per CSS 2.1 and Firefox. Your mileage may vary
-            'pt' => 4,
-            'pc' => 48,
-            'in' => 288,
-            self::METRIC => array('pt', '0.352777778', 'mm'),
-        ),
-        self::METRIC => array(
-            'mm' => 1,
-            'cm' => 10,
-            self::ENGLISH => array('mm', '2.83464567', 'pt'),
-        ),
-    );
-
-    /**
-     * Minimum bcmath precision for output.
-     * @type int
-     */
-    protected $outputPrecision;
-
-    /**
-     * Bcmath precision for internal calculations.
-     * @type int
-     */
-    protected $internalPrecision;
-
-    /**
-     * Whether or not BCMath is available.
-     * @type bool
-     */
-    private $bcmath;
-
-    public function __construct($output_precision = 4, $internal_precision = 10, $force_no_bcmath = false)
-    {
-        $this->outputPrecision = $output_precision;
-        $this->internalPrecision = $internal_precision;
-        $this->bcmath = !$force_no_bcmath && function_exists('bcmul');
-    }
-
-    /**
-     * Converts a length object of one unit into another unit.
-     * @param HTMLPurifier_Length $length
-     *      Instance of HTMLPurifier_Length to convert. You must validate()
-     *      it before passing it here!
-     * @param string $to_unit
-     *      Unit to convert to.
-     * @return HTMLPurifier_Length|bool
-     * @note
-     *      About precision: This conversion function pays very special
-     *      attention to the incoming precision of values and attempts
-     *      to maintain a number of significant figure. Results are
-     *      fairly accurate up to nine digits. Some caveats:
-     *          - If a number is zero-padded as a result of this significant
-     *            figure tracking, the zeroes will be eliminated.
-     *          - If a number contains less than four sigfigs ($outputPrecision)
-     *            and this causes some decimals to be excluded, those
-     *            decimals will be added on.
-     */
-    public function convert($length, $to_unit)
-    {
-        if (!$length->isValid()) {
-            return false;
-        }
-
-        $n = $length->getN();
-        $unit = $length->getUnit();
-
-        if ($n === '0' || $unit === false) {
-            return new HTMLPurifier_Length('0', false);
-        }
-
-        $state = $dest_state = false;
-        foreach (self::$units as $k => $x) {
-            if (isset($x[$unit])) {
-                $state = $k;
-            }
-            if (isset($x[$to_unit])) {
-                $dest_state = $k;
-            }
-        }
-        if (!$state || !$dest_state) {
-            return false;
-        }
-
-        // Some calculations about the initial precision of the number;
-        // this will be useful when we need to do final rounding.
-        $sigfigs = $this->getSigFigs($n);
-        if ($sigfigs < $this->outputPrecision) {
-            $sigfigs = $this->outputPrecision;
-        }
-
-        // BCMath's internal precision deals only with decimals. Use
-        // our default if the initial number has no decimals, or increase
-        // it by how ever many decimals, thus, the number of guard digits
-        // will always be greater than or equal to internalPrecision.
-        $log = (int)floor(log(abs($n), 10));
-        $cp = ($log < 0) ? $this->internalPrecision - $log : $this->internalPrecision; // internal precision
-
-        for ($i = 0; $i < 2; $i++) {
-
-            // Determine what unit IN THIS SYSTEM we need to convert to
-            if ($dest_state === $state) {
-                // Simple conversion
-                $dest_unit = $to_unit;
-            } else {
-                // Convert to the smallest unit, pending a system shift
-                $dest_unit = self::$units[$state][$dest_state][0];
-            }
-
-            // Do the conversion if necessary
-            if ($dest_unit !== $unit) {
-                $factor = $this->div(self::$units[$state][$unit], self::$units[$state][$dest_unit], $cp);
-                $n = $this->mul($n, $factor, $cp);
-                $unit = $dest_unit;
-            }
-
-            // Output was zero, so bail out early. Shouldn't ever happen.
-            if ($n === '') {
-                $n = '0';
-                $unit = $to_unit;
-                break;
-            }
-
-            // It was a simple conversion, so bail out
-            if ($dest_state === $state) {
-                break;
-            }
-
-            if ($i !== 0) {
-                // Conversion failed! Apparently, the system we forwarded
-                // to didn't have this unit. This should never happen!
-                return false;
-            }
-
-            // Pre-condition: $i == 0
-
-            // Perform conversion to next system of units
-            $n = $this->mul($n, self::$units[$state][$dest_state][1], $cp);
-            $unit = self::$units[$state][$dest_state][2];
-            $state = $dest_state;
-
-            // One more loop around to convert the unit in the new system.
-
-        }
-
-        // Post-condition: $unit == $to_unit
-        if ($unit !== $to_unit) {
-            return false;
-        }
-
-        // Useful for debugging:
-        //echo "<pre>n";
-        //echo "$n\nsigfigs = $sigfigs\nnew_log = $new_log\nlog = $log\nrp = $rp\n</pre>\n";
-
-        $n = $this->round($n, $sigfigs);
-        if (strpos($n, '.') !== false) {
-            $n = rtrim($n, '0');
-        }
-        $n = rtrim($n, '.');
-
-        return new HTMLPurifier_Length($n, $unit);
-    }
-
-    /**
-     * Returns the number of significant figures in a string number.
-     * @param string $n Decimal number
-     * @return int number of sigfigs
-     */
-    public function getSigFigs($n)
-    {
-        $n = ltrim($n, '0+-');
-        $dp = strpos($n, '.'); // decimal position
-        if ($dp === false) {
-            $sigfigs = strlen(rtrim($n, '0'));
-        } else {
-            $sigfigs = strlen(ltrim($n, '0.')); // eliminate extra decimal character
-            if ($dp !== 0) {
-                $sigfigs--;
-            }
-        }
-        return $sigfigs;
-    }
-
-    /**
-     * Adds two numbers, using arbitrary precision when available.
-     * @param string $s1
-     * @param string $s2
-     * @param int $scale
-     * @return string
-     */
-    private function add($s1, $s2, $scale)
-    {
-        if ($this->bcmath) {
-            return bcadd($s1, $s2, $scale);
-        } else {
-            return $this->scale((float)$s1 + (float)$s2, $scale);
-        }
-    }
-
-    /**
-     * Multiples two numbers, using arbitrary precision when available.
-     * @param string $s1
-     * @param string $s2
-     * @param int $scale
-     * @return string
-     */
-    private function mul($s1, $s2, $scale)
-    {
-        if ($this->bcmath) {
-            return bcmul($s1, $s2, $scale);
-        } else {
-            return $this->scale((float)$s1 * (float)$s2, $scale);
-        }
-    }
-
-    /**
-     * Divides two numbers, using arbitrary precision when available.
-     * @param string $s1
-     * @param string $s2
-     * @param int $scale
-     * @return string
-     */
-    private function div($s1, $s2, $scale)
-    {
-        if ($this->bcmath) {
-            return bcdiv($s1, $s2, $scale);
-        } else {
-            return $this->scale((float)$s1 / (float)$s2, $scale);
-        }
-    }
-
-    /**
-     * Rounds a number according to the number of sigfigs it should have,
-     * using arbitrary precision when available.
-     * @param float $n
-     * @param int $sigfigs
-     * @return string
-     */
-    private function round($n, $sigfigs)
-    {
-        $new_log = (int)floor(log(abs($n), 10)); // Number of digits left of decimal - 1
-        $rp = $sigfigs - $new_log - 1; // Number of decimal places needed
-        $neg = $n < 0 ? '-' : ''; // Negative sign
-        if ($this->bcmath) {
-            if ($rp >= 0) {
-                $n = bcadd($n, $neg . '0.' . str_repeat('0', $rp) . '5', $rp + 1);
-                $n = bcdiv($n, '1', $rp);
-            } else {
-                // This algorithm partially depends on the standardized
-                // form of numbers that comes out of bcmath.
-                $n = bcadd($n, $neg . '5' . str_repeat('0', $new_log - $sigfigs), 0);
-                $n = substr($n, 0, $sigfigs + strlen($neg)) . str_repeat('0', $new_log - $sigfigs + 1);
-            }
-            return $n;
-        } else {
-            return $this->scale(round($n, $sigfigs - $new_log - 1), $rp + 1);
-        }
-    }
-
-    /**
-     * Scales a float to $scale digits right of decimal point, like BCMath.
-     * @param float $r
-     * @param int $scale
-     * @return string
-     */
-    private function scale($r, $scale)
-    {
-        if ($scale < 0) {
-            // The f sprintf type doesn't support negative numbers, so we
-            // need to cludge things manually. First get the string.
-            $r = sprintf('%.0f', (float)$r);
-            // Due to floating point precision loss, $r will more than likely
-            // look something like 4652999999999.9234. We grab one more digit
-            // than we need to precise from $r and then use that to round
-            // appropriately.
-            $precise = (string)round(substr($r, 0, strlen($r) + $scale), -1);
-            // Now we return it, truncating the zero that was rounded off.
-            return substr($precise, 0, -1) . str_repeat('0', -$scale + 1);
-        }
-        return sprintf('%.' . $scale . 'f', (float)$r);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/VarParser.php b/libraries/htmlpurifier410/library/HTMLPurifier/VarParser.php
deleted file mode 100644
index 4bf7771a1..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/VarParser.php
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-
-/**
- * Parses string representations into their corresponding native PHP
- * variable type. The base implementation does a simple type-check.
- */
-class HTMLPurifier_VarParser
-{
-
-    const STRING = 1;
-    const ISTRING = 2;
-    const TEXT = 3;
-    const ITEXT = 4;
-    const INT = 5;
-    const FLOAT = 6;
-    const BOOL = 7;
-    const LOOKUP = 8;
-    const ALIST = 9;
-    const HASH = 10;
-    const MIXED = 11;
-
-    /**
-     * Lookup table of allowed types. Mainly for backwards compatibility, but
-     * also convenient for transforming string type names to the integer constants.
-     */
-    public static $types = array(
-        'string' => self::STRING,
-        'istring' => self::ISTRING,
-        'text' => self::TEXT,
-        'itext' => self::ITEXT,
-        'int' => self::INT,
-        'float' => self::FLOAT,
-        'bool' => self::BOOL,
-        'lookup' => self::LOOKUP,
-        'list' => self::ALIST,
-        'hash' => self::HASH,
-        'mixed' => self::MIXED
-    );
-
-    /**
-     * Lookup table of types that are string, and can have aliases or
-     * allowed value lists.
-     */
-    public static $stringTypes = array(
-        self::STRING => true,
-        self::ISTRING => true,
-        self::TEXT => true,
-        self::ITEXT => true,
-    );
-
-    /**
-     * Validate a variable according to type.
-     * It may return NULL as a valid type if $allow_null is true.
-     *
-     * @param mixed $var Variable to validate
-     * @param int $type Type of variable, see HTMLPurifier_VarParser->types
-     * @param bool $allow_null Whether or not to permit null as a value
-     * @return string Validated and type-coerced variable
-     * @throws HTMLPurifier_VarParserException
-     */
-    final public function parse($var, $type, $allow_null = false)
-    {
-        if (is_string($type)) {
-            if (!isset(HTMLPurifier_VarParser::$types[$type])) {
-                throw new HTMLPurifier_VarParserException("Invalid type '$type'");
-            } else {
-                $type = HTMLPurifier_VarParser::$types[$type];
-            }
-        }
-        $var = $this->parseImplementation($var, $type, $allow_null);
-        if ($allow_null && $var === null) {
-            return null;
-        }
-        // These are basic checks, to make sure nothing horribly wrong
-        // happened in our implementations.
-        switch ($type) {
-            case (self::STRING):
-            case (self::ISTRING):
-            case (self::TEXT):
-            case (self::ITEXT):
-                if (!is_string($var)) {
-                    break;
-                }
-                if ($type == self::ISTRING || $type == self::ITEXT) {
-                    $var = strtolower($var);
-                }
-                return $var;
-            case (self::INT):
-                if (!is_int($var)) {
-                    break;
-                }
-                return $var;
-            case (self::FLOAT):
-                if (!is_float($var)) {
-                    break;
-                }
-                return $var;
-            case (self::BOOL):
-                if (!is_bool($var)) {
-                    break;
-                }
-                return $var;
-            case (self::LOOKUP):
-            case (self::ALIST):
-            case (self::HASH):
-                if (!is_array($var)) {
-                    break;
-                }
-                if ($type === self::LOOKUP) {
-                    foreach ($var as $k) {
-                        if ($k !== true) {
-                            $this->error('Lookup table contains value other than true');
-                        }
-                    }
-                } elseif ($type === self::ALIST) {
-                    $keys = array_keys($var);
-                    if (array_keys($keys) !== $keys) {
-                        $this->error('Indices for list are not uniform');
-                    }
-                }
-                return $var;
-            case (self::MIXED):
-                return $var;
-            default:
-                $this->errorInconsistent(get_class($this), $type);
-        }
-        $this->errorGeneric($var, $type);
-    }
-
-    /**
-     * Actually implements the parsing. Base implementation does not
-     * do anything to $var. Subclasses should overload this!
-     * @param mixed $var
-     * @param int $type
-     * @param bool $allow_null
-     * @return string
-     */
-    protected function parseImplementation($var, $type, $allow_null)
-    {
-        return $var;
-    }
-
-    /**
-     * Throws an exception.
-     * @throws HTMLPurifier_VarParserException
-     */
-    protected function error($msg)
-    {
-        throw new HTMLPurifier_VarParserException($msg);
-    }
-
-    /**
-     * Throws an inconsistency exception.
-     * @note This should not ever be called. It would be called if we
-     *       extend the allowed values of HTMLPurifier_VarParser without
-     *       updating subclasses.
-     * @param string $class
-     * @param int $type
-     * @throws HTMLPurifier_Exception
-     */
-    protected function errorInconsistent($class, $type)
-    {
-        throw new HTMLPurifier_Exception(
-            "Inconsistency in $class: " . HTMLPurifier_VarParser::getTypeName($type) .
-            " not implemented"
-        );
-    }
-
-    /**
-     * Generic error for if a type didn't work.
-     * @param mixed $var
-     * @param int $type
-     */
-    protected function errorGeneric($var, $type)
-    {
-        $vtype = gettype($var);
-        $this->error("Expected type " . HTMLPurifier_VarParser::getTypeName($type) . ", got $vtype");
-    }
-
-    /**
-     * @param int $type
-     * @return string
-     */
-    public static function getTypeName($type)
-    {
-        static $lookup;
-        if (!$lookup) {
-            // Lazy load the alternative lookup table
-            $lookup = array_flip(HTMLPurifier_VarParser::$types);
-        }
-        if (!isset($lookup[$type])) {
-            return 'unknown';
-        }
-        return $lookup[$type];
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Flexible.php b/libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Flexible.php
deleted file mode 100644
index b2ed860ac..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Flexible.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-/**
- * Performs safe variable parsing based on types which can be used by
- * users. This may not be able to represent all possible data inputs,
- * however.
- */
-class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser
-{
-    /**
-     * @param mixed $var
-     * @param int $type
-     * @param bool $allow_null
-     * @return array|bool|float|int|mixed|null|string
-     * @throws HTMLPurifier_VarParserException
-     */
-    protected function parseImplementation($var, $type, $allow_null)
-    {
-        if ($allow_null && $var === null) {
-            return null;
-        }
-        switch ($type) {
-            // Note: if code "breaks" from the switch, it triggers a generic
-            // exception to be thrown. Specific errors can be specifically
-            // done here.
-            case self::MIXED:
-            case self::ISTRING:
-            case self::STRING:
-            case self::TEXT:
-            case self::ITEXT:
-                return $var;
-            case self::INT:
-                if (is_string($var) && ctype_digit($var)) {
-                    $var = (int)$var;
-                }
-                return $var;
-            case self::FLOAT:
-                if ((is_string($var) && is_numeric($var)) || is_int($var)) {
-                    $var = (float)$var;
-                }
-                return $var;
-            case self::BOOL:
-                if (is_int($var) && ($var === 0 || $var === 1)) {
-                    $var = (bool)$var;
-                } elseif (is_string($var)) {
-                    if ($var == 'on' || $var == 'true' || $var == '1') {
-                        $var = true;
-                    } elseif ($var == 'off' || $var == 'false' || $var == '0') {
-                        $var = false;
-                    } else {
-                        throw new HTMLPurifier_VarParserException("Unrecognized value '$var' for $type");
-                    }
-                }
-                return $var;
-            case self::ALIST:
-            case self::HASH:
-            case self::LOOKUP:
-                if (is_string($var)) {
-                    // special case: technically, this is an array with
-                    // a single empty string item, but having an empty
-                    // array is more intuitive
-                    if ($var == '') {
-                        return array();
-                    }
-                    if (strpos($var, "\n") === false && strpos($var, "\r") === false) {
-                        // simplistic string to array method that only works
-                        // for simple lists of tag names or alphanumeric characters
-                        $var = explode(',', $var);
-                    } else {
-                        $var = preg_split('/(,|[\n\r]+)/', $var);
-                    }
-                    // remove spaces
-                    foreach ($var as $i => $j) {
-                        $var[$i] = trim($j);
-                    }
-                    if ($type === self::HASH) {
-                        // key:value,key2:value2
-                        $nvar = array();
-                        foreach ($var as $keypair) {
-                            $c = explode(':', $keypair, 2);
-                            if (!isset($c[1])) {
-                                continue;
-                            }
-                            $nvar[trim($c[0])] = trim($c[1]);
-                        }
-                        $var = $nvar;
-                    }
-                }
-                if (!is_array($var)) {
-                    break;
-                }
-                $keys = array_keys($var);
-                if ($keys === array_keys($keys)) {
-                    if ($type == self::ALIST) {
-                        return $var;
-                    } elseif ($type == self::LOOKUP) {
-                        $new = array();
-                        foreach ($var as $key) {
-                            $new[$key] = true;
-                        }
-                        return $new;
-                    } else {
-                        break;
-                    }
-                }
-                if ($type === self::ALIST) {
-                    trigger_error("Array list did not have consecutive integer indexes", E_USER_WARNING);
-                    return array_values($var);
-                }
-                if ($type === self::LOOKUP) {
-                    foreach ($var as $key => $value) {
-                        if ($value !== true) {
-                            trigger_error(
-                                "Lookup array has non-true value at key '$key'; " .
-                                "maybe your input array was not indexed numerically",
-                                E_USER_WARNING
-                            );
-                        }
-                        $var[$key] = true;
-                    }
-                }
-                return $var;
-            default:
-                $this->errorInconsistent(__CLASS__, $type);
-        }
-        $this->errorGeneric($var, $type);
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Native.php b/libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Native.php
deleted file mode 100644
index c28055b5e..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/VarParser/Native.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * This variable parser uses PHP's internal code engine. Because it does
- * this, it can represent all inputs; however, it is dangerous and cannot
- * be used by users.
- */
-class HTMLPurifier_VarParser_Native extends HTMLPurifier_VarParser
-{
-
-    /**
-     * @param mixed $var
-     * @param int $type
-     * @param bool $allow_null
-     * @return null|string
-     */
-    protected function parseImplementation($var, $type, $allow_null)
-    {
-        return $this->evalExpression($var);
-    }
-
-    /**
-     * @param string $expr
-     * @return mixed
-     * @throws HTMLPurifier_VarParserException
-     */
-    protected function evalExpression($expr)
-    {
-        $var = null;
-        $result = eval("\$var = $expr;");
-        if ($result === false) {
-            throw new HTMLPurifier_VarParserException("Fatal error in evaluated code");
-        }
-        return $var;
-    }
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/VarParserException.php b/libraries/htmlpurifier410/library/HTMLPurifier/VarParserException.php
deleted file mode 100644
index 82e465d6a..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/VarParserException.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-/**
- * Exception type for HTMLPurifier_VarParser
- */
-class HTMLPurifier_VarParserException extends HTMLPurifier_Exception
-{
-
-}
-
-// vim: et sw=4 sts=4
diff --git a/libraries/htmlpurifier410/library/HTMLPurifier/Zipper.php b/libraries/htmlpurifier410/library/HTMLPurifier/Zipper.php
deleted file mode 100644
index a358fff02..000000000
--- a/libraries/htmlpurifier410/library/HTMLPurifier/Zipper.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-
-/**
- * A zipper is a purely-functional data structure which contains
- * a focus that can be efficiently manipulated.  It is known as
- * a "one-hole context".  This mutable variant implements a zipper
- * for a list as a pair of two arrays, laid out as follows:
- *
- *      Base list: 1 2 3 4 [ ] 6 7 8 9
- *      Front list: 1 2 3 4
- *      Back list: 9 8 7 6
- *
- * User is expected to keep track of the "current element" and properly
- * fill it back in as necessary.  (ToDo: Maybe it's more user friendly
- * to implicitly track the current element?)
- *
- * Nota bene: the current class gets confused if you try to store NULLs
- * in the list.
- */
-
-class HTMLPurifier_Zipper
-{
-    public $front, $back;
-
-    public function __construct($front, $back) {
-        $this->front = $front;
-        $this->back = $back;
-    }
-
-    /**
-     * Creates a zipper from an array, with a hole in the
-     * 0-index position.
-     * @param Array to zipper-ify.
-     * @return Tuple of zipper and element of first position.
-     */
-    static public function fromArray($array) {
-        $z = new self(array(), array_reverse($array));
-        $t = $z->delete(); // delete the "dummy hole"
-        return array($z, $t);
-    }
-
-    /**
-     * Convert zipper back into a normal array, optionally filling in
-     * the hole with a value. (Usually you should supply a $t, unless you
-     * are at the end of the array.)
-     */
-    public function toArray($t = NULL) {
-        $a = $this->front;
-        if ($t !== NULL) $a[] = $t;
-        for ($i = count($this->back)-1; $i >= 0; $i--) {
-            $a[] = $this->back[$i];
-        }
-        return $a;
-    }
-
-    /**
-     * Move hole to the next element.
-     * @param $t Element to fill hole with
-     * @return Original contents of new hole.
-     */
-    public function next($t) {
-        if ($t !== NULL) array_push($this->front, $t);
-        return empty($this->back) ? NULL : array_pop($this->back);
-    }
-
-    /**
-     * Iterated hole advancement.
-     * @param $t Element to fill hole with
-     * @param $i How many forward to advance hole
-     * @return Original contents of new hole, i away
-     */
-    public function advance($t, $n) {
-        for ($i = 0; $i < $n; $i++) {
-            $t = $this->next($t);
-        }
-        return $t;
-    }
-
-    /**
-     * Move hole to the previous element
-     * @param $t Element to fill hole with
-     * @return Original contents of new hole.
-     */
-    public function prev($t) {
-        if ($t !== NULL) array_push($this->back, $t);
-        return empty($this->front) ? NULL : array_pop($this->front);
-    }
-
-    /**
-     * Delete contents of current hole, shifting hole to
-     * next element.
-     * @return Original contents of new hole.
-     */
-    public function delete() {
-        return empty($this->back) ? NULL : array_pop($this->back);
-    }
-
-    /**
-     * Returns true if we are at the end of the list.
-     * @return bool
-     */
-    public function done() {
-        return empty($this->back);
-    }
-
-    /**
-     * Insert element before hole.
-     * @param Element to insert
-     */
-    public function insertBefore($t) {
-        if ($t !== NULL) array_push($this->front, $t);
-    }
-
-    /**
-     * Insert element after hole.
-     * @param Element to insert
-     */
-    public function insertAfter($t) {
-        if ($t !== NULL) array_push($this->back, $t);
-    }
-
-    /**
-     * Splice in multiple elements at hole.  Functional specification
-     * in terms of array_splice:
-     *
-     *      $arr1 = $arr;
-     *      $old1 = array_splice($arr1, $i, $delete, $replacement);
-     *
-     *      list($z, $t) = HTMLPurifier_Zipper::fromArray($arr);
-     *      $t = $z->advance($t, $i);
-     *      list($old2, $t) = $z->splice($t, $delete, $replacement);
-     *      $arr2 = $z->toArray($t);
-     *
-     *      assert($old1 === $old2);
-     *      assert($arr1 === $arr2);
-     *
-     * NB: the absolute index location after this operation is
-     * *unchanged!*
-     *
-     * @param Current contents of hole.
-     */
-    public function splice($t, $delete, $replacement) {
-        // delete
-        $old = array();
-        $r = $t;
-        for ($i = $delete; $i > 0; $i--) {
-            $old[] = $r;
-            $r = $this->delete();
-        }
-        // insert
-        for ($i = count($replacement)-1; $i >= 0; $i--) {
-            $this->insertAfter($r);
-            $r = $replacement[$i];
-        }
-        return array($old, $r);
-    }
-}
diff --git a/libraries/magpierss/extlib/Snoopy.class.inc b/libraries/magpierss/extlib/Snoopy.class.inc
deleted file mode 100755
index 17cc3fbdc..000000000
--- a/libraries/magpierss/extlib/Snoopy.class.inc
+++ /dev/null
@@ -1,915 +0,0 @@
-<?php
-
-/*************************************************
-
-Snoopy - the PHP net client
-Author: Monte Ohrt <monte@ispi.net>
-Copyright (c): 1999-2000 ispi, all rights reserved
-Version: 1.0
-
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-You may contact the author of Snoopy by e-mail at:
-monte@ispi.net
-
-Or, write to:
-Monte Ohrt
-CTO, ispi
-237 S. 70th suite 220
-Lincoln, NE 68510
-
-The latest version of Snoopy can be obtained from:
-http://snoopy.sourceforge.com
-
-*************************************************/
-require_once("include/database/PearDatabase.php");
-class Snoopy
-{
-	/**** Public variables ****/
-	
-	/* user definable vars */
-
-	var $host			=	"www.php.net";		// host name we are connecting to
-	var $port			=	80;					// port we are connecting to
-	var $proxy_host		=	"";					// proxy host to use
-	var $proxy_port		=	"";					// proxy port to use
-	var $agent			=	"Snoopy v1.0";		// agent we masquerade as
-	var	$referer		=	"";					// referer info to pass
-	var $cookies		=	array();			// array of cookies to pass
-												// $cookies["username"]="joe";
-	var	$rawheaders		=	array();			// array of raw headers to send
-												// $rawheaders["Content-type"]="text/html";
-
-	var $maxredirs		=	5;					// http redirection depth maximum. 0 = disallow
-	var $lastredirectaddr	=	"";				// contains address of last redirected address
-	var	$offsiteok		=	true;				// allows redirection off-site
-	var $maxframes		=	0;					// frame content depth maximum. 0 = disallow
-	var $expandlinks	=	true;				// expand links to fully qualified URLs.
-												// this only applies to fetchlinks()
-												// or submitlinks()
-	var $passcookies	=	true;				// pass set cookies back through redirects
-												// NOTE: this currently does not respect
-												// dates, domains or paths.
-	
-	var	$user			=	"";					// user for http authentication
-	var	$pass			=	"";					// password for http authentication
-	
-	// http accept types
-	var $accept			=	"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
-	
-	var $results		=	"";					// where the content is put
-		
-	var $error			=	"";					// error messages sent here
-	var	$response_code	=	"";					// response code returned from server
-	var	$headers		=	array();			// headers returned from server sent here
-	var	$maxlength		=	500000;				// max return data length (body)
-	var $read_timeout	=	0;					// timeout on read operations, in seconds
-												// supported only since PHP 4 Beta 4
-												// set to 0 to disallow timeouts
-	var $timed_out		=	false;				// if a read operation timed out
-	var	$status			=	0;					// http request status
-	
-	var	$curl_path		=	"/usr/bin/curl";
-												// Snoopy will use cURL for fetching
-												// SSL content if a full system path to
-												// the cURL binary is supplied here.
-												// set to false if you do not have
-												// cURL installed. See http://curl.haxx.se
-												// for details on installing cURL.
-												// Snoopy does *not* use the cURL
-												// library functions built into php,
-												// as these functions are not stable
-												// as of this Snoopy release.
-	
-	// send Accept-encoding: gzip?
-	var $use_gzip		= true;	
-	
-	/**** Private variables ****/	
-	
-	var	$_maxlinelen	=	4096;				// max line length (headers)
-	
-	var $_httpmethod	=	"GET";				// default http request method
-	var $_httpversion	=	"HTTP/1.0";			// default http request version
-	var $_submit_method	=	"POST";				// default submit method
-	var $_submit_type	=	"application/x-www-form-urlencoded";	// default submit type
-	var $_mime_boundary	=   "";					// MIME boundary for multipart/form-data submit type
-	var $_redirectaddr	=	false;				// will be set if page fetched is a redirect
-	var $_redirectdepth	=	0;					// increments on an http redirect
-	var $_frameurls		= 	array();			// frame src urls
-	var $_framedepth	=	0;					// increments on frame depth
-	
-	var $_isproxy		=	true;				// set if using a proxy server
-	var $_fp_timeout	=	60;					// timeout for socket connection
-	function Snoopy()
-	{
-		global $adb;
-		$query = "select * from vtiger_systems where server_type=?";
-		$result = $adb->pquery($query, array('proxy'));
-		$noofrows = $adb->num_rows($result);
-		if($noofrows != 0)
-		{
-			$this->proxy_host=$adb->query_result($result,0,"server");
-			$this->proxy_port=$adb->query_result($result,0,"server_port");
-			$this->user=$adb->query_result($result,0,"server_username");
-			$this->pass=$adb->query_result($result,0,"server_password");
-		}
-	}
-
-/*======================================================================*\
-	Function:	fetch
-	Purpose:	fetch the contents of a web page
-				(and possibly other protocols in the
-				future like ftp, nntp, gopher, etc.)
-	Input:		$URI	the location of the page to fetch
-	Output:		$this->results	the output text from the fetch
-\*======================================================================*/
-
-	function fetch($URI)
-	{
-	
-		//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
-		$URI_PARTS = parse_url($URI);
-		if (!empty($URI_PARTS["user"]))
-			$this->user = $URI_PARTS["user"];
-		if (!empty($URI_PARTS["pass"]))
-			$this->pass = $URI_PARTS["pass"];
-				
-		switch($URI_PARTS["scheme"])
-		{
-			case "http":
-				$this->host = $URI_PARTS["host"];
-				if(!empty($URI_PARTS["port"]))
-					$this->port = $URI_PARTS["port"];
-				if($this->_connect($fp))
-				{
-					if($this->_isproxy)
-					{
-						// using proxy, send entire URI
-						$this->_httprequest($URI,$fp,$URI,$this->_httpmethod);
-					}
-					else
-					{
-						$path = $URI_PARTS["path"].(isset($URI_PARTS["query"]) ? "?".$URI_PARTS["query"] : "");
-						// no proxy, send only the path
-						$this->_httprequest($path, $fp, $URI, $this->_httpmethod);
-					}
-					
-					$this->_disconnect($fp);
-
-					if($this->_redirectaddr)
-					{
-						/* url was redirected, check if we've hit the max depth */
-						if($this->maxredirs > $this->_redirectdepth)
-						{
-							// only follow redirect if it's on this site, or offsiteok is true
-							if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
-							{
-								/* follow the redirect */
-								$this->_redirectdepth++;
-								$this->lastredirectaddr=$this->_redirectaddr;
-								$this->fetch($this->_redirectaddr);
-							}
-						}
-					}
-
-					if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
-					{
-						$frameurls = $this->_frameurls;
-						$this->_frameurls = array();
-						
-						while(list(,$frameurl) = each($frameurls))
-						{
-							if($this->_framedepth < $this->maxframes)
-							{
-								$this->fetch($frameurl);
-								$this->_framedepth++;
-							}
-							else
-								break;
-						}
-					}					
-				}
-				else
-				{
-					return false;
-				}
-				return true;					
-				break;
-			case "https":
-				if(!$this->curl_path || (!is_executable($this->curl_path))) {
-					$this->error = "Bad curl ($this->curl_path), can't fetch HTTPS \n";
-					return false;
-				}
-				$this->host = $URI_PARTS["host"];
-				if(!empty($URI_PARTS["port"]))
-					$this->port = $URI_PARTS["port"];
-				if($this->_isproxy)
-				{
-					// using proxy, send entire URI
-					$this->_httpsrequest($URI,$URI,$this->_httpmethod);
-				}
-				else
-				{
-					$path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
-					// no proxy, send only the path
-					$this->_httpsrequest($path, $URI, $this->_httpmethod);
-				}
-
-				if($this->_redirectaddr)
-				{
-					/* url was redirected, check if we've hit the max depth */
-					if($this->maxredirs > $this->_redirectdepth)
-					{
-						// only follow redirect if it's on this site, or offsiteok is true
-						if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
-						{
-							/* follow the redirect */
-							$this->_redirectdepth++;
-							$this->lastredirectaddr=$this->_redirectaddr;
-							$this->fetch($this->_redirectaddr);
-						}
-					}
-				}
-
-				if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
-				{
-					$frameurls = $this->_frameurls;
-					$this->_frameurls = array();
-
-					while(list(,$frameurl) = each($frameurls))
-					{
-						if($this->_framedepth < $this->maxframes)
-						{
-							$this->fetch($frameurl);
-							$this->_framedepth++;
-						}
-						else
-							break;
-					}
-				}					
-				return true;					
-				break;
-			default:
-				// not a valid protocol
-				$this->error	=	'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
-				return false;
-				break;
-		}		
-		return true;
-	}
-
-
-
-/*======================================================================*\
-	Private functions
-\*======================================================================*/
-	
-	
-/*======================================================================*\
-	Function:	_striplinks
-	Purpose:	strip the hyperlinks from an html document
-	Input:		$document	document to strip.
-	Output:		$match		an array of the links
-\*======================================================================*/
-
-	function _striplinks($document)
-	{	
-		preg_match_all("'<\s*a\s+.*href\s*=\s*			# find <a href=
-						([\"\'])?					# find single or double quote
-						(?(1) (.*?)\\1 | ([^\s\>]+))		# if quote found, match up to next matching
-													# quote, otherwise match up to next space
-						'isx",$document,$links);
-						
-
-		// catenate the non-empty matches from the conditional subpattern
-
-		while(list($key,$val) = each($links[2]))
-		{
-			if(!empty($val))
-				$match[] = $val;
-		}				
-		
-		while(list($key,$val) = each($links[3]))
-		{
-			if(!empty($val))
-				$match[] = $val;
-		}		
-		
-		// return the links
-		return $match;
-	}
-
-/*======================================================================*\
-	Function:	_stripform
-	Purpose:	strip the form elements from an html document
-	Input:		$document	document to strip.
-	Output:		$match		an array of the links
-\*======================================================================*/
-
-	function _stripform($document)
-	{	
-		preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);
-		
-		// catenate the matches
-		$match = implode("\r\n",$elements[0]);
-				
-		// return the links
-		return $match;
-	}
-
-	
-	
-/*======================================================================*\
-	Function:	_striptext
-	Purpose:	strip the text from an html document
-	Input:		$document	document to strip.
-	Output:		$text		the resulting text
-\*======================================================================*/
-
-	function _striptext($document)
-	{
-		
-		// I didn't use preg eval (//e) since that is only available in PHP 4.0.
-		// so, list your entities one by one here. I included some of the
-		// more common ones.
-								
-		$search = array("'<script[^>]*?>.*?</script>'si",	// strip out javascript
-						"'<[\/\!]*?[^<>]*?>'si",			// strip out html tags
-						"'([\r\n])[\s]+'",					// strip out white space
-						"'&(quote|#34);'i",					// replace html entities
-						"'&(amp|#38);'i",
-						"'&(lt|#60);'i",
-						"'&(gt|#62);'i",
-						"'&(nbsp|#160);'i",
-						"'&(iexcl|#161);'i",
-						"'&(cent|#162);'i",
-						"'&(pound|#163);'i",
-						"'&(copy|#169);'i"
-						);				
-		$replace = array(	"",
-							"",
-							"\\1",
-							"\"",
-							"&",
-							"<",
-							">",
-							" ",
-							chr(161),
-							chr(162),
-							chr(163),
-							chr(169));
-					
-		$text = preg_replace($search,$replace,$document);
-								
-		return $text;
-	}
-
-/*======================================================================*\
-	Function:	_expandlinks
-	Purpose:	expand each link into a fully qualified URL
-	Input:		$links			the links to qualify
-				$URI			the full URI to get the base from
-	Output:		$expandedLinks	the expanded links
-\*======================================================================*/
-
-	function _expandlinks($links,$URI)
-	{
-		
-		preg_match("/^[^\?]+/",$URI,$match);
-
-		$match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);
-				
-		$search = array( 	"|^http://".preg_quote($this->host)."|i",
-							"|^(?!http://)(\/)?(?!mailto:)|i",
-							"|/\./|",
-							"|/[^\/]+/\.\./|"
-						);
-						
-		$replace = array(	"",
-							$match."/",
-							"/",
-							"/"
-						);			
-				
-		$expandedLinks = preg_replace($search,$replace,$links);
-
-		return $expandedLinks;
-	}
-
-/*======================================================================*\
-	Function:	_httprequest
-	Purpose:	go get the http data from the server
-	Input:		$url		the url to fetch
-				$fp			the current open file pointer
-				$URI		the full URI
-				$body		body contents to send if any (POST)
-	Output:		
-\*======================================================================*/
-	
-	function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
-	{
-		if($this->passcookies && $this->_redirectaddr)
-			$this->setcookies();
-			
-		$URI_PARTS = parse_url($URI);
-		if(empty($url))
-			$url = "/";
-		$headers = $http_method." ".$url." ".$this->_httpversion."\r\n";		
-		if(!empty($this->agent))
-			$headers .= "User-Agent: ".$this->agent."\r\n";
-		if(!empty($this->host) && !isset($this->rawheaders['Host']))
-			$headers .= "Host: ".$this->host."\r\n";
-		if(!empty($this->accept))
-			$headers .= "Accept: ".$this->accept."\r\n";
-		
-		if($this->use_gzip) {
-			// make sure PHP was built with --with-zlib
-			// and we can handle gzipp'ed data
-			if ( function_exists(gzinflate) ) {
-			   $headers .= "Accept-encoding: gzip\r\n";
-			}
-			else {
-				//commented to supress the warning
-			   /*trigger_error(
-			   	"use_gzip is on, but PHP was built without zlib support.".
-				"  Requesting file(s) without gzip encoding.", 
-				E_USER_NOTICE);*/
-			}
-		}
-		
-		if(!empty($this->referer))
-			$headers .= "Referer: ".$this->referer."\r\n";
-		if(!empty($this->cookies))
-		{			
-			if(!is_array($this->cookies))
-				$this->cookies = (array)$this->cookies;
-	
-			reset($this->cookies);
-			if ( count($this->cookies) > 0 ) {
-				$cookie_headers .= 'Cookie: ';
-				foreach ( $this->cookies as $cookieKey => $cookieVal ) {
-				$cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; ";
-				}
-				$headers .= substr($cookie_headers,0,-2) . "\r\n";
-			} 
-		}
-		if(!empty($this->rawheaders))
-		{
-			if(!is_array($this->rawheaders))
-				$this->rawheaders = (array)$this->rawheaders;
-			while(list($headerKey,$headerVal) = each($this->rawheaders))
-				$headers .= $headerKey.": ".$headerVal."\r\n";
-		}
-		if(!empty($content_type)) {
-			$headers .= "Content-type: $content_type";
-			if ($content_type == "multipart/form-data")
-				$headers .= "; boundary=".$this->_mime_boundary;
-			$headers .= "\r\n";
-		}
-		if(!empty($body))	
-			$headers .= "Content-length: ".strlen($body)."\r\n";
-		if(!empty($this->user) || !empty($this->pass))	
-			$headers .= "Proxy-Authorization: BASIC ".base64_encode($this->user.":".$this->pass)."\r\n";
-
-		$headers .= "\r\n";
-		
-		// set the read timeout if needed
-		if ($this->read_timeout > 0)
-			socket_set_timeout($fp, $this->read_timeout);
-		$this->timed_out = false;
-		
-		fwrite($fp,$headers.$body,strlen($headers.$body));
-		
-		$this->_redirectaddr = false;
-		unset($this->headers);
-		
-		// content was returned gzip encoded?
-		$is_gzipped = false;
-						
-		while($currentHeader = fgets($fp,$this->_maxlinelen))
-		{
-			if ($this->read_timeout > 0 && $this->_check_timeout($fp))
-			{
-				$this->status=-100;
-				return false;
-			}
-				
-		//	if($currentHeader == "\r\n")
-			if(preg_match("/^\r?\n$/", $currentHeader) )
-			      break;
-						
-			// if a header begins with Location: or URI:, set the redirect
-			if(preg_match("/^(Location:|URI:)/i",$currentHeader))
-			{
-				// get URL portion of the redirect
-				preg_match("/^(Location:|URI:)\s+(.*)/",chop($currentHeader),$matches);
-				// look for :// in the Location header to see if hostname is included
-				if(!preg_match("|\:\/\/|",$matches[2]))
-				{
-					// no host in the path, so prepend
-					$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
-					// eliminate double slash
-					if(!preg_match("|^/|",$matches[2]))
-							$this->_redirectaddr .= "/".$matches[2];
-					else
-							$this->_redirectaddr .= $matches[2];
-				}
-				else
-					$this->_redirectaddr = $matches[2];
-			}
-		
-			if(preg_match("|^HTTP/|",$currentHeader))
-			{
-                if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status))
-				{
-					$this->status= $status[1];
-                }				
-				$this->response_code = $currentHeader;
-			}
-			
-			if (preg_match("/Content-Encoding: gzip/", $currentHeader) ) {
-				$is_gzipped = true;
-			}
-			
-			$this->headers[] = $currentHeader;
-		}
-
-		# $results = fread($fp, $this->maxlength);
-		$results = "";
-		while ( $data = fread($fp, $this->maxlength) ) {
-		    $results .= $data;
-		    if (
-		        strlen($results) > $this->maxlength ) {
-		        break;
-		    }
-		}
-		
-		// gunzip
-		if ( $is_gzipped ) {
-			// per http://www.php.net/manual/en/function.gzencode.php
-			$results = substr($results, 10);
-			$results = gzinflate($results);
-		}
-		
-		if ($this->read_timeout > 0 && $this->_check_timeout($fp))
-		{
-			$this->status=-100;
-			return false;
-		}
-		
-		// check if there is a a redirect meta tag
-		
-		if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
-		{
-			$this->_redirectaddr = $this->_expandlinks($match[1],$URI);	
-		}
-
-		// have we hit our frame depth and is there frame src to fetch?
-		if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))
-		{
-			$this->results[] = $results;
-			for($x=0; $x<count($match[1]); $x++)
-				$this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host);
-		}
-		// have we already fetched framed content?
-		elseif(is_array($this->results))
-			$this->results[] = $results;
-		// no framed content
-		else
-			$this->results = $results;
-		
-		return true;
-	}
-
-/*======================================================================*\
-	Function:	_httpsrequest
-	Purpose:	go get the https data from the server using curl
-	Input:		$url		the url to fetch
-				$URI		the full URI
-				$body		body contents to send if any (POST)
-	Output:		
-\*======================================================================*/
-	
-	function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")
-	{
-		if($this->passcookies && $this->_redirectaddr)
-			$this->setcookies();
-
-		$headers = array();		
-					
-		$URI_PARTS = parse_url($URI);
-		if(empty($url))
-			$url = "/";
-		// GET ... header not needed for curl
-		//$headers[] = $http_method." ".$url." ".$this->_httpversion;		
-		if(!empty($this->agent))
-			$headers[] = "User-Agent: ".$this->agent;
-		if(!empty($this->host))
-			$headers[] = "Host: ".$this->host;
-		if(!empty($this->accept))
-			$headers[] = "Accept: ".$this->accept;
-		if(!empty($this->referer))
-			$headers[] = "Referer: ".$this->referer;
-		if(!empty($this->cookies))
-		{			
-			if(!is_array($this->cookies))
-				$this->cookies = (array)$this->cookies;
-	
-			reset($this->cookies);
-			if ( count($this->cookies) > 0 ) {
-				$cookie_str = 'Cookie: ';
-				foreach ( $this->cookies as $cookieKey => $cookieVal ) {
-				$cookie_str .= $cookieKey."=".urlencode($cookieVal)."; ";
-				}
-				$headers[] = substr($cookie_str,0,-2);
-			}
-		}
-		if(!empty($this->rawheaders))
-		{
-			if(!is_array($this->rawheaders))
-				$this->rawheaders = (array)$this->rawheaders;
-			while(list($headerKey,$headerVal) = each($this->rawheaders))
-				$headers[] = $headerKey.": ".$headerVal;
-		}
-		if(!empty($content_type)) {
-			if ($content_type == "multipart/form-data")
-				$headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary;
-			else
-				$headers[] = "Content-type: $content_type";
-		}
-		if(!empty($body))	
-			$headers[] = "Content-length: ".strlen($body);
-		if(!empty($this->user) || !empty($this->pass))	
-			$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
-			
-		for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
-			$cmdline_params .= " -H \"".$headers[$curr_header]."\"";
-		}
-			  	                         
-		if(!empty($body))
-			$cmdline_params .= " -d \"$body\"";
-		
-		if($this->read_timeout > 0)
-			$cmdline_params .= " -m ".$this->read_timeout;
-		
-		$headerfile = uniqid(time());
-		
-		# accept self-signed certs
-		$cmdline_params .= " -k"; 
-		exec($this->curl_path." -D \"/tmp/$headerfile\"".escapeshellcmd($cmdline_params)." ".escapeshellcmd($URI),$results,$return);
-		
-		if($return)
-		{
-			$this->error = "Error: cURL could not retrieve the document, error $return.";
-			return false;
-		}
-			
-			
-		$results = implode("\r\n",$results);
-		
-		$result_headers = file("/tmp/$headerfile");
-						
-		$this->_redirectaddr = false;
-		unset($this->headers);
-						
-		for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++)
-		{
-			
-			// if a header begins with Location: or URI:, set the redirect
-			if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader]))
-			{
-				// get URL portion of the redirect
-				preg_match("/^(Location: |URI:)(.*)/",chop($result_headers[$currentHeader]),$matches);
-				// look for :// in the Location header to see if hostname is included
-				if(!preg_match("|\:\/\/|",$matches[2]))
-				{
-					// no host in the path, so prepend
-					$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
-					// eliminate double slash
-					if(!preg_match("|^/|",$matches[2]))
-							$this->_redirectaddr .= "/".$matches[2];
-					else
-							$this->_redirectaddr .= $matches[2];
-				}
-				else
-					$this->_redirectaddr = $matches[2];
-			}
-		
-			if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
-			{
-			    $this->response_code = $result_headers[$currentHeader];
-			    if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$this->response_code, $match))
-			    {
-				$this->status= $match[1];
-                	    }
-			}
-			$this->headers[] = $result_headers[$currentHeader];
-		}
-
-		// check if there is a a redirect meta tag
-		
-		if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]+URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
-		{
-			$this->_redirectaddr = $this->_expandlinks($match[1],$URI);	
-		}
-
-		// have we hit our frame depth and is there frame src to fetch?
-		if(($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))
-		{
-			$this->results[] = $results;
-			for($x=0; $x<count($match[1]); $x++)
-				$this->_frameurls[] = $this->_expandlinks($match[1][$x],$URI_PARTS["scheme"]."://".$this->host);
-		}
-		// have we already fetched framed content?
-		elseif(is_array($this->results))
-			$this->results[] = $results;
-		// no framed content
-		else
-			$this->results = $results;
-
-		unlink("/tmp/$headerfile");
-		
-		return true;
-	}
-
-/*======================================================================*\
-	Function:	setcookies()
-	Purpose:	set cookies for a redirection
-\*======================================================================*/
-	
-	function setcookies()
-	{
-		for($x=0; $x<count($this->headers); $x++)
-		{
-		if(preg_match("/^set-cookie:[\s]+([^=]+)=([^;]+)/i", $this->headers[$x],$match))
-			$this->cookies[$match[1]] = $match[2];
-		}
-	}
-
-	
-/*======================================================================*\
-	Function:	_check_timeout
-	Purpose:	checks whether timeout has occurred
-	Input:		$fp	file pointer
-\*======================================================================*/
-
-	function _check_timeout($fp)
-	{
-		if ($this->read_timeout > 0) {
-			$fp_status = socket_get_status($fp);
-			if ($fp_status["timed_out"]) {
-				$this->timed_out = true;
-				return true;
-			}
-		}
-		return false;
-	}
-
-/*======================================================================*\
-	Function:	_connect
-	Purpose:	make a socket connection
-	Input:		$fp	file pointer
-\*======================================================================*/
-	
-	function _connect(&$fp)
-	{
-		if(!empty($this->proxy_host) && !empty($this->proxy_port))
-			{
-				$this->_isproxy = true;
-				$host = $this->proxy_host;
-				$port = $this->proxy_port;
-			}
-		else
-		{
-			$host = $this->host;
-			$port = $this->port;
-		}
-
-		$this->status = 0;
-		
-		if($fp = @fsockopen(
-					$host,
-					$port,
-					$errno,
-					$errstr,
-					$this->_fp_timeout
-					))
-		{
-			// socket connection succeeded
-
-			return true;
-		}
-		else
-		{
-			// socket connection failed
-			$this->status = $errno;
-			switch($errno)
-			{
-				case -3:
-					$this->error="socket creation failed (-3)";
-				case -4:
-					$this->error="dns lookup failure (-4)";
-				case -5:
-					$this->error="connection refused or timed out (-5)";
-				default:
-					$this->error="connection failed (".$errno.")";
-			}
-			return false;
-		}
-	}
-/*======================================================================*\
-	Function:	_disconnect
-	Purpose:	disconnect a socket connection
-	Input:		$fp	file pointer
-\*======================================================================*/
-	
-	function _disconnect($fp)
-	{
-		return(fclose($fp));
-	}
-
-	
-/*======================================================================*\
-	Function:	_prepare_post_body
-	Purpose:	Prepare post body according to encoding type
-	Input:		$formvars  - form variables
-				$formfiles - form upload files
-	Output:		post body
-\*======================================================================*/
-	
-	function _prepare_post_body($formvars, $formfiles)
-	{
-		settype($formvars, "array");
-		settype($formfiles, "array");
-
-		if (count($formvars) == 0 && count($formfiles) == 0)
-			return;
-		
-		switch ($this->_submit_type) {
-			case "application/x-www-form-urlencoded":
-				reset($formvars);
-				while(list($key,$val) = each($formvars)) {
-					if (is_array($val) || is_object($val)) {
-						while (list($cur_key, $cur_val) = each($val)) {
-							$postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
-						}
-					} else
-						$postdata .= urlencode($key)."=".urlencode($val)."&";
-				}
-				break;
-
-			case "multipart/form-data":
-				$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
-				
-				reset($formvars);
-				while(list($key,$val) = each($formvars)) {
-					if (is_array($val) || is_object($val)) {
-						while (list($cur_key, $cur_val) = each($val)) {
-							$postdata .= "--".$this->_mime_boundary."\r\n";
-							$postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
-							$postdata .= "$cur_val\r\n";
-						}
-					} else {
-						$postdata .= "--".$this->_mime_boundary."\r\n";
-						$postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
-						$postdata .= "$val\r\n";
-					}
-				}
-				
-				reset($formfiles);
-				while (list($field_name, $file_names) = each($formfiles)) {
-					settype($file_names, "array");
-					while (list(, $file_name) = each($file_names)) {
-						if (!is_readable($file_name)) continue;
-
-						$fp = fopen($file_name, "r");
-						$file_content = fread($fp, filesize($file_name));
-						fclose($fp);
-						$base_name = basename($file_name);
-
-						$postdata .= "--".$this->_mime_boundary."\r\n";
-						$postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
-						$postdata .= "$file_content\r\n";
-					}
-				}
-				$postdata .= "--".$this->_mime_boundary."--\r\n";
-				break;
-		}
-
-		return $postdata;
-	}
-}
-
-?>
diff --git a/libraries/magpierss/rss_cache.inc b/libraries/magpierss/rss_cache.inc
deleted file mode 100755
index b8d436cdd..000000000
--- a/libraries/magpierss/rss_cache.inc
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-/*
- * Project:     MagpieRSS: a simple RSS integration tool
- * File:        rss_cache.inc, a simple, rolling(no GC), cache 
- *              for RSS objects, keyed on URL.
- * Author:      Kellan Elliott-McCrea <kellan@protest.net>
- * Version:     0.51
- * License:     GPL
- *
- * The lastest version of MagpieRSS can be obtained from:
- * http://magpierss.sourceforge.net
- *
- * For questions, help, comments, discussion, etc., please join the
- * Magpie mailing list:
- * http://lists.sourceforge.net/lists/listinfo/magpierss-general
- *
- */
-
-class RSSCache {
-    var $BASE_CACHE = './cache';    // where the cache files are stored
-    var $MAX_AGE    = 3600;         // when are files stale, default one hour
-    var $ERROR      = "";           // accumulate error messages
-    
-    function RSSCache ($base='', $age='') {
-        if ( $base ) {
-            $this->BASE_CACHE = $base;
-        }
-        if ( $age ) {
-            $this->MAX_AGE = $age;
-        }
-        
-        // attempt to make the cache directory
-        if ( ! file_exists( $this->BASE_CACHE ) ) {
-            $status = @mkdir( $this->BASE_CACHE, 0755 );
-            
-            // if make failed 
-            if ( ! $status ) {
-                $this->error(
-                    "Cache couldn't make dir '" . $this->BASE_CACHE . "'."
-                );
-            }
-        }
-    }
-    
-/*=======================================================================*\
-    Function:   set
-    Purpose:    add an item to the cache, keyed on url
-    Input:      url from wich the rss file was fetched
-    Output:     true on sucess  
-\*=======================================================================*/
-    function set ($url, $rss) {
-        $this->ERROR = "";
-        $cache_file = $this->file_name( $url );
-        $fp = @fopen( $cache_file, 'w' );
-        
-        if ( ! $fp ) {
-            $this->error(
-                "Cache unable to open file for writing: $cache_file"
-            );
-            return 0;
-        }
-        
-        
-        $data = $this->serialize( $rss );
-        fwrite( $fp, $data );
-        fclose( $fp );
-        
-        return $cache_file;
-    }
-    
-/*=======================================================================*\
-    Function:   get
-    Purpose:    fetch an item from the cache
-    Input:      url from wich the rss file was fetched
-    Output:     cached object on HIT, false on MISS 
-\*=======================================================================*/ 
-    function get ($url) {
-        $this->ERROR = "";
-        $cache_file = $this->file_name( $url );
-        
-        if ( ! file_exists( $cache_file ) ) {
-            $this->debug( 
-                "Cache doesn't contain: $url (cache file: $cache_file)"
-            );
-            return 0;
-        }
-        
-        $fp = @fopen($cache_file, 'r');
-        if ( ! $fp ) {
-            $this->error(
-                "Failed to open cache file for reading: $cache_file"
-            );
-            return 0;
-        }
-        
-        if ($filesize = filesize($cache_file) ) {
-        	$data = fread( $fp, filesize($cache_file) );
-        	$rss = $this->unserialize( $data );
-        
-        	return $rss;
-    	}
-    	
-    	return 0;
-    }
-
-/*=======================================================================*\
-    Function:   check_cache
-    Purpose:    check a url for membership in the cache
-                and whether the object is older then MAX_AGE (ie. STALE)
-    Input:      url from wich the rss file was fetched
-    Output:     cached object on HIT, false on MISS 
-\*=======================================================================*/     
-    function check_cache ( $url ) {
-        $this->ERROR = "";
-        $filename = $this->file_name( $url );
-        
-        if ( file_exists( $filename ) ) {
-            // find how long ago the file was added to the cache
-            // and whether that is longer then MAX_AGE
-            $mtime = filemtime( $filename );
-            $age = time() - $mtime;
-            if ( $this->MAX_AGE > $age ) {
-                // object exists and is current
-                return 'HIT';
-            }
-            else {
-                // object exists but is old
-                return 'STALE';
-            }
-        }
-        else {
-            // object does not exist
-            return 'MISS';
-        }
-    }
-
-	function cache_age( $cache_key ) {
-		$filename = $this->file_name( $url );
-		if ( file_exists( $filename ) ) {
-			$mtime = filemtime( $filename );
-            $age = time() - $mtime;
-			return $age;
-		}
-		else {
-			return -1;	
-		}
-	}
-	
-/*=======================================================================*\
-    Function:   serialize
-\*=======================================================================*/     
-    function serialize ( $rss ) {
-        return serialize( $rss );
-    }
-
-/*=======================================================================*\
-    Function:   unserialize
-\*=======================================================================*/     
-    function unserialize ( $data ) {
-        return unserialize( $data );
-    }
-    
-/*=======================================================================*\
-    Function:   file_name
-    Purpose:    map url to location in cache
-    Input:      url from wich the rss file was fetched
-    Output:     a file name
-\*=======================================================================*/     
-    function file_name ($url) {
-        $filename = md5( $url );
-        return join( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) );
-    }
-
-/*=======================================================================*\
-    Function:   error
-    Purpose:    register error
-\*=======================================================================*/         
-    function error ($errormsg, $lvl=E_USER_WARNING) {
-        // append PHP's error message if track_errors enabled
-        if ( isset($php_errormsg) ) { 
-            $errormsg .= " ($php_errormsg)";
-        }
-        $this->ERROR = $errormsg;
-        if ( MAGPIE_DEBUG ) {
-            trigger_error( $errormsg, $lvl);
-        }
-        else {
-            error_log( $errormsg, 0);
-        }
-    }
-    
-    function debug ($debugmsg, $lvl=E_USER_NOTICE) {
-        if ( MAGPIE_DEBUG ) {
-            $this->error("MagpieRSS [debug] $debugmsg", $lvl);
-        }
-    }
-
-}
-
-?>
diff --git a/libraries/magpierss/rss_fetch.inc b/libraries/magpierss/rss_fetch.inc
deleted file mode 100755
index 1cb759e7e..000000000
--- a/libraries/magpierss/rss_fetch.inc
+++ /dev/null
@@ -1,458 +0,0 @@
-<?php
-/*
- * Project:     MagpieRSS: a simple RSS integration tool
- * File:        rss_fetch.inc, a simple functional interface
-                to fetching and parsing RSS files, via the
-                function fetch_rss()
- * Author:      Kellan Elliott-McCrea <kellan@protest.net>
- * License:     GPL
- *
- * The lastest version of MagpieRSS can be obtained from:
- * http://magpierss.sourceforge.net
- *
- * For questions, help, comments, discussion, etc., please join the
- * Magpie mailing list:
- * magpierss-general@lists.sourceforge.net
- *
- */
- 
-// Setup MAGPIE_DIR for use on hosts that don't include
-// the current path in include_path.
-// with thanks to rajiv and smarty
-if (!defined('DIR_SEP')) {
-    define('DIR_SEP', DIRECTORY_SEPARATOR);
-}
-
-if (!defined('MAGPIE_DIR')) {
-    define('MAGPIE_DIR', dirname(__FILE__) . DIR_SEP);
-}
-
-require_once( MAGPIE_DIR . 'rss_parse.inc' );
-require_once( MAGPIE_DIR . 'rss_cache.inc' );
-
-// for including 3rd party libraries
-define('MAGPIE_EXTLIB', MAGPIE_DIR . 'extlib' . DIR_SEP);
-require_once( MAGPIE_EXTLIB . 'Snoopy.class.inc');
-
-
-/* 
- * CONSTANTS - redefine these in your script to change the
- * behaviour of fetch_rss() currently, most options effect the cache
- *
- * MAGPIE_CACHE_ON - Should Magpie cache parsed RSS objects? 
- * For me a built in cache was essential to creating a "PHP-like" 
- * feel to Magpie, see rss_cache.inc for rationale
- *
- *
- * MAGPIE_CACHE_DIR - Where should Magpie cache parsed RSS objects?
- * This should be a location that the webserver can write to.   If this 
- * directory does not already exist Mapie will try to be smart and create 
- * it.  This will often fail for permissions reasons.
- *
- *
- * MAGPIE_CACHE_AGE - How long to store cached RSS objects? In seconds.
- *
- *
- * MAGPIE_CACHE_FRESH_ONLY - If remote fetch fails, throw error
- * instead of returning stale object?
- *
- * MAGPIE_DEBUG - Display debugging notices?
- *
-*/
-
-
-/*=======================================================================*\
-    Function: fetch_rss: 
-    Purpose:  return RSS object for the give url
-              maintain the cache
-    Input:    url of RSS file
-    Output:   parsed RSS object (see rss_parse.inc)
-
-    NOTES ON CACHEING:  
-    If caching is on (MAGPIE_CACHE_ON) fetch_rss will first check the cache.
-    
-    NOTES ON RETRIEVING REMOTE FILES:
-    If conditional gets are on (MAGPIE_CONDITIONAL_GET_ON) fetch_rss will
-    return a cached object, and touch the cache object upon recieving a
-    304.
-    
-    NOTES ON FAILED REQUESTS:
-    If there is an HTTP error while fetching an RSS object, the cached
-    version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
-\*=======================================================================*/
-
-define('MAGPIE_VERSION', '0.72');
-define('MAGPIE_CACHE_ON', false); /* Fix: XML_Parser cannot be serialized */
-
-$MAGPIE_ERROR = "";
-
-function fetch_rss ($url) {
-    // initialize constants
-    init();
-    
-    if ( !isset($url) ) {
-        error("fetch_rss called without a url");
-        return false;
-    }
-    
-    // if cache is disabled
-    if ( !MAGPIE_CACHE_ON ) {
-        // fetch file, and parse it
-        $resp = _fetch_remote_file( $url );
-        if ( is_success( $resp->status ) ) {
-            return _response_to_rss( $resp );
-        }
-        else {
-            error("Failed to fetch $url and cache is off");
-            return false;
-        }
-    } 
-    // else cache is ON
-    else {
-        // Flow
-        // 1. check cache
-        // 2. if there is a hit, make sure its fresh
-        // 3. if cached obj fails freshness check, fetch remote
-        // 4. if remote fails, return stale object, or error
-        
-        $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
-        
-        if (MAGPIE_DEBUG and $cache->ERROR) {
-            debug($cache->ERROR, E_USER_WARNING);
-        }
-        
-        
-        $cache_status    = 0;       // response of check_cache
-        $request_headers = array(); // HTTP headers to send with fetch
-        $rss             = 0;       // parsed RSS object
-        $errormsg        = 0;       // errors, if any
-        
-        // store parsed XML by desired output encoding
-        // as character munging happens at parse time
-        $cache_key       = $url . MAGPIE_OUTPUT_ENCODING;
-        
-        if (!$cache->ERROR) {
-            // return cache HIT, MISS, or STALE
-            $cache_status = $cache->check_cache( $cache_key);
-        }
-                
-        // if object cached, and cache is fresh, return cached obj
-        if ( $cache_status == 'HIT' ) {
-            $rss = $cache->get( $cache_key );
-            if ( isset($rss) and $rss ) {
-                // should be cache age
-                $rss->from_cache = 1;
-                if ( MAGPIE_DEBUG > 1) {
-                    debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
-                }
-                return $rss;
-            }
-        }
-        
-        // else attempt a conditional get
-        
-        // setup headers
-        if ( $cache_status == 'STALE' ) {
-            $rss = $cache->get( $cache_key );
-            if ( $rss and $rss->etag and $rss->last_modified ) {
-                $request_headers['If-None-Match'] = $rss->etag;
-                $request_headers['If-Last-Modified'] = $rss->last_modified;
-            }
-        }
-        
-        $resp = _fetch_remote_file( $url, $request_headers );
-        
-        if (isset($resp) and $resp) {
-          if ($resp->status == '304' ) {
-                // we have the most current copy
-                if ( MAGPIE_DEBUG > 1) {
-                    debug("Got 304 for $url");
-                }
-                // reset cache on 304 (at minutillo insistent prodding)
-                $cache->set($cache_key, $rss);
-                return $rss;
-            }
-            elseif ( is_success( $resp->status ) ) {
-                $rss = _response_to_rss( $resp );
-                if ( $rss ) {
-                    if (MAGPIE_DEBUG > 1) {
-                        debug("Fetch successful");
-                    }
-                    // add object to cache
-                    $cache->set( $cache_key, $rss );
-                    return $rss;
-                }
-            }
-            else {
-                $errormsg = "Failed to fetch $url ";
-                if ( $resp->status == '-100' ) {
-                    $errormsg .= "(Request timed out after " . MAGPIE_FETCH_TIME_OUT . " seconds)";
-                }
-                elseif ( $resp->error ) {
-                    # compensate for Snoopy's annoying habbit to tacking
-                    # on '\n'
-                    $http_error = substr($resp->error, 0, -2); 
-                    $errormsg .= "(HTTP Error: $http_error)";
-                }
-                else {
-                    $errormsg .=  "(HTTP Response: " . $resp->response_code .')';
-                }
-            }
-        }
-        else {
-            $errormsg = "Unable to retrieve RSS file for unknown reasons.";
-        }
-        
-        // else fetch failed
-        
-        // attempt to return cached object
-        if ($rss) {
-            if ( MAGPIE_DEBUG ) {
-                debug("Returning STALE object for $url");
-            }
-            return $rss;
-        }
-        
-        // else we totally failed
-        error( $errormsg ); 
-        
-        return false;
-        
-    } // end if ( !MAGPIE_CACHE_ON ) {
-} // end fetch_rss()
-
-/*=======================================================================*\
-    Function:   error
-    Purpose:    set MAGPIE_ERROR, and trigger error
-\*=======================================================================*/
-
-function error ($errormsg, $lvl=E_USER_WARNING) {
-        global $MAGPIE_ERROR;
-        
-        // append PHP's error message if track_errors enabled
-        if ( isset($php_errormsg) ) { 
-            $errormsg .= " ($php_errormsg)";
-        }
-        if ( $errormsg ) {
-            $errormsg = "MagpieRSS: $errormsg";
-            $MAGPIE_ERROR = $errormsg;
-            //trigger_error( $errormsg, $lvl);                
-        }
-}
-
-function debug ($debugmsg, $lvl=E_USER_NOTICE) {
-    trigger_error("MagpieRSS [debug] $debugmsg", $lvl);
-}
-            
-/*=======================================================================*\
-    Function:   magpie_error
-    Purpose:    accessor for the magpie error variable
-\*=======================================================================*/
-function magpie_error ($errormsg="") {
-    global $MAGPIE_ERROR;
-    
-    if ( isset($errormsg) and $errormsg ) { 
-        $MAGPIE_ERROR = $errormsg;
-    }
-    
-    return $MAGPIE_ERROR;   
-}
-
-/*=======================================================================*\
-    Function:   _fetch_remote_file
-    Purpose:    retrieve an arbitrary remote file
-    Input:      url of the remote file
-                headers to send along with the request (optional)
-    Output:     an HTTP response object (see Snoopy.class.inc)  
-\*=======================================================================*/
-function _fetch_remote_file ($url, $headers = "" ) {
-
-    require_once 'vtlib/Vtiger/Net/Client.php';
-
-    $client = new Vtiger_Net_Client($url);
-    if (is_array($headers)) $client->setHeaders($headers);
-    $content = $client->doGet(null, MAGPIE_FETCH_TIME_OUT);
-    $res = new stdClass;
-    $res->status = $client->client->getResponseCode();
-    $res->results = $content;
-    return $res;
-
-}
-
-/*=======================================================================*\
-    Function:   _response_to_rss
-    Purpose:    parse an HTTP response object into an RSS object
-    Input:      an HTTP response object (see Snoopy)
-    Output:     parsed RSS object (see rss_parse)
-\*=======================================================================*/
-function _response_to_rss ($resp) {
-    $rss = new MagpieRSS( $resp->results, MAGPIE_OUTPUT_ENCODING, MAGPIE_INPUT_ENCODING, MAGPIE_DETECT_ENCODING );
-    
-    // if RSS parsed successfully       
-    if ( $rss and !$rss->ERROR) {
-        
-        // find Etag, and Last-Modified
-        foreach($resp->headers as $h) {
-            // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
-            if (strpos($h, ": ")) {
-                list($field, $val) = explode(": ", $h, 2);
-            }
-            else {
-                $field = $h;
-                $val = "";
-            }
-            
-            if ( $field == 'ETag' ) {
-                $rss->etag = $val;
-            }
-            
-            if ( $field == 'Last-Modified' ) {
-                $rss->last_modified = $val;
-            }
-        }
-        
-        return $rss;    
-    } // else construct error message
-    else {
-        $errormsg = "Failed to parse RSS file.";
-        
-        if ($rss) {
-            $errormsg .= " (" . $rss->ERROR . ")";
-        }
-        error($errormsg);
-        
-        return false;
-    } // end if ($rss and !$rss->error)
-}
-
-/*=======================================================================*\
-    Function:   init
-    Purpose:    setup constants with default values
-                check for user overrides
-\*=======================================================================*/
-function init () {
-    if ( defined('MAGPIE_INITALIZED') ) {
-        return;
-    }
-    else {
-        define('MAGPIE_INITALIZED', true);
-    }
-    
-    if ( !defined('MAGPIE_CACHE_ON') ) {
-        define('MAGPIE_CACHE_ON', true);
-    }
-
-    if ( !defined('MAGPIE_CACHE_DIR') ) {
-        define('MAGPIE_CACHE_DIR', './cache');
-    }
-
-    if ( !defined('MAGPIE_CACHE_AGE') ) {
-        define('MAGPIE_CACHE_AGE', 60*60); // one hour
-    }
-
-    if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
-        define('MAGPIE_CACHE_FRESH_ONLY', false);
-    }
-
-    if ( !defined('MAGPIE_OUTPUT_ENCODING') ) {
-        define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
-    }
-    
-    if ( !defined('MAGPIE_INPUT_ENCODING') ) {
-        define('MAGPIE_INPUT_ENCODING', null);
-    }
-    
-    if ( !defined('MAGPIE_DETECT_ENCODING') ) {
-        define('MAGPIE_DETECT_ENCODING', true);
-    }
-    
-    if ( !defined('MAGPIE_DEBUG') ) {
-        define('MAGPIE_DEBUG', 0);
-    }
-    
-    if ( !defined('MAGPIE_USER_AGENT') ) {
-        $ua = 'MagpieRSS/'. MAGPIE_VERSION . ' (+http://magpierss.sf.net';
-        
-        if ( MAGPIE_CACHE_ON ) {
-            $ua = $ua . ')';
-        }
-        else {
-            $ua = $ua . '; No cache)';
-        }
-        
-        define('MAGPIE_USER_AGENT', $ua);
-    }
-    
-    if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
-        define('MAGPIE_FETCH_TIME_OUT', 5); // 5 second timeout
-    }
-    
-    // use gzip encoding to fetch rss files if supported?
-    if ( !defined('MAGPIE_USE_GZIP') ) {
-        define('MAGPIE_USE_GZIP', true);    
-    }
-}
-
-// NOTE: the following code should really be in Snoopy, or at least
-// somewhere other then rss_fetch!
-
-/*=======================================================================*\
-    HTTP STATUS CODE PREDICATES
-    These functions attempt to classify an HTTP status code
-    based on RFC 2616 and RFC 2518.
-    
-    All of them take an HTTP status code as input, and return true or false
-
-    All this code is adapted from LWP's HTTP::Status.
-\*=======================================================================*/
-
-
-/*=======================================================================*\
-    Function:   is_info
-    Purpose:    return true if Informational status code
-\*=======================================================================*/
-function is_info ($sc) { 
-    return $sc >= 100 && $sc < 200; 
-}
-
-/*=======================================================================*\
-    Function:   is_success
-    Purpose:    return true if Successful status code
-\*=======================================================================*/
-function is_success ($sc) { 
-    return $sc >= 200 && $sc < 300; 
-}
-
-/*=======================================================================*\
-    Function:   is_redirect
-    Purpose:    return true if Redirection status code
-\*=======================================================================*/
-function is_redirect ($sc) { 
-    return $sc >= 300 && $sc < 400; 
-}
-
-/*=======================================================================*\
-    Function:   is_error
-    Purpose:    return true if Error status code
-\*=======================================================================*/
-function is_error ($sc) { 
-    return $sc >= 400 && $sc < 600; 
-}
-
-/*=======================================================================*\
-    Function:   is_client_error
-    Purpose:    return true if Error status code, and its a client error
-\*=======================================================================*/
-function is_client_error ($sc) { 
-    return $sc >= 400 && $sc < 500; 
-}
-
-/*=======================================================================*\
-    Function:   is_client_error
-    Purpose:    return true if Error status code, and its a server error
-\*=======================================================================*/
-function is_server_error ($sc) { 
-    return $sc >= 500 && $sc < 600; 
-}
-
-?>
diff --git a/libraries/magpierss/rss_parse.inc b/libraries/magpierss/rss_parse.inc
deleted file mode 100755
index 6ea0c35a9..000000000
--- a/libraries/magpierss/rss_parse.inc
+++ /dev/null
@@ -1,605 +0,0 @@
-<?php
-
-/**
-* Project:     MagpieRSS: a simple RSS integration tool
-* File:        rss_parse.inc  - parse an RSS or Atom feed
-*               return as a simple object.
-*
-* Handles RSS 0.9x, RSS 2.0, RSS 1.0, and Atom 0.3
-*
-* The lastest version of MagpieRSS can be obtained from:
-* http://magpierss.sourceforge.net
-*
-* For questions, help, comments, discussion, etc., please join the
-* Magpie mailing list:
-* magpierss-general@lists.sourceforge.net
-*
-* @author           Kellan Elliott-McCrea <kellan@protest.net>
-* @version          0.7a
-* @license          GPL
-*
-*/
-
-define('RSS', 'RSS');
-define('ATOM', 'Atom');
-
-require_once (MAGPIE_DIR . 'rss_utils.inc');
-
-/**
-* Hybrid parser, and object, takes RSS as a string and returns a simple object.
-*
-* see: rss_fetch.inc for a simpler interface with integrated caching support
-*
-*/
-class MagpieRSS {
-    var $parser;
-    
-    var $current_item   = array();  // item currently being parsed
-    var $items          = array();  // collection of parsed items
-    var $channel        = array();  // hash of channel fields
-    var $textinput      = array();
-    var $image          = array();
-    var $feed_type;
-    var $feed_version;
-    var $encoding       = '';       // output encoding of parsed rss
-    
-    var $_source_encoding = '';     // only set if we have to parse xml prolog
-    
-    var $ERROR = "";
-    var $WARNING = "";
-    
-    // define some constants
-    
-    var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
-    var $_KNOWN_ENCODINGS    = array('UTF-8', 'US-ASCII', 'ISO-8859-1');
-
-    // parser variables, useless if you're not a parser, treat as private
-    var $stack              = array(); // parser stack
-    var $inchannel          = false;
-    var $initem             = false;
-    var $incontent          = false; // if in Atom <content mode="xml"> field 
-    var $intextinput        = false;
-    var $inimage            = false;
-    var $current_namespace  = false;
-    
-
-    /**
-     *  Set up XML parser, parse source, and return populated RSS object..
-     *   
-     *  @param string $source           string containing the RSS to be parsed
-     *
-     *  NOTE:  Probably a good idea to leave the encoding options alone unless
-     *         you know what you're doing as PHP's character set support is
-     *         a little weird.
-     *
-     *  NOTE:  A lot of this is unnecessary but harmless with PHP5 
-     *
-     *
-     *  @param string $output_encoding  output the parsed RSS in this character 
-     *                                  set defaults to ISO-8859-1 as this is PHP's
-     *                                  default.
-     *
-     *                                  NOTE: might be changed to UTF-8 in future
-     *                                  versions.
-     *                               
-     *  @param string $input_encoding   the character set of the incoming RSS source. 
-     *                                  Leave blank and Magpie will try to figure it
-     *                                  out.
-     *                                  
-     *                                   
-     *  @param bool   $detect_encoding  if false Magpie won't attempt to detect
-     *                                  source encoding. (caveat emptor)
-     *
-     */
-    function __construct ($source, $output_encoding='UTF-8', 
-                        $input_encoding=null, $detect_encoding=true) 
-    {   
-        # if PHP xml isn't compiled in, die
-        #
-        if (!function_exists('xml_parser_create')) {
-            $this->error( "Failed to load PHP's XML Extension. " . 
-                          "http://www.php.net/manual/en/ref.xml.php",
-                           E_USER_ERROR );
-        }
-        
-        list($parser, $source) = $this->create_parser($source, 
-                $output_encoding, $input_encoding, $detect_encoding);
-        
-        
-        if (!is_object($parser)) {
-            $this->error( "Failed to create an instance of PHP's XML parser. " .
-                          "http://www.php.net/manual/en/ref.xml.php",
-                          E_USER_ERROR );
-        }
-
-        
-        $this->parser = $parser;
-        
-        # pass in parser, and a reference to this object
-        # setup handlers
-        #
-        xml_set_object( $this->parser, $this );
-        xml_set_element_handler($this->parser, 
-                'feed_start_element', 'feed_end_element' );
-                        
-        xml_set_character_data_handler( $this->parser, 'feed_cdata' ); 
-    
-        $status = xml_parse( $this->parser, $source );
-        
-        if (! $status ) {
-            $errorcode = xml_get_error_code( $this->parser );
-            if ( $errorcode != XML_ERROR_NONE ) {
-                $xml_error = xml_error_string( $errorcode );
-                $error_line = xml_get_current_line_number($this->parser);
-                $error_col = xml_get_current_column_number($this->parser);
-                $errormsg = "$xml_error at line $error_line, column $error_col";
-
-                $this->error( $errormsg );
-            }
-        }
-        
-        xml_parser_free( $this->parser );
-
-        $this->normalize();
-    }
-    
-    function feed_start_element($p, $element, &$attrs) {
-        $el = $element = strtolower($element);
-        $attrs = array_change_key_case($attrs, CASE_LOWER);
-        
-        // check for a namespace, and split if found
-        $ns = false;
-        if ( strpos( $element, ':' ) ) {
-            list($ns, $el) = split( ':', $element, 2); 
-        }
-        if ( $ns and $ns != 'rdf' ) {
-            $this->current_namespace = $ns;
-        }
-            
-        # if feed type isn't set, then this is first element of feed
-        # identify feed from root element
-        #
-        if (!isset($this->feed_type) ) {
-            if ( $el == 'rdf' ) {
-                $this->feed_type = RSS;
-                $this->feed_version = '1.0';
-            }
-            elseif ( $el == 'rss' ) {
-                $this->feed_type = RSS;
-                $this->feed_version = $attrs['version'];
-            }
-            elseif ( $el == 'feed' ) {
-                $this->feed_type = ATOM;
-                $this->feed_version = $attrs['version'];
-                $this->inchannel = true;
-            }
-            return;
-        }
-    
-        if ( $el == 'channel' ) 
-        {
-            $this->inchannel = true;
-        }
-        elseif ($el == 'item' or $el == 'entry' ) 
-        {
-            $this->initem = true;
-            if ( isset($attrs['rdf:about']) ) {
-                $this->current_item['about'] = $attrs['rdf:about']; 
-            }
-        }
-        
-        // if we're in the default namespace of an RSS feed,
-        //  record textinput or image fields
-        elseif ( 
-            $this->feed_type == RSS and 
-            $this->current_namespace == '' and 
-            $el == 'textinput' ) 
-        {
-            $this->intextinput = true;
-        }
-        
-        elseif (
-            $this->feed_type == RSS and 
-            $this->current_namespace == '' and 
-            $el == 'image' ) 
-        {
-            $this->inimage = true;
-        }
-        
-        # handle atom content constructs
-        elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
-        {
-            // avoid clashing w/ RSS mod_content
-            if ($el == 'content' ) {
-                $el = 'atom_content';
-            }
-            
-            $this->incontent = $el;
-            
-            
-        }
-        
-        // if inside an Atom content construct (e.g. content or summary) field treat tags as text
-        elseif ($this->feed_type == ATOM and $this->incontent ) 
-        {
-            // if tags are inlined, then flatten
-            $attrs_str = join(' ', 
-                    array_map('map_attrs', 
-                    array_keys($attrs), 
-                    array_values($attrs) ) );
-            
-            $this->append_content( "<$element $attrs_str>"  );
-                    
-            array_unshift( $this->stack, $el );
-        }
-        
-        // Atom support many links per containging element.
-        // Magpie treats link elements of type rel='alternate'
-        // as being equivalent to RSS's simple link element.
-        //
-        elseif ($this->feed_type == ATOM and $el == 'link' ) 
-        {
-            if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) 
-            {
-                $link_el = 'link';
-            }
-            else {
-                $link_el = 'link_' . $attrs['rel'];
-            }
-            
-            $this->append($link_el, $attrs['href']);
-        }
-        // set stack[0] to current element
-        else {
-            array_unshift($this->stack, $el);
-        }
-    }
-    
-
-    
-    function feed_cdata ($p, $text) {
-        if ($this->feed_type == ATOM and $this->incontent) 
-        {
-            $this->append_content( $text );
-        }
-        else {
-            $current_el = join('_', array_reverse($this->stack));
-            $this->append($current_el, $text);
-        }
-    }
-    
-    function feed_end_element ($p, $el) {
-        $el = strtolower($el);
-        
-        if ( $el == 'item' or $el == 'entry' ) 
-        {
-            $this->items[] = $this->current_item;
-            $this->current_item = array();
-            $this->initem = false;
-        }
-        elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) 
-        {
-            $this->intextinput = false;
-        }
-        elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) 
-        {
-            $this->inimage = false;
-        }
-        elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
-        {   
-            $this->incontent = false;
-        }
-        elseif ($el == 'channel' or $el == 'feed' ) 
-        {
-            $this->inchannel = false;
-        }
-        elseif ($this->feed_type == ATOM and $this->incontent  ) {
-            // balance tags properly
-            // note:  i don't think this is actually neccessary
-            if ( $this->stack[0] == $el ) 
-            {
-                $this->append_content("</$el>");
-            }
-            else {
-                $this->append_content("<$el />");
-            }
-
-            array_shift( $this->stack );
-        }
-        else {
-            array_shift( $this->stack );
-        }
-        
-        $this->current_namespace = false;
-    }
-    
-    function concat (&$str1, $str2="") {
-        if (!isset($str1) ) {
-            $str1="";
-        }
-        $str1 .= $str2;
-    }
-    
-    
-    
-    function append_content($text) {
-        if ( $this->initem ) {
-            $this->concat( $this->current_item[ $this->incontent ], $text );
-        }
-        elseif ( $this->inchannel ) {
-            $this->concat( $this->channel[ $this->incontent ], $text );
-        }
-    }
-    
-    // smart append - field and namespace aware
-    function append($el, $text) {
-        if (!$el) {
-            return;
-        }
-        if ( $this->current_namespace ) 
-        {
-            if ( $this->initem ) {
-                $this->concat(
-                    $this->current_item[ $this->current_namespace ][ $el ], $text);
-            }
-            elseif ($this->inchannel) {
-                $this->concat(
-                    $this->channel[ $this->current_namespace][ $el ], $text );
-            }
-            elseif ($this->intextinput) {
-                $this->concat(
-                    $this->textinput[ $this->current_namespace][ $el ], $text );
-            }
-            elseif ($this->inimage) {
-                $this->concat(
-                    $this->image[ $this->current_namespace ][ $el ], $text );
-            }
-        }
-        else {
-            if ( $this->initem ) {
-                $this->concat(
-                    $this->current_item[ $el ], $text);
-            }
-            elseif ($this->intextinput) {
-                $this->concat(
-                    $this->textinput[ $el ], $text );
-            }
-            elseif ($this->inimage) {
-                $this->concat(
-                    $this->image[ $el ], $text );
-            }
-            elseif ($this->inchannel) {
-                $this->concat(
-                    $this->channel[ $el ], $text );
-            }
-            
-        }
-    }
-    
-    function normalize () {
-        // if atom populate rss fields
-        if ( $this->is_atom() ) {
-            $this->channel['description'] = $this->channel['tagline'];
-            for ( $i = 0; $i < count($this->items); $i++) {
-                $item = $this->items[$i];
-                if ( isset($item['summary']) )
-                    $item['description'] = $item['summary'];
-                if ( isset($item['atom_content']))
-                    $item['content']['encoded'] = $item['atom_content'];
-                
-                $atom_date = (isset($item['issued']) ) ? $item['issued'] : $item['modified'];
-                if ( $atom_date ) {
-                    $epoch = @parse_w3cdtf($atom_date);
-                    if ($epoch and $epoch > 0) {
-                        $item['date_timestamp'] = $epoch;
-                    }
-                }
-                
-                $this->items[$i] = $item;
-            }       
-        }
-        elseif ( $this->is_rss() ) {
-            $this->channel['tagline'] = $this->channel['description'];
-            for ( $i = 0; $i < count($this->items); $i++) {
-                $item = $this->items[$i];
-                if ( isset($item['description']))
-                    $item['summary'] = $item['description'];
-                if ( isset($item['content']['encoded'] ) )
-                    $item['atom_content'] = $item['content']['encoded'];
-                
-                if ( $this->is_rss() == '1.0' and isset($item['dc']['date']) ) {
-                    $epoch = @parse_w3cdtf($item['dc']['date']);
-                    if ($epoch and $epoch > 0) {
-                        $item['date_timestamp'] = $epoch;
-                    }
-                }
-                elseif ( isset($item['pubdate']) ) {
-                    $epoch = @strtotime($item['pubdate']);
-                    if ($epoch > 0) {
-                        $item['date_timestamp'] = $epoch;
-                    }
-                }
-                
-                $this->items[$i] = $item;
-            }
-        }
-    }
-    
-    
-    function is_rss () {
-        if ( $this->feed_type == RSS ) {
-            return $this->feed_version; 
-        }
-        else {
-            return false;
-        }
-    }
-    
-    function is_atom() {
-        if ( $this->feed_type == ATOM ) {
-            return $this->feed_version;
-        }
-        else {
-            return false;
-        }
-    }
-
-    /**
-    * return XML parser, and possibly re-encoded source
-    *
-    */
-    function create_parser($source, $out_enc, $in_enc, $detect) {
-        if ( substr(phpversion(),0,1) >= 5) {
-            $parser = $this->php5_create_parser($in_enc, $detect);
-        }
-        else {
-            list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect);
-        }
-        if ($out_enc) {
-            $this->encoding = $out_enc;
-            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $out_enc);
-        }
-        
-        return array($parser, $source);
-    }
-    
-    /**
-    * Instantiate an XML parser under PHP5
-    *
-    * PHP5 will do a fine job of detecting input encoding
-    * if passed an empty string as the encoding. 
-    *
-    * All hail libxml2!
-    *
-    */
-    function php5_create_parser($in_enc, $detect) {
-        // by default php5 does a fine job of detecting input encodings
-        if(!$detect && $in_enc) {
-            return xml_parser_create($in_enc);
-        }
-        else {
-            return xml_parser_create('');
-        }
-    }
-    
-    /**
-    * Instaniate an XML parser under PHP4
-    *
-    * Unfortunately PHP4's support for character encodings
-    * and especially XML and character encodings sucks.  As
-    * long as the documents you parse only contain characters
-    * from the ISO-8859-1 character set (a superset of ASCII,
-    * and a subset of UTF-8) you're fine.  However once you
-    * step out of that comfy little world things get mad, bad,
-    * and dangerous to know.
-    *
-    * The following code is based on SJM's work with FoF
-    * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
-    *
-    */
-    function php4_create_parser($source, $in_enc, $detect) {
-        if ( !$detect ) {
-            return array(xml_parser_create($in_enc), $source);
-        }
-        
-        if (!$in_enc) {
-            if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
-                $in_enc = strtoupper($m[1]);
-                $this->source_encoding = $in_enc;
-            }
-            else {
-                $in_enc = 'UTF-8';
-            }
-        }
-        
-        if ($this->known_encoding($in_enc)) {
-            return array(xml_parser_create($in_enc), $source);
-        }
-        
-        // the dectected encoding is not one of the simple encodings PHP knows
-        
-        // attempt to use the iconv extension to
-        // cast the XML to a known encoding
-        // @see http://php.net/iconv
-       
-        if (function_exists('iconv'))  {
-            $encoded_source = iconv($in_enc,'UTF-8', $source);
-            if ($encoded_source) {
-                return array(xml_parser_create('UTF-8'), $encoded_source);
-            }
-        }
-        
-        // iconv didn't work, try mb_convert_encoding
-        // @see http://php.net/mbstring
-        if(function_exists('mb_convert_encoding')) {
-            $encoded_source = mb_convert_encoding($source, 'UTF-8', $in_enc );
-            if ($encoded_source) {
-                return array(xml_parser_create('UTF-8'), $encoded_source);
-            }
-        }
-        
-        // else 
-        $this->error("Feed is in an unsupported character encoding. ($in_enc) " .
-                     "You may see strange artifacts, and mangled characters.",
-                     E_USER_NOTICE);
-            
-        return array(xml_parser_create(), $source);
-    }
-    
-    function known_encoding($enc) {
-        $enc = strtoupper($enc);
-        if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) {
-            return $enc;
-        }
-        else {
-            return false;
-        }
-    }
-
-    function error ($errormsg, $lvl=E_USER_WARNING) {
-        // append PHP's error message if track_errors enabled
-        if ( isset($php_errormsg) ) { 
-            $errormsg .= " ($php_errormsg)";
-        }
-        if ( MAGPIE_DEBUG ) {
-            trigger_error( $errormsg, $lvl);        
-        }
-        else {
-            error_log( $errormsg, 0);
-        }
-        
-        $notices = E_USER_NOTICE|E_NOTICE;
-        if ( $lvl&$notices ) {
-            $this->WARNING = $errormsg;
-        } else {
-            $this->ERROR = $errormsg;
-        }
-    }
-    
-    
-} // end class RSS
-
-function map_attrs($k, $v) {
-    return "$k=\"$v\"";
-}
-
-// patch to support medieval versions of PHP4.1.x, 
-// courtesy, Ryan Currie, ryan@digibliss.com
-
-if (!function_exists('array_change_key_case')) {
-	define("CASE_UPPER",1);
-	define("CASE_LOWER",0);
-
-
-	function array_change_key_case($array,$case=CASE_LOWER) {
-       if ($case=CASE_LOWER) $cmd=strtolower;
-       elseif ($case=CASE_UPPER) $cmd=strtoupper;
-       foreach($array as $key=>$value) {
-               $output[$cmd($key)]=$value;
-       }
-       return $output;
-	}
-
-}
-
-?>
diff --git a/libraries/magpierss/rss_utils.inc b/libraries/magpierss/rss_utils.inc
deleted file mode 100755
index 2a29e72a9..000000000
--- a/libraries/magpierss/rss_utils.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * Project:     MagpieRSS: a simple RSS integration tool
- * File:        rss_utils.inc, utility methods for working with RSS
- * Author:      Kellan Elliott-McCrea <kellan@protest.net>
- * Version:     0.51
- * License:     GPL
- *
- * The lastest version of MagpieRSS can be obtained from:
- * http://magpierss.sourceforge.net
- *
- * For questions, help, comments, discussion, etc., please join the
- * Magpie mailing list:
- * magpierss-general@lists.sourceforge.net
- */
-
-
-/*======================================================================*\
-    Function: parse_w3cdtf
-    Purpose:  parse a W3CDTF date into unix epoch
-
-    NOTE: http://www.w3.org/TR/NOTE-datetime
-\*======================================================================*/
-
-function parse_w3cdtf ( $date_str ) {
-    
-    # regex to match wc3dtf
-    $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
-    
-    if ( preg_match( $pat, $date_str, $match ) ) {
-        list( $year, $month, $day, $hours, $minutes, $seconds) = 
-            array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
-        
-        # calc epoch for current date assuming GMT
-        $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
-        
-        $offset = 0;
-        if ( $match[10] == 'Z' ) {
-            # zulu time, aka GMT
-        }
-        else {
-            list( $tz_mod, $tz_hour, $tz_min ) =
-                array( $match[8], $match[9], $match[10]);
-            
-            # zero out the variables
-            if ( ! $tz_hour ) { $tz_hour = 0; }
-            if ( ! $tz_min ) { $tz_min = 0; }
-        
-            $offset_secs = (($tz_hour*60)+$tz_min)*60;
-            
-            # is timezone ahead of GMT?  then subtract offset
-            #
-            if ( $tz_mod == '+' ) {
-                $offset_secs = $offset_secs * -1;
-            }
-            
-            $offset = $offset_secs; 
-        }
-        $epoch = $epoch + $offset;
-        return $epoch;
-    }
-    else {
-        return -1;
-    }
-}
-
-?>
diff --git a/libraries/mobileDetect/Mobile_Detect.php b/libraries/mobileDetect/Mobile_Detect.php
deleted file mode 100644
index 17c0966a7..000000000
--- a/libraries/mobileDetect/Mobile_Detect.php
+++ /dev/null
@@ -1,1428 +0,0 @@
-<?php
-/**
- * Mobile Detect Library
- * =====================
- *
- * Motto: "Every business should have a mobile detection script to detect mobile readers"
- *
- * Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets).
- * It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
- *
- * @author      Current authors: Serban Ghita <serbanghita@gmail.com>
- *                               Nick Ilyin <nick.ilyin@gmail.com>
- *
- *              Original author: Victor Stanciu <vic.stanciu@gmail.com>
- *
- * @license     Code and contributions have 'MIT License'
- *              More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
- *
- * @link        Homepage:     http://mobiledetect.net
- *              GitHub Repo:  https://github.com/serbanghita/Mobile-Detect
- *              Google Code:  http://code.google.com/p/php-mobile-detect/
- *              README:       https://github.com/serbanghita/Mobile-Detect/blob/master/README.md
- *              HOWTO:        https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
- *
- * @version     2.8.15
- */
-
-class Mobile_Detect
-{
-    /**
-     * Mobile detection type.
-     *
-     * @deprecated since version 2.6.9
-     */
-    const DETECTION_TYPE_MOBILE     = 'mobile';
-
-    /**
-     * Extended detection type.
-     *
-     * @deprecated since version 2.6.9
-     */
-    const DETECTION_TYPE_EXTENDED   = 'extended';
-
-    /**
-     * A frequently used regular expression to extract version #s.
-     *
-     * @deprecated since version 2.6.9
-     */
-    const VER                       = '([\w._\+]+)';
-
-    /**
-     * Top-level device.
-     */
-    const MOBILE_GRADE_A            = 'A';
-
-    /**
-     * Mid-level device.
-     */
-    const MOBILE_GRADE_B            = 'B';
-
-    /**
-     * Low-level device.
-     */
-    const MOBILE_GRADE_C            = 'C';
-
-    /**
-     * Stores the version number of the current release.
-     */
-    const VERSION                   = '2.8.15';
-
-    /**
-     * A type for the version() method indicating a string return value.
-     */
-    const VERSION_TYPE_STRING       = 'text';
-
-    /**
-     * A type for the version() method indicating a float return value.
-     */
-    const VERSION_TYPE_FLOAT        = 'float';
-
-    /**
-     * A cache for resolved matches
-     * @var array
-     */
-    protected $cache = array();
-
-    /**
-     * The User-Agent HTTP header is stored in here.
-     * @var string
-     */
-    protected $userAgent = null;
-
-    /**
-     * HTTP headers in the PHP-flavor. So HTTP_USER_AGENT and SERVER_SOFTWARE.
-     * @var array
-     */
-    protected $httpHeaders = array();
-
-    /**
-     * CloudFront headers. E.g. CloudFront-Is-Desktop-Viewer, CloudFront-Is-Mobile-Viewer & CloudFront-Is-Tablet-Viewer.
-     * @var array
-     */
-    protected $cloudfrontHeaders = array();
-
-    /**
-     * The matching Regex.
-     * This is good for debug.
-     * @var string
-     */
-    protected $matchingRegex = null;
-
-    /**
-     * The matches extracted from the regex expression.
-     * This is good for debug.
-     * @var string
-     */
-    protected $matchesArray = null;
-
-    /**
-     * The detection type, using self::DETECTION_TYPE_MOBILE or self::DETECTION_TYPE_EXTENDED.
-     *
-     * @deprecated since version 2.6.9
-     *
-     * @var string
-     */
-    protected $detectionType = self::DETECTION_TYPE_MOBILE;
-
-    /**
-     * HTTP headers that trigger the 'isMobile' detection
-     * to be true.
-     *
-     * @var array
-     */
-    protected static $mobileHeaders = array(
-
-            'HTTP_ACCEPT'                  => array('matches' => array(
-                                                                        // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/
-                                                                        'application/x-obml2d',
-                                                                        // BlackBerry devices.
-                                                                        'application/vnd.rim.html',
-                                                                        'text/vnd.wap.wml',
-                                                                        'application/vnd.wap.xhtml+xml'
-                                            )),
-            'HTTP_X_WAP_PROFILE'           => null,
-            'HTTP_X_WAP_CLIENTID'          => null,
-            'HTTP_WAP_CONNECTION'          => null,
-            'HTTP_PROFILE'                 => null,
-            // Reported by Opera on Nokia devices (eg. C3).
-            'HTTP_X_OPERAMINI_PHONE_UA'    => null,
-            'HTTP_X_NOKIA_GATEWAY_ID'      => null,
-            'HTTP_X_ORANGE_ID'             => null,
-            'HTTP_X_VODAFONE_3GPDPCONTEXT' => null,
-            'HTTP_X_HUAWEI_USERID'         => null,
-            // Reported by Windows Smartphones.
-            'HTTP_UA_OS'                   => null,
-            // Reported by Verizon, Vodafone proxy system.
-            'HTTP_X_MOBILE_GATEWAY'        => null,
-            // Seen this on HTC Sensation. SensationXE_Beats_Z715e.
-            'HTTP_X_ATT_DEVICEID'          => null,
-            // Seen this on a HTC.
-            'HTTP_UA_CPU'                  => array('matches' => array('ARM')),
-    );
-
-    /**
-     * List of mobile devices (phones).
-     *
-     * @var array
-     */
-    protected static $phoneDevices = array(
-        'iPhone'        => '\biPhone\b|\biPod\b', // |\biTunes
-        'BlackBerry'    => 'BlackBerry|\bBB10\b|rim[0-9]+',
-        'HTC'           => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m',
-        'Nexus'         => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6',
-        // @todo: Is 'Dell Streak' a tablet or a phone? ;)
-        'Dell'          => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b',
-        'Motorola'      => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\bMoto E\b',
-        'Samsung'       => 'Samsung|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205',
-        'LG'            => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802)',
-        'Sony'          => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533',
-        'Asus'          => 'Asus.*Galaxy|PadFone.*Mobile',
-        // http://www.micromaxinfo.com/mobiles/smartphones
-        // Added because the codes might conflict with Acer Tablets.
-        'Micromax'      => 'Micromax.*\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\b',
-        // @todo Complete the regex.
-        'Palm'          => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ;
-        'Vertu'         => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;)
-        // http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH)
-        // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android.
-        'Pantech'       => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790',
-        // http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones.
-        'Fly'           => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250',
-        // http://fr.wikomobile.com
-        'Wiko'          => 'KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLIM|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM',
-        'iMobile'        => 'i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)',
-        // Added simvalley mobile just for fun. They have some interesting devices.
-        // http://www.simvalley.fr/telephonie---gps-_22_telephonie-mobile_telephones_.html
-        'SimValley'     => '\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\b',
-         // Wolfgang - a brand that is sold by Aldi supermarkets.
-         // http://www.wolfgangmobile.com/
-        'Wolfgang'      => 'AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q',
-        'Alcatel'       => 'Alcatel',
-        'Nintendo' => 'Nintendo 3DS',
-        // http://en.wikipedia.org/wiki/Amoi
-        'Amoi'          => 'Amoi',
-        // http://en.wikipedia.org/wiki/INQ
-        'INQ'           => 'INQ',
-        // @Tapatalk is a mobile app; http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039
-        'GenericPhone'  => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser',
-    );
-
-    /**
-     * List of tablet devices.
-     *
-     * @var array
-     */
-    protected static $tabletDevices = array(
-        'iPad'              => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic.
-        'NexusTablet'       => 'Android.*Nexus[\s]+(7|9|10)|^.*Android.*Nexus(?:(?!Mobile).)*$',
-        'SamsungTablet'     => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805', // SCH-P709|SCH-P729|SM-T2558|GT-I9205 - Samsung Mega - treat them like a regular phone.
-        // http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
-        'Kindle'            => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI)\b',
-        // Only the Surface tablets with Windows RT are considered mobile.
-        // http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
-        'SurfaceTablet'     => 'Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)',
-        // http://shopping1.hp.com/is-bin/INTERSHOP.enfinity/WFS/WW-USSMBPublicStore-Site/en_US/-/USD/ViewStandardCatalog-Browse?CatalogCategoryID=JfIQ7EN5lqMAAAEyDcJUDwMT
-        'HPTablet'          => 'HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10',
-        // Watch out for PadFone, see #132.
-        // http://www.asus.com/de/Tablets_Mobile/Memo_Pad_Products/
-        'AsusTablet'        => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|\bK00C\b|\bK00E\b|\bK00L\b|TX201LA|ME176C|ME102A|\bM80TA\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K017 |ME572C|ME103K|ME170C|ME171C|\bME70C\b|ME581C|ME581CL|ME8510C|ME181C',
-        'BlackBerryTablet'  => 'PlayBook|RIM Tablet',
-        'HTCtablet'         => 'HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410',
-        'MotorolaTablet'    => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617',
-        'NookTablet'        => 'Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2',
-        // http://www.acer.ro/ac/ro/RO/content/drivers
-        // http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer)
-        // http://us.acer.com/ac/en/US/content/group/tablets
-        // http://www.acer.de/ac/de/DE/content/models/tablets/
-        // Can conflict with Micromax and Motorola phones codes.
-        'AcerTablet'        => 'Android.*; \b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\b|W3-810|\bA3-A10\b|\bA3-A11\b',
-        // http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/
-        // http://us.toshiba.com/tablets/tablet-finder
-        // http://www.toshiba.co.jp/regza/tablet/
-        'ToshibaTablet'     => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO',
-        // http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html
-        // http://www.lg.com/us/tablets
-        'LGTablet'          => '\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\b',
-        'FujitsuTablet'     => 'Android.*\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\b',
-        // Prestigio Tablets http://www.prestigio.com/support
-        'PrestigioTablet'   => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD',
-        // http://support.lenovo.com/en_GB/downloads/default.page?#
-        'LenovoTablet'      => 'Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)',
-        // http://www.dell.com/support/home/us/en/04/Products/tab_mob/tablets
-        'DellTablet'        => 'Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7',
-        // http://www.yarvik.com/en/matrix/tablets/
-        'YarvikTablet'      => 'Android.*\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\b',
-        'MedionTablet'      => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB',
-        'ArnovaTablet'      => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2',
-        // http://www.intenso.de/kategorie_en.php?kategorie=33
-        // @todo: http://www.nbhkdz.com/read/b8e64202f92a2df129126bff.html - investigate
-        'IntensoTablet'     => 'INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004',
-        // IRU.ru Tablets http://www.iru.ru/catalog/soho/planetable/
-        'IRUTablet'         => 'M702pro',
-        'MegafonTablet'     => 'MegaFon V9|\bZTE V9\b|Android.*\bMT7A\b',
-        // http://www.e-boda.ro/tablete-pc.html
-        'EbodaTablet'       => 'E-Boda (Supreme|Impresspeed|Izzycomm|Essential)',
-        // http://www.allview.ro/produse/droseries/lista-tablete-pc/
-        'AllViewTablet'           => 'Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)',
-        // http://wiki.archosfans.com/index.php?title=Main_Page
-        'ArchosTablet'      => '\b(101G9|80G9|A101IT)\b|Qilive 97R|Archos5|\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\b',
-        // http://www.ainol.com/plugin.php?identifier=ainol&module=product
-        'AinolTablet'       => 'NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark',
-        // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER
-        // Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser
-        // http://www.sony.jp/support/tablet/
-        'SonyTablet'        => 'Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP612',
-        // http://www.support.philips.com/support/catalog/worldproducts.jsp?userLanguage=en&userCountry=cn&categoryid=3G_LTE_TABLET_SU_CN_CARE&title=3G%20tablets%20/%20LTE%20range&_dyncharset=UTF-8
-        'PhilipsTablet'     => '\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\b',
-        // db + http://www.cube-tablet.com/buy-products.html
-        'CubeTablet'        => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT',
-        // http://www.cobyusa.com/?p=pcat&pcat_id=3001
-        'CobyTablet'        => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010',
-        // http://www.match.net.cn/products.asp
-        'MIDTablet'         => 'M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733',
-        // http://www.msi.com/support
-        // @todo Research the Windows Tablets.
-        'MSITablet' => 'MSI \b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\b',
-        // @todo http://www.kyoceramobile.com/support/drivers/
-    //    'KyoceraTablet' => null,
-        // @todo http://intexuae.com/index.php/category/mobile-devices/tablets-products/
-    //    'IntextTablet' => null,
-        // http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets)
-        // http://www.imp3.net/14/show.php?itemid=20454
-        'SMiTTablet'        => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)',
-        // http://www.rock-chips.com/index.php?do=prod&pid=2
-        'RockChipTablet'    => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A',
-        // http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/
-        'FlyTablet'         => 'IQ310|Fly Vision',
-        // http://www.bqreaders.com/gb/tablets-prices-sale.html
-        'bqTablet'          => '(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris E10)|Maxwell.*Lite|Maxwell.*Plus',
-        // http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290
-        // http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets)
-        'HuaweiTablet'      => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim',
-        // Nec or Medias Tab
-        'NecTablet'         => '\bN-06D|\bN-08D',
-        // Pantech Tablets: http://www.pantechusa.com/phones/
-        'PantechTablet'     => 'Pantech.*P4100',
-        // Broncho Tablets: http://www.broncho.cn/ (hard to find)
-        'BronchoTablet'     => 'Broncho.*(N701|N708|N802|a710)',
-        // http://versusuk.com/support.html
-        'VersusTablet'      => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b',
-        // http://www.zync.in/index.php/our-products/tablet-phablets
-        'ZyncTablet'        => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900',
-        // http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/
-        'PositivoTablet'    => 'TB07STA|TB10STA|TB07FTA|TB10FTA',
-        // https://www.nabitablet.com/
-        'NabiTablet'        => 'Android.*\bNabi',
-        'KoboTablet'        => 'Kobo Touch|\bK080\b|\bVox\b Build|\bArc\b Build',
-        // French Danew Tablets http://www.danew.com/produits-tablette.php
-        'DanewTablet'       => 'DSlide.*\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\b',
-        // Texet Tablets and Readers http://www.texet.ru/tablet/
-        'TexetTablet'       => 'NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE',
-        // Avoid detecting 'PLAYSTATION 3' as mobile.
-        'PlaystationTablet' => 'Playstation.*(Portable|Vita)',
-        // http://www.trekstor.de/surftabs.html
-        'TrekstorTablet'    => 'ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab',
-        // http://www.pyleaudio.com/Products.aspx?%2fproducts%2fPersonal-Electronics%2fTablets
-        'PyleAudioTablet'   => '\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\b',
-        // http://www.advandigital.com/index.php?link=content-product&jns=JP001
-        // because of the short codenames we have to include whitespaces to reduce the possible conflicts.
-        'AdvanTablet'       => 'Android.* \b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\b ',
-        // http://www.danytech.com/category/tablet-pc
-        'DanyTechTablet' => 'Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1',
-        // http://www.galapad.net/product.html
-        'GalapadTablet'     => 'Android.*\bG1\b',
-        // http://www.micromaxinfo.com/tablet/funbook
-        'MicromaxTablet'    => 'Funbook|Micromax.*\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\b',
-        // http://www.karbonnmobiles.com/products_tablet.php
-        'KarbonnTablet'     => 'Android.*\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\b',
-        // http://www.myallfine.com/Products.asp
-        'AllFineTablet'     => 'Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide',
-        // http://www.proscanvideo.com/products-search.asp?itemClass=TABLET&itemnmbr=
-        'PROSCANTablet'     => '\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\b',
-        // http://www.yonesnav.com/products/products.php
-        'YONESTablet' => 'BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026',
-        // http://www.cjshowroom.com/eproducts.aspx?classcode=004001001
-        // China manufacturer makes tablets for different small brands (eg. http://www.zeepad.net/index.html)
-        'ChangJiaTablet'    => 'TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503',
-        // http://www.gloryunion.cn/products.asp
-        // http://www.allwinnertech.com/en/apply/mobile.html
-        // http://www.ptcl.com.pk/pd_content.php?pd_id=284 (EVOTAB)
-        // @todo: Softwiner tablets?
-        // aka. Cute or Cool tablets. Not sure yet, must research to avoid collisions.
-        'GUTablet'          => 'TX-A1301|TX-M9002|Q702|kf026', // A12R|D75A|D77|D79|R83|A95|A106C|R15|A75|A76|D71|D72|R71|R73|R77|D82|R85|D92|A97|D92|R91|A10F|A77F|W71F|A78F|W78F|W81F|A97F|W91F|W97F|R16G|C72|C73E|K72|K73|R96G
-        // http://www.pointofview-online.com/showroom.php?shop_mode=product_listing&category_id=118
-        'PointOfViewTablet' => 'TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10',
-        // http://www.overmax.pl/pl/katalog-produktow,p8/tablety,c14/
-        // @todo: add more tests.
-        'OvermaxTablet'     => 'OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)',
-        // http://hclmetablet.com/India/index.php
-        'HCLTablet'         => 'HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync',
-        // http://www.edigital.hu/Tablet_es_e-book_olvaso/Tablet-c18385.html
-        'DPSTablet'         => 'DPS Dream 9|DPS Dual 7',
-        // http://www.visture.com/index.asp
-        'VistureTablet'     => 'V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10',
-        // http://www.mijncresta.nl/tablet
-        'CrestaTablet'     => 'CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989',
-        // MediaTek - http://www.mediatek.com/_en/01_products/02_proSys.php?cata_sn=1&cata1_sn=1&cata2_sn=309
-        'MediatekTablet' => '\bMT8125|MT8389|MT8135|MT8377\b',
-        // Concorde tab
-        'ConcordeTablet' => 'Concorde([ ]+)?Tab|ConCorde ReadMan',
-        // GoClever Tablets - http://www.goclever.com/uk/products,c1/tablet,c5/
-        'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042',
-        // Modecom Tablets - http://www.modecom.eu/tablets/portal/
-        'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003',
-        // Vonino Tablets - http://www.vonino.eu/tablets
-        'VoninoTablet'  => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b',
-        // ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0
-        'ECSTablet'     => 'V07OT2|TM105A|S10OT1|TR10CS1',
-        // Storex Tablets - http://storex.fr/espace_client/support.html
-        // @note: no need to add all the tablet codes since they are guided by the first regex.
-        'StorexTablet'  => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab',
-        // Generic Vodafone tablets.
-        'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7',
-        // French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb
-        // Aka: http://www.essentielb.fr/
-        'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2',
-        // Ross & Moor - http://ross-moor.ru/
-        'RossMoorTablet' => 'RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711',
-        // i-mobile http://product.i-mobilephone.com/Mobile_Device
-        'iMobileTablet'        => 'i-mobile i-note',
-        // http://www.tolino.de/de/vergleichen/
-        'TolinoTablet'  => 'tolino tab [0-9.]+|tolino shine',
-        // AudioSonic - a Kmart brand
-        // http://www.kmart.com.au/webapp/wcs/stores/servlet/Search?langId=-1&storeId=10701&catalogId=10001&categoryId=193001&pageSize=72&currentPage=1&searchCategory=193001%2b4294965664&sortBy=p_MaxPrice%7c1
-        'AudioSonicTablet' => '\bC-22Q|T7-QC|T-17B|T-17P\b',
-        // AMPE Tablets - http://www.ampe.com.my/product-category/tablets/
-        // @todo: add them gradually to avoid conflicts.
-        'AMPETablet' => 'Android.* A78 ',
-        // Skk Mobile - http://skkmobile.com.ph/product_tablets.php
-        'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)',
-        // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1
-        'TecnoTablet' => 'TECNO P9',
-        // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3
-        'JXDTablet' => 'Android.*\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b',
-        // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/
-        'iJoyTablet' => 'Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)',
-        // http://www.intracon.eu/tablet
-        'FX2Tablet' => 'FX2 PAD7|FX2 PAD10',
-        // http://www.xoro.de/produkte/
-        // @note: Might be the same brand with 'Simply tablets'
-        'XoroTablet'        => 'KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151',
-        // http://www1.viewsonic.com/products/computing/tablets/
-        'ViewsonicTablet'   => 'ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a',
-        // http://www.odys.de/web/internet-tablet_en.html
-        'OdysTablet'        => 'LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\bXELIO\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10',
-        // http://www.captiva-power.de/products.html#tablets-en
-        'CaptivaTablet'     => 'CAPTIVA PAD',
-        // IconBIT - http://www.iconbit.com/products/tablets/
-        'IconbitTablet' => 'NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S',
-        // http://www.teclast.com/topic.php?channelID=70&topicID=140&pid=63
-        'TeclastTablet' => 'T98 4G|\bP80\b|\bX90HD\b|X98 Air|X98 Air 3G|\bX89\b|P80 3G|\bX80h\b|P98 Air|\bX89HD\b|P98 3G|\bP90HD\b|P89 3G|X98 3G|\bP70h\b|P79HD 3G|G18d 3G|\bP79HD\b|\bP89s\b|\bA88\b|\bP10HD\b|\bP19HD\b|G18 3G|\bP78HD\b|\bA78\b|\bP75\b|G17s 3G|G17h 3G|\bP85t\b|\bP90\b|\bP11\b|\bP98t\b|\bP98HD\b|\bG18d\b|\bP85s\b|\bP11HD\b|\bP88s\b|\bA80HD\b|\bA80se\b|\bA10h\b|\bP89\b|\bP78s\b|\bG18\b|\bP85\b|\bA70h\b|\bA70\b|\bG17\b|\bP18\b|\bA80s\b|\bA11s\b|\bP88HD\b|\bA80h\b|\bP76s\b|\bP76h\b|\bP98\b|\bA10HD\b|\bP78\b|\bP88\b|\bA11\b|\bA10t\b|\bP76a\b|\bP76t\b|\bP76e\b|\bP85HD\b|\bP85a\b|\bP86\b|\bP75HD\b|\bP76v\b|\bA12\b|\bP75a\b|\bA15\b|\bP76Ti\b|\bP81HD\b|\bA10\b|\bT760VE\b|\bT720HD\b|\bP76\b|\bP73\b|\bP71\b|\bP72\b|\bT720SE\b|\bC520Ti\b|\bT760\b|\bT720VE\b|T720-3GE|T720-WiFi',
-        // Onda - http://www.onda-tablet.com/buy-android-onda.html?dir=desc&limit=all&order=price
-        'OndaTablet' => '\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\b[\s]+',
-        'JaytechTablet'     => 'TPC-PA762',
-        'BlaupunktTablet'   => 'Endeavour 800NG|Endeavour 1010',
-        // http://www.digma.ru/support/download/
-        // @todo: Ebooks also (if requested)
-        'DigmaTablet' => '\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\b',
-        // http://www.evolioshop.com/ro/tablete-pc.html
-        // http://www.evolio.ro/support/downloads_static.html?cat=2
-        // @todo: Research some more
-        'EvolioTablet' => 'ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\bEvotab\b|\bNeura\b',
-        // @todo http://www.lavamobiles.com/tablets-data-cards
-        'LavaTablet' => 'QPAD E704|\bIvoryS\b|E-TAB IVORY|\bE-TAB\b',
-        // https://www.celkonmobiles.com/?_a=categoryphones&sid=2
-        'CelkonTablet' => 'CT695|CT888|CT[\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\bCT-1\b',
-        // http://www.wolderelectronics.com/productos/manuales-y-guias-rapidas/categoria-2-miTab
-        'WolderTablet' => 'miTab \b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\b',
-        // http://www.mi.com/en
-        'MiTablet' => '\bMI PAD\b|\bHM NOTE 1W\b',
-        // http://www.nbru.cn/index.html
-        'NibiruTablet' => 'Nibiru M1|Nibiru Jupiter One',
-        // http://navroad.com/products/produkty/tablety/
-        'NexoTablet' => 'NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI',
-        // http://www.datawind.com/ubislate/
-        'UbislateTablet' => 'UbiSlate[\s]?7C',
-        // http://www.pocketbook-int.com/ru/support
-        'PocketBookTablet' => 'Pocketbook',
-        // http://www.tesco.com/direct/hudl/
-        'Hudl'              => 'Hudl HT7S3',
-        // http://www.telstra.com.au/home-phone/thub-2/
-        'TelstraTablet'     => 'T-Hub2',
-        'GenericTablet'     => 'Android.*\b97D\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\bM6pro\b|CT1020W|arc 10HD|\bJolla\b'
-    );
-
-    /**
-     * List of mobile Operating Systems.
-     *
-     * @var array
-     */
-    protected static $operatingSystems = array(
-        'AndroidOS'         => 'Android',
-        'BlackBerryOS'      => 'blackberry|\bBB10\b|rim tablet os',
-        'PalmOS'            => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino',
-        'SymbianOS'         => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b',
-        // @reference: http://en.wikipedia.org/wiki/Windows_Mobile
-        'WindowsMobileOS'   => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;',
-        // @reference: http://en.wikipedia.org/wiki/Windows_Phone
-        // http://wifeng.cn/?r=blog&a=view&id=106
-        // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx
-        // http://msdn.microsoft.com/library/ms537503.aspx
-        'WindowsPhoneOS'   => 'Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;',
-        'iOS'               => '\biPhone.*Mobile|\biPod|\biPad',
-        // http://en.wikipedia.org/wiki/MeeGo
-        // @todo: research MeeGo in UAs
-        'MeeGoOS'           => 'MeeGo',
-        // http://en.wikipedia.org/wiki/Maemo
-        // @todo: research Maemo in UAs
-        'MaemoOS'           => 'Maemo',
-        'JavaOS'            => 'J2ME/|\bMIDP\b|\bCLDC\b', // '|Java/' produces bug #135
-        'webOS'             => 'webOS|hpwOS',
-        'badaOS'            => '\bBada\b',
-        'BREWOS'            => 'BREW',
-    );
-
-    /**
-     * List of mobile User Agents.
-     *
-     * @var array
-     */
-    protected static $browsers = array(
-        // @reference: https://developers.google.com/chrome/mobile/docs/user-agent
-        'Chrome'          => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?',
-        'Dolfin'          => '\bDolfin\b',
-        'Opera'           => 'Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+',
-        'Skyfire'         => 'Skyfire',
-        'IE'              => 'IEMobile|MSIEMobile', // |Trident/[.0-9]+
-        'Firefox'         => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile',
-        'Bolt'            => 'bolt',
-        'TeaShark'        => 'teashark',
-        'Blazer'          => 'Blazer',
-        // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3
-        'Safari'          => 'Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari',
-        // http://en.wikipedia.org/wiki/Midori_(web_browser)
-        //'Midori'          => 'midori',
-        'Tizen'           => 'Tizen',
-        'UCBrowser'       => 'UC.*Browser|UCWEB',
-        'baiduboxapp'     => 'baiduboxapp',
-        'baidubrowser'    => 'baidubrowser',
-        // https://github.com/serbanghita/Mobile-Detect/issues/7
-        'DiigoBrowser'    => 'DiigoBrowser',
-        // http://www.puffinbrowser.com/index.php
-        'Puffin'            => 'Puffin',
-        // http://mercury-browser.com/index.html
-        'Mercury'          => '\bMercury\b',
-        // http://en.wikipedia.org/wiki/Obigo_Browser
-        'ObigoBrowser' => 'Obigo',
-        // http://en.wikipedia.org/wiki/NetFront
-        'NetFront' => 'NF-Browser',
-        // @reference: http://en.wikipedia.org/wiki/Minimo
-        // http://en.wikipedia.org/wiki/Vision_Mobile_Browser
-        'GenericBrowser'  => 'NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger',
-    );
-
-    /**
-     * Utilities.
-     *
-     * @var array
-     */
-    protected static $utilities = array(
-        // Experimental. When a mobile device wants to switch to 'Desktop Mode'.
-        // http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/
-        // https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011
-        // https://developers.facebook.com/docs/sharing/best-practices
-        'Bot'         => 'Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor',
-        'MobileBot'   => 'Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/M1A1-R2D2',
-        'DesktopMode' => 'WPDesktop',
-        'TV'          => 'SonyDTV|HbbTV', // experimental
-        'WebKit'      => '(webkit)[ /]([\w.]+)',
-        // @todo: Include JXD consoles.
-        'Console'     => '\b(Nintendo|Nintendo WiiU|Nintendo 3DS|PLAYSTATION|Xbox)\b',
-        'Watch'       => 'SM-V700',
-    );
-
-    /**
-     * All possible HTTP headers that represent the
-     * User-Agent string.
-     *
-     * @var array
-     */
-    protected static $uaHttpHeaders = array(
-        // The default User-Agent string.
-        'HTTP_USER_AGENT',
-        // Header can occur on devices using Opera Mini.
-        'HTTP_X_OPERAMINI_PHONE_UA',
-        // Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
-        'HTTP_X_DEVICE_USER_AGENT',
-        'HTTP_X_ORIGINAL_USER_AGENT',
-        'HTTP_X_SKYFIRE_PHONE',
-        'HTTP_X_BOLT_PHONE_UA',
-        'HTTP_DEVICE_STOCK_UA',
-        'HTTP_X_UCBROWSER_DEVICE_UA'
-    );
-
-    /**
-     * The individual segments that could exist in a User-Agent string. VER refers to the regular
-     * expression defined in the constant self::VER.
-     *
-     * @var array
-     */
-    protected static $properties = array(
-
-        // Build
-        'Mobile'        => 'Mobile/[VER]',
-        'Build'         => 'Build/[VER]',
-        'Version'       => 'Version/[VER]',
-        'VendorID'      => 'VendorID/[VER]',
-
-        // Devices
-        'iPad'          => 'iPad.*CPU[a-z ]+[VER]',
-        'iPhone'        => 'iPhone.*CPU[a-z ]+[VER]',
-        'iPod'          => 'iPod.*CPU[a-z ]+[VER]',
-        //'BlackBerry'    => array('BlackBerry[VER]', 'BlackBerry [VER];'),
-        'Kindle'        => 'Kindle/[VER]',
-
-        // Browser
-        'Chrome'        => array('Chrome/[VER]', 'CriOS/[VER]', 'CrMo/[VER]'),
-        'Coast'         => array('Coast/[VER]'),
-        'Dolfin'        => 'Dolfin/[VER]',
-        // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference
-        'Firefox'       => 'Firefox/[VER]',
-        'Fennec'        => 'Fennec/[VER]',
-        // http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
-        // https://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx
-        'IE'      => array('IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];', 'Trident/[0-9.]+;.*rv:[VER]'),
-        // http://en.wikipedia.org/wiki/NetFront
-        'NetFront'      => 'NetFront/[VER]',
-        'NokiaBrowser'  => 'NokiaBrowser/[VER]',
-        'Opera'         => array( ' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]' ),
-        'Opera Mini'    => 'Opera Mini/[VER]',
-        'Opera Mobi'    => 'Version/[VER]',
-        'UC Browser'    => 'UC Browser[VER]',
-        'MQQBrowser'    => 'MQQBrowser/[VER]',
-        'MicroMessenger' => 'MicroMessenger/[VER]',
-        'baiduboxapp'   => 'baiduboxapp/[VER]',
-        'baidubrowser'  => 'baidubrowser/[VER]',
-        'Iron'          => 'Iron/[VER]',
-        // @note: Safari 7534.48.3 is actually Version 5.1.
-        // @note: On BlackBerry the Version is overwriten by the OS.
-        'Safari'        => array( 'Version/[VER]', 'Safari/[VER]' ),
-        'Skyfire'       => 'Skyfire/[VER]',
-        'Tizen'         => 'Tizen/[VER]',
-        'Webkit'        => 'webkit[ /][VER]',
-
-        // Engine
-        'Gecko'         => 'Gecko/[VER]',
-        'Trident'       => 'Trident/[VER]',
-        'Presto'        => 'Presto/[VER]',
-
-        // OS
-        'iOS'              => ' \bi?OS\b [VER][ ;]{1}',
-        'Android'          => 'Android [VER]',
-        'BlackBerry'       => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'),
-        'BREW'             => 'BREW [VER]',
-        'Java'             => 'Java/[VER]',
-        // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx
-        // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases
-        'Windows Phone OS' => array( 'Windows Phone OS [VER]', 'Windows Phone [VER]'),
-        'Windows Phone'    => 'Windows Phone [VER]',
-        'Windows CE'       => 'Windows CE/[VER]',
-        // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd
-        'Windows NT'       => 'Windows NT [VER]',
-        'Symbian'          => array('SymbianOS/[VER]', 'Symbian/[VER]'),
-        'webOS'            => array('webOS/[VER]', 'hpwOS/[VER];'),
-    );
-
-    /**
-     * Construct an instance of this class.
-     *
-     * @param array  $headers   Specify the headers as injection. Should be PHP _SERVER flavored.
-     *                          If left empty, will use the global _SERVER['HTTP_*'] vars instead.
-     * @param string $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT
-     *                          from the $headers array instead.
-     */
-    public function __construct(
-        array $headers = null,
-        $userAgent = null
-    ) {
-        $this->setHttpHeaders($headers);
-        $this->setUserAgent($userAgent);
-    }
-
-    /**
-     * Get the current script version.
-     * This is useful for the demo.php file,
-     * so people can check on what version they are testing
-     * for mobile devices.
-     *
-     * @return string The version number in semantic version format.
-     */
-    public static function getScriptVersion()
-    {
-        return self::VERSION;
-    }
-
-    /**
-     * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers.
-     *
-     * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract
-     *                           the headers. The default null is left for backwards compatibilty.
-     */
-    public function setHttpHeaders($httpHeaders = null)
-    {
-        // use global _SERVER if $httpHeaders aren't defined
-        if (!is_array($httpHeaders) || !count($httpHeaders)) {
-            $httpHeaders = $_SERVER;
-        }
-
-        // clear existing headers
-        $this->httpHeaders = array();
-
-        // Only save HTTP headers. In PHP land, that means only _SERVER vars that
-        // start with HTTP_.
-        foreach ($httpHeaders as $key => $value) {
-            if (substr($key, 0, 5) === 'HTTP_') {
-                $this->httpHeaders[$key] = $value;
-            }
-        }
-
-        // In case we're dealing with CloudFront, we need to know.
-        $this->setCfHeaders($httpHeaders);
-    }
-
-    /**
-     * Retrieves the HTTP headers.
-     *
-     * @return array
-     */
-    public function getHttpHeaders()
-    {
-        return $this->httpHeaders;
-    }
-
-    /**
-     * Retrieves a particular header. If it doesn't exist, no exception/error is caused.
-     * Simply null is returned.
-     *
-     * @param string $header The name of the header to retrieve. Can be HTTP compliant such as
-     *                       "User-Agent" or "X-Device-User-Agent" or can be php-esque with the
-     *                       all-caps, HTTP_ prefixed, underscore seperated awesomeness.
-     *
-     * @return string|null The value of the header.
-     */
-    public function getHttpHeader($header)
-    {
-        // are we using PHP-flavored headers?
-        if (strpos($header, '_') === false) {
-            $header = str_replace('-', '_', $header);
-            $header = strtoupper($header);
-        }
-
-        // test the alternate, too
-        $altHeader = 'HTTP_' . $header;
-
-        //Test both the regular and the HTTP_ prefix
-        if (isset($this->httpHeaders[$header])) {
-            return $this->httpHeaders[$header];
-        } elseif (isset($this->httpHeaders[$altHeader])) {
-            return $this->httpHeaders[$altHeader];
-        }
-
-        return null;
-    }
-
-    public function getMobileHeaders()
-    {
-        return self::$mobileHeaders;
-    }
-
-    /**
-     * Get all possible HTTP headers that
-     * can contain the User-Agent string.
-     *
-     * @return array List of HTTP headers.
-     */
-    public function getUaHttpHeaders()
-    {
-        return self::$uaHttpHeaders;
-    }
-
-    
-    /**
-     * Set CloudFront headers
-     * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-device
-     * 
-     * @param array $cfHeaders List of HTTP headers
-     *
-     * @return  boolean If there were CloudFront headers to be set
-     */
-    public function setCfHeaders($cfHeaders = null) {
-        // use global _SERVER if $cfHeaders aren't defined
-        if (!is_array($cfHeaders) || !count($cfHeaders)) {
-            $cfHeaders = $_SERVER;
-        }
-
-        // clear existing headers
-        $this->cloudfrontHeaders = array();
-
-        // Only save CLOUDFRONT headers. In PHP land, that means only _SERVER vars that
-        // start with cloudfront-.
-        $response = false;
-        foreach ($cfHeaders as $key => $value) {
-            if (substr(strtolower($key), 0, 16) === 'http_cloudfront_') {
-                $this->cloudfrontHeaders[strtoupper($key)] = $value;
-                $response = true;
-            }
-        }
-
-        return $response;
-    }
-
-    /**
-     * Retrieves the cloudfront headers.
-     *
-     * @return array
-     */
-    public function getCfHeaders()
-    {
-        return $this->cloudfrontHeaders;
-    }
-
-    /**
-     * Set the User-Agent to be used.
-     *
-     * @param string $userAgent The user agent string to set.
-     *
-     * @return string|null
-     */
-    public function setUserAgent($userAgent = null)
-    {
-        // Invalidate cache due to #375
-        $this->cache = array();
-
-        if (false === empty($userAgent)) {
-            return $this->userAgent = $userAgent;
-        } else {
-            $this->userAgent = null;
-            foreach ($this->getUaHttpHeaders() as $altHeader) {
-                if (false === empty($this->httpHeaders[$altHeader])) { // @todo: should use getHttpHeader(), but it would be slow. (Serban)
-                    $this->userAgent .= $this->httpHeaders[$altHeader] . " ";
-                }
-            }
-
-            if (!empty($this->userAgent)) {
-                return $this->userAgent = trim($this->userAgent);
-            }
-        }
-
-        if (count($this->getCfHeaders()) > 0) {
-            return $this->userAgent = 'Amazon CloudFront';
-        }
-        return $this->userAgent = null;
-    }
-
-    /**
-     * Retrieve the User-Agent.
-     *
-     * @return string|null The user agent if it's set.
-     */
-    public function getUserAgent()
-    {
-        return $this->userAgent;
-    }
-
-    /**
-     * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or
-     * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set.
-     *
-     * @deprecated since version 2.6.9
-     *
-     * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default
-     *                     parameter is null which will default to self::DETECTION_TYPE_MOBILE.
-     */
-    public function setDetectionType($type = null)
-    {
-        if ($type === null) {
-            $type = self::DETECTION_TYPE_MOBILE;
-        }
-
-        if ($type !== self::DETECTION_TYPE_MOBILE && $type !== self::DETECTION_TYPE_EXTENDED) {
-            return;
-        }
-
-        $this->detectionType = $type;
-    }
-
-    public function getMatchingRegex()
-    {
-        return $this->matchingRegex;
-    }
-
-    public function getMatchesArray()
-    {
-        return $this->matchesArray;
-    }
-
-    /**
-     * Retrieve the list of known phone devices.
-     *
-     * @return array List of phone devices.
-     */
-    public static function getPhoneDevices()
-    {
-        return self::$phoneDevices;
-    }
-
-    /**
-     * Retrieve the list of known tablet devices.
-     *
-     * @return array List of tablet devices.
-     */
-    public static function getTabletDevices()
-    {
-        return self::$tabletDevices;
-    }
-
-    /**
-     * Alias for getBrowsers() method.
-     *
-     * @return array List of user agents.
-     */
-    public static function getUserAgents()
-    {
-        return self::getBrowsers();
-    }
-
-    /**
-     * Retrieve the list of known browsers. Specifically, the user agents.
-     *
-     * @return array List of browsers / user agents.
-     */
-    public static function getBrowsers()
-    {
-        return self::$browsers;
-    }
-
-    /**
-     * Retrieve the list of known utilities.
-     *
-     * @return array List of utilities.
-     */
-    public static function getUtilities()
-    {
-        return self::$utilities;
-    }
-
-    /**
-     * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*().
-     *
-     * @deprecated since version 2.6.9
-     *
-     * @return array All the rules (but not extended).
-     */
-    public static function getMobileDetectionRules()
-    {
-        static $rules;
-
-        if (!$rules) {
-            $rules = array_merge(
-                self::$phoneDevices,
-                self::$tabletDevices,
-                self::$operatingSystems,
-                self::$browsers
-            );
-        }
-
-        return $rules;
-
-    }
-
-    /**
-     * Method gets the mobile detection rules + utilities.
-     * The reason this is separate is because utilities rules
-     * don't necessary imply mobile. This method is used inside
-     * the new $detect->is('stuff') method.
-     *
-     * @deprecated since version 2.6.9
-     *
-     * @return array All the rules + extended.
-     */
-    public function getMobileDetectionRulesExtended()
-    {
-        static $rules;
-
-        if (!$rules) {
-            // Merge all rules together.
-            $rules = array_merge(
-                self::$phoneDevices,
-                self::$tabletDevices,
-                self::$operatingSystems,
-                self::$browsers,
-                self::$utilities
-            );
-        }
-
-        return $rules;
-    }
-
-    /**
-     * Retrieve the current set of rules.
-     *
-     * @deprecated since version 2.6.9
-     *
-     * @return array
-     */
-    public function getRules()
-    {
-        if ($this->detectionType == self::DETECTION_TYPE_EXTENDED) {
-            return self::getMobileDetectionRulesExtended();
-        } else {
-            return self::getMobileDetectionRules();
-        }
-    }
-
-    /**
-     * Retrieve the list of mobile operating systems.
-     *
-     * @return array The list of mobile operating systems.
-     */
-    public static function getOperatingSystems()
-    {
-        return self::$operatingSystems;
-    }
-
-    /**
-     * Check the HTTP headers for signs of mobile.
-     * This is the fastest mobile check possible; it's used
-     * inside isMobile() method.
-     *
-     * @return bool
-     */
-    public function checkHttpHeadersForMobile()
-    {
-
-        foreach ($this->getMobileHeaders() as $mobileHeader => $matchType) {
-            if (isset($this->httpHeaders[$mobileHeader])) {
-                if (is_array($matchType['matches'])) {
-                    foreach ($matchType['matches'] as $_match) {
-                        if (strpos($this->httpHeaders[$mobileHeader], $_match) !== false) {
-                            return true;
-                        }
-                    }
-
-                    return false;
-                } else {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-
-    }
-
-    /**
-     * Magic overloading method.
-     *
-     * @method boolean is[...]()
-     * @param  string                 $name
-     * @param  array                  $arguments
-     * @return mixed
-     * @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is'
-     */
-    public function __call($name, $arguments)
-    {
-        // make sure the name starts with 'is', otherwise
-        if (substr($name, 0, 2) !== 'is') {
-            throw new BadMethodCallException("No such method exists: $name");
-        }
-
-        $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
-
-        $key = substr($name, 2);
-
-        return $this->matchUAAgainstKey($key);
-    }
-
-    /**
-     * Find a detection rule that matches the current User-agent.
-     *
-     * @param  null    $userAgent deprecated
-     * @return boolean
-     */
-    protected function matchDetectionRulesAgainstUA($userAgent = null)
-    {
-        // Begin general search.
-        foreach ($this->getRules() as $_regex) {
-            if (empty($_regex)) {
-                continue;
-            }
-
-            if ($this->match($_regex, $userAgent)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Search for a certain key in the rules array.
-     * If the key is found the try to match the corresponding
-     * regex against the User-Agent.
-     *
-     * @param string $key
-     *
-     * @return boolean
-     */
-    protected function matchUAAgainstKey($key)
-    {
-        // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc.
-        $key = strtolower($key);
-        if (false === isset($this->cache[$key])) {
-
-            // change the keys to lower case
-            $_rules = array_change_key_case($this->getRules());
-
-            if (false === empty($_rules[$key])) {
-                $this->cache[$key] = $this->match($_rules[$key]);
-            }
-
-            if (false === isset($this->cache[$key])) {
-                $this->cache[$key] = false;
-            }
-        }
-
-        return $this->cache[$key];
-    }
-
-    /**
-     * Check if the device is mobile.
-     * Returns true if any type of mobile device detected, including special ones
-     * @param  null $userAgent   deprecated
-     * @param  null $httpHeaders deprecated
-     * @return bool
-     */
-    public function isMobile($userAgent = null, $httpHeaders = null)
-    {
-
-        if ($httpHeaders) {
-            $this->setHttpHeaders($httpHeaders);
-        }
-
-        if ($userAgent) {
-            $this->setUserAgent($userAgent);
-        }
-
-        // Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront'
-        if ($this->getUserAgent() === 'Amazon CloudFront') {
-            $cfHeaders = $this->getCfHeaders();
-            if(array_key_exists('HTTP_CLOUDFRONT_IS_MOBILE_VIEWER', $cfHeaders) && $cfHeaders['HTTP_CLOUDFRONT_IS_MOBILE_VIEWER'] === 'true') {
-                return true;
-            }
-        }
-
-        $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
-
-        if ($this->checkHttpHeadersForMobile()) {
-            return true;
-        } else {
-            return $this->matchDetectionRulesAgainstUA();
-        }
-
-    }
-
-    /**
-     * Check if the device is a tablet.
-     * Return true if any type of tablet device is detected.
-     *
-     * @param  string $userAgent   deprecated
-     * @param  array  $httpHeaders deprecated
-     * @return bool
-     */
-    public function isTablet($userAgent = null, $httpHeaders = null)
-    {
-        // Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront'
-        if ($this->getUserAgent() === 'Amazon CloudFront') {
-            $cfHeaders = $this->getCfHeaders();
-            if(array_key_exists('HTTP_CLOUDFRONT_IS_TABLET_VIEWER', $cfHeaders) && $cfHeaders['HTTP_CLOUDFRONT_IS_TABLET_VIEWER'] === 'true') {
-                return true;
-            }
-        }
-
-        $this->setDetectionType(self::DETECTION_TYPE_MOBILE);
-
-        foreach (self::$tabletDevices as $_regex) {
-            if ($this->match($_regex, $userAgent)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * This method checks for a certain property in the
-     * userAgent.
-     * @todo: The httpHeaders part is not yet used.
-     *
-     * @param  string        $key
-     * @param  string        $userAgent   deprecated
-     * @param  string        $httpHeaders deprecated
-     * @return bool|int|null
-     */
-    public function is($key, $userAgent = null, $httpHeaders = null)
-    {
-        // Set the UA and HTTP headers only if needed (eg. batch mode).
-        if ($httpHeaders) {
-            $this->setHttpHeaders($httpHeaders);
-        }
-
-        if ($userAgent) {
-            $this->setUserAgent($userAgent);
-        }
-
-        $this->setDetectionType(self::DETECTION_TYPE_EXTENDED);
-
-        return $this->matchUAAgainstKey($key);
-    }
-
-    /**
-     * Some detection rules are relative (not standard),
-     * because of the diversity of devices, vendors and
-     * their conventions in representing the User-Agent or
-     * the HTTP headers.
-     *
-     * This method will be used to check custom regexes against
-     * the User-Agent string.
-     *
-     * @param $regex
-     * @param  string $userAgent
-     * @return bool
-     *
-     * @todo: search in the HTTP headers too.
-     */
-    public function match($regex, $userAgent = null)
-    {
-        $match = (bool) preg_match(sprintf('#%s#is', $regex), (false === empty($userAgent) ? $userAgent : $this->userAgent), $matches);
-        // If positive match is found, store the results for debug.
-        if ($match) {
-            $this->matchingRegex = $regex;
-            $this->matchesArray = $matches;
-        }
-
-        return $match;
-    }
-
-    /**
-     * Get the properties array.
-     *
-     * @return array
-     */
-    public static function getProperties()
-    {
-        return self::$properties;
-    }
-
-    /**
-     * Prepare the version number.
-     *
-     * @todo Remove the error supression from str_replace() call.
-     *
-     * @param string $ver The string version, like "2.6.21.2152";
-     *
-     * @return float
-     */
-    public function prepareVersionNo($ver)
-    {
-        $ver = str_replace(array('_', ' ', '/'), '.', $ver);
-        $arrVer = explode('.', $ver, 2);
-
-        if (isset($arrVer[1])) {
-            $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions.
-        }
-
-        return (float) implode('.', $arrVer);
-    }
-
-    /**
-     * Check the version of the given property in the User-Agent.
-     * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31)
-     *
-     * @param string $propertyName The name of the property. See self::getProperties() array
-     *                             keys for all possible properties.
-     * @param string $type         Either self::VERSION_TYPE_STRING to get a string value or
-     *                             self::VERSION_TYPE_FLOAT indicating a float value. This parameter
-     *                             is optional and defaults to self::VERSION_TYPE_STRING. Passing an
-     *                             invalid parameter will default to the this type as well.
-     *
-     * @return string|float The version of the property we are trying to extract.
-     */
-    public function version($propertyName, $type = self::VERSION_TYPE_STRING)
-    {
-        if (empty($propertyName)) {
-            return false;
-        }
-
-        // set the $type to the default if we don't recognize the type
-        if ($type !== self::VERSION_TYPE_STRING && $type !== self::VERSION_TYPE_FLOAT) {
-            $type = self::VERSION_TYPE_STRING;
-        }
-
-        $properties = self::getProperties();
-
-        // Check if the property exists in the properties array.
-        if (true === isset($properties[$propertyName])) {
-
-            // Prepare the pattern to be matched.
-            // Make sure we always deal with an array (string is converted).
-            $properties[$propertyName] = (array) $properties[$propertyName];
-
-            foreach ($properties[$propertyName] as $propertyMatchString) {
-
-                $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString);
-
-                // Identify and extract the version.
-                preg_match(sprintf('#%s#is', $propertyPattern), $this->userAgent, $match);
-
-                if (false === empty($match[1])) {
-                    $version = ($type == self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1]);
-
-                    return $version;
-                }
-
-            }
-
-        }
-
-        return false;
-    }
-
-    /**
-     * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants.
-     *
-     * @return string One of the self::MOBILE_GRADE_* constants.
-     */
-    public function mobileGrade()
-    {
-        $isMobile = $this->isMobile();
-
-        if (
-            // Apple iOS 4-7.0 – Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3 / 5.1 / 6.1), iPad 3 (5.1 / 6.0), iPad Mini (6.1), iPad Retina (7.0), iPhone 3GS (4.3), iPhone 4 (4.3 / 5.1), iPhone 4S (5.1 / 6.0), iPhone 5 (6.0), and iPhone 5S (7.0)
-            $this->is('iOS') && $this->version('iPad', self::VERSION_TYPE_FLOAT) >= 4.3 ||
-            $this->is('iOS') && $this->version('iPhone', self::VERSION_TYPE_FLOAT) >= 4.3 ||
-            $this->is('iOS') && $this->version('iPod', self::VERSION_TYPE_FLOAT) >= 4.3 ||
-
-            // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5)
-            // Android 3.1 (Honeycomb)  - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM
-            // Android 4.0 (ICS)  - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices
-            // Android 4.1 (Jelly Bean)  - Tested on a Galaxy Nexus and Galaxy 7
-            ( $this->version('Android', self::VERSION_TYPE_FLOAT)>2.1 && $this->is('Webkit') ) ||
-
-            // Windows Phone 7.5-8 - Tested on the HTC Surround (7.5), HTC Trophy (7.5), LG-E900 (7.5), Nokia 800 (7.8), HTC Mazaa (7.8), Nokia Lumia 520 (8), Nokia Lumia 920 (8), HTC 8x (8)
-            $this->version('Windows Phone OS', self::VERSION_TYPE_FLOAT) >= 7.5 ||
-
-            // Tested on the Torch 9800 (6) and Style 9670 (6), BlackBerry® Torch 9810 (7), BlackBerry Z10 (10)
-            $this->is('BlackBerry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) >= 6.0 ||
-            // Blackberry Playbook (1.0-2.0) - Tested on PlayBook
-            $this->match('Playbook.*Tablet') ||
-
-            // Palm WebOS (1.4-3.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0), HP TouchPad (3.0)
-            ( $this->version('webOS', self::VERSION_TYPE_FLOAT) >= 1.4 && $this->match('Palm|Pre|Pixi') ) ||
-            // Palm WebOS 3.0  - Tested on HP TouchPad
-            $this->match('hp.*TouchPad') ||
-
-            // Firefox Mobile 18 - Tested on Android 2.3 and 4.1 devices
-            ( $this->is('Firefox') && $this->version('Firefox', self::VERSION_TYPE_FLOAT) >= 18 ) ||
-
-            // Chrome for Android - Tested on Android 4.0, 4.1 device
-            ( $this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 4.0 ) ||
-
-            // Skyfire 4.1 - Tested on Android 2.3 device
-            ( $this->is('Skyfire') && $this->version('Skyfire', self::VERSION_TYPE_FLOAT) >= 4.1 && $this->is('AndroidOS') && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 ) ||
-
-            // Opera Mobile 11.5-12: Tested on Android 2.3
-            ( $this->is('Opera') && $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT) >= 11.5 && $this->is('AndroidOS') ) ||
-
-            // Meego 1.2 - Tested on Nokia 950 and N9
-            $this->is('MeeGoOS') ||
-
-            // Tizen (pre-release) - Tested on early hardware
-            $this->is('Tizen') ||
-
-            // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser
-            // @todo: more tests here!
-            $this->is('Dolfin') && $this->version('Bada', self::VERSION_TYPE_FLOAT) >= 2.0 ||
-
-            // UC Browser - Tested on Android 2.3 device
-            ( ($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 ) ||
-
-            // Kindle 3 and Fire  - Tested on the built-in WebKit browser for each
-            ( $this->match('Kindle Fire') ||
-            $this->is('Kindle') && $this->version('Kindle', self::VERSION_TYPE_FLOAT) >= 3.0 ) ||
-
-            // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet
-            $this->is('AndroidOS') && $this->is('NookTablet') ||
-
-            // Chrome Desktop 16-24 - Tested on OS X 10.7 and Windows 7
-            $this->version('Chrome', self::VERSION_TYPE_FLOAT) >= 16 && !$isMobile ||
-
-            // Safari Desktop 5-6 - Tested on OS X 10.7 and Windows 7
-            $this->version('Safari', self::VERSION_TYPE_FLOAT) >= 5.0 && !$isMobile ||
-
-            // Firefox Desktop 10-18 - Tested on OS X 10.7 and Windows 7
-            $this->version('Firefox', self::VERSION_TYPE_FLOAT) >= 10.0 && !$isMobile ||
-
-            // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7
-            $this->version('IE', self::VERSION_TYPE_FLOAT) >= 7.0 && !$isMobile ||
-
-            // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7
-            $this->version('Opera', self::VERSION_TYPE_FLOAT) >= 10 && !$isMobile
-        ){
-            return self::MOBILE_GRADE_A;
-        }
-
-        if (
-            $this->is('iOS') && $this->version('iPad', self::VERSION_TYPE_FLOAT)<4.3 ||
-            $this->is('iOS') && $this->version('iPhone', self::VERSION_TYPE_FLOAT)<4.3 ||
-            $this->is('iOS') && $this->version('iPod', self::VERSION_TYPE_FLOAT)<4.3 ||
-
-            // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770
-            $this->is('Blackberry') && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) >= 5 && $this->version('BlackBerry', self::VERSION_TYPE_FLOAT)<6 ||
-
-            //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3
-            ($this->version('Opera Mini', self::VERSION_TYPE_FLOAT) >= 5.0 && $this->version('Opera Mini', self::VERSION_TYPE_FLOAT) <= 7.0 &&
-            ($this->version('Android', self::VERSION_TYPE_FLOAT) >= 2.3 || $this->is('iOS')) ) ||
-
-            // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1)
-            $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') ||
-
-            // @todo: report this (tested on Nokia N71)
-            $this->version('Opera Mobi', self::VERSION_TYPE_FLOAT) >= 11 && $this->is('SymbianOS')
-        ){
-            return self::MOBILE_GRADE_B;
-        }
-
-        if (
-            // Blackberry 4.x - Tested on the Curve 8330
-            $this->version('BlackBerry', self::VERSION_TYPE_FLOAT) <= 5.0 ||
-            // Windows Mobile - Tested on the HTC Leo (WinMo 5.2)
-            $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile', self::VERSION_TYPE_FLOAT) <= 5.2 ||
-
-            // Tested on original iPhone (3.1), iPhone 3 (3.2)
-            $this->is('iOS') && $this->version('iPad', self::VERSION_TYPE_FLOAT) <= 3.2 ||
-            $this->is('iOS') && $this->version('iPhone', self::VERSION_TYPE_FLOAT) <= 3.2 ||
-            $this->is('iOS') && $this->version('iPod', self::VERSION_TYPE_FLOAT) <= 3.2 ||
-
-            // Internet Explorer 7 and older - Tested on Windows XP
-            $this->version('IE', self::VERSION_TYPE_FLOAT) <= 7.0 && !$isMobile
-        ){
-            return self::MOBILE_GRADE_C;
-        }
-
-        // All older smartphone platforms and featurephones - Any device that doesn't support media queries
-        // will receive the basic, C grade experience.
-        return self::MOBILE_GRADE_C;
-    }
-}
diff --git a/libraries/nusoap/changelog b/libraries/nusoap/changelog
deleted file mode 100644
index fe8c5ca59..000000000
--- a/libraries/nusoap/changelog
+++ /dev/null
@@ -1,438 +0,0 @@
-2003-07-21, version 0.6.5
-- soap_transport_http: SOAPAction header is quoted again, fixes problem w/ Weblogic Server
-- applied Jason Levitt patch for proper array serialization, fixes problem w/ Amazon shopping cart services
-- fixed null value serialization
-- applied patch from "BZC ToOn'S" - fixes wsdl serialization when no parameters
-- applied John's patch, implementing compression for the server
-
-2003-07-22, version 0.6.5
-- soap_server: fixed bug causing charset encoding not to be passed to the parser
-- soap_fault: added default encoding to the fault serialization
-- soap_parser: changed the parser to pre-load the parent's result array when processing scalar values. This increases parsing speed.
-
-2003-07-23, version 0.6.5
-- soap_base: fix code that overwrites user-supplied attributes in serialize_val
-- soap_base: use arrays-of-arrays rather than attempting multi-dimensional in serialize_val
-- xmlschema: emit import statements and qualify all elements with prefix in serializeSchema (better interop with validation tools)
-- soapclient: get xml character encoding from HTTP Content-Type header if provided, e.g. text/xml;charset="UTF-8"
-- soapclient: use headers in call if provided (previously ignored this parameter)
-- soap_server: in parse_request, if neither getallheaders nor $_SERVER are available, use $HTTP_SERVER_VARS to get SOAPAction and xml encoding
-
-2003-07-24, version 0.6.5
-- soap_transport_http: apply patch from Steven Brown "if the server closes connection prematurely, nusoap would spin trying to read data that isn't there"
-
-2003-07-25, version 0.6.5
-- wsdl: apply patch from Sven to workaround single schema limitation
-- wsdl: apply a variant of the patch from Holger to handle empty values for array by serializing an array with 0 elements
-- xmlschema: remove the redundant default namespace attribute on the schema element; everything in xsd is explicitly specified as being from xsd
-- soap_transport_http: fix setCredentials and add TODO comments in sendHTTPS about what to change if this setCredentials stays
-
-2003-07-30, version 0.6.5
-- nusoap_base: change documentation of soap_defencoding to specify it is the encoding for outgoing messages
-- nusoap_base: only change &, <, > to entities, not all HTML entities
-- soap_transport_http: update the Content-Type header in sendRequest, since soap_defencoding could be changed after ctor is called
-- soap_server: use soap_defencoding instead of charset_encoding
-- soap_server: read encoding from _SERVER if available
-- nusoap_base: do entity translation for string parameters with an xsd type specified (thanks David Derr)
-
-2003-07-31, version 0.6.5
-- soap_transport_http: add proxy authentication
-- soap_transport_http: build payload the same way for http and https
-- wsdl: add proxy authentication
-- soapclient: add proxy authentication
-- soapclient: allow proxy information in ctor, so that it can be used for wsdl
-
-2003-08-01, version 0.6.5
-- soap_transport_http: close a persistent connection that's at EOF
-- soap_transport_http: prevent conflicts between setEncoding and usePersistentConnection
-- soap_transport_http: fix use of $headers instead of $this->incoming_headers in getResponse
-- soapclient: improve handling of persistent connections
-- soapclient: force xml_encoding to upper case
-- soap_server: let the Web server decide whether to close the connection (no Connection: close header)
-- soap_server: force xml_encoding to upper case
-
-2003-08-04, version 0.6.5
-- soap_parser: use XML type information to pick a PHP data type; also decode base64
-- soap_server: read all HTTP headers when using _SERVER or HTTP_SERVER_VARS
-- soap_server: add gzip encoding support for outgoing messages
-- soap_transport_http: deflate is gzcompress/gzuncompress (cf. http://archive.develooper.com/libwww@perl.org/msg04650.html)
-- soap_transport_http: clean use of persistentConnection so it's always a set boolean
-- soapclient: add responseData member to access deflated/gunzipped payload
-
-2003-08-05, version 0.6.5
-- soap_server: look multiple places when setting debug_flag
-
-2003-08-07, version 0.6.5
-- nusoap_base: serialize specified type (e.g. ArrayOfString) even for simple array
-- wsdl: only specify encodingStyle in the input/output soap bindings when it is not empty (thanks Guillaume)
-
-2003-08-15, version 0.6.5
-- soap_parser: fix parsing of elements with no XSD type specified
-- soap_parser: use PHP string type for XSD long and unsignedLong types
-
-2003-08-16, version 0.6.5
-- soap_parser: fix code generating warning (thanks Torsten)
-
-2003-08-19, version 0.6.5
-- soap_parser: fix another line of code generating a warning (thanks Torsten)
-
-2003-08-22, version 0.6.5
-- soap_server: remove all '--' from debug_str; previous code changed '---' to '- --'
-- wsdl, soapclient, soap_parser: patch submitted by Mark Spavin as described by
-                                 the following...
-> Changes for the multiple/nested imports from the wsdl file. This builds an
-> array of files not just the last one and also checks for relative paths to
-> the parent. This will then get the imported files from the remote site
-> instead of your local disk. Local wsdl files should still work (untested).
->
-> Changes for multiple encoding sytles as previously posted
-
-2003-08-24, version 0.6.5
-- wsdl, soapclient: fix some PHP notices from previous update
-
-2003-08-26, version 0.6.5
-- wsdl: support multiple SOAP ports
-- soapclient, soap_server: when no charset is specified, use UTF-8, even though HTTP specifies US-ASCII.
-- soap_transport_http: do not prepend $host with 'ssl://' for https (is this required for older cURL versions?)
-
-2003-08-27, version 0.6.5
-- soap_server: support compressed request messages (thanks John Huong)
-- soap_parser: deserialize Apache Vector as an array
-- xmlschema: use $this->typemap in getPHPType (which is not used)
-- soapclient, wsdl: check for WSDL errors after serializing parameters
-- nusoap_base: add serialization of Apache Map (when not using WSDL)
-- wsdl: add serialization of Apache Map (when using WSDL)
-- wsdl: only change &, <, > to entities, not all HTML entities
-
-2003-08-28, version 0.6.5
-- soap_transport_http: disable cURL verification of peer and server (formerly the cURL default)
-- soap_transport_http: mingle cURL code with straight http, so sendHTTP is no longer needed
-
-2003-08-29, version 0.6.6
-- soap_transport_http: add setContentType
-- soapclient: call setContentType using new getHTTPContentType and getHTTPContentTypeCharset
-
-2003-09-05, version 0.6.6
-- wsdl: add some more code to handle null/nil values (but there's still a way to go)
-
-2003-10-21, version 0.6.6
-- soap_transport_http: only include port in Host header if it was specified in the URL
-- soap_transport_http: add some code to use OpenSSL for PHP ssl:// scheme, but comment out since it's not ready
-- soap_server: use $_SERVER['PHP_SELF'] if $GLOBALS['PHP_SELF'] is not set
-- wsdl: add WSDL request and response and transport debug to debug
-- wsdl: handle custom type extending xmlschema namespace (GLUE ... Thanks Matt)
-- soap_parser: add param to docs
-- soapclient: add getHTTPBody, getHTTPContentType, getHTTPContentTypeCharset (anticipating MIME subclass)
-
-2003-10-28, version 0.6.6
-- nusoap_base: add expandEntities method
-- wsdl: use expandEntities
-- soap_fault: use expandEntities
-- soap_transport_http: Allow credentials to be included in URL, rather than requiring setCredentials
-- soap_transport_http: Merge HTTP headers that span multiple lines
-- soap_parser: Properly set errors in ctor
-- soapclient: Pass headers to parseResponse and parse them in that method
-
-2003-10-30, version 0.6.6
-- xmlschema: Add some information for the related type to an element
-
-2003-12-09, version 0.6.6
-- nusoap_base: Add some namespace methods previously in xmlschema
-- xmlschema: Improve parsing of complexType, element and simpleType
-- xmlschema: Improve serialization
-- xmlschema: Track imports
-- xmlschema: Track elementFormDefault and form attributes
-- wsdl: Support multiple <schema> (note that setting $server->wsdl->schemaTargetNamespace no longer does anything!  Use configureWSDL instead.)
-- wsdl: Use form attribute of element to control namespace specification
-- wsdl: Support chained imports (A imports B which imports C)
-- wsdl: Include port in endpoint address when serializing
-- soap_server: Fix use of style (rpc|document) and use (encoded|literal)
-- soap_server: Support _SERVER[CONTENT_TYPE] in addition to _SERVER[HTTP_CONTENT_TYPE]
-- soap_server: Support wsdl with multiple <schema>
-- soap_client: Remove a var_dump
-- soap_client: Add style and use parameters to call method to support doc/lit without WSDL
-- soap_transport_http: Check that $this->fp exists when doing persistent connections
-
-2003-12-17, version 0.6.6
-- soap_server: pass namespaces to xmlschema constructor
-- wsdl: post-process after all imports
-- wsdl: remove some debug, add some error handling
-- xmlschema: allow enclosing namespaces to be specified in constructor
-- xmlschema: improve handling of compositors and simple types
-
-2004-01-08, version 0.6.6
-- soap_server: when requested WSDL is in a file, return to client using passthru (thanks Ingo Fischer)
-- soapclient: have proxy inherit more client state
-- soapclient: allow timeout and response timeout to be specified in the constructor
-- wsdl: allow timeout and response timeout to be specified in the constructor
-- soap_transport_http: allow response timeout to be specified in send and sendHTTPS
-
-2004-01-28, version 0.6.6
-- wsdl: add namespace for array and scalar when form is qualified
-- wsdl: fix a bug in which data type of complexType elements were ignored in serialization
-- wsdl: enhance handling of URLs with file scheme
-- wsdl: add addSimpleType
-- xmlschema: add addSimpleType
-- xmlschema: always set phpType elements
-- soapclient: allow a wsdl instance to be specified in constructor
-- soap_server: allow a wsdl instance to be specified in constructor (not tested!)
-- soap_server: fix default SOAPAction created in register method
-- soap_transport_http: accept chunking with LF separators in addition to CRLF.
-- wsdlcache: added class
-- nusoapmime: fix comments
-
-2004-02-23, version 0.6.6
-- soap_transport_http: don't try to unchunk cURL data, since cURL already does it
-- soap_transport_http: append CVS revision to version in User-Agent
-- wsdl: serialize boolean as true|false, not 1|0, to agree with XML Schema
-- soap_server: always exit() after returning WSDL
-- soap_server: use the WSDL URL scheme as the default endpoint URL scheme
-- soap_server: append CVS revision to version in X-SOAP-Server
-- nusoap_base: add (CVS) revision
-- wsdlcache: synchronize using a per-WSDL lock file (Thanks Ingo)
-- wsdlcache: add cache lifetime, after which cache contents are invalidated (Thanks Ingo)
-
-2004-03-15, version 0.6.6
-- nusoap_base: add isArraySimpleOrStruct method
-- soap_server: improve WSDL URL scheme determination
-- soap_server: only deflate/gzip payloads > 1024 bytes
-- soap_server: fix parameter order in fault method (always used as faultcode, faultstring)
-- soap_server: refactor parse_request into multiple functions (for sanity)
-- soap_server: set the namespace on the Response element to the same as the request
-- soap_server: name the return value element 'return' by default
-- soap_server: added and documented data fields, so that service programmers can use them if desired
-- soap_parser: standardize parsing error message
-- soap_parser: fix document and responseHeaders so they are the correct XML text (as documented)
-- soap_transport_http: fix read from persistent connection
-- soapclient: clean up debugging for persistent connection
-- wsdl: enforce correct naming of messages parts when an associative array is used for parameters
-- wsdl: better serialization of null values
-- wsdl: standardize parsing error message
-- xmlschema: standardize parsing error message
-
-2004-03-24, version 0.6.7
-- soap_transport_http: add digest authentication (based on code by Kevin A. Miller)
-- xmlschema: improve parsing of import elements
-- wsdl: do schema imports even if there are no wsdl imports
-
-2004-04-12, version 0.6.7
-- wsdl: serialize multiple elements when maxOccurs="unbounded" and value is an array
-- wsdl: serialize soapval values (used to force an XML type, e.g. when WSDL uses an abstract type)
-- nusoapmime: do not require nusoap.php (it is now the programmer's responsibility)
-
-2004-04-21, version 0.6.7
-- soap_parser: parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element)
-- soap_server: do not wrap response in a response element for a document style service
-
-2004-04-30, version 0.6.7
-- soap_transport_http: allow digest auth params to be separated by "," as well as ", "
-- soap_transport_http: re-initialize incoming headers for each response
-- soap_server: add methodreturnisliteralxml property to allow service function to return XML as a string
-- soapclient: improve rpc/literal support
-- soapclient: allow XML string as call params in addition to array
-- soapclient: support document style and literal encoding when not using WSDL
-
-2004-05-05, version 0.6.7
-- wsdl: serialize PHP objects for WSDL XML Schema complexTypes, in addition to associative arrays
-- wsdl: fix WSDL generation when there is no encodingStyle
-- soap_transport_http: suppress fsockopen warnings
-- soap_transport_http: detect socket timeouts when reading (0 bytes returned)
-- soap_transport_http: read chunked content "in-line" so it works on a persistent connection
-- nusoap_base: serialize boolean as true|false, not 1|0, to agree with XML Schema
-- nusoap_base: serialize array of struct differently than array of array
-
-2004-06-25, version 0.6.8
-- soap_server: prefer gzip to deflate, since IE does not like our deflate
-- soap_server: move webDescription to the wsdl class
-- soap_server: allow class and instance method calls for service (thanks Ingo Fischer and Roland Knall)
-- wsdl: get webDescription from the soap_server class
-- wsdl: allow compression from the server
-- wsdl: fix serialization of soapval without a type
-- wsdl: propagate debug value from query string to SOAP endpoint in programmatic WSDL generation
-- nusoap_base: add anyType, anySimpleType for 2001 XML Schema
-- nusoap_base: provide additional debug functions
-- soap_transport_http: ignore Content-Length when chunked encoding is used
-- soap_transport_http: remove ':' from username for Basic authentication (cf. RFC 2617)
-- soap_transport_http: urldecode username and password taken from URL
-- soap_transport_http: use raw inflate/deflate for IE/IIS compatibility, rather than having Zlib headers according to HTTP 1.1 spec
-- soap_transport_http: attempt to handle the case when both the service application and Web server compress the response
-- soapclient: when creating proxy methods, replace '.' in operation name with '__' in function name
-- soapclient: initialize requestHeaders in proxy
-- general: use new debug methods; never access debug_str directly
-
-2004-09-30, version 0.6.8
-- soapclient: do not allow getProxy call when WSDL is not used
-- soapclient: use ISO-8859-1 as the charset if not specified in the Content-Type header
-- soapclient: when an empty string is specified for the call namespace, do not put the method element in a namespace
-- soapclient: let soap_transport_http check for SSL support
-- soapclient: have proxy inherit soap_defencoding from the client from which it is generated
-- soapclient: do not assume that 'ns1' is an unused namespace prefix; always generate namespace prefixes randomly
-- soap_parser: compare any encoding in the XML declaration to the charset from the HTTP Content-Type header (thanks Ingo Fischer)
-- soap_parser: improve parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element)
-- soap_server: use ISO-8859-1 as the charset if not specified in the Content-Type header
-- soap_server: allow suppression of automatic UTF-8 decoding
-- soap_server: fix a bug when call_user_func_array() is used
-- soap_transport_http: correct digest authentication through a proxy
-- wsdl: serialize SOAP-ENC types similarly to XSD types
-- xmlschema: force unprefixed type into default namespace
-- xmlschema: fix serialization of definition of simple types
-
-2004-10-01, version 0.6.8
-- soap_parser: handle default namespace attributes
-- soap_server: add default_utf8 field
-- soap_server: support literal encoding (with RPC style)
-- soap_transport_http: parse HTTP status and generate error for 300, 302-307, 400, 401-417, 501-505 (thanks for the idea Ghislain)
-- soap_transport_http: follow HTTP redirection (HTTP status 301 and Location header) (thanks for the idea Ghislain)
-- xmlschema: allow any attributes to be specified in an element of a complexType, e.g., abstract, default, form, minOccurs, maxOccurs, nillable (thanks Jirka Pech for the original patch)
-
-2004-10-02, version 0.6.8
-- soapclient: read/write cookies (thanks Ingo)
-- soap_server: change faultcode on non-resendable faults to Client
-- soap_transport_http: read/write cookies (thanks Ingo)
-
-2004-10-05, version 0.6.8
-- wsdl: add addElement method
-- wsdl: support the document style in the register method
-- xmlschema: parse unnamed simpleTypes, rather than ignoring them
-- xmlschema: include untyped elements when parsing a complexType
-- xmlschema: add addElement method
-
-2004-10-14, version 0.6.8
-- soapclient: support client certificates
-- soap_parser: deserialize attributes, prefixing names with "!"
-- soap_server: notify the client with HTML when WSDL is requested but not supported by service
-- soap_transport_http: support client certificates
-- wsdl: support defaults for elements of a complexType
-- wsdl: serialize elements from complexType extension base
-- wsdl: serialize data (associative array elements) as attributes according to XML Schema
-- xmlschema: record extension base if present for a complexType
-
-2004-12-15, version 0.6.8
-- nusoap_base: add 2000 XML Schema (rare, but used by Akamai)
-- soap_parser: avoid deserializing more common attributes that are not data
-- soap_parser: be lax when HTTP specifies ISO-8859-1 (the default) and XML specifies UTF-8 (the norm)
-- soap_server: account for the fact that get_class_methods returns methods in all lower case (thanks Steve Haldane)
-- soap_transport_http: parse digest info that includes '=' in the data (thanks Jinsuk Kim)
-- wsdl: feably handle some cases for literal serialization of form="unqualified" elements
-- wsdl: don't serialize the decimal portion of a PHP double when the XML type is long
-- wsdl: fix serialization of attributes for complexType that is an extension
-- wsdlcache: enhance diagnostics
-- xmlschema: handle untyped elements
-- xmlschema: handle WSDL for SOAP Array that uses the base attribute plus a sequence of element
-
-2005-01-22, version 0.6.8
-- wsdl: allow an element in one schema to have a type from another schema
-
-2005-01-24, version 0.6.8
-- xmlschema: correctly parse nested complexType definitions
-
-2005-02-14, version 0.6.8
-- nusoap_base: fix a bug in which attributes were sometimes not serialized with a value
-- nusoap_base: improve serialization of null values (thanks Dominique Stender)
-- soap_parser: parse null values by handling the nil attribute (thanks Dominique Stender)
-- soap_server: set character encoding for a fault to be the same as for the server (thanks Mark Scott)
-- soap_server: correctly check for null value returned from method when WSDL is used (without WSDL, cannot distinguish whether NULL or void return is desired)
-- soapclient: for document style, call should always return an array rooted at the response part (all bets are off when there are multiple parts)
-- xmlschema: save enumeration values parsed from WSDL
-
-2005-02-10, version 0.6.9
-- soapclient: only set SOAP headers when they are specified in call params (so setHeaders still works)
-
-2005-04-04, version 0.6.9
-- soap_server: use get_class instead of is_a (thanks Thomas Noel)
-- soapclient: use get_class instead of is_a (thanks Thomas Noel)
-- soapclient: add setEndpoint method
-- soap_transport_http: fix client certificates (thanks Doug Anarino and Eryan Eriobowo)
-
-2005-04-29, version 0.6.9
-- nusoap_base: add global variable and methods for setting debug level
-- nusoap_base: use xsd:anyType instead of xsd:ur-type to serialize arrays with multiple element types (thanks Ingo Fischer)
-- nusoap_base: expand entities in attributes (thanks Gaetano Giunta)
-- soapclient: call parent constructor
-- soapval: call parent constructor
-- soap_fault: call parent constructor
-- soap_parser: call parent constructor
-- soap_server: assume get_class_methods always returns lower case for PHP 4.x only
-- soap_server: call parent constructor
-- soap_transport_http: do nothing in setEncoding if gzdeflate is not present (thanks Franck Touanen for pointing this out)
-- soap_transport_http: fix check for server request for digest authentication (thanks Mark Spavin)
-- soap_transport_http: call parent constructor
-- wsdl: fix documentation page popup of one method after another (thanks Owen)
-- wsdl: call parent constructor
-- wsdl: expand entities in attributes (thanks Gaetano Giunta)
-- xmlschema: call parent constructor
-
-2005-06-03, version 0.6.9
-- nusoap_base: serialize empty arrays as having elements xsd:anyType[0]
-- nusoap_base: add encodingStyle parameter to serializeEnvelope
-- nusoap_base: serialize xsi:type with nil values
-- nusoap_base: improve debug and comments
-- soap_parser: correctly parse an empty array to an empty array, not an empty string
-- soap_parser: improve debug and comments
-- soap_server: specify encodingStyle for envelope when WSDL is used
-- soapclient: factor out new getProxyClassCode method
-- soapclient: specify encodingStyle for envelope
-- soapclient: improve debug and comments
-- wsdl: add namespace for Apache SOAP types if a variable of such type is serialized
-- wsdl: serialize nil value for nillable elements when no value is provided
-- wsdl: serialize xsi:type with nil values
-- wsdl: copy attributes as well as elements to an element from its complexType
-- wsdl: specify encodingStyle for operations
-- wsdl: improve debug and comments
-- xmlschema: improve debug and comments
-
-2005-06-03, version 0.7.0
-- nusoap_base: improve debug and comments
-- nusoap_base: fix version, which should have been 0.7.0 since 2005-03-04
-
-2005-06-06, version 0.7.1
-- nusoap_base: adjust numeric element names for serialization, instead of forcing them to 'soapVal'
-- nusoapmime: add type=text/xml to multipart/related (thanks Emmanuel Cordonnier)
-- soap_fault: fix serialization of detail
-- soap_server: check required parameters for register method
-- soap_server: when getallheaders is used, massage header names
-- soap_server: use SOAPAction to determine operation when doc/lit service does not wrap parameters in an element with the method name (thanks Peter Hrastnik)
-- soap_transport_http: correctly handle multiple HTTP/1.1 100 responses for https (thanks Jan Slabon)
-- wsdl: fixed documentation for addComplexType (thanks Csintalan Ádám)
-- wsdl: serialize array data when maxOccurs = 'unbounded' OR maxOccurs > 1 (thanks Dominique Schreckling)
-- wsdl: when serializing a string == 'false' as a boolean, set the value to false
-- wsdl: when serializing a complexType, require the PHP value supplied to be an array
-
-2005-07-01, version 0.7.1
-- nusoap_base: Allow SOAP headers to be supplied as an array like parameters
-- soap_parser: de-serialize simpleContent that accompanies complexContent
-- soap_server: append debug information when programmatically-defined WSDL is returned
-- soap_transport_http: Add debug when an outgoing header is set
-- soapclient: Allow SOAP headers to be supplied as an array like parameters
-- xmlschema: serialize attributes more generally, rather than assuming they are for SOAP 1.1 Array
-- wsdl: when serializing, look up types by namespace, not prefix (simple programmatic doc/lit WSDL now seems to work)
-- wsdl: process namespace declarations first when parsing an element
-
-2005-07-27, version 0.7.1
-- nusoap_base: do not override supplied element name with class name when serializing an object in serialize_val
-- nusoap_base: remove http://soapinterop.org/xsd (si) from namespaces array
-- nusoapmime: add nusoapservermime class to implement MIME attachments on the server
-- soap_fault: improve documentation
-- soap_server: improve documentation
-- soap_server: make consistent use of _SERVER and HTTP_SERVER_VARS
-- soap_server: make all incoming HTTP header keys lower case
-- soap_server: add hook functions to support subclassing for MIME attachments
-- soap_transport_http: remove an unnecessary global statement
-- soapclient: when creating a proxy, make $params within each function an associative array
-- soapval: improve documentation
-- wsdl: when serializing complexType elements, used typed serialization if there is either a type or a reference for the element
-- wsdl: allow PHP objects to be serialized as SOAP structs in serializeType
-- wsdl: for WSDL and XML Schema imports, don't forget to use the TCP port number (thanks Luca GIOPPO)
-- wsdl: make consistent use of _SERVER and HTTP_SERVER_VARS
-- xmlschema: improve documentation
-
-2005-07-31, version 0.7.2
-- nusoap_base: correctly serialize attributes in serialize_val (thanks Hidran Arias)
-- soap_parser: when resolving references, do not assume that buildVal returns an array (thanks Akshell)
-- soap_parser: removed decode_entities, which does not work (thanks Martin Sarsale)
-- soap_server: fix a bug parsing headers from _SERVER and HTTP_SERVER_VARS (thanks Bert Catsburg)
-- soap_server: parse all "headers" from HTTP_SERVER_VARS (not just HTTP_*)
-- soap_server: use PHP_SELF instead of SCRIPT_NAME for WSDL endpoint
-- soap_server: when generating a fault while debug_flag is true, put debug into faultdetail
-- wsdl: add enumeration parameter to addSimpleType
-- xmlschema: add enumeration parameter to addSimpleType
diff --git a/libraries/nusoap/class.nusoap_base.php b/libraries/nusoap/class.nusoap_base.php
deleted file mode 100644
index 012b22d90..000000000
--- a/libraries/nusoap/class.nusoap_base.php
+++ /dev/null
@@ -1,905 +0,0 @@
-<?php
-
-/*
-$Id: class.nusoap_base.php,v 1.43 2005/08/04 01:27:42 snichol Exp $
-
-NuSOAP - Web Services Toolkit for PHP
-
-Copyright (c) 2002 NuSphere Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-If you have any questions or comments, please email:
-
-Dietrich Ayala
-dietrich@ganx4.com
-http://dietrich.ganx4.com/nusoap
-
-NuSphere Corporation
-http://www.nusphere.com
-
-*/
-
-/* load classes
-
-// necessary classes
-require_once('class.soapclient.php');
-require_once('class.soap_val.php');
-require_once('class.soap_parser.php');
-require_once('class.soap_fault.php');
-
-// transport classes
-require_once('class.soap_transport_http.php');
-
-// optional add-on classes
-require_once('class.xmlschema.php');
-require_once('class.wsdl.php');
-
-// server class
-require_once('class.soap_server.php');*/
-
-// class variable emulation
-// cf. http://www.webkreator.com/php/techniques/php-static-class-variables.html
-$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
-
-/**
-*
-* nusoap_base
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.nusoap_base.php,v 1.43 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class nusoap_base {
-	/**
-	 * Identification for HTTP headers.
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $title = 'NuSOAP';
-	/**
-	 * Version for HTTP headers.
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $version = '0.7.2';
-	/**
-	 * CVS revision for HTTP headers.
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $revision = '$Revision: 1.43 $';
-    /**
-     * Current error string (manipulated by getError/setError)
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $error_str = '';
-    /**
-     * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
-	 *
-	 * @var string
-	 * @access private
-	 */
-    var $debug_str = '';
-    /**
-	 * toggles automatic encoding of special characters as entities
-	 * (should always be true, I think)
-	 *
-	 * @var boolean
-	 * @access private
-	 */
-	var $charencoding = true;
-	/**
-	 * the debug level for this instance
-	 *
-	 * @var	integer
-	 * @access private
-	 */
-	var $debugLevel;
-
-    /**
-	* set schema version
-	*
-	* @var      string
-	* @access   public
-	*/
-	var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
-	
-    /**
-	* charset encoding for outgoing messages
-	*
-	* @var      string
-	* @access   public
-	*/
-    var $soap_defencoding = 'UTF-8';
-	//var $soap_defencoding = 'UTF-8';
-
-	/**
-	* namespaces in an array of prefix => uri
-	*
-	* this is "seeded" by a set of constants, but it may be altered by code
-	*
-	* @var      array
-	* @access   public
-	*/
-	var $namespaces = array(
-		'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
-		'xsd' => 'http://www.w3.org/2001/XMLSchema',
-		'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
-		'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
-		);
-
-	/**
-	* namespaces used in the current context, e.g. during serialization
-	*
-	* @var      array
-	* @access   private
-	*/
-	var $usedNamespaces = array();
-
-	/**
-	* XML Schema types in an array of uri => (array of xml type => php type)
-	* is this legacy yet?
-	* no, this is used by the xmlschema class to verify type => namespace mappings.
-	* @var      array
-	* @access   public
-	*/
-	var $typemap = array(
-	'http://www.w3.org/2001/XMLSchema' => array(
-		'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
-		'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
-		'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
-		// abstract "any" types
-		'anyType'=>'string','anySimpleType'=>'string',
-		// derived datatypes
-		'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
-		'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
-		'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
-		'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
-	'http://www.w3.org/2000/10/XMLSchema' => array(
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
-		'float'=>'double','dateTime'=>'string',
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
-	'http://www.w3.org/1999/XMLSchema' => array(
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
-		'float'=>'double','dateTime'=>'string',
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
-	'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
-	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
-    'http://xml.apache.org/xml-soap' => array('Map')
-	);
-
-	/**
-	* XML entities to convert
-	*
-	* @var      array
-	* @access   public
-	* @deprecated
-	* @see	expandEntities
-	*/
-	var $xmlEntities = array('quot' => '"','amp' => '&',
-		'lt' => '<','gt' => '>','apos' => "'");
-
-	/**
-	* constructor
-	*
-	* @access	public
-	*/
-	function nusoap_base() {
-		$this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
-	}
-
-	/**
-	* gets the global debug level, which applies to future instances
-	*
-	* @return	integer	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function getGlobalDebugLevel() {
-		return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
-	}
-
-	/**
-	* sets the global debug level, which applies to future instances
-	*
-	* @param	int	$level	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function setGlobalDebugLevel($level) {
-		$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
-	}
-
-	/**
-	* gets the debug level for this instance
-	*
-	* @return	int	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function getDebugLevel() {
-		return $this->debugLevel;
-	}
-
-	/**
-	* sets the debug level for this instance
-	*
-	* @param	int	$level	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function setDebugLevel($level) {
-		$this->debugLevel = $level;
-	}
-
-	/**
-	* adds debug data to the instance debug string with formatting
-	*
-	* @param    string $string debug data
-	* @access   private
-	*/
-	function debug($string){
-		if ($this->debugLevel > 0) {
-			$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
-		}
-	}
-
-	/**
-	* adds debug data to the instance debug string without formatting
-	*
-	* @param    string $string debug data
-	* @access   public
-	*/
-	function appendDebug($string){
-		if ($this->debugLevel > 0) {
-			// it would be nice to use a memory stream here to use
-			// memory more efficiently
-			$this->debug_str .= $string;
-		}
-	}
-
-	/**
-	* clears the current debug data for this instance
-	*
-	* @access   public
-	*/
-	function clearDebug() {
-		// it would be nice to use a memory stream here to use
-		// memory more efficiently
-		$this->debug_str = '';
-	}
-
-	/**
-	* gets the current debug data for this instance
-	*
-	* @return   debug data
-	* @access   public
-	*/
-	function &getDebug() {
-		// it would be nice to use a memory stream here to use
-		// memory more efficiently
-		return $this->debug_str;
-	}
-
-	/**
-	* gets the current debug data for this instance as an XML comment
-	* this may change the contents of the debug data
-	*
-	* @return   debug data as an XML comment
-	* @access   public
-	*/
-	function &getDebugAsXMLComment() {
-		// it would be nice to use a memory stream here to use
-		// memory more efficiently
-		while (strpos($this->debug_str, '--')) {
-			$this->debug_str = str_replace('--', '- -', $this->debug_str);
-		}
-    	return "<!--\n" . $this->debug_str . "\n-->";
-	}
-
-	/**
-	* expands entities, e.g. changes '<' to '&lt;'.
-	*
-	* @param	string	$val	The string in which to expand entities.
-	* @access	private
-	*/
-	function expandEntities($val) {
-		if ($this->charencoding) {
-	    	$val = str_replace('&', '&amp;', $val);
-	    	$val = str_replace("'", '&apos;', $val);
-	    	$val = str_replace('"', '&quot;', $val);
-	    	$val = str_replace('<', '&lt;', $val);
-	    	$val = str_replace('>', '&gt;', $val);
-	    }
-	    return $val;
-	}
-
-	/**
-	* returns error string if present
-	*
-	* @return   mixed error string or false
-	* @access   public
-	*/
-	function getError(){
-		if($this->error_str != ''){
-			return $this->error_str;
-		}
-		return false;
-	}
-
-	/**
-	* sets error string
-	*
-	* @return   boolean $string error string
-	* @access   private
-	*/
-	function setError($str){
-		$this->error_str = $str;
-	}
-
-	/**
-	* detect if array is a simple array or a struct (associative array)
-	*
-	* @param	mixed	$val	The PHP array
-	* @return	string	(arraySimple|arrayStruct)
-	* @access	private
-	*/
-	function isArraySimpleOrStruct($val) {
-        $keyList = array_keys($val);
-		foreach ($keyList as $keyListValue) {
-			if (!is_int($keyListValue)) {
-				return 'arrayStruct';
-			}
-		}
-		return 'arraySimple';
-	}
-
-	/**
-	* serializes PHP values in accordance w/ section 5. Type information is
-	* not serialized if $use == 'literal'.
-	*
-	* @param	mixed	$val	The value to serialize
-	* @param	string	$name	The name (local part) of the XML element
-	* @param	string	$type	The XML schema type (local part) for the element
-	* @param	string	$name_ns	The namespace for the name of the XML element
-	* @param	string	$type_ns	The namespace for the type of the element
-	* @param	array	$attributes	The attributes to serialize as name=>value pairs
-	* @param	string	$use	The WSDL "use" (encoded|literal)
-	* @return	string	The serialized element, possibly with child elements
-    * @access	public
-	*/
-	function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded'){
-		$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use");
-		$this->appendDebug('value=' . $this->varDump($val));
-		$this->appendDebug('attributes=' . $this->varDump($attributes));
-		
-    	if(is_object($val) && get_class($val) == 'soapval'){
-        	return $val->serialize($use);
-        }
-		// force valid name if necessary
-		if (is_numeric($name)) {
-			$name = '__numeric_' . $name;
-		} elseif (! $name) {
-			$name = 'noname';
-		}
-		// if name has ns, add ns prefix to name
-		$xmlns = '';
-        if($name_ns){
-			$prefix = 'nu'.rand(1000,9999);
-			$name = $prefix.':'.$name;
-			$xmlns .= " xmlns:$prefix=\"$name_ns\"";
-		}
-		// if type is prefixed, create type prefix
-		if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
-			// need to fix this. shouldn't default to xsd if no ns specified
-		    // w/o checking against typemap
-			$type_prefix = 'xsd';
-		} elseif($type_ns){
-			$type_prefix = 'ns'.rand(1000,9999);
-			$xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
-		}
-		// serialize attributes if present
-		$atts = '';
-		if($attributes){
-			foreach($attributes as $k => $v){
-				$atts .= " $k=\"".$this->expandEntities($v).'"';
-			}
-		}
-		// serialize null value
-		if (is_null($val)) {
-			if ($use == 'literal') {
-				// TODO: depends on minOccurs
-	        	return "<$name$xmlns $atts/>";
-        	} else {
-				if (isset($type) && isset($type_prefix)) {
-					$type_str = " xsi:type=\"$type_prefix:$type\"";
-				} else {
-					$type_str = '';
-				}
-	        	return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
-        	}
-		}
-        // serialize if an xsd built-in primitive type
-        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
-        	if (is_bool($val)) {
-        		if ($type == 'boolean') {
-	        		$val = $val ? 'true' : 'false';
-	        	} elseif (! $val) {
-	        		$val = 0;
-	        	}
-			} else if (is_string($val)) {
-				$val = $this->expandEntities($val);
-			}
-			if ($use == 'literal') {
-	        	return "<$name$xmlns $atts>$val</$name>";
-        	} else {
-	        	return "<$name$xmlns $atts xsi:type=\"xsd:$type\">$val</$name>";
-        	}
-        }
-		// detect type and serialize
-		$xml = '';
-		switch(true) {
-			case (is_bool($val) || $type == 'boolean'):
-        		if ($type == 'boolean') {
-	        		$val = $val ? 'true' : 'false';
-	        	} elseif (! $val) {
-	        		$val = 0;
-	        	}
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
-				}
-				break;
-			case (is_int($val) || is_long($val) || $type == 'int'):
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
-				}
-				break;
-			case (is_float($val)|| is_double($val) || $type == 'float'):
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
-				}
-				break;
-			case (is_string($val) || $type == 'string'):
-				$val = $this->expandEntities($val);
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
-				}
-				break;
-			case is_object($val):
-				if (! $name) {
-					$name = get_class($val);
-					$this->debug("In serialize_val, used class name $name as element name");
-				} else {
-					$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
-				}
-				foreach(get_object_vars($val) as $k => $v){
-					$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
-				}
-				$xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
-				break;
-			break;
-			case (is_array($val) || $type):
-				// detect if struct or array
-				$valueType = $this->isArraySimpleOrStruct($val);
-                if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
-					$i = 0;
-					if(is_array($val) && count($val)> 0){
-						foreach($val as $v){
-	                    	if(is_object($v) && get_class($v) ==  'soapval'){
-								$tt_ns = $v->type_ns;
-								$tt = $v->type;
-							} elseif (is_array($v)) {
-								$tt = $this->isArraySimpleOrStruct($v);
-							} else {
-								$tt = gettype($v);
-	                        }
-							$array_types[$tt] = 1;
-							// TODO: for literal, the name should be $name
-							$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
-							++$i;
-						}
-						if(count($array_types) > 1){
-							$array_typename = 'xsd:anyType';
-						} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
-							if ($tt == 'integer') {
-								$tt = 'int';
-							}
-							$array_typename = 'xsd:'.$tt;
-						} elseif(isset($tt) && $tt == 'arraySimple'){
-							$array_typename = 'SOAP-ENC:Array';
-						} elseif(isset($tt) && $tt == 'arrayStruct'){
-							$array_typename = 'unnamed_struct_use_soapval';
-						} else {
-							// if type is prefixed, create type prefix
-							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
-								 $array_typename = 'xsd:' . $tt;
-							} elseif ($tt_ns) {
-								$tt_prefix = 'ns' . rand(1000, 9999);
-								$array_typename = "$tt_prefix:$tt";
-								$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
-							} else {
-								$array_typename = $tt;
-							}
-						}
-						$array_type = $i;
-						if ($use == 'literal') {
-							$type_str = '';
-						} else if (isset($type) && isset($type_prefix)) {
-							$type_str = " xsi:type=\"$type_prefix:$type\"";
-						} else {
-							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
-						}
-					// empty array
-					} else {
-						if ($use == 'literal') {
-							$type_str = '';
-						} else if (isset($type) && isset($type_prefix)) {
-							$type_str = " xsi:type=\"$type_prefix:$type\"";
-						} else {
-							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
-						}
-					}
-					// TODO: for array in literal, there is no wrapper here
-					$xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
-				} else {
-					// got a struct
-					if(isset($type) && isset($type_prefix)){
-						$type_str = " xsi:type=\"$type_prefix:$type\"";
-					} else {
-						$type_str = '';
-					}
-					if ($use == 'literal') {
-						$xml .= "<$name$xmlns $atts>";
-					} else {
-						$xml .= "<$name$xmlns$type_str$atts>";
-					}
-					foreach($val as $k => $v){
-						// Apache Map
-						if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
-							$xml .= '<item>';
-							$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
-							$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
-							$xml .= '</item>';
-						} else {
-							$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
-						}
-					}
-					$xml .= "</$name>";
-				}
-				break;
-			default:
-				$xml .= 'not detected, got '.gettype($val).' for '.$val;
-				break;
-		}
-		return $xml;
-	}
-
-    /**
-    * serializes a message
-    *
-    * @param string $body the XML of the SOAP body
-    * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
-    * @param array $namespaces optional the namespaces used in generating the body and headers
-    * @param string $style optional (rpc|document)
-    * @param string $use optional (encoded|literal)
-    * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
-    * @return string the message
-    * @access public
-    */
-    function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
-    // TODO: add an option to automatically run utf8_encode on $body and $headers
-    // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
-    // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
-
-	$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
-	$this->debug("headers:");
-	$this->appendDebug($this->varDump($headers));
-	$this->debug("namespaces:");
-	$this->appendDebug($this->varDump($namespaces));
-
-	// serialize namespaces
-    $ns_string = '';
-	foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
-		$ns_string .= " xmlns:$k=\"$v\"";
-	}
-	if($encodingStyle) {
-		$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
-	}
-
-	// serialize headers
-	if($headers){
-		if (is_array($headers)) {
-			$xml = '';
-			foreach ($headers as $header) {
-				$xml .= $this->serialize_val($header, false, false, false, false, false, $use);
-			}
-			$headers = $xml;
-			$this->debug("In serializeEnvelope, serialzied array of headers to $headers");
-		}
-		$headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
-	}
-	// serialize envelope
-	return
-	'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
-	'<SOAP-ENV:Envelope'.$ns_string.">".
-	$headers.
-	"<SOAP-ENV:Body>".
-		$body.
-	"</SOAP-ENV:Body>".
-	"</SOAP-ENV:Envelope>";
-    }
-
-	/**
-	 * formats a string to be inserted into an HTML stream
-	 *
-	 * @param string $str The string to format
-	 * @return string The formatted string
-	 * @access public
-	 * @deprecated
-	 */
-    function formatDump($str){
-		$str = htmlspecialchars($str);
-		return nl2br($str);
-    }
-
-	/**
-	* contracts (changes namespace to prefix) a qualified name
-	*
-	* @param    string $qname qname
-	* @return	string contracted qname
-	* @access   private
-	*/
-	function contractQname($qname){
-		// get element namespace
-		//$this->xdebug("Contract $qname");
-		if (strrpos($qname, ':')) {
-			// get unqualified name
-			$name = substr($qname, strrpos($qname, ':') + 1);
-			// get ns
-			$ns = substr($qname, 0, strrpos($qname, ':'));
-			$p = $this->getPrefixFromNamespace($ns);
-			if ($p) {
-				return $p . ':' . $name;
-			}
-			return $qname;
-		} else {
-			return $qname;
-		}
-	}
-
-	/**
-	* expands (changes prefix to namespace) a qualified name
-	*
-	* @param    string $string qname
-	* @return	string expanded qname
-	* @access   private
-	*/
-	function expandQname($qname){
-		// get element prefix
-		if(strpos($qname,':') && !ereg('^http://',$qname)){
-			// get unqualified name
-			$name = substr(strstr($qname,':'),1);
-			// get ns prefix
-			$prefix = substr($qname,0,strpos($qname,':'));
-			if(isset($this->namespaces[$prefix])){
-				return $this->namespaces[$prefix].':'.$name;
-			} else {
-				return $qname;
-			}
-		} else {
-			return $qname;
-		}
-	}
-
-    /**
-    * returns the local part of a prefixed string
-    * returns the original string, if not prefixed
-    *
-    * @param string $str The prefixed string
-    * @return string The local part
-    * @access public
-    */
-	function getLocalPart($str){
-		if($sstr = strrchr($str,':')){
-			// get unqualified name
-			return substr( $sstr, 1 );
-		} else {
-			return $str;
-		}
-	}
-
-	/**
-    * returns the prefix part of a prefixed string
-    * returns false, if not prefixed
-    *
-    * @param string $str The prefixed string
-    * @return mixed The prefix or false if there is no prefix
-    * @access public
-    */
-	function getPrefix($str){
-		if($pos = strrpos($str,':')){
-			// get prefix
-			return substr($str,0,$pos);
-		}
-		return false;
-	}
-
-	/**
-    * pass it a prefix, it returns a namespace
-    *
-    * @param string $prefix The prefix
-    * @return mixed The namespace, false if no namespace has the specified prefix
-    * @access public
-    */
-	function getNamespaceFromPrefix($prefix){
-		if (isset($this->namespaces[$prefix])) {
-			return $this->namespaces[$prefix];
-		}
-		//$this->setError("No namespace registered for prefix '$prefix'");
-		return false;
-	}
-
-	/**
-    * returns the prefix for a given namespace (or prefix)
-    * or false if no prefixes registered for the given namespace
-    *
-    * @param string $ns The namespace
-    * @return mixed The prefix, false if the namespace has no prefixes
-    * @access public
-    */
-	function getPrefixFromNamespace($ns) {
-		foreach ($this->namespaces as $p => $n) {
-			if ($ns == $n || $ns == $p) {
-			    $this->usedNamespaces[$p] = $n;
-				return $p;
-			}
-		}
-		return false;
-	}
-
-	/**
-    * returns the time in ODBC canonical form with microseconds
-    *
-    * @return string The time in ODBC canonical form with microseconds
-    * @access public
-    */
-	function getmicrotime() {
-		if (function_exists('gettimeofday')) {
-			$tod = gettimeofday();
-			$sec = $tod['sec'];
-			$usec = $tod['usec'];
-		} else {
-			$sec = time();
-			$usec = 0;
-		}
-		return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
-	}
-
-	/**
-	 * Returns a string with the output of var_dump
-	 *
-	 * @param mixed $data The variable to var_dump
-	 * @return string The output of var_dump
-	 * @access public
-	 */
-    function varDump($data) {
-		ob_start();
-		var_dump($data);
-		$ret_val = ob_get_contents();
-		ob_end_clean();
-		return $ret_val;
-	}
-}
-
-// XML Schema Datatype Helper Functions
-
-//xsd:dateTime helpers
-
-/**
-* convert unix timestamp to ISO 8601 compliant date string
-*
-* @param    string $timestamp Unix time stamp
-* @access   public
-*/
-function timestamp_to_iso8601($timestamp,$utc=true){
-	$datestr = date('Y-m-d\TH:i:sO',$timestamp);
-	if($utc){
-		$eregStr =
-		'([0-9]{4})-'.	// centuries & years CCYY-
-		'([0-9]{2})-'.	// months MM-
-		'([0-9]{2})'.	// days DD
-		'T'.			// separator T
-		'([0-9]{2}):'.	// hours hh:
-		'([0-9]{2}):'.	// minutes mm:
-		'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
-		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
-
-		if(ereg($eregStr,$datestr,$regs)){
-			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
-		}
-		return false;
-	} else {
-		return $datestr;
-	}
-}
-
-/**
-* convert ISO 8601 compliant date string to unix timestamp
-*
-* @param    string $datestr ISO 8601 compliant date string
-* @access   public
-*/
-function iso8601_to_timestamp($datestr){
-	$eregStr =
-	'([0-9]{4})-'.	// centuries & years CCYY-
-	'([0-9]{2})-'.	// months MM-
-	'([0-9]{2})'.	// days DD
-	'T'.			// separator T
-	'([0-9]{2}):'.	// hours hh:
-	'([0-9]{2}):'.	// minutes mm:
-	'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
-	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
-	if(ereg($eregStr,$datestr,$regs)){
-		// not utc
-		if($regs[8] != 'Z'){
-			$op = substr($regs[8],0,1);
-			$h = substr($regs[8],1,2);
-			$m = substr($regs[8],strlen($regs[8])-2,2);
-			if($op == '-'){
-				$regs[4] = $regs[4] + $h;
-				$regs[5] = $regs[5] + $m;
-			} elseif($op == '+'){
-				$regs[4] = $regs[4] - $h;
-				$regs[5] = $regs[5] - $m;
-			}
-		}
-		return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z");
-	} else {
-		return false;
-	}
-}
-
-/**
-* sleeps some number of microseconds
-*
-* @param    string $usec the number of microseconds to sleep
-* @access   public
-* @deprecated
-*/
-function usleepWindows($usec)
-{
-	$start = gettimeofday();
-	
-	do
-	{
-		$stop = gettimeofday();
-		$timePassed = 1000000 * ($stop['sec'] - $start['sec'])
-		+ $stop['usec'] - $start['usec'];
-	}
-	while ($timePassed < $usec);
-}
-
-
-?>
diff --git a/libraries/nusoap/class.soap_fault.php b/libraries/nusoap/class.soap_fault.php
deleted file mode 100644
index 47e5ee812..000000000
--- a/libraries/nusoap/class.soap_fault.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-
-
-
-
-/**
-* Contains information for a SOAP fault.
-* Mainly used for returning faults from deployed functions
-* in a server instance.
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.soap_fault.php,v 1.12 2005/07/27 19:24:42 snichol Exp $
-* @access public
-*/
-class soap_fault extends nusoap_base {
-	/**
-	 * The fault code (client|server)
-	 * @var string
-	 * @access private
-	 */
-	var $faultcode;
-	/**
-	 * The fault actor
-	 * @var string
-	 * @access private
-	 */
-	var $faultactor;
-	/**
-	 * The fault string, a description of the fault
-	 * @var string
-	 * @access private
-	 */
-	var $faultstring;
-	/**
-	 * The fault detail, typically a string or array of string
-	 * @var mixed
-	 * @access private
-	 */
-	var $faultdetail;
-
-	/**
-	* constructor
-    *
-    * @param string $faultcode (client | server)
-    * @param string $faultactor only used when msg routed between multiple actors
-    * @param string $faultstring human readable error message
-    * @param mixed $faultdetail detail, typically a string or array of string
-	*/
-	function soap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
-		parent::nusoap_base();
-		$this->faultcode = $faultcode;
-		$this->faultactor = $faultactor;
-		$this->faultstring = $faultstring;
-		$this->faultdetail = $faultdetail;
-	}
-
-	/**
-	* serialize a fault
-	*
-	* @return	string	The serialization of the fault instance.
-	* @access   public
-	*/
-	function serialize(){
-		$ns_string = '';
-		foreach($this->namespaces as $k => $v){
-			$ns_string .= "\n  xmlns:$k=\"$v\"";
-		}
-		$return_msg =
-			'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
-			'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
-				'<SOAP-ENV:Body>'.
-				'<SOAP-ENV:Fault>'.
-					$this->serialize_val($this->faultcode, 'faultcode').
-					$this->serialize_val($this->faultactor, 'faultactor').
-					$this->serialize_val($this->faultstring, 'faultstring').
-					$this->serialize_val($this->faultdetail, 'detail').
-				'</SOAP-ENV:Fault>'.
-				'</SOAP-ENV:Body>'.
-			'</SOAP-ENV:Envelope>';
-		return $return_msg;
-	}
-}
-
-
-
-
-?>
\ No newline at end of file
diff --git a/libraries/nusoap/class.soap_parser.php b/libraries/nusoap/class.soap_parser.php
deleted file mode 100644
index 8fd2d792d..000000000
--- a/libraries/nusoap/class.soap_parser.php
+++ /dev/null
@@ -1,599 +0,0 @@
-<?php
-
-
-
-
-/**
-*
-* soap_parser class parses SOAP XML messages into native PHP values
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.soap_parser.php,v 1.36 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class soap_parser extends nusoap_base {
-
-	var $xml = '';
-	var $xml_encoding = '';
-	var $method = '';
-	var $root_struct = '';
-	var $root_struct_name = '';
-	var $root_struct_namespace = '';
-	var $root_header = '';
-    var $document = '';			// incoming SOAP body (text)
-	// determines where in the message we are (envelope,header,body,method)
-	var $status = '';
-	var $position = 0;
-	var $depth = 0;
-	var $default_namespace = '';
-	var $namespaces = array();
-	var $message = array();
-    var $parent = '';
-	var $fault = false;
-	var $fault_code = '';
-	var $fault_str = '';
-	var $fault_detail = '';
-	var $depth_array = array();
-	var $debug_flag = true;
-	var $soapresponse = NULL;
-	var $responseHeaders = '';	// incoming SOAP headers (text)
-	var $body_position = 0;
-	// for multiref parsing:
-	// array of id => pos
-	var $ids = array();
-	// array of id => hrefs => pos
-	var $multirefs = array();
-	// toggle for auto-decoding element content
-	var $decode_utf8 = true;
-
-	/**
-	* constructor that actually does the parsing
-	*
-	* @param    string $xml SOAP message
-	* @param    string $encoding character encoding scheme of message
-	* @param    string $method method for which XML is parsed (unused?)
-	* @param    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
-	* @access   public
-	*/
-	function soap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
-		parent::nusoap_base();
-		$this->xml = $xml;
-		$this->xml_encoding = $encoding;
-		$this->method = $method;
-		$this->decode_utf8 = $decode_utf8;
-
-		// Check whether content has been read.
-		if(!empty($xml)){
-			// Check XML encoding
-			$pos_xml = strpos($xml, '<?xml');
-			if ($pos_xml !== FALSE) {
-				$xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
-				if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
-					$xml_encoding = $res[1];
-					if (strtoupper($xml_encoding) != $encoding) {
-						$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
-						$this->debug($err);
-						if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
-							$this->setError($err);
-							return;
-						}
-						// when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
-					} else {
-						$this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
-					}
-				} else {
-					$this->debug('No encoding specified in XML declaration');
-				}
-			} else {
-				$this->debug('No XML declaration');
-			}
-			$this->debug('Entering soap_parser(), length='.strlen($xml).', encoding='.$encoding);
-			// Create an XML parser - why not xml_parser_create_ns?
-			$this->parser = xml_parser_create($this->xml_encoding);
-			// Set the options for parsing the XML data.
-			//xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
-			xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
-			xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
-			// Set the object for the parser.
-			xml_set_object($this->parser, $this);
-			// Set the element handlers for the parser.
-			xml_set_element_handler($this->parser, 'start_element','end_element');
-			xml_set_character_data_handler($this->parser,'character_data');
-
-			// Parse the XML file.
-			if(!xml_parse($this->parser,$xml,true)){
-			    // Display an error message.
-			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
-			    xml_get_current_line_number($this->parser),
-			    xml_error_string(xml_get_error_code($this->parser)));
-				$this->debug($err);
-				$this->debug("XML payload:\n" . $xml);
-				$this->setError($err);
-			} else {
-				$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
-				// get final value
-				$this->soapresponse = $this->message[$this->root_struct]['result'];
-				// get header value: no, because this is documented as XML string
-//				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
-//					$this->responseHeaders = $this->message[$this->root_header]['result'];
-//				}
-				// resolve hrefs/ids
-				if(sizeof($this->multirefs) > 0){
-					foreach($this->multirefs as $id => $hrefs){
-						$this->debug('resolving multirefs for id: '.$id);
-						$idVal = $this->buildVal($this->ids[$id]);
-						if (is_array($idVal) && isset($idVal['!id'])) {
-							unset($idVal['!id']);
-						}
-						foreach($hrefs as $refPos => $ref){
-							$this->debug('resolving href at pos '.$refPos);
-							$this->multirefs[$id][$refPos] = $idVal;
-						}
-					}
-				}
-			}
-			xml_parser_free($this->parser);
-		} else {
-			$this->debug('xml was empty, didn\'t parse!');
-			$this->setError('xml was empty, didn\'t parse!');
-		}
-	}
-
-	/**
-	* start-element handler
-	*
-	* @param    resource $parser XML parser object
-	* @param    string $name element name
-	* @param    array $attrs associative array of attributes
-	* @access   private
-	*/
-	function start_element($parser, $name, $attrs) {
-		// position in a total number of elements, starting from 0
-		// update class level pos
-		$pos = $this->position++;
-		// and set mine
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
-		// depth = how many levels removed from root?
-		// set mine as current global depth and increment global depth value
-		$this->message[$pos]['depth'] = $this->depth++;
-
-		// else add self as child to whoever the current parent is
-		if($pos != 0){
-			$this->message[$this->parent]['children'] .= '|'.$pos;
-		}
-		// set my parent
-		$this->message[$pos]['parent'] = $this->parent;
-		// set self as current parent
-		$this->parent = $pos;
-		// set self as current value for this depth
-		$this->depth_array[$this->depth] = $pos;
-		// get element prefix
-		if(strpos($name,':')){
-			// get ns prefix
-			$prefix = substr($name,0,strpos($name,':'));
-			// get unqualified name
-			$name = substr(strstr($name,':'),1);
-		}
-		// set status
-		if($name == 'Envelope'){
-			$this->status = 'envelope';
-		} elseif($name == 'Header'){
-			$this->root_header = $pos;
-			$this->status = 'header';
-		} elseif($name == 'Body'){
-			$this->status = 'body';
-			$this->body_position = $pos;
-		// set method
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)){
-			$this->status = 'method';
-			$this->root_struct_name = $name;
-			$this->root_struct = $pos;
-			$this->message[$pos]['type'] = 'struct';
-			$this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
-		}
-		// set my status
-		$this->message[$pos]['status'] = $this->status;
-		// set name
-		$this->message[$pos]['name'] = htmlspecialchars($name);
-		// set attrs
-		$this->message[$pos]['attrs'] = $attrs;
-
-		// loop through atts, logging ns and type declarations
-        $attstr = '';
-		foreach($attrs as $key => $value){
-        	$key_prefix = $this->getPrefix($key);
-			$key_localpart = $this->getLocalPart($key);
-			// if ns declarations, add to class level array of valid namespaces
-            if($key_prefix == 'xmlns'){
-				if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
-					$this->XMLSchemaVersion = $value;
-					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
-					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
-				}
-                $this->namespaces[$key_localpart] = $value;
-				// set method namespace
-				if($name == $this->root_struct_name){
-					$this->methodNamespace = $value;
-				}
-			// if it's a type declaration, set type
-            } elseif($key_localpart == 'type'){
-            	$value_prefix = $this->getPrefix($value);
-                $value_localpart = $this->getLocalPart($value);
-				$this->message[$pos]['type'] = $value_localpart;
-				$this->message[$pos]['typePrefix'] = $value_prefix;
-                if(isset($this->namespaces[$value_prefix])){
-                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
-                } else if(isset($attrs['xmlns:'.$value_prefix])) {
-					$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
-                }
-				// should do something here with the namespace of specified type?
-			} elseif($key_localpart == 'arrayType'){
-				$this->message[$pos]['type'] = 'array';
-				/* do arrayType ereg here
-				[1]    arrayTypeValue    ::=    atype asize
-				[2]    atype    ::=    QName rank*
-				[3]    rank    ::=    '[' (',')* ']'
-				[4]    asize    ::=    '[' length~ ']'
-				[5]    length    ::=    nextDimension* Digit+
-				[6]    nextDimension    ::=    Digit+ ','
-				*/
-				$expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
-				if(ereg($expr,$value,$regs)){
-					$this->message[$pos]['typePrefix'] = $regs[1];
-					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
-	                if (isset($this->namespaces[$regs[1]])) {
-	                	$this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
-	                } else if (isset($attrs['xmlns:'.$regs[1]])) {
-						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
-	                }
-					$this->message[$pos]['arrayType'] = $regs[2];
-					$this->message[$pos]['arraySize'] = $regs[3];
-					$this->message[$pos]['arrayCols'] = $regs[4];
-				}
-			// specifies nil value (or not)
-			} elseif ($key_localpart == 'nil'){
-				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
-			// some other attribute
-			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
-				$this->message[$pos]['xattrs']['!' . $key] = $value;
-			}
-
-			if ($key == 'xmlns') {
-				$this->default_namespace = $value;
-			}
-			// log id
-			if($key == 'id'){
-				$this->ids[$value] = $pos;
-			}
-			// root
-			if($key_localpart == 'root' && $value == 1){
-				$this->status = 'method';
-				$this->root_struct_name = $name;
-				$this->root_struct = $pos;
-				$this->debug("found root struct $this->root_struct_name, pos $pos");
-			}
-            // for doclit
-            $attstr .= " $key=\"$value\"";
-		}
-        // get namespace - must be done after namespace atts are processed
-		if(isset($prefix)){
-			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
-			$this->default_namespace = $this->namespaces[$prefix];
-		} else {
-			$this->message[$pos]['namespace'] = $this->default_namespace;
-		}
-        if($this->status == 'header'){
-        	if ($this->root_header != $pos) {
-	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
-	        }
-        } elseif($this->root_struct_name != ''){
-        	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
-        }
-	}
-
-	/**
-	* end-element handler
-	*
-	* @param    resource $parser XML parser object
-	* @param    string $name element name
-	* @access   private
-	*/
-	function end_element($parser, $name) {
-		// position of current element is equal to the last value left in depth_array for my depth
-		$pos = $this->depth_array[$this->depth--];
-
-        // get element prefix
-		if(strpos($name,':')){
-			// get ns prefix
-			$prefix = substr($name,0,strpos($name,':'));
-			// get unqualified name
-			$name = substr(strstr($name,':'),1);
-		}
-		
-		// build to native type
-		if(isset($this->body_position) && $pos > $this->body_position){
-			// deal w/ multirefs
-			if(isset($this->message[$pos]['attrs']['href'])){
-				// get id
-				$id = substr($this->message[$pos]['attrs']['href'],1);
-				// add placeholder to href array
-				$this->multirefs[$id][$pos] = 'placeholder';
-				// add set a reference to it as the result value
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
-            // build complexType values
-			} elseif($this->message[$pos]['children'] != ''){
-				// if result has already been generated (struct/array)
-				if(!isset($this->message[$pos]['result'])){
-					$this->message[$pos]['result'] = $this->buildVal($pos);
-				}
-			// build complexType values of attributes and possibly simpleContent
-			} elseif (isset($this->message[$pos]['xattrs'])) {
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
-					$this->message[$pos]['xattrs']['!'] = null;
-				} elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
-	            	if (isset($this->message[$pos]['type'])) {
-						$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-					} else {
-						$parent = $this->message[$pos]['parent'];
-						if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-							$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-						} else {
-							$this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
-						}
-					}
-				}
-				$this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
-			// set value of simpleType (or nil complexType)
-			} else {
-            	//$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
-					$this->message[$pos]['xattrs']['!'] = null;
-				} elseif (isset($this->message[$pos]['type'])) {
-					$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-				} else {
-					$parent = $this->message[$pos]['parent'];
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-						$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-					} else {
-						$this->message[$pos]['result'] = $this->message[$pos]['cdata'];
-					}
-				}
-
-				/* add value to parent's result, if parent is struct/array
-				$parent = $this->message[$pos]['parent'];
-				if($this->message[$parent]['type'] != 'map'){
-					if(strtolower($this->message[$parent]['type']) == 'array'){
-						$this->message[$parent]['result'][] = $this->message[$pos]['result'];
-					} else {
-						$this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
-					}
-				}
-				*/
-			}
-		}
-		
-        // for doclit
-        if($this->status == 'header'){
-        	if ($this->root_header != $pos) {
-	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
-	        }
-        } elseif($pos >= $this->root_struct){
-        	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
-        }
-		// switch status
-		if($pos == $this->root_struct){
-			$this->status = 'body';
-			$this->root_struct_namespace = $this->message[$pos]['namespace'];
-		} elseif($name == 'Body'){
-			$this->status = 'envelope';
-		 } elseif($name == 'Header'){
-			$this->status = 'envelope';
-		} elseif($name == 'Envelope'){
-			//
-		}
-		// set parent back to my parent
-		$this->parent = $this->message[$pos]['parent'];
-	}
-
-	/**
-	* element content handler
-	*
-	* @param    resource $parser XML parser object
-	* @param    string $data element content
-	* @access   private
-	*/
-	function character_data($parser, $data){
-		$pos = $this->depth_array[$this->depth];
-		if ($this->xml_encoding=='UTF-8'){
-			// TODO: add an option to disable this for folks who want
-			// raw UTF-8 that, e.g., might not map to iso-8859-1
-			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
-			if($this->decode_utf8){
-				$data = utf8_decode($data);
-			}
-		}
-        $this->message[$pos]['cdata'] .= $data;
-        // for doclit
-        if($this->status == 'header'){
-        	$this->responseHeaders .= $data;
-        } else {
-        	$this->document .= $data;
-        }
-	}
-
-	/**
-	* get the parsed message
-	*
-	* @return	mixed
-	* @access   public
-	*/
-	function get_response(){
-		return $this->soapresponse;
-	}
-
-	/**
-	* get the parsed headers
-	*
-	* @return	string XML or empty if no headers
-	* @access   public
-	*/
-	function getHeaders(){
-	    return $this->responseHeaders;
-	}
-
-	/**
-	* decodes simple types into PHP variables
-	*
-	* @param    string $value value to decode
-	* @param    string $type XML type to decode
-	* @param    string $typens XML type namespace to decode
-	* @return	mixed PHP value
-	* @access   private
-	*/
-	function decodeSimple($value, $type, $typens) {
-		// TODO: use the namespace!
-		if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
-			return (string) $value;
-		}
-		if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
-			return (int) $value;
-		}
-		if ($type == 'float' || $type == 'double' || $type == 'decimal') {
-			return (double) $value;
-		}
-		if ($type == 'boolean') {
-			if (strtolower($value) == 'false' || strtolower($value) == 'f') {
-				return false;
-			}
-			return (boolean) $value;
-		}
-		if ($type == 'base64' || $type == 'base64Binary') {
-			$this->debug('Decode base64 value');
-			return base64_decode($value);
-		}
-		// obscure numeric types
-		if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
-			|| $type == 'nonNegativeInteger' || $type == 'positiveInteger'
-			|| $type == 'unsignedInt'
-			|| $type == 'unsignedShort' || $type == 'unsignedByte') {
-			return (int) $value;
-		}
-		// bogus: parser treats array with no elements as a simple type
-		if ($type == 'array') {
-			return array();
-		}
-		// everything else
-		return (string) $value;
-	}
-
-	/**
-	* builds response structures for compound values (arrays/structs)
-	* and scalars
-	*
-	* @param    integer $pos position in node tree
-	* @return	mixed	PHP value
-	* @access   private
-	*/
-	function buildVal($pos){
-		if(!isset($this->message[$pos]['type'])){
-			$this->message[$pos]['type'] = '';
-		}
-		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
-		// if there are children...
-		if($this->message[$pos]['children'] != ''){
-			$this->debug('in buildVal, there are children');
-			$children = explode('|',$this->message[$pos]['children']);
-			array_shift($children); // knock off empty
-			// md array
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
-            	$r=0; // rowcount
-            	$c=0; // colcount
-            	foreach($children as $child_pos){
-					$this->debug("in buildVal, got an MD array element: $r, $c");
-					$params[$r][] = $this->message[$child_pos]['result'];
-				    $c++;
-				    if($c == $this->message[$pos]['arrayCols']){
-				    	$c = 0;
-						$r++;
-				    }
-                }
-            // array
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
-                $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
-                foreach($children as $child_pos){
-                	$params[] = &$this->message[$child_pos]['result'];
-                }
-            // apache Map type: java hashtable
-            } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
-                $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
-                foreach($children as $child_pos){
-                	$kv = explode("|",$this->message[$child_pos]['children']);
-                   	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
-                }
-            // generic compound type
-            //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
-		    } else {
-	    		// Apache Vector type: treat as an array
-                $this->debug('in buildVal, adding Java Vector '.$this->message[$pos]['name']);
-				if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
-					$notstruct = 1;
-				} else {
-					$notstruct = 0;
-	            }
-            	//
-            	foreach($children as $child_pos){
-            		if($notstruct){
-            			$params[] = &$this->message[$child_pos]['result'];
-            		} else {
-            			if (isset($params[$this->message[$child_pos]['name']])) {
-            				// de-serialize repeated element name into an array
-            				if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
-            					$params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
-            				}
-            				$params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
-            			} else {
-					    	$params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
-					    }
-                	}
-                }
-			}
-			if (isset($this->message[$pos]['xattrs'])) {
-                $this->debug('in buildVal, handling attributes');
-				foreach ($this->message[$pos]['xattrs'] as $n => $v) {
-					$params[$n] = $v;
-				}
-			}
-			// handle simpleContent
-			if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
-                $this->debug('in buildVal, handling simpleContent');
-            	if (isset($this->message[$pos]['type'])) {
-					$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-				} else {
-					$parent = $this->message[$pos]['parent'];
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-						$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-					} else {
-						$params['!'] = $this->message[$pos]['cdata'];
-					}
-				}
-			}
-			return is_array($params) ? $params : array();
-		} else {
-        	$this->debug('in buildVal, no children, building scalar');
-			$cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
-        	if (isset($this->message[$pos]['type'])) {
-				return $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-			}
-			$parent = $this->message[$pos]['parent'];
-			if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-				return $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-			}
-           	return $this->message[$pos]['cdata'];
-		}
-	}
-}
-
-
-
-
-?>
\ No newline at end of file
diff --git a/libraries/nusoap/class.soap_server.php b/libraries/nusoap/class.soap_server.php
deleted file mode 100644
index 5192eb7b4..000000000
--- a/libraries/nusoap/class.soap_server.php
+++ /dev/null
@@ -1,1038 +0,0 @@
-<?php
-
-
-
-
-/**
-*
-* soap_server allows the user to create a SOAP server
-* that is capable of receiving messages and returning responses
-*
-* NOTE: WSDL functionality is experimental
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.soap_server.php,v 1.48 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class soap_server extends nusoap_base {
-	/**
-	 * HTTP headers of request
-	 * @var array
-	 * @access private
-	 */
-	var $headers = array();
-	/**
-	 * HTTP request
-	 * @var string
-	 * @access private
-	 */
-	var $request = '';
-	/**
-	 * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
-	 * @var string
-	 * @access public
-	 */
-	var $requestHeaders = '';
-	/**
-	 * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
-	 * @var string
-	 * @access public
-	 */
-	var $document = '';
-	/**
-	 * SOAP payload for request (text)
-	 * @var string
-	 * @access public
-	 */
-	var $requestSOAP = '';
-	/**
-	 * requested method namespace URI
-	 * @var string
-	 * @access private
-	 */
-	var $methodURI = '';
-	/**
-	 * name of method requested
-	 * @var string
-	 * @access private
-	 */
-	var $methodname = '';
-	/**
-	 * method parameters from request
-	 * @var array
-	 * @access private
-	 */
-	var $methodparams = array();
-	/**
-	 * SOAP Action from request
-	 * @var string
-	 * @access private
-	 */
-	var $SOAPAction = '';
-	/**
-	 * character set encoding of incoming (request) messages
-	 * @var string
-	 * @access public
-	 */
-	var $xml_encoding = '';
-	/**
-	 * toggles whether the parser decodes element content w/ utf8_decode()
-	 * @var boolean
-	 * @access public
-	 */
-    var $decode_utf8 = true;
-
-	/**
-	 * HTTP headers of response
-	 * @var array
-	 * @access public
-	 */
-	var $outgoing_headers = array();
-	/**
-	 * HTTP response
-	 * @var string
-	 * @access private
-	 */
-	var $response = '';
-	/**
-	 * SOAP headers for response (text)
-	 * @var string
-	 * @access public
-	 */
-	var $responseHeaders = '';
-	/**
-	 * SOAP payload for response (text)
-	 * @var string
-	 * @access private
-	 */
-	var $responseSOAP = '';
-	/**
-	 * method return value to place in response
-	 * @var mixed
-	 * @access private
-	 */
-	var $methodreturn = false;
-	/**
-	 * whether $methodreturn is a string of literal XML
-	 * @var boolean
-	 * @access public
-	 */
-	var $methodreturnisliteralxml = false;
-	/**
-	 * SOAP fault for response (or false)
-	 * @var mixed
-	 * @access private
-	 */
-	var $fault = false;
-	/**
-	 * text indication of result (for debugging)
-	 * @var string
-	 * @access private
-	 */
-	var $result = 'successful';
-
-	/**
-	 * assoc array of operations => opData; operations are added by the register()
-	 * method or by parsing an external WSDL definition
-	 * @var array
-	 * @access private
-	 */
-	var $operations = array();
-	/**
-	 * wsdl instance (if one)
-	 * @var mixed
-	 * @access private
-	 */
-	var $wsdl = false;
-	/**
-	 * URL for WSDL (if one)
-	 * @var mixed
-	 * @access private
-	 */
-	var $externalWSDLURL = false;
-	/**
-	 * whether to append debug to response as XML comment
-	 * @var boolean
-	 * @access public
-	 */
-	var $debug_flag = false;
-
-
-	/**
-	* constructor
-    * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
-	*
-    * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
-	* @access   public
-	*/
-	function soap_server($wsdl=false){
-		parent::nusoap_base();
-		// turn on debugging?
-		global $debug;
-		global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER)) {
-			$this->debug("_SERVER is defined:");
-			$this->appendDebug($this->varDump($_SERVER));
-		} elseif (isset($HTTP_SERVER_VARS)) {
-			$this->debug("HTTP_SERVER_VARS is defined:");
-			$this->appendDebug($this->varDump($HTTP_SERVER_VARS));
-		} else {
-			$this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
-		}
-
-		if (isset($debug)) {
-			$this->debug("In soap_server, set debug_flag=$debug based on global flag");
-			$this->debug_flag = $debug;
-		} elseif (isset($_SERVER['QUERY_STRING'])) {
-			$qs = explode('&', $_SERVER['QUERY_STRING']);
-			foreach ($qs as $v) {
-				if (substr($v, 0, 6) == 'debug=') {
-					$this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
-					$this->debug_flag = substr($v, 6);
-				}
-			}
-		} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
-			$qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
-			foreach ($qs as $v) {
-				if (substr($v, 0, 6) == 'debug=') {
-					$this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
-					$this->debug_flag = substr($v, 6);
-				}
-			}
-		}
-
-		// wsdl
-		if($wsdl){
-			$this->debug("In soap_server, WSDL is specified");
-			if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
-				$this->wsdl = $wsdl;
-				$this->externalWSDLURL = $this->wsdl->wsdl;
-				$this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
-			} else {
-				$this->debug('Create wsdl from ' . $wsdl);
-				$this->wsdl = new wsdl($wsdl);
-				$this->externalWSDLURL = $wsdl;
-			}
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			if($err = $this->wsdl->getError()){
-				die('WSDL ERROR: '.$err);
-			}
-		}
-	}
-
-	/**
-	* processes request and returns response
-	*
-	* @param    string $data usually is the value of $HTTP_RAW_POST_DATA
-	* @access   public
-	*/
-	function service($data){
-		global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER['QUERY_STRING'])) {
-			$qs = $_SERVER['QUERY_STRING'];
-		} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
-			$qs = $HTTP_SERVER_VARS['QUERY_STRING'];
-		} else {
-			$qs = '';
-		}
-		$this->debug("In service, query string=$qs");
-
-		if (ereg('wsdl', $qs) ){
-			$this->debug("In service, this is a request for WSDL");
-			if($this->externalWSDLURL){
-              if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
-				header('Location: '.$this->externalWSDLURL);
-              } else { // assume file
-                header("Content-Type: text/xml\r\n");
-                $fp = fopen($this->externalWSDLURL, 'r');
-                fpassthru($fp);
-              }
-			} elseif ($this->wsdl) {
-				header("Content-Type: text/xml; charset=UTF-8\r\n");
-				print $this->wsdl->serialize($this->debug_flag);
-				if ($this->debug_flag) {
-					$this->debug('wsdl:');
-					$this->appendDebug($this->varDump($this->wsdl));
-					print $this->getDebugAsXMLComment();
-				}
-			} else {
-				header("Content-Type: text/html; charset=UTF-8\r\n");
-				print "This service does not provide WSDL";
-			}
-		} elseif ($data == '' && $this->wsdl) {
-			$this->debug("In service, there is no data, so return Web description");
-			print $this->wsdl->webDescription();
-		} else {
-			$this->debug("In service, invoke the request");
-			$this->parse_request($data);
-			if (! $this->fault) {
-				$this->invoke_method();
-			}
-			if (! $this->fault) {
-				$this->serialize_return();
-			}
-			$this->send_response();
-		}
-	}
-
-	/**
-	* parses HTTP request headers.
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* headers
-	* request
-	* xml_encoding
-	* SOAPAction
-	*
-	* @access   private
-	*/
-	function parse_http_headers() {
-		global $HTTP_SERVER_VARS;
-
-		$this->request = '';
-		$this->SOAPAction = '';
-		if(function_exists('getallheaders')){
-			$this->debug("In parse_http_headers, use getallheaders");
-			$headers = getallheaders();
-			foreach($headers as $k=>$v){
-				$k = strtolower($k);
-				$this->headers[$k] = $v;
-				$this->request .= "$k: $v\r\n";
-				$this->debug("$k: $v");
-			}
-			// get SOAPAction header
-			if(isset($this->headers['soapaction'])){
-				$this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
-			}
-			// get the character encoding of the incoming request
-			if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
-				$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
-				if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
-					$this->xml_encoding = strtoupper($enc);
-				} else {
-					$this->xml_encoding = 'US-ASCII';
-				}
-			} else {
-				// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-				$this->xml_encoding = 'UTF-8';
-			}
-		} elseif(isset($_SERVER) && is_array($_SERVER)){
-			$this->debug("In parse_http_headers, use _SERVER");
-			foreach ($_SERVER as $k => $v) {
-				if (substr($k, 0, 5) == 'HTTP_') {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
-				} else {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
-				}
-				if ($k == 'soapaction') {
-					// get SOAPAction header
-					$k = 'SOAPAction';
-					$v = str_replace('"', '', $v);
-					$v = str_replace('\\', '', $v);
-					$this->SOAPAction = $v;
-				} else if ($k == 'content-type') {
-					// get the character encoding of the incoming request
-					if (strpos($v, '=')) {
-						$enc = substr(strstr($v, '='), 1);
-						$enc = str_replace('"', '', $enc);
-						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
-							$this->xml_encoding = strtoupper($enc);
-						} else {
-							$this->xml_encoding = 'US-ASCII';
-						}
-					} else {
-						// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-						$this->xml_encoding = 'UTF-8';
-					}
-				}
-				$this->headers[$k] = $v;
-				$this->request .= "$k: $v\r\n";
-				$this->debug("$k: $v");
-			}
-		} elseif (is_array($HTTP_SERVER_VARS)) {
-			$this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
-			foreach ($HTTP_SERVER_VARS as $k => $v) {
-				if (substr($k, 0, 5) == 'HTTP_') {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
-				} else {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
-				}
-				if ($k == 'soapaction') {
-					// get SOAPAction header
-					$k = 'SOAPAction';
-					$v = str_replace('"', '', $v);
-					$v = str_replace('\\', '', $v);
-					$this->SOAPAction = $v;
-				} else if ($k == 'content-type') {
-					// get the character encoding of the incoming request
-					if (strpos($v, '=')) {
-						$enc = substr(strstr($v, '='), 1);
-						$enc = str_replace('"', '', $enc);
-						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
-							$this->xml_encoding = strtoupper($enc);
-						} else {
-							$this->xml_encoding = 'US-ASCII';
-						}
-					} else {
-						// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-						$this->xml_encoding = 'UTF-8';
-					}
-				}
-				$this->headers[$k] = $v;
-				$this->request .= "$k: $v\r\n";
-				$this->debug("$k: $v");
-			}
-		} else {
-			$this->debug("In parse_http_headers, HTTP headers not accessible");
-			$this->setError("HTTP headers not accessible");
-		}
-	}
-
-	/**
-	* parses a request
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* headers
-	* request
-	* xml_encoding
-	* SOAPAction
-	* request
-	* requestSOAP
-	* methodURI
-	* methodname
-	* methodparams
-	* requestHeaders
-	* document
-	*
-	* This sets the fault field on error
-	*
-	* @param    string $data XML string
-	* @access   private
-	*/
-	function parse_request($data='') {
-		$this->debug('entering parse_request()');
-		$this->parse_http_headers();
-		$this->debug('got character encoding: '.$this->xml_encoding);
-		// uncompress if necessary
-		if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
-			$this->debug('got content encoding: ' . $this->headers['content-encoding']);
-			if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
-		    	// if decoding works, use it. else assume data wasn't gzencoded
-				if (function_exists('gzuncompress')) {
-					if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
-						$data = $degzdata;
-					} elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
-						$data = $degzdata;
-					} else {
-						$this->fault('Client', 'Errors occurred when trying to decode the data');
-						return;
-					}
-				} else {
-					$this->fault('Client', 'This Server does not support compressed data');
-					return;
-				}
-			}
-		}
-		$this->request .= "\r\n".$data;
-		$data = $this->parseRequest($this->headers, $data);
-		$this->requestSOAP = $data;
-		$this->debug('leaving parse_request');
-	}
-
-	/**
-	* invokes a PHP function for the requested SOAP method
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* methodreturn
-	*
-	* Note that the PHP function that is called may also set the following
-	* fields to affect the response sent to the client
-	*
-	* responseHeaders
-	* outgoing_headers
-	*
-	* This sets the fault field on error
-	*
-	* @access   private
-	*/
-	function invoke_method() {
-		$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
-
-		if ($this->wsdl) {
-			if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
-				$this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
-			} elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
-				// Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
-				$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
-				$this->methodname = $this->opData['name'];
-			} else {
-				$this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
-				$this->fault('Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
-				return;
-			}
-		} else {
-			$this->debug('in invoke_method, no WSDL to validate method');
-		}
-
-		// if a . is present in $this->methodname, we see if there is a class in scope,
-		// which could be referred to. We will also distinguish between two deliminators,
-		// to allow methods to be called a the class or an instance
-		$class = '';
-		$method = '';
-		if (strpos($this->methodname, '..') > 0) {
-			$delim = '..';
-		} else if (strpos($this->methodname, '.') > 0) {
-			$delim = '.';
-		} else {
-			$delim = '';
-		}
-
-		if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
-			class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
-			// get the class and method name
-			$class = substr($this->methodname, 0, strpos($this->methodname, $delim));
-			$method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
-			$this->debug("in invoke_method, class=$class method=$method delim=$delim");
-		}
-
-		// does method exist?
-		if ($class == '') {
-			if (!function_exists($this->methodname)) {
-				$this->debug("in invoke_method, function '$this->methodname' not found!");
-				$this->result = 'fault: method not found';
-				$this->fault('Client',"method '$this->methodname' not defined in service");
-				return;
-			}
-		} else {
-			$method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
-			if (!in_array($method_to_compare, get_class_methods($class))) {
-				$this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
-				$this->result = 'fault: method not found';
-				$this->fault('Client',"method '$this->methodname' not defined in service");
-				return;
-			}
-		}
-
-		// evaluate message, getting back parameters
-		// verify that request parameters match the method's signature
-		if(! $this->verify_method($this->methodname,$this->methodparams)){
-			// debug
-			$this->debug('ERROR: request not verified against method signature');
-			$this->result = 'fault: request failed validation against method signature';
-			// return fault
-			$this->fault('Client',"Operation '$this->methodname' not defined in service.");
-			return;
-		}
-
-		// if there are parameters to pass
-		$this->debug('in invoke_method, params:');
-		$this->appendDebug($this->varDump($this->methodparams));
-		$this->debug("in invoke_method, calling '$this->methodname'");
-		if (!function_exists('call_user_func_array')) {
-			if ($class == '') {
-				$this->debug('in invoke_method, calling function using eval()');
-				$funcCall = "\$this->methodreturn = $this->methodname(";
-			} else {
-				if ($delim == '..') {
-					$this->debug('in invoke_method, calling class method using eval()');
-					$funcCall = "\$this->methodreturn = ".$class."::".$method."(";
-				} else {
-					$this->debug('in invoke_method, calling instance method using eval()');
-					// generate unique instance name
-					$instname = "\$inst_".time();
-					$funcCall = $instname." = new ".$class."(); ";
-					$funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
-				}
-			}
-			if ($this->methodparams) {
-				foreach ($this->methodparams as $param) {
-					if (is_array($param)) {
-						$this->fault('Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
-						return;
-					}
-					$funcCall .= "\"$param\",";
-				}
-				$funcCall = substr($funcCall, 0, -1);
-			}
-			$funcCall .= ');';
-			$this->debug('in invoke_method, function call: '.$funcCall);
-			@eval($funcCall);
-		} else {
-			if ($class == '') {
-				$this->debug('in invoke_method, calling function using call_user_func_array()');
-				$call_arg = "$this->methodname";	// straight assignment changes $this->methodname to lower case after call_user_func_array()
-			} elseif ($delim == '..') {
-				$this->debug('in invoke_method, calling class method using call_user_func_array()');
-				$call_arg = array ($class, $method);
-			} else {
-				$this->debug('in invoke_method, calling instance method using call_user_func_array()');
-				$instance = new $class ();
-				$call_arg = array(&$instance, $method);
-			}
-			$this->methodreturn = call_user_func_array($call_arg, $this->methodparams);
-		}
-        $this->debug('in invoke_method, methodreturn:');
-        $this->appendDebug($this->varDump($this->methodreturn));
-		$this->debug("in invoke_method, called method $this->methodname, received $this->methodreturn of type ".gettype($this->methodreturn));
-	}
-
-	/**
-	* serializes the return value from a PHP function into a full SOAP Envelope
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* responseSOAP
-	*
-	* This sets the fault field on error
-	*
-	* @access   private
-	*/
-	function serialize_return() {
-		$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
-		// if fault
-		if (isset($this->methodreturn) && (get_class($this->methodreturn) == 'soap_fault')) {
-			$this->debug('got a fault object from method');
-			$this->fault = $this->methodreturn;
-			return;
-		} elseif ($this->methodreturnisliteralxml) {
-			$return_val = $this->methodreturn;
-		// returned value(s)
-		} else {
-			$this->debug('got a(n) '.gettype($this->methodreturn).' from method');
-			$this->debug('serializing return value');
-			if($this->wsdl){
-				// weak attempt at supporting multiple output params
-				if(sizeof($this->opData['output']['parts']) > 1){
-			    	$opParams = $this->methodreturn;
-			    } else {
-			    	// TODO: is this really necessary?
-			    	$opParams = array($this->methodreturn);
-			    }
-			    $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
-			    $this->appendDebug($this->wsdl->getDebug());
-			    $this->wsdl->clearDebug();
-				if($errstr = $this->wsdl->getError()){
-					$this->debug('got wsdl error: '.$errstr);
-					$this->fault('Server', 'unable to serialize result');
-					return;
-				}
-			} else {
-				if (isset($this->methodreturn)) {
-					$return_val = $this->serialize_val($this->methodreturn, 'return');
-				} else {
-					$return_val = '';
-					$this->debug('in absence of WSDL, assume void return for backward compatibility');
-				}
-			}
-		}
-		$this->debug('return value:');
-		$this->appendDebug($this->varDump($return_val));
-
-		$this->debug('serializing response');
-		if ($this->wsdl) {
-			$this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
-			if ($this->opData['style'] == 'rpc') {
-				$this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
-				if ($this->opData['output']['use'] == 'literal') {
-					$payload = '<'.$this->methodname.'Response xmlns="'.$this->methodURI.'">'.$return_val.'</'.$this->methodname."Response>";
-				} else {
-					$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
-				}
-			} else {
-				$this->debug('style is not rpc for serialization: assume document');
-				$payload = $return_val;
-			}
-		} else {
-			$this->debug('do not have WSDL for serialization: assume rpc/encoded');
-			$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
-		}
-		$this->result = 'successful';
-		if($this->wsdl){
-			//if($this->debug_flag){
-            	$this->appendDebug($this->wsdl->getDebug());
-            //	}
-			if (isset($opData['output']['encodingStyle'])) {
-				$encodingStyle = $opData['output']['encodingStyle'];
-			} else {
-				$encodingStyle = '';
-			}
-			// Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$encodingStyle);
-		} else {
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
-		}
-		$this->debug("Leaving serialize_return");
-	}
-
-	/**
-	* sends an HTTP response
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* outgoing_headers
-	* response
-	*
-	* @access   private
-	*/
-	function send_response() {
-		$this->debug('Enter send_response');
-		if ($this->fault) {
-			$payload = $this->fault->serialize();
-			$this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
-			$this->outgoing_headers[] = "Status: 500 Internal Server Error";
-		} else {
-			$payload = $this->responseSOAP;
-			// Some combinations of PHP+Web server allow the Status
-			// to come through as a header.  Since OK is the default
-			// just do nothing.
-			// $this->outgoing_headers[] = "HTTP/1.0 200 OK";
-			// $this->outgoing_headers[] = "Status: 200 OK";
-		}
-        // add debug data if in debug mode
-		if(isset($this->debug_flag) && $this->debug_flag){
-        	$payload .= $this->getDebugAsXMLComment();
-        }
-		$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
-		ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
-		$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
-		// Let the Web server decide about this
-		//$this->outgoing_headers[] = "Connection: Close\r\n";
-		$payload = $this->getHTTPBody($payload);
-		$type = $this->getHTTPContentType();
-		$charset = $this->getHTTPContentTypeCharset();
-		$this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
-		//begin code to compress payload - by John
-		// NOTE: there is no way to know whether the Web server will also compress
-		// this data.
-		if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {	
-			if (strstr($this->headers['accept-encoding'], 'gzip')) {
-				if (function_exists('gzencode')) {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content being gzipped -->";
-					}
-					$this->outgoing_headers[] = "Content-Encoding: gzip";
-					$payload = gzencode($payload);
-				} else {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content will not be gzipped: no gzencode -->";
-					}
-				}
-			} elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
-				// Note: MSIE requires gzdeflate output (no Zlib header and checksum),
-				// instead of gzcompress output,
-				// which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
-				if (function_exists('gzdeflate')) {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content being deflated -->";
-					}
-					$this->outgoing_headers[] = "Content-Encoding: deflate";
-					$payload = gzdeflate($payload);
-				} else {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content will not be deflated: no gzcompress -->";
-					}
-				}
-			}
-		}
-		//end code
-		$this->outgoing_headers[] = "Content-Length: ".strlen($payload);
-		reset($this->outgoing_headers);
-		foreach($this->outgoing_headers as $hdr){
-			header($hdr, false);
-		}
-		print $payload;
-		$this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
-	}
-
-	/**
-	* takes the value that was created by parsing the request
-	* and compares to the method's signature, if available.
-	*
-	* @param	string	$operation	The operation to be invoked
-	* @param	array	$request	The array of parameter values
-	* @return	boolean	Whether the operation was found
-	* @access   private
-	*/
-	function verify_method($operation,$request){
-		if(isset($this->wsdl) && is_object($this->wsdl)){
-			if($this->wsdl->getOperationData($operation)){
-				return true;
-			}
-	    } elseif(isset($this->operations[$operation])){
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	* processes SOAP message received from client
-	*
-	* @param	array	$headers	The HTTP headers
-	* @param	string	$data		unprocessed request data from client
-	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
-	*/
-    function parseRequest($headers, $data) {
-		$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
-		if (!strstr($headers['content-type'], 'text/xml')) {
-			$this->setError('Request not of type text/xml');
-			return false;
-		}
-		if (strpos($headers['content-type'], '=')) {
-			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
-			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
-				$this->xml_encoding = strtoupper($enc);
-			} else {
-				$this->xml_encoding = 'US-ASCII';
-			}
-		} else {
-			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-			$this->xml_encoding = 'UTF-8';
-		}
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
-		// parse response, get soap parser obj
-		$parser = new soap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
-		// parser debug
-		$this->debug("parser debug: \n".$parser->getDebug());
-		// if fault occurred during message parsing
-		if($err = $parser->getError()){
-			$this->result = 'fault: error in msg parsing: '.$err;
-			$this->fault('Client',"error in msg parsing:\n".$err);
-		// else successfully parsed request into soapval object
-		} else {
-			// get/set methodname
-			$this->methodURI = $parser->root_struct_namespace;
-			$this->methodname = $parser->root_struct_name;
-			$this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
-			$this->debug('calling parser->get_response()');
-			$this->methodparams = $parser->get_response();
-			// get SOAP headers
-			$this->requestHeaders = $parser->getHeaders();
-            // add document for doclit support
-            $this->document = $parser->document;
-		}
-	 }
-
-	/**
-	* gets the HTTP body for the current response.
-	*
-	* @param string $soapmsg The SOAP payload
-	* @return string The HTTP body, which includes the SOAP payload
-	* @access private
-	*/
-	function getHTTPBody($soapmsg) {
-		return $soapmsg;
-	}
-	
-	/**
-	* gets the HTTP content type for the current response.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type for the current response.
-	* @access private
-	*/
-	function getHTTPContentType() {
-		return 'text/xml';
-	}
-	
-	/**
-	* gets the HTTP content type charset for the current response.
-	* returns false for non-text content types.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type charset for the current response.
-	* @access private
-	*/
-	function getHTTPContentTypeCharset() {
-		return $this->soap_defencoding;
-	}
-
-	/**
-	* add a method to the dispatch map (this has been replaced by the register method)
-	*
-	* @param    string $methodname
-	* @param    string $in array of input values
-	* @param    string $out array of output values
-	* @access   public
-	* @deprecated
-	*/
-	function add_to_map($methodname,$in,$out){
-			$this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
-	}
-
-	/**
-	* register a service function with the server
-	*
-	* @param    string $name the name of the PHP function, class.method or class..method
-	* @param    array $in assoc array of input values: key = param name, value = param type
-	* @param    array $out assoc array of output values: key = param name, value = param type
-	* @param	mixed $namespace the element namespace for the method or false
-	* @param	mixed $soapaction the soapaction for the method or false
-	* @param	mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
-	* @param	mixed $use optional (encoded|literal) or false
-	* @param	string $documentation optional Description to include in WSDL
-	* @param	string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
-	* @access   public
-	*/
-	function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
-		global $HTTP_SERVER_VARS;
-
-		if($this->externalWSDLURL){
-			die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
-		}
-		if (! $name) {
-			die('You must specify a name when you register an operation');
-		}
-		if (!is_array($in)) {
-			die('You must provide an array for operation inputs');
-		}
-		if (!is_array($out)) {
-			die('You must provide an array for operation outputs');
-		}
-		if(false == $namespace) {
-		}
-		if(false == $soapaction) {
-			if (isset($_SERVER)) {
-				$SERVER_NAME = $_SERVER['SERVER_NAME'];
-				$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
-			} elseif (isset($HTTP_SERVER_VARS)) {
-				$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
-				$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
-			} else {
-				$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
-			}
-			$soapaction = "http://$SERVER_NAME$SCRIPT_NAME/$name";
-		}
-		if(false == $style) {
-			$style = "rpc";
-		}
-		if(false == $use) {
-			$use = "encoded";
-		}
-		if ($use == 'encoded' && $encodingStyle = '') {
-			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		}
-
-		$this->operations[$name] = array(
-	    'name' => $name,
-	    'in' => $in,
-	    'out' => $out,
-	    'namespace' => $namespace,
-	    'soapaction' => $soapaction,
-	    'style' => $style);
-        if($this->wsdl){
-        	$this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
-	    }
-		return true;
-	}
-
-	/**
-	* Specify a fault to be returned to the client.
-	* This also acts as a flag to the server that a fault has occured.
-	*
-	* @param	string $faultcode
-	* @param	string $faultstring
-	* @param	string $faultactor
-	* @param	string $faultdetail
-	* @access   public
-	*/
-	function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
-		if ($faultdetail == '' && $this->debug_flag) {
-			$faultdetail = $this->getDebug();
-		}
-		$this->fault = new soap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
-		$this->fault->soap_defencoding = $this->soap_defencoding;
-	}
-
-    /**
-    * Sets up wsdl object.
-    * Acts as a flag to enable internal WSDL generation
-    *
-    * @param string $serviceName, name of the service
-    * @param mixed $namespace optional 'tns' service namespace or false
-    * @param mixed $endpoint optional URL of service endpoint or false
-    * @param string $style optional (rpc|document) WSDL style (also specified by operation)
-    * @param string $transport optional SOAP transport
-    * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false
-    */
-    function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
-    {
-    	global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER)) {
-			$SERVER_NAME = $_SERVER['SERVER_NAME'];
-			$SERVER_PORT = $_SERVER['SERVER_PORT'];
-			$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
-			$HTTPS = $_SERVER['HTTPS'];
-		} elseif (isset($HTTP_SERVER_VARS)) {
-			$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
-			$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
-			$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
-			$HTTPS = $HTTP_SERVER_VARS['HTTPS'];
-		} else {
-			$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
-		}
-		if ($SERVER_PORT == 80) {
-			$SERVER_PORT = '';
-		} else {
-			$SERVER_PORT = ':' . $SERVER_PORT;
-		}
-        if(false == $namespace) {
-            $namespace = "http://$SERVER_NAME/soap/$serviceName";
-        }
-        
-        if(false == $endpoint) {
-        	if ($HTTPS == '1' || $HTTPS == 'on') {
-        		$SCHEME = 'https';
-        	} else {
-        		$SCHEME = 'http';
-        	}
-            $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
-        }
-        
-        if(false == $schemaTargetNamespace) {
-            $schemaTargetNamespace = $namespace;
-        }
-        
-		$this->wsdl = new wsdl;
-		$this->wsdl->serviceName = $serviceName;
-        $this->wsdl->endpoint = $endpoint;
-		$this->wsdl->namespaces['tns'] = $namespace;
-		$this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		$this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
-		if ($schemaTargetNamespace != $namespace) {
-			$this->wsdl->namespaces['types'] = $schemaTargetNamespace;
-		}
-        $this->wsdl->schemas[$schemaTargetNamespace][0] = new xmlschema('', '', $this->wsdl->namespaces);
-        $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
-        $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
-        $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
-        $this->wsdl->bindings[$serviceName.'Binding'] = array(
-        	'name'=>$serviceName.'Binding',
-            'style'=>$style,
-            'transport'=>$transport,
-            'portType'=>$serviceName.'PortType');
-        $this->wsdl->ports[$serviceName.'Port'] = array(
-        	'binding'=>$serviceName.'Binding',
-            'location'=>$endpoint,
-            'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/');
-    }
-}
-
-
-
-
-?>
diff --git a/libraries/nusoap/class.soap_transport_http.php b/libraries/nusoap/class.soap_transport_http.php
deleted file mode 100644
index 5ab0e4e29..000000000
--- a/libraries/nusoap/class.soap_transport_http.php
+++ /dev/null
@@ -1,1038 +0,0 @@
-<?php
-
-
-
-
-/**
-* transport class for sending/receiving data via HTTP and HTTPS
-* NOTE: PHP must be compiled with the CURL extension for HTTPS support
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.soap_transport_http.php,v 1.57 2005/07/27 19:24:42 snichol Exp $
-* @access public
-*/
-class soap_transport_http extends nusoap_base {
-
-	var $url = '';
-	var $uri = '';
-	var $digest_uri = '';
-	var $scheme = '';
-	var $host = '';
-	var $port = '';
-	var $path = '';
-	var $request_method = 'POST';
-	var $protocol_version = '1.0';
-	var $encoding = '';
-	var $outgoing_headers = array();
-	var $incoming_headers = array();
-	var $incoming_cookies = array();
-	var $outgoing_payload = '';
-	var $incoming_payload = '';
-	var $useSOAPAction = true;
-	var $persistentConnection = false;
-	var $ch = false;	// cURL handle
-	var $username = '';
-	var $password = '';
-	var $authtype = '';
-	var $digestRequest = array();
-	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional)
-								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
-								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
-								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
-								// passphrase: SSL key password/passphrase
-								// verifypeer: default is 1
-								// verifyhost: default is 1
-
-	/**
-	* constructor
-	*/
-	function soap_transport_http($url){
-		parent::nusoap_base();
-		$this->setURL($url);
-		ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
-		$this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
-		$this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
-	}
-
-	function setURL($url) {
-		$this->url = $url;
-
-		$u = parse_url($url);
-		foreach($u as $k => $v){
-			$this->debug("$k = $v");
-			$this->$k = $v;
-		}
-		
-		// add any GET params to path
-		if(isset($u['query']) && $u['query'] != ''){
-            $this->path .= '?' . $u['query'];
-		}
-		
-		// set default port
-		if(!isset($u['port'])){
-			if($u['scheme'] == 'https'){
-				$this->port = 443;
-			} else {
-				$this->port = 80;
-			}
-		}
-		
-		$this->uri = $this->path;
-		$this->digest_uri = $this->uri;
-		
-		// build headers
-		if (!isset($u['port'])) {
-			$this->outgoing_headers['Host'] = $this->host;
-		} else {
-			$this->outgoing_headers['Host'] = $this->host.':'.$this->port;
-		}
-		$this->debug('set Host: ' . $this->outgoing_headers['Host']);
-
-		if (isset($u['user']) && $u['user'] != '') {
-			$this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
-		}
-	}
-	
-	function connect($connection_timeout=0,$response_timeout=30){
-	  	// For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
-	  	// "regular" socket.
-	  	// TODO: disabled for now because OpenSSL must be *compiled* in (not just
-	  	//       loaded), and until PHP5 stream_get_wrappers is not available.
-//	  	if ($this->scheme == 'https') {
-//		  	if (version_compare(phpversion(), '4.3.0') >= 0) {
-//		  		if (extension_loaded('openssl')) {
-//		  			$this->scheme = 'ssl';
-//		  			$this->debug('Using SSL over OpenSSL');
-//		  		}
-//		  	}
-//		}
-		$this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-		// use persistent connection
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
-			if (!feof($this->fp)) {
-				$this->debug('Re-use persistent connection');
-				return true;
-			}
-			fclose($this->fp);
-			$this->debug('Closed persistent connection at EOF');
-		}
-
-		// munge host if using OpenSSL
-		if ($this->scheme == 'ssl') {
-			$host = 'ssl://' . $this->host;
-		} else {
-			$host = $this->host;
-		}
-		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
-
-		// open socket
-		if($connection_timeout > 0){
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
-		} else {
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
-		}
-		
-		// test pointer
-		if(!$this->fp) {
-			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
-			if ($this->errno) {
-				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
-			} else {
-				$msg .= ' prior to connect().  This is often a problem looking up the host name.';
-			}
-			$this->debug($msg);
-			$this->setError($msg);
-			return false;
-		}
-		
-		// set response timeout
-		$this->debug('set response timeout to ' . $response_timeout);
-		socket_set_timeout( $this->fp, $response_timeout);
-
-		$this->debug('socket connected');
-		return true;
-	  } else if ($this->scheme == 'https') {
-		if (!extension_loaded('curl')) {
-			$this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
-			return false;
-		}
-		$this->debug('connect using https');
-		// init CURL
-		$this->ch = curl_init();
-		// set url
-		$hostURL = ($this->port != '') ? "https://$this->host:$this->port" : "https://$this->host";
-		// add path
-		$hostURL .= $this->path;
-		curl_setopt($this->ch, CURLOPT_URL, $hostURL);
-		// follow location headers (re-directs)
-		curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
-		// ask for headers in the response output
-		curl_setopt($this->ch, CURLOPT_HEADER, 1);
-		// ask for the response output as the return value
-		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
-		// encode
-		// We manage this ourselves through headers and encoding
-//		if(function_exists('gzuncompress')){
-//			curl_setopt($this->ch, CURLOPT_ENCODING, 'deflate');
-//		}
-		// persistent connection
-		if ($this->persistentConnection) {
-			// The way we send data, we cannot use persistent connections, since
-			// there will be some "junk" at the end of our request.
-			//curl_setopt($this->ch, CURL_HTTP_VERSION_1_1, true);
-			$this->persistentConnection = false;
-			$this->outgoing_headers['Connection'] = 'close';
-			$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-		}
-		// set timeout
-		if ($connection_timeout != 0) {
-			curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
-		}
-		// TODO: cURL has added a connection timeout separate from the response timeout
-		//if ($connection_timeout != 0) {
-		//	curl_setopt($this->ch, CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
-		//}
-		//if ($response_timeout != 0) {
-		//	curl_setopt($this->ch, CURLOPT_TIMEOUT, $response_timeout);
-		//}
-
-		// recent versions of cURL turn on peer/host checking by default,
-		// while PHP binaries are not compiled with a default location for the
-		// CA cert bundle, so disable peer/host checking.
-//curl_setopt($this->ch, CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');		
-		curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
-		curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
-
-		// support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
-		if ($this->authtype == 'certificate') {
-			if (isset($this->certRequest['cainfofile'])) {
-				curl_setopt($this->ch, CURLOPT_CAINFO, $this->certRequest['cainfofile']);
-			}
-			if (isset($this->certRequest['verifypeer'])) {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
-			} else {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
-			}
-			if (isset($this->certRequest['verifyhost'])) {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
-			} else {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
-			}
-			if (isset($this->certRequest['sslcertfile'])) {
-				curl_setopt($this->ch, CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
-			}
-			if (isset($this->certRequest['sslkeyfile'])) {
-				curl_setopt($this->ch, CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
-			}
-			if (isset($this->certRequest['passphrase'])) {
-				curl_setopt($this->ch, CURLOPT_SSLKEYPASSWD , $this->certRequest['passphrase']);
-			}
-		}
-		$this->debug('cURL connection set up');
-		return true;
-	  } else {
-		$this->setError('Unknown scheme ' . $this->scheme);
-		$this->debug('Unknown scheme ' . $this->scheme);
-		return false;
-	  }
-	}
-	
-	/**
-	* send the SOAP message via HTTP
-	*
-	* @param    string $data message data
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @param	array $cookies cookies to send
-	* @return	string data
-	* @access   public
-	*/
-	function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
-		
-		$this->debug('entered send() with data of length: '.strlen($data));
-
-		$this->tryagain = true;
-		$tries = 0;
-		while ($this->tryagain) {
-			$this->tryagain = false;
-			if ($tries++ < 2) {
-				// make connnection
-				if (!$this->connect($timeout, $response_timeout)){
-					return false;
-				}
-				
-				// send request
-				if (!$this->sendRequest($data, $cookies)){
-					return false;
-				}
-				
-				// get response
-				$respdata = $this->getResponse();
-			} else {
-				$this->setError('Too many tries to get an OK response');
-			}
-		}		
-		$this->debug('end of send()');
-		return $respdata;
-	}
-
-
-	/**
-	* send the SOAP message via HTTPS 1.0 using CURL
-	*
-	* @param    string $msg message data
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @param	array $cookies cookies to send
-	* @return	string data
-	* @access   public
-	*/
-	function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
-		return $this->send($data, $timeout, $response_timeout, $cookies);
-	}
-	
-	/**
-	* if authenticating, set user credentials here
-	*
-	* @param    string $username
-	* @param    string $password
-	* @param	string $authtype (basic, digest, certificate)
-	* @param	array $digestRequest (keys must be nonce, nc, realm, qop)
-	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
-	* @access   public
-	*/
-	function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
-		$this->debug("Set credentials for authtype $authtype");
-		// cf. RFC 2617
-		if ($authtype == 'basic') {
-			$this->outgoing_headers['Authorization'] = 'Basic '.base64_encode(str_replace(':','',$username).':'.$password);
-		} elseif ($authtype == 'digest') {
-			if (isset($digestRequest['nonce'])) {
-				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
-				
-				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
-	
-				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
-	
-				// H(A1) = MD5(A1)
-				$HA1 = md5($A1);
-	
-				// A2 = Method ":" digest-uri-value
-				$A2 = 'POST:' . $this->digest_uri;
-	
-				// H(A2)
-				$HA2 =  md5($A2);
-	
-				// KD(secret, data) = H(concat(secret, ":", data))
-				// if qop == auth:
-				// request-digest  = <"> < KD ( H(A1),     unq(nonce-value)
-				//                              ":" nc-value
-				//                              ":" unq(cnonce-value)
-				//                              ":" unq(qop-value)
-				//                              ":" H(A2)
-				//                            ) <">
-				// if qop is missing,
-				// request-digest  = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
-	
-				$unhashedDigest = '';
-				$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
-				$cnonce = $nonce;
-				if ($digestRequest['qop'] != '') {
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
-				} else {
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
-				}
-	
-				$hashedDigest = md5($unhashedDigest);
-	
-				$this->outgoing_headers['Authorization'] = 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"';
-			}
-		} elseif ($authtype == 'certificate') {
-			$this->certRequest = $certRequest;
-		}
-		$this->username = $username;
-		$this->password = $password;
-		$this->authtype = $authtype;
-		$this->digestRequest = $digestRequest;
-		
-		if (isset($this->outgoing_headers['Authorization'])) {
-			$this->debug('set Authorization: ' . substr($this->outgoing_headers['Authorization'], 0, 12) . '...');
-		} else {
-			$this->debug('Authorization header not set');
-		}
-	}
-	
-	/**
-	* set the soapaction value
-	*
-	* @param    string $soapaction
-	* @access   public
-	*/
-	function setSOAPAction($soapaction) {
-		$this->outgoing_headers['SOAPAction'] = '"' . $soapaction . '"';
-		$this->debug('set SOAPAction: ' . $this->outgoing_headers['SOAPAction']);
-	}
-	
-	/**
-	* use http encoding
-	*
-	* @param    string $enc encoding style. supported values: gzip, deflate, or both
-	* @access   public
-	*/
-	function setEncoding($enc='gzip, deflate') {
-		if (function_exists('gzdeflate')) {
-			$this->protocol_version = '1.1';
-			$this->outgoing_headers['Accept-Encoding'] = $enc;
-			$this->debug('set Accept-Encoding: ' . $this->outgoing_headers['Accept-Encoding']);
-			if (!isset($this->outgoing_headers['Connection'])) {
-				$this->outgoing_headers['Connection'] = 'close';
-				$this->persistentConnection = false;
-				$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-			}
-			set_magic_quotes_runtime(0);
-			// deprecated
-			$this->encoding = $enc;
-		}
-	}
-	
-	/**
-	* set proxy info here
-	*
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @access   public
-	*/
-	function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
-		$this->uri = $this->url;
-		$this->host = $proxyhost;
-		$this->port = $proxyport;
-		if ($proxyusername != '' && $proxypassword != '') {
-			$this->outgoing_headers['Proxy-Authorization'] = ' Basic '.base64_encode($proxyusername.':'.$proxypassword);
-			$this->debug('set Proxy-Authorization: ' . $this->outgoing_headers['Proxy-Authorization']);
-		}
-	}
-	
-	/**
-	* decode a string that is encoded w/ "chunked' transfer encoding
- 	* as defined in RFC2068 19.4.6
-	*
-	* @param    string $buffer
-	* @param    string $lb
-	* @returns	string
-	* @access   public
-	* @deprecated
-	*/
-	function decodeChunked($buffer, $lb){
-		// length := 0
-		$length = 0;
-		$new = '';
-		
-		// read chunk-size, chunk-extension (if any) and CRLF
-		// get the position of the linebreak
-		$chunkend = strpos($buffer, $lb);
-		if ($chunkend == FALSE) {
-			$this->debug('no linebreak found in decodeChunked');
-			return $new;
-		}
-		$temp = substr($buffer,0,$chunkend);
-		$chunk_size = hexdec( trim($temp) );
-		$chunkstart = $chunkend + strlen($lb);
-		// while (chunk-size > 0) {
-		while ($chunk_size > 0) {
-			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
-		  	
-			// Just in case we got a broken connection
-		  	if ($chunkend == FALSE) {
-		  	    $chunk = substr($buffer,$chunkstart);
-				// append chunk-data to entity-body
-		    	$new .= $chunk;
-		  	    $length += strlen($chunk);
-		  	    break;
-			}
-			
-		  	// read chunk-data and CRLF
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
-		  	// append chunk-data to entity-body
-		  	$new .= $chunk;
-		  	// length := length + chunk-size
-		  	$length += strlen($chunk);
-		  	// read chunk-size and CRLF
-		  	$chunkstart = $chunkend + strlen($lb);
-			
-		  	$chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
-			if ($chunkend == FALSE) {
-				break; //Just in case we got a broken connection
-			}
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
-			$chunk_size = hexdec( trim($temp) );
-			$chunkstart = $chunkend;
-		}
-		return $new;
-	}
-	
-	/*
-	 *	Writes payload, including HTTP headers, to $this->outgoing_payload.
-	 */
-	function buildPayload($data, $cookie_str = '') {
-		// add content-length header
-		$this->outgoing_headers['Content-Length'] = strlen($data);
-		$this->debug('set Content-Length: ' . $this->outgoing_headers['Content-Length']);
-
-		// start building outgoing payload:
-		$req = "$this->request_method $this->uri HTTP/$this->protocol_version";
-		$this->debug("HTTP request: $req");
-		$this->outgoing_payload = "$req\r\n";
-
-		// loop thru headers, serializing
-		foreach($this->outgoing_headers as $k => $v){
-			$hdr = $k.': '.$v;
-			$this->debug("HTTP header: $hdr");
-			$this->outgoing_payload .= "$hdr\r\n";
-		}
-
-		// add any cookies
-		if ($cookie_str != '') {
-			$hdr = 'Cookie: '.$cookie_str;
-			$this->debug("HTTP header: $hdr");
-			$this->outgoing_payload .= "$hdr\r\n";
-		}
-
-		// header/body separator
-		$this->outgoing_payload .= "\r\n";
-		
-		// add data
-		$this->outgoing_payload .= $data;
-	}
-
-	function sendRequest($data, $cookies = NULL) {
-		// build cookie string
-		$cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
-
-		// build payload
-		$this->buildPayload($data, $cookie_str);
-
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-		// send payload
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
-			$this->setError('couldn\'t write message data to socket');
-			$this->debug('couldn\'t write message data to socket');
-			return false;
-		}
-		$this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
-		return true;
-	  } else if ($this->scheme == 'https') {
-		// set payload
-		// TODO: cURL does say this should only be the verb, and in fact it
-		// turns out that the URI and HTTP version are appended to this, which
-		// some servers refuse to work with
-		//curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
-		foreach($this->outgoing_headers as $k => $v){
-			$curl_headers[] = "$k: $v";
-		}
-		if ($cookie_str != '') {
-			$curl_headers[] = 'Cookie: ' . $cookie_str;
-		}
-		curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
-		if ($this->request_method == "POST") {
-	  		curl_setopt($this->ch, CURLOPT_POST, 1);
-	  		curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
-	  	} else {
-	  	}
-		$this->debug('set cURL payload');
-		return true;
-	  }
-	}
-
-	function getResponse(){
-		$this->incoming_payload = '';
-	    
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-	    // loop until headers have been retrieved
-	    $data = '';
-	    while (!isset($lb)){
-
-			// We might EOF during header read.
-			if(feof($this->fp)) {
-				$this->incoming_payload = $data;
-				$this->debug('found no headers before EOF after length ' . strlen($data));
-				$this->debug("received before EOF:\n" . $data);
-				$this->setError('server failed to send headers');
-				return false;
-			}
-
-			$tmp = fgets($this->fp, 256);
-			$tmplen = strlen($tmp);
-			$this->debug("read line of $tmplen bytes: " . trim($tmp));
-
-			if ($tmplen == 0) {
-				$this->incoming_payload = $data;
-				$this->debug('socket read of headers timed out after length ' . strlen($data));
-				$this->debug("read before timeout: " . $data);
-				$this->setError('socket read of headers timed out');
-				return false;
-			}
-
-			$data .= $tmp;
-			$pos = strpos($data,"\r\n\r\n");
-			if($pos > 1){
-				$lb = "\r\n";
-			} else {
-				$pos = strpos($data,"\n\n");
-				if($pos > 1){
-					$lb = "\n";
-				}
-			}
-			// remove 100 header
-			if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
-				unset($lb);
-				$data = '';
-			}//
-		}
-		// store header data
-		$this->incoming_payload .= $data;
-		$this->debug('found end of headers after length ' . strlen($data));
-		// process headers
-		$header_data = trim(substr($data,0,$pos));
-		$header_array = explode($lb,$header_data);
-		$this->incoming_headers = array();
-		$this->incoming_cookies = array();
-		foreach($header_array as $header_line){
-			$arr = explode(':',$header_line, 2);
-			if(count($arr) > 1){
-				$header_name = strtolower(trim($arr[0]));
-				$this->incoming_headers[$header_name] = trim($arr[1]);
-				if ($header_name == 'set-cookie') {
-					// TODO: allow multiple cookies from parseCookie
-					$cookie = $this->parseCookie(trim($arr[1]));
-					if ($cookie) {
-						$this->incoming_cookies[] = $cookie;
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
-					} else {
-						$this->debug('did not find cookie in ' . trim($arr[1]));
-					}
-    			}
-			} else if (isset($header_name)) {
-				// append continuation line to previous header
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
-			}
-		}
-		
-		// loop until msg has been received
-		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
-			$content_length =  2147483647;	// ignore any content-length header
-			$chunked = true;
-			$this->debug("want to read chunked content");
-		} elseif (isset($this->incoming_headers['content-length'])) {
-			$content_length = $this->incoming_headers['content-length'];
-			$chunked = false;
-			$this->debug("want to read content of length $content_length");
-		} else {
-			$content_length =  2147483647;
-			$chunked = false;
-			$this->debug("want to read content to EOF");
-		}
-		$data = '';
-		do {
-			if ($chunked) {
-				$tmp = fgets($this->fp, 256);
-				$tmplen = strlen($tmp);
-				$this->debug("read chunk line of $tmplen bytes");
-				if ($tmplen == 0) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of chunk length timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of chunk length timed out');
-					return false;
-				}
-				$content_length = hexdec(trim($tmp));
-				$this->debug("chunk length $content_length");
-			}
-			$strlen = 0;
-		    while (($strlen < $content_length) && (!feof($this->fp))) {
-		    	$readlen = min(8192, $content_length - $strlen);
-				$tmp = fread($this->fp, $readlen);
-				$tmplen = strlen($tmp);
-				$this->debug("read buffer of $tmplen bytes");
-				if (($tmplen == 0) && (!feof($this->fp))) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of body timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of body timed out');
-					return false;
-				}
-				$strlen += $tmplen;
-				$data .= $tmp;
-			}
-			if ($chunked && ($content_length > 0)) {
-				$tmp = fgets($this->fp, 256);
-				$tmplen = strlen($tmp);
-				$this->debug("read chunk terminator of $tmplen bytes");
-				if ($tmplen == 0) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of chunk terminator timed out');
-					return false;
-				}
-			}
-		} while ($chunked && ($content_length > 0) && (!feof($this->fp)));
-		if (feof($this->fp)) {
-			$this->debug('read to EOF');
-		}
-		$this->debug('read body of length ' . strlen($data));
-		$this->incoming_payload .= $data;
-		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
-		
-		// close filepointer
-		if(
-			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
-			(! $this->persistentConnection) || feof($this->fp)){
-			fclose($this->fp);
-			$this->fp = false;
-			$this->debug('closed socket');
-		}
-		
-		// connection was closed unexpectedly
-		if($this->incoming_payload == ''){
-			$this->setError('no response from server');
-			return false;
-		}
-		
-		// decode transfer-encoding
-//		if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
-//			if(!$data = $this->decodeChunked($data, $lb)){
-//				$this->setError('Decoding of chunked data failed');
-//				return false;
-//			}
-			//print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
-			// set decoded payload
-//			$this->incoming_payload = $header_data.$lb.$lb.$data;
-//		}
-	
-	  } else if ($this->scheme == 'https') {
-		// send and receive
-		$this->debug('send and receive with cURL');
-		$this->incoming_payload = curl_exec($this->ch);
-		$data = $this->incoming_payload;
-
-        $cErr = curl_error($this->ch);
-		if ($cErr != '') {
-        	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
-        	// TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
-			foreach(curl_getinfo($this->ch) as $k => $v){
-				$err .= "$k: $v<br>";
-			}
-			$this->debug($err);
-			$this->setError($err);
-			curl_close($this->ch);
-	    	return false;
-		} else {
-			//echo '<pre>';
-			//var_dump(curl_getinfo($this->ch));
-			//echo '</pre>';
-		}
-		// close curl
-		$this->debug('No cURL error, closing cURL');
-		curl_close($this->ch);
-		
-		// remove 100 header(s)
-		while (ereg('^HTTP/1.1 100',$data)) {
-			if ($pos = strpos($data,"\r\n\r\n")) {
-				$data = ltrim(substr($data,$pos));
-			} elseif($pos = strpos($data,"\n\n") ) {
-				$data = ltrim(substr($data,$pos));
-			}
-		}
-		
-		// separate content from HTTP headers
-		if ($pos = strpos($data,"\r\n\r\n")) {
-			$lb = "\r\n";
-		} elseif( $pos = strpos($data,"\n\n")) {
-			$lb = "\n";
-		} else {
-			$this->debug('no proper separation of headers and document');
-			$this->setError('no proper separation of headers and document');
-			return false;
-		}
-		$header_data = trim(substr($data,0,$pos));
-		$header_array = explode($lb,$header_data);
-		$data = ltrim(substr($data,$pos));
-		$this->debug('found proper separation of headers and document');
-		$this->debug('cleaned data, stringlen: '.strlen($data));
-		// clean headers
-		foreach ($header_array as $header_line) {
-			$arr = explode(':',$header_line,2);
-			if(count($arr) > 1){
-				$header_name = strtolower(trim($arr[0]));
-				$this->incoming_headers[$header_name] = trim($arr[1]);
-				if ($header_name == 'set-cookie') {
-					// TODO: allow multiple cookies from parseCookie
-					$cookie = $this->parseCookie(trim($arr[1]));
-					if ($cookie) {
-						$this->incoming_cookies[] = $cookie;
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
-					} else {
-						$this->debug('did not find cookie in ' . trim($arr[1]));
-					}
-    			}
-			} else if (isset($header_name)) {
-				// append continuation line to previous header
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
-			}
-		}
-	  }
-
-		$arr = explode(' ', $header_array[0], 3);
-		$http_version = $arr[0];
-		$http_status = intval($arr[1]);
-		$http_reason = count($arr) > 2 ? $arr[2] : '';
-
- 		// see if we need to resend the request with http digest authentication
- 		if (isset($this->incoming_headers['location']) && $http_status == 301) {
- 			$this->debug("Got 301 $http_reason with Location: " . $this->incoming_headers['location']);
- 			$this->setURL($this->incoming_headers['location']);
-			$this->tryagain = true;
-			return false;
-		}
-
- 		// see if we need to resend the request with http digest authentication
- 		if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
- 			$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
- 			if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
- 				$this->debug('Server wants digest authentication');
- 				// remove "Digest " from our elements
- 				$digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
- 				
- 				// parse elements into array
- 				$digestElements = explode(',', $digestString);
- 				foreach ($digestElements as $val) {
- 					$tempElement = explode('=', trim($val), 2);
- 					$digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
- 				}
-
-				// should have (at least) qop, realm, nonce
- 				if (isset($digestRequest['nonce'])) {
- 					$this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
- 					$this->tryagain = true;
- 					return false;
- 				}
- 			}
-			$this->debug('HTTP authentication failed');
-			$this->setError('HTTP authentication failed');
-			return false;
- 		}
-		
-		if (
-			($http_status >= 300 && $http_status <= 307) ||
-			($http_status >= 400 && $http_status <= 417) ||
-			($http_status >= 501 && $http_status <= 505)
-		   ) {
-			$this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient2->response has contents of the response)");
-			return false;
-		}
-
-		// decode content-encoding
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
-    			// if decoding works, use it. else assume data wasn't gzencoded
-    			if(function_exists('gzinflate')){
-					//$timer->setMarker('starting decoding of gzip/deflated content');
-					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
-					// this means there are no Zlib headers, although there should be
-					$this->debug('The gzinflate function exists');
-					$datalen = strlen($data);
-					if ($this->incoming_headers['content-encoding'] == 'deflate') {
-						if ($degzdata = @gzinflate($data)) {
-	    					$data = $degzdata;
-	    					$this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
-	    					if (strlen($data) < $datalen) {
-	    						// test for the case that the payload has been compressed twice
-		    					$this->debug('The inflated payload is smaller than the gzipped one; try again');
-								if ($degzdata = @gzinflate($data)) {
-			    					$data = $degzdata;
-			    					$this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
-								}
-	    					}
-	    				} else {
-	    					$this->debug('Error using gzinflate to inflate the payload');
-	    					$this->setError('Error using gzinflate to inflate the payload');
-	    				}
-					} elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
-						if ($degzdata = @gzinflate(substr($data, 10))) {	// do our best
-							$data = $degzdata;
-	    					$this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
-	    					if (strlen($data) < $datalen) {
-	    						// test for the case that the payload has been compressed twice
-		    					$this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
-								if ($degzdata = @gzinflate(substr($data, 10))) {
-			    					$data = $degzdata;
-			    					$this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
-								}
-	    					}
-	    				} else {
-	    					$this->debug('Error using gzinflate to un-gzip the payload');
-							$this->setError('Error using gzinflate to un-gzip the payload');
-	    				}
-					}
-					//$timer->setMarker('finished decoding of gzip/deflated content');
-					//print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
-					// set decoded payload
-					$this->incoming_payload = $header_data.$lb.$lb.$data;
-    			} else {
-					$this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
-					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
-				}
-			} else {
-				$this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
-				$this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
-			}
-		} else {
-			$this->debug('No Content-Encoding header');
-		}
-		
-		if(strlen($data) == 0){
-			$this->debug('no data after headers!');
-			$this->setError('no data present after HTTP headers');
-			return false;
-		}
-		
-		return $data;
-	}
-
-	function setContentType($type, $charset = false) {
-		$this->outgoing_headers['Content-Type'] = $type . ($charset ? '; charset=' . $charset : '');
-		$this->debug('set Content-Type: ' . $this->outgoing_headers['Content-Type']);
-	}
-
-	function usePersistentConnection(){
-		if (isset($this->outgoing_headers['Accept-Encoding'])) {
-			return false;
-		}
-		$this->protocol_version = '1.1';
-		$this->persistentConnection = true;
-		$this->outgoing_headers['Connection'] = 'Keep-Alive';
-		$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-		return true;
-	}
-
-	/**
-	 * parse an incoming Cookie into it's parts
-	 *
-	 * @param	string $cookie_str content of cookie
-	 * @return	array with data of that cookie
-	 * @access	private
-	 */
-	/*
-	 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
-	 */
-	function parseCookie($cookie_str) {
-		$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
-		$data = split(';', $cookie_str);
-		$value_str = $data[0];
-
-		$cookie_param = 'domain=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ($start > 0) {
-			$domain = substr($cookie_str, $start + strlen($cookie_param));
-			$domain = substr($domain, 0, strpos($domain, ';'));
-		} else {
-			$domain = '';
-		}
-
-		$cookie_param = 'expires=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ($start > 0) {
-			$expires = substr($cookie_str, $start + strlen($cookie_param));
-			$expires = substr($expires, 0, strpos($expires, ';'));
-		} else {
-			$expires = '';
-		}
-
-		$cookie_param = 'path=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ( $start > 0 ) {
-			$path = substr($cookie_str, $start + strlen($cookie_param));
-			$path = substr($path, 0, strpos($path, ';'));
-		} else {
-			$path = '/';
-		}
-						
-		$cookie_param = ';secure;';
-		if (strpos($cookie_str, $cookie_param) !== FALSE) {
-			$secure = true;
-		} else {
-			$secure = false;
-		}
-
-		$sep_pos = strpos($value_str, '=');
-
-		if ($sep_pos) {
-			$name = substr($value_str, 0, $sep_pos);
-			$value = substr($value_str, $sep_pos + 1);
-			$cookie= array(	'name' => $name,
-			                'value' => $value,
-							'domain' => $domain,
-							'path' => $path,
-							'expires' => $expires,
-							'secure' => $secure
-							);		
-			return $cookie;
-		}
-		return false;
-	}
-  
-	/**
-	 * sort out cookies for the current request
-	 *
-	 * @param	array $cookies array with all cookies
-	 * @param	boolean $secure is the send-content secure or not?
-	 * @return	string for Cookie-HTTP-Header
-	 * @access	private
-	 */
-	function getCookiesForRequest($cookies, $secure=false) {
-		$cookie_str = '';
-		if ((! is_null($cookies)) && (is_array($cookies))) {
-			foreach ($cookies as $cookie) {
-				if (! is_array($cookie)) {
-					continue;
-				}
-	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
-					if (strtotime($cookie['expires']) <= time()) {
-						$this->debug('cookie has expired');
-						continue;
-					}
-				}
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
-					$domain = preg_quote($cookie['domain']);
-					if (! preg_match("'.*$domain$'i", $this->host)) {
-						$this->debug('cookie has different domain');
-						continue;
-					}
-				}
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
-					$path = preg_quote($cookie['path']);
-					if (! preg_match("'^$path.*'i", $this->path)) {
-						$this->debug('cookie is for a different path');
-						continue;
-					}
-				}
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
-					$this->debug('cookie is secure, transport is not');
-					continue;
-				}
-				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
-	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
-			}
-		}
-		return $cookie_str;
-  }
-}
-
-
-?>
diff --git a/libraries/nusoap/class.soap_val.php b/libraries/nusoap/class.soap_val.php
deleted file mode 100644
index 5a8e12abb..000000000
--- a/libraries/nusoap/class.soap_val.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-
-
-
-/**
-* For creating serializable abstractions of native PHP types.  This class
-* allows element name/namespace, XSD type, and XML attributes to be
-* associated with a value.  This is extremely useful when WSDL is not
-* used, but is also useful when WSDL is used with polymorphic types, including
-* xsd:anyType and user-defined types.
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.soap_val.php,v 1.9 2005/07/27 19:24:42 snichol Exp $
-* @access   public
-*/
-class soapval extends nusoap_base {
-	/**
-	 * The XML element name
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $name;
-	/**
-	 * The XML type name (string or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $type;
-	/**
-	 * The PHP value
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $value;
-	/**
-	 * The XML element namespace (string or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $element_ns;
-	/**
-	 * The XML type namespace (string or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $type_ns;
-	/**
-	 * The XML element attributes (array or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $attributes;
-
-	/**
-	* constructor
-	*
-	* @param    string $name optional name
-	* @param    mixed $type optional type name
-	* @param	mixed $value optional value
-	* @param	mixed $element_ns optional namespace of value
-	* @param	mixed $type_ns optional namespace of type
-	* @param	mixed $attributes associative array of attributes to add to element serialization
-	* @access   public
-	*/
-  	function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
-		parent::nusoap_base();
-		$this->name = $name;
-		$this->type = $type;
-		$this->value = $value;
-		$this->element_ns = $element_ns;
-		$this->type_ns = $type_ns;
-		$this->attributes = $attributes;
-    }
-
-	/**
-	* return serialized value
-	*
-	* @param	string $use The WSDL use value (encoded|literal)
-	* @return	string XML data
-	* @access   public
-	*/
-	function serialize($use='encoded') {
-		return $this->serialize_val($this->value,$this->name,$this->type,$this->element_ns,$this->type_ns,$this->attributes,$use);
-    }
-
-	/**
-	* decodes a soapval object into a PHP native type
-	*
-	* @return	mixed
-	* @access   public
-	*/
-	function decode(){
-		return $this->value;
-	}
-}
-
-
-
-
-?>
\ No newline at end of file
diff --git a/libraries/nusoap/class.soapclient.php b/libraries/nusoap/class.soapclient.php
deleted file mode 100644
index a8db2b2d9..000000000
--- a/libraries/nusoap/class.soapclient.php
+++ /dev/null
@@ -1,859 +0,0 @@
-<?php
-
-
-
-
-/**
-*
-* soapclient2 higher level class for easy usage.
-*
-* usage:
-*
-* // instantiate client with server info
-* $soapclient2 = new soapclient2( string path [ ,boolean wsdl] );
-*
-* // call method, get results
-* echo $soapclient2->call( string methodname [ ,array parameters] );
-*
-* // bye bye client
-* unset($soapclient2);
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.soapclient2.php,v 1.52 2005/07/27 19:24:42 snichol Exp $
-* @access   public
-*/
-class soapclient2 extends nusoap_base  {
-
-	var $username = '';
-	var $password = '';
-	var $authtype = '';
-	var $certRequest = array();
-	var $requestHeaders = false;	// SOAP headers in request (text)
-	var $responseHeaders = '';		// SOAP headers from response (incomplete namespace resolution) (text)
-	var $document = '';				// SOAP body response portion (incomplete namespace resolution) (text)
-	var $endpoint;
-	var $forceEndpoint = '';		// overrides WSDL endpoint
-    var $proxyhost = '';
-    var $proxyport = '';
-	var $proxyusername = '';
-	var $proxypassword = '';
-    var $xml_encoding = '';			// character set encoding of incoming (response) messages
-	var $http_encoding = false;
-	var $timeout = 0;				// HTTP connection timeout
-	var $response_timeout = 30;		// HTTP response timeout
-	var $endpointType = '';			// soap|wsdl, empty for WSDL initialization error
-	var $persistentConnection = false;
-	var $defaultRpcParams = false;	// This is no longer used
-	var $request = '';				// HTTP request
-	var $response = '';				// HTTP response
-	var $responseData = '';			// SOAP payload of response
-	var $cookies = array();			// Cookies from response or for request
-    var $decode_utf8 = true;		// toggles whether the parser decodes element content w/ utf8_decode()
-	var $operations = array();		// WSDL operations, empty for WSDL initialization error
-	
-	/*
-	 * fault related variables
-	 */
-	/**
-	 * @var      fault
-	 * @access   public
-	 */
-	var $fault;
-	/**
-	 * @var      faultcode
-	 * @access   public
-	 */
-	var $faultcode;
-	/**
-	 * @var      faultstring
-	 * @access   public
-	 */
-	var $faultstring;
-	/**
-	 * @var      faultdetail
-	 * @access   public
-	 */
-	var $faultdetail;
-
-	/**
-	* constructor
-	*
-	* @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
-	* @param    bool $wsdl optional, set to true if using WSDL
-	* @param	int $portName optional portName in WSDL document
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @param	integer $timeout set the connection timeout
-	* @param	integer $response_timeout set the response timeout
-	* @access   public
-	*/
-	function soapclient2($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30){
-		parent::nusoap_base();
-		$this->endpoint = $endpoint;
-		$this->proxyhost = $proxyhost;
-		$this->proxyport = $proxyport;
-		$this->proxyusername = $proxyusername;
-		$this->proxypassword = $proxypassword;
-		$this->timeout = $timeout;
-		$this->response_timeout = $response_timeout;
-
-		// make values
-		if($wsdl){
-			if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
-				$this->wsdl = $endpoint;
-				$this->endpoint = $this->wsdl->wsdl;
-				$this->wsdlFile = $this->endpoint;
-				$this->debug('existing wsdl instance created from ' . $this->endpoint);
-			} else {
-				$this->wsdlFile = $this->endpoint;
-				
-				// instantiate wsdl object and parse wsdl file
-				$this->debug('instantiating wsdl class with doc: '.$endpoint);
-				$this->wsdl = new wsdl($this->wsdlFile,$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout);
-			}
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			// catch errors
-			if($errstr = $this->wsdl->getError()){
-				$this->debug('got wsdl error: '.$errstr);
-				$this->setError('wsdl error: '.$errstr);
-			} elseif($this->operations = $this->wsdl->getOperations()){
-				$this->debug( 'got '.count($this->operations).' operations from wsdl '.$this->wsdlFile);
-				$this->endpointType = 'wsdl';
-			} else {
-				$this->debug( 'getOperations returned false');
-				$this->setError('no operations defined in the WSDL document!');
-			}
-		} else {
-			$this->debug("instantiate SOAP with endpoint at $endpoint");
-			$this->endpointType = 'soap';
-		}
-	}
-
-	/**
-	* calls method, returns PHP native type
-	*
-	* @param    string $method SOAP server URL or path
-	* @param    mixed $params An array, associative or simple, of the parameters
-	*			              for the method call, or a string that is the XML
-	*			              for the call.  For rpc style, this call will
-	*			              wrap the XML in a tag named after the method, as
-	*			              well as the SOAP Envelope and Body.  For document
-	*			              style, this will only wrap with the Envelope and Body.
-	*			              IMPORTANT: when using an array with document style,
-	*			              in which case there
-	*                         is really one parameter, the root of the fragment
-	*                         used in the call, which encloses what programmers
-	*                         normally think of parameters.  A parameter array
-	*                         *must* include the wrapper.
-	* @param	string $namespace optional method namespace (WSDL can override)
-	* @param	string $soapAction optional SOAPAction value (WSDL can override)
-	* @param	mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
-	* @param	boolean $rpcParams optional (no longer used)
-	* @param	string	$style optional (rpc|document) the style to use when serializing parameters (WSDL can override)
-	* @param	string	$use optional (encoded|literal) the use when serializing parameters (WSDL can override)
-	* @return	mixed	response from SOAP call
-	* @access   public
-	*/
-	function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
-		$this->operation = $operation;
-		$this->fault = false;
-		$this->setError('');
-		$this->request = '';
-		$this->response = '';
-		$this->responseData = '';
-		$this->faultstring = '';
-		$this->faultcode = '';
-		$this->opData = array();
-		
-		$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
-		$this->appendDebug('params=' . $this->varDump($params));
-		$this->appendDebug('headers=' . $this->varDump($headers));
-		if ($headers) {
-			$this->requestHeaders = $headers;
-		}
-		// serialize parameters
-		if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
-			// use WSDL for operation
-			$this->opData = $opData;
-			$this->debug("found operation");
-			$this->appendDebug('opData=' . $this->varDump($opData));
-			if (isset($opData['soapAction'])) {
-				$soapAction = $opData['soapAction'];
-			}
-			if (! $this->forceEndpoint) {
-				$this->endpoint = $opData['endpoint'];
-			} else {
-				$this->endpoint = $this->forceEndpoint;
-			}
-			$namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] :	$namespace;
-			$style = $opData['style'];
-			$use = $opData['input']['use'];
-			// add ns to ns array
-			if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
-				$nsPrefix = 'ns' . rand(1000, 9999);
-				$this->wsdl->namespaces[$nsPrefix] = $namespace;
-			}
-            $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
-			// serialize payload
-			if (is_string($params)) {
-				$this->debug("serializing param string for WSDL operation $operation");
-				$payload = $params;
-			} elseif (is_array($params)) {
-				$this->debug("serializing param array for WSDL operation $operation");
-				$payload = $this->wsdl->serializeRPCParameters($operation,'input',$params);
-			} else {
-				$this->debug('params must be array or string');
-				$this->setError('params must be array or string');
-				return false;
-			}
-            $usedNamespaces = $this->wsdl->usedNamespaces;
-			if (isset($opData['input']['encodingStyle'])) {
-				$encodingStyle = $opData['input']['encodingStyle'];
-			} else {
-				$encodingStyle = '';
-			}
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			if ($errstr = $this->wsdl->getError()) {
-				$this->debug('got wsdl error: '.$errstr);
-				$this->setError('wsdl error: '.$errstr);
-				return false;
-			}
-		} elseif($this->endpointType == 'wsdl') {
-			// operation not in WSDL
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			$this->setError( 'operation '.$operation.' not present.');
-			$this->debug("operation '$operation' not present.");
-			return false;
-		} else {
-			// no WSDL
-			//$this->namespaces['ns1'] = $namespace;
-			$nsPrefix = 'ns' . rand(1000, 9999);
-			// serialize 
-			$payload = '';
-			if (is_string($params)) {
-				$this->debug("serializing param string for operation $operation");
-				$payload = $params;
-			} elseif (is_array($params)) {
-				$this->debug("serializing param array for operation $operation");
-				foreach($params as $k => $v){
-					$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
-				}
-			} else {
-				$this->debug('params must be array or string');
-				$this->setError('params must be array or string');
-				return false;
-			}
-			$usedNamespaces = array();
-			if ($use == 'encoded') {
-				$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-			} else {
-				$encodingStyle = '';
-			}
-		}
-		// wrap RPC calls with method element
-		if ($style == 'rpc') {
-			if ($use == 'literal') {
-				$this->debug("wrapping RPC request with literal method element");
-				if ($namespace) {
-					$payload = "<$operation xmlns=\"$namespace\">" . $payload . "</$operation>";
-				} else {
-					$payload = "<$operation>" . $payload . "</$operation>";
-				}
-			} else {
-				$this->debug("wrapping RPC request with encoded method element");
-				if ($namespace) {
-					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
-								$payload .
-								"</$nsPrefix:$operation>";
-				} else {
-					$payload = "<$operation>" .
-								$payload .
-								"</$operation>";
-				}
-			}
-		}
-		// serialize envelope
-		$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
-		$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
-		$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
-		// send
-		$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
-		if($errstr = $this->getError()){
-			$this->debug('Error: '.$errstr);
-			return false;
-		} else {
-			$this->return = $return;
-			$this->debug('sent message successfully and got a(n) '.gettype($return));
-           	$this->appendDebug('return=' . $this->varDump($return));
-			
-			// fault?
-			if(is_array($return) && isset($return['faultcode'])){
-				$this->debug('got fault');
-				$this->setError($return['faultcode'].': '.$return['faultstring']);
-				$this->fault = true;
-				foreach($return as $k => $v){
-					$this->$k = $v;
-					$this->debug("$k = $v<br>");
-				}
-				return $return;
-			} elseif ($style == 'document') {
-				// NOTE: if the response is defined to have multiple parts (i.e. unwrapped),
-				// we are only going to return the first part here...sorry about that
-				return $return;
-			} else {
-				// array of return values
-				if(is_array($return)){
-					// multiple 'out' parameters, which we return wrapped up
-					// in the array
-					if(sizeof($return) > 1){
-						return $return;
-					}
-					// single 'out' parameter (normally the return value)
-					$return = array_shift($return);
-					$this->debug('return shifted value: ');
-					$this->appendDebug($this->varDump($return));
-           			return $return;
-				// nothing returned (ie, echoVoid)
-				} else {
-					return "";
-				}
-			}
-		}
-	}
-
-	/**
-	* get available data pertaining to an operation
-	*
-	* @param    string $operation operation name
-	* @return	array array of data pertaining to the operation
-	* @access   public
-	*/
-	function getOperationData($operation){
-		if(isset($this->operations[$operation])){
-			return $this->operations[$operation];
-		}
-		$this->debug("No data for operation: $operation");
-	}
-
-    /**
-    * send the SOAP message
-    *
-    * Note: if the operation has multiple return values
-    * the return value of this method will be an array
-    * of those values.
-    *
-	* @param    string $msg a SOAPx4 soapmsg object
-	* @param    string $soapaction SOAPAction value
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @return	mixed native PHP types.
-	* @access   private
-	*/
-	function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
-		$this->checkCookies();
-		// detect transport
-		switch(true){
-			// http(s)
-			case ereg('^http',$this->endpoint):
-				$this->debug('transporting via HTTP');
-				if($this->persistentConnection == true && is_object($this->persistentConnection)){
-					$http =& $this->persistentConnection;
-				} else {
-					$http = new soap_transport_http($this->endpoint);
-					if ($this->persistentConnection) {
-						$http->usePersistentConnection();
-					}
-				}
-				$http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
-				$http->setSOAPAction($soapaction);
-				if($this->proxyhost && $this->proxyport){
-					$http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
-				}
-                if($this->authtype != '') {
-					$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
-				}
-				if($this->http_encoding != ''){
-					$http->setEncoding($this->http_encoding);
-				}
-				$this->debug('sending message, length='.strlen($msg));
-				if(ereg('^http:',$this->endpoint)){
-				//if(strpos($this->endpoint,'http:')){
-					$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
-				} elseif(ereg('^https',$this->endpoint)){
-				//} elseif(strpos($this->endpoint,'https:')){
-					//if(phpversion() == '4.3.0-dev'){
-						//$response = $http->send($msg,$timeout,$response_timeout);
-                   		//$this->request = $http->outgoing_payload;
-						//$this->response = $http->incoming_payload;
-					//} else
-					$this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
-				} else {
-					$this->setError('no http/s in endpoint url');
-				}
-				$this->request = $http->outgoing_payload;
-				$this->response = $http->incoming_payload;
-				$this->appendDebug($http->getDebug());
-				$this->UpdateCookies($http->incoming_cookies);
-
-				// save transport object if using persistent connections
-				if ($this->persistentConnection) {
-					$http->clearDebug();
-					if (!is_object($this->persistentConnection)) {
-						$this->persistentConnection = $http;
-					}
-				}
-				
-				if($err = $http->getError()){
-					$this->setError('HTTP Error: '.$err);
-					return false;
-				} elseif($this->getError()){
-					return false;
-				} else {
-					$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
-					return $this->parseResponse($http->incoming_headers, $this->responseData);
-				}
-			break;
-			default:
-				$this->setError('no transport found, or selected transport is not yet supported!');
-			return false;
-			break;
-		}
-	}
-
-	/**
-	* processes SOAP message returned from server
-	*
-	* @param	array	$headers	The HTTP headers
-	* @param	string	$data		unprocessed response data from server
-	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
-	*/
-    function parseResponse($headers, $data) {
-		$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
-		if (!strstr($headers['content-type'], 'text/xml')) {
-			$this->setError('Response not of type text/xml');
-			return false;
-		}
-		if (strpos($headers['content-type'], '=')) {
-			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
-			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
-				$this->xml_encoding = strtoupper($enc);
-			} else {
-				$this->xml_encoding = 'US-ASCII';
-			}
-		} else {
-			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-			$this->xml_encoding = 'UTF-8';
-		}
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
-		$parser = new soap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
-		// add parser debug data to our debug
-		$this->appendDebug($parser->getDebug());
-		// if parse errors
-		if($errstr = $parser->getError()){
-			$this->setError( $errstr);
-			// destroy the parser object
-			unset($parser);
-			return false;
-		} else {
-			// get SOAP headers
-			$this->responseHeaders = $parser->getHeaders();
-			// get decoded message
-			$return = $parser->get_response();
-            // add document for doclit support
-            $this->document = $parser->document;
-			// destroy the parser object
-			unset($parser);
-			// return decode message
-			return $return;
-		}
-	 }
-
-	/**
-	* sets the SOAP endpoint, which can override WSDL
-	*
-	* @param	$endpoint string The endpoint URL to use, or empty string or false to prevent override
-	* @access   public
-	*/
-	function setEndpoint($endpoint) {
-		$this->forceEndpoint = $endpoint;
-	}
-
-	/**
-	* set the SOAP headers
-	*
-	* @param	$headers mixed String of XML with SOAP header content, or array of soapval objects for SOAP headers
-	* @access   public
-	*/
-	function setHeaders($headers){
-		$this->requestHeaders = $headers;
-	}
-
-	/**
-	* get the SOAP response headers (namespace resolution incomplete)
-	*
-	* @return	string
-	* @access   public
-	*/
-	function getHeaders(){
-		return $this->responseHeaders;
-	}
-
-	/**
-	* set proxy info here
-	*
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @access   public
-	*/
-	function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
-		$this->proxyhost = $proxyhost;
-		$this->proxyport = $proxyport;
-		$this->proxyusername = $proxyusername;
-		$this->proxypassword = $proxypassword;
-	}
-
-	/**
-	* if authenticating, set user credentials here
-	*
-	* @param    string $username
-	* @param    string $password
-	* @param	string $authtype (basic|digest|certificate)
-	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
-	* @access   public
-	*/
-	function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
-		$this->username = $username;
-		$this->password = $password;
-		$this->authtype = $authtype;
-		$this->certRequest = $certRequest;
-	}
-	
-	/**
-	* use HTTP encoding
-	*
-	* @param    string $enc
-	* @access   public
-	*/
-	function setHTTPEncoding($enc='gzip, deflate'){
-		$this->http_encoding = $enc;
-	}
-	
-	/**
-	* use HTTP persistent connections if possible
-	*
-	* @access   public
-	*/
-	function useHTTPPersistentConnection(){
-		$this->persistentConnection = true;
-	}
-	
-	/**
-	* gets the default RPC parameter setting.
-	* If true, default is that call params are like RPC even for document style.
-	* Each call() can override this value.
-	*
-	* This is no longer used.
-	*
-	* @return boolean
-	* @access public
-	* @deprecated
-	*/
-	function getDefaultRpcParams() {
-		return $this->defaultRpcParams;
-	}
-
-	/**
-	* sets the default RPC parameter setting.
-	* If true, default is that call params are like RPC even for document style
-	* Each call() can override this value.
-	*
-	* This is no longer used.
-	*
-	* @param    boolean $rpcParams
-	* @access public
-	* @deprecated
-	*/
-	function setDefaultRpcParams($rpcParams) {
-		$this->defaultRpcParams = $rpcParams;
-	}
-	
-	/**
-	* dynamically creates an instance of a proxy class,
-	* allowing user to directly call methods from wsdl
-	*
-	* @return   object soap_proxy object
-	* @access   public
-	*/
-	function getProxy(){
-		$r = rand();
-		$evalStr = $this->_getProxyClassCode($r);
-		//$this->debug("proxy class: $evalStr";
-		// eval the class
-		eval($evalStr);
-		// instantiate proxy object
-		eval("\$proxy = new soap_proxy_$r('');");
-		// transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
-		$proxy->endpointType = 'wsdl';
-		$proxy->wsdlFile = $this->wsdlFile;
-		$proxy->wsdl = $this->wsdl;
-		$proxy->operations = $this->operations;
-		$proxy->defaultRpcParams = $this->defaultRpcParams;
-		// transfer other state
-		$proxy->username = $this->username;
-		$proxy->password = $this->password;
-		$proxy->authtype = $this->authtype;
-		$proxy->proxyhost = $this->proxyhost;
-		$proxy->proxyport = $this->proxyport;
-		$proxy->proxyusername = $this->proxyusername;
-		$proxy->proxypassword = $this->proxypassword;
-		$proxy->timeout = $this->timeout;
-		$proxy->response_timeout = $this->response_timeout;
-		$proxy->http_encoding = $this->http_encoding;
-		$proxy->persistentConnection = $this->persistentConnection;
-		$proxy->requestHeaders = $this->requestHeaders;
-		$proxy->soap_defencoding = $this->soap_defencoding;
-		$proxy->endpoint = $this->endpoint;
-		$proxy->forceEndpoint = $this->forceEndpoint;
-		return $proxy;
-	}
-
-	/**
-	* dynamically creates proxy class code
-	*
-	* @return   string PHP/NuSOAP code for the proxy class
-	* @access   private
-	*/
-	function _getProxyClassCode($r) {
-		if ($this->endpointType != 'wsdl') {
-			$evalStr = 'A proxy can only be created for a WSDL client';
-			$this->setError($evalStr);
-			return $evalStr;
-		}
-		$evalStr = '';
-		foreach ($this->operations as $operation => $opData) {
-			if ($operation != '') {
-				// create param string and param comment string
-				if (sizeof($opData['input']['parts']) > 0) {
-					$paramStr = '';
-					$paramArrayStr = '';
-					$paramCommentStr = '';
-					foreach ($opData['input']['parts'] as $name => $type) {
-						$paramStr .= "\$$name, ";
-						$paramArrayStr .= "'$name' => \$$name, ";
-						$paramCommentStr .= "$type \$$name, ";
-					}
-					$paramStr = substr($paramStr, 0, strlen($paramStr)-2);
-					$paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
-					$paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
-				} else {
-					$paramStr = '';
-					$paramCommentStr = 'void';
-				}
-				$opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
-				$evalStr .= "// $paramCommentStr
-	function " . str_replace('.', '__', $operation) . "($paramStr) {
-		\$params = array($paramArrayStr);
-		return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
-	}
-	";
-				unset($paramStr);
-				unset($paramCommentStr);
-			}
-		}
-		$evalStr = 'class soap_proxy_'.$r.' extends soapclient2 {
-	'.$evalStr.'
-}';
-		return $evalStr;
-	}
-
-	/**
-	* dynamically creates proxy class code
-	*
-	* @return   string PHP/NuSOAP code for the proxy class
-	* @access   public
-	*/
-	function getProxyClassCode() {
-		$r = rand();
-		return $this->_getProxyClassCode($r);
-	}
-
-	/**
-	* gets the HTTP body for the current request.
-	*
-	* @param string $soapmsg The SOAP payload
-	* @return string The HTTP body, which includes the SOAP payload
-	* @access private
-	*/
-	function getHTTPBody($soapmsg) {
-		return $soapmsg;
-	}
-	
-	/**
-	* gets the HTTP content type for the current request.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type for the current request.
-	* @access private
-	*/
-	function getHTTPContentType() {
-		return 'text/xml';
-	}
-	
-	/**
-	* gets the HTTP content type charset for the current request.
-	* returns false for non-text content types.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type charset for the current request.
-	* @access private
-	*/
-	function getHTTPContentTypeCharset() {
-		return $this->soap_defencoding;
-	}
-
-	/*
-	* whether or not parser should decode utf8 element content
-    *
-    * @return   always returns true
-    * @access   public
-    */
-    function decodeUTF8($bool){
-		$this->decode_utf8 = $bool;
-		return true;
-    }
-
-	/**
-	 * adds a new Cookie into $this->cookies array
-	 *
-	 * @param	string $name Cookie Name
-	 * @param	string $value Cookie Value
-	 * @return	if cookie-set was successful returns true, else false
-	 * @access	public
-	 */
-	function setCookie($name, $value) {
-		if (strlen($name) == 0) {
-			return false;
-		}
-		$this->cookies[] = array('name' => $name, 'value' => $value);
-		return true;
-	}
-
-	/**
-	 * gets all Cookies
-	 *
-	 * @return   array with all internal cookies
-	 * @access   public
-	 */
-	function getCookies() {
-		return $this->cookies;
-	}
-
-	/**
-	 * checks all Cookies and delete those which are expired
-	 *
-	 * @return   always return true
-	 * @access   private
-	 */
-	function checkCookies() {
-		if (sizeof($this->cookies) == 0) {
-			return true;
-		}
-		$this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
-		$curr_cookies = $this->cookies;
-		$this->cookies = array();
-		foreach ($curr_cookies as $cookie) {
-			if (! is_array($cookie)) {
-				$this->debug('Remove cookie that is not an array');
-				continue;
-			}
-			if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
-				if (strtotime($cookie['expires']) > time()) {
-					$this->cookies[] = $cookie;
-				} else {
-					$this->debug('Remove expired cookie ' . $cookie['name']);
-				}
-			} else {
-				$this->cookies[] = $cookie;
-			}
-		}
-		$this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
-		return true;
-	}
-
-	/**
-	 * updates the current cookies with a new set
-	 *
-	 * @param	array $cookies new cookies with which to update current ones
-	 * @return	always return true
-	 * @access	private
-	 */
-	function UpdateCookies($cookies) {
-		if (sizeof($this->cookies) == 0) {
-			// no existing cookies: take whatever is new
-			if (sizeof($cookies) > 0) {
-				$this->debug('Setting new cookie(s)');
-				$this->cookies = $cookies;
-			}
-			return true;
-		}
-		if (sizeof($cookies) == 0) {
-			// no new cookies: keep what we've got
-			return true;
-		}
-		// merge
-		foreach ($cookies as $newCookie) {
-			if (!is_array($newCookie)) {
-				continue;
-			}
-			if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
-				continue;
-			}
-			$newName = $newCookie['name'];
-
-			$found = false;
-			for ($i = 0; $i < count($this->cookies); $i++) {
-				$cookie = $this->cookies[$i];
-				if (!is_array($cookie)) {
-					continue;
-				}
-				if (!isset($cookie['name'])) {
-					continue;
-				}
-				if ($newName != $cookie['name']) {
-					continue;
-				}
-				$newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
-				$domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
-				if ($newDomain != $domain) {
-					continue;
-				}
-				$newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
-				$path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
-				if ($newPath != $path) {
-					continue;
-				}
-				$this->cookies[$i] = $newCookie;
-				$found = true;
-				$this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
-				break;
-			}
-			if (! $found) {
-				$this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
-				$this->cookies[] = $newCookie;
-			}
-		}
-		return true;
-	}
-}
-?>
diff --git a/libraries/nusoap/class.wsdl.php b/libraries/nusoap/class.wsdl.php
deleted file mode 100644
index 66d743e6b..000000000
--- a/libraries/nusoap/class.wsdl.php
+++ /dev/null
@@ -1,1727 +0,0 @@
-<?php
-
-
-
-
-/**
-* parses a WSDL file, allows access to it's data, other utility methods
-* 
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.wsdl.php,v 1.56 2005/08/04 01:27:42 snichol Exp $
-* @access public 
-*/
-class wsdl extends nusoap_base {
-	// URL or filename of the root of this WSDL
-    var $wsdl; 
-    // define internal arrays of bindings, ports, operations, messages, etc.
-    var $schemas = array();
-    var $currentSchema;
-    var $message = array();
-    var $complexTypes = array();
-    var $messages = array();
-    var $currentMessage;
-    var $currentOperation;
-    var $portTypes = array();
-    var $currentPortType;
-    var $bindings = array();
-    var $currentBinding;
-    var $ports = array();
-    var $currentPort;
-    var $opData = array();
-    var $status = '';
-    var $documentation = false;
-    var $endpoint = ''; 
-    // array of wsdl docs to import
-    var $import = array(); 
-    // parser vars
-    var $parser;
-    var $position = 0;
-    var $depth = 0;
-    var $depth_array = array();
-	// for getting wsdl
-	var $proxyhost = '';
-    var $proxyport = '';
-	var $proxyusername = '';
-	var $proxypassword = '';
-	var $timeout = 0;
-	var $response_timeout = 30;
-
-    /**
-     * constructor
-     * 
-     * @param string $wsdl WSDL document URL
-	 * @param string $proxyhost
-	 * @param string $proxyport
-	 * @param string $proxyusername
-	 * @param string $proxypassword
-	 * @param integer $timeout set the connection timeout
-	 * @param integer $response_timeout set the response timeout
-     * @access public 
-     */
-    function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30){
-		parent::nusoap_base();
-        $this->wsdl = $wsdl;
-        $this->proxyhost = $proxyhost;
-        $this->proxyport = $proxyport;
-		$this->proxyusername = $proxyusername;
-		$this->proxypassword = $proxypassword;
-		$this->timeout = $timeout;
-		$this->response_timeout = $response_timeout;
-        
-        // parse wsdl file
-        if ($wsdl != "") {
-            $this->debug('initial wsdl URL: ' . $wsdl);
-            $this->parseWSDL($wsdl);
-        }
-        // imports
-        // TODO: handle imports more properly, grabbing them in-line and nesting them
-        	$imported_urls = array();
-        	$imported = 1;
-        	while ($imported > 0) {
-        		$imported = 0;
-        		// Schema imports
-        		foreach ($this->schemas as $ns => $list) {
-        			foreach ($list as $xs) {
-						$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
-			            foreach ($xs->imports as $ns2 => $list2) {
-			                for ($ii = 0; $ii < count($list2); $ii++) {
-			                	if (! $list2[$ii]['loaded']) {
-			                		$this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
-			                		$url = $list2[$ii]['location'];
-									if ($url != '') {
-										$urlparts = parse_url($url);
-										if (!isset($urlparts['host'])) {
-											$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
-													substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
-										}
-										if (! in_array($url, $imported_urls)) {
-						                	$this->parseWSDL($url);
-					                		$imported++;
-					                		$imported_urls[] = $url;
-					                	}
-									} else {
-										$this->debug("Unexpected scenario: empty URL for unloaded import");
-									}
-								}
-							}
-			            } 
-        			}
-        		}
-        		// WSDL imports
-				$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
-	            foreach ($this->import as $ns => $list) {
-	                for ($ii = 0; $ii < count($list); $ii++) {
-	                	if (! $list[$ii]['loaded']) {
-	                		$this->import[$ns][$ii]['loaded'] = true;
-	                		$url = $list[$ii]['location'];
-							if ($url != '') {
-								$urlparts = parse_url($url);
-								if (!isset($urlparts['host'])) {
-									$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
-											substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
-								}
-								if (! in_array($url, $imported_urls)) {
-				                	$this->parseWSDL($url);
-			                		$imported++;
-			                		$imported_urls[] = $url;
-			                	}
-							} else {
-								$this->debug("Unexpected scenario: empty URL for unloaded import");
-							}
-						}
-					}
-	            } 
-			}
-        // add new data to operation data
-        foreach($this->bindings as $binding => $bindingData) {
-            if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
-                foreach($bindingData['operations'] as $operation => $data) {
-                    $this->debug('post-parse data gathering for ' . $operation);
-                    $this->bindings[$binding]['operations'][$operation]['input'] = 
-						isset($this->bindings[$binding]['operations'][$operation]['input']) ? 
-						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
-						$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
-                    $this->bindings[$binding]['operations'][$operation]['output'] = 
-						isset($this->bindings[$binding]['operations'][$operation]['output']) ?
-						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
-						$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
-                    if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
-						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
-					}
-					if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
-                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
-                    }
-					if (isset($bindingData['style'])) {
-                        $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
-                    }
-                    $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
-                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
-                    $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
-                } 
-            } 
-        }
-    }
-
-    /**
-     * parses the wsdl document
-     * 
-     * @param string $wsdl path or URL
-     * @access private 
-     */
-    function parseWSDL($wsdl = '')
-    {
-        if ($wsdl == '') {
-            $this->debug('no wsdl passed to parseWSDL()!!');
-            $this->setError('no wsdl passed to parseWSDL()!!');
-            return false;
-        }
-        
-        // parse $wsdl for url format
-        $wsdl_props = parse_url($wsdl);
-
-        if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
-            $this->debug('getting WSDL http(s) URL ' . $wsdl);
-        	// get wsdl
-	        $tr = new soap_transport_http($wsdl);
-			$tr->request_method = 'GET';
-			$tr->useSOAPAction = false;
-			if($this->proxyhost && $this->proxyport){
-				$tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
-			}
-			$tr->setEncoding('gzip, deflate');
-			$wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
-			//$this->debug("WSDL request\n" . $tr->outgoing_payload);
-			//$this->debug("WSDL response\n" . $tr->incoming_payload);
-			$this->appendDebug($tr->getDebug());
-			// catch errors
-			if($err = $tr->getError() ){
-				$errstr = 'HTTP ERROR: '.$err;
-				$this->debug($errstr);
-	            $this->setError($errstr);
-				unset($tr);
-	            return false;
-			}
-			unset($tr);
-			$this->debug("got WSDL URL");
-        } else {
-            // $wsdl is not http(s), so treat it as a file URL or plain file path
-        	if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
-        		$path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
-        	} else {
-        		$path = $wsdl;
-        	}
-            $this->debug('getting WSDL file ' . $path);
-            if ($fp = @fopen($path, 'r')) {
-                $wsdl_string = '';
-                while ($data = fread($fp, 32768)) {
-                    $wsdl_string .= $data;
-                } 
-                fclose($fp);
-            } else {
-            	$errstr = "Bad path to WSDL file $path";
-            	$this->debug($errstr);
-                $this->setError($errstr);
-                return false;
-            } 
-        }
-        $this->debug('Parse WSDL');
-        // end new code added
-        // Create an XML parser.
-        $this->parser = xml_parser_create(); 
-        // Set the options for parsing the XML data.
-        // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
-        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); 
-        // Set the object for the parser.
-        xml_set_object($this->parser, $this); 
-        // Set the element handlers for the parser.
-        xml_set_element_handler($this->parser, 'start_element', 'end_element');
-        xml_set_character_data_handler($this->parser, 'character_data');
-        // Parse the XML file.
-        if (!xml_parse($this->parser, $wsdl_string, true)) {
-            // Display an error message.
-            $errstr = sprintf(
-				'XML error parsing WSDL from %s on line %d: %s',
-				$wsdl,
-                xml_get_current_line_number($this->parser),
-                xml_error_string(xml_get_error_code($this->parser))
-                );
-            $this->debug($errstr);
-			$this->debug("XML payload:\n" . $wsdl_string);
-            $this->setError($errstr);
-            return false;
-        } 
-		// free the parser
-        xml_parser_free($this->parser);
-        $this->debug('Parsing WSDL done');
-		// catch wsdl parse errors
-		if($this->getError()){
-			return false;
-		}
-        return true;
-    } 
-
-    /**
-     * start-element handler
-     * 
-     * @param string $parser XML parser object
-     * @param string $name element name
-     * @param string $attrs associative array of attributes
-     * @access private 
-     */
-    function start_element($parser, $name, $attrs)
-    {
-        if ($this->status == 'schema') {
-            $this->currentSchema->schemaStartElement($parser, $name, $attrs);
-            $this->appendDebug($this->currentSchema->getDebug());
-            $this->currentSchema->clearDebug();
-        } elseif (ereg('schema$', $name)) {
-        	$this->debug('Parsing WSDL schema');
-            // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
-            $this->status = 'schema';
-            $this->currentSchema = new xmlschema('', '', $this->namespaces);
-            $this->currentSchema->schemaStartElement($parser, $name, $attrs);
-            $this->appendDebug($this->currentSchema->getDebug());
-            $this->currentSchema->clearDebug();
-        } else {
-            // position in the total number of elements, starting from 0
-            $pos = $this->position++;
-            $depth = $this->depth++; 
-            // set self as current value for this depth
-            $this->depth_array[$depth] = $pos;
-            $this->message[$pos] = array('cdata' => ''); 
-            // process attributes
-            if (count($attrs) > 0) {
-				// register namespace declarations
-                foreach($attrs as $k => $v) {
-                    if (ereg("^xmlns", $k)) {
-                        if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
-                            $this->namespaces[$ns_prefix] = $v;
-                        } else {
-                            $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
-                        } 
-                        if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
-                            $this->XMLSchemaVersion = $v;
-                            $this->namespaces['xsi'] = $v . '-instance';
-                        } 
-                    }
-                }
-                // expand each attribute prefix to its namespace
-                foreach($attrs as $k => $v) {
-                    $k = strpos($k, ':') ? $this->expandQname($k) : $k;
-                    if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
-                        $v = strpos($v, ':') ? $this->expandQname($v) : $v;
-                    } 
-                    $eAttrs[$k] = $v;
-                } 
-                $attrs = $eAttrs;
-            } else {
-                $attrs = array();
-            } 
-            // get element prefix, namespace and name
-            if (ereg(':', $name)) {
-                // get ns prefix
-                $prefix = substr($name, 0, strpos($name, ':')); 
-                // get ns
-                $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; 
-                // get unqualified name
-                $name = substr(strstr($name, ':'), 1);
-            } 
-			// process attributes, expanding any prefixes to namespaces
-            // find status, register data
-            switch ($this->status) {
-                case 'message':
-                    if ($name == 'part') {
-			            if (isset($attrs['type'])) {
-		                    $this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs));
-		                    $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
-            			} 
-			            if (isset($attrs['element'])) {
-		                    $this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs));
-			                $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'];
-			            } 
-        			} 
-        			break;
-			    case 'portType':
-			        switch ($name) {
-			            case 'operation':
-			                $this->currentPortOperation = $attrs['name'];
-			                $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
-			                if (isset($attrs['parameterOrder'])) {
-			                	$this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
-			        		} 
-			        		break;
-					    case 'documentation':
-					        $this->documentation = true;
-					        break; 
-					    // merge input/output data
-					    default:
-					        $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
-					        $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
-					        break;
-					} 
-			    	break;
-				case 'binding':
-				    switch ($name) {
-				        case 'binding': 
-				            // get ns prefix
-				            if (isset($attrs['style'])) {
-				            $this->bindings[$this->currentBinding]['prefix'] = $prefix;
-					    	} 
-					    	$this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
-					    	break;
-						case 'header':
-						    $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
-						    break;
-						case 'operation':
-						    if (isset($attrs['soapAction'])) {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
-						    } 
-						    if (isset($attrs['style'])) {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
-						    } 
-						    if (isset($attrs['name'])) {
-						        $this->currentOperation = $attrs['name'];
-						        $this->debug("current binding operation: $this->currentOperation");
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
-						    } 
-						    break;
-						case 'input':
-						    $this->opStatus = 'input';
-						    break;
-						case 'output':
-						    $this->opStatus = 'output';
-						    break;
-						case 'body':
-						    if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
-						    } else {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
-						    } 
-						    break;
-					} 
-					break;
-				case 'service':
-					switch ($name) {
-					    case 'port':
-					        $this->currentPort = $attrs['name'];
-					        $this->debug('current port: ' . $this->currentPort);
-					        $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
-					
-					        break;
-					    case 'address':
-					        $this->ports[$this->currentPort]['location'] = $attrs['location'];
-					        $this->ports[$this->currentPort]['bindingType'] = $namespace;
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
-					        break;
-					} 
-					break;
-			} 
-		// set status
-		switch ($name) {
-			case 'import':
-			    if (isset($attrs['location'])) {
-                    $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
-				} else {
-                    $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
-					}
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
-				}
-				break;
-			//wait for schema
-			//case 'types':
-			//	$this->status = 'schema';
-			//	break;
-			case 'message':
-				$this->status = 'message';
-				$this->messages[$attrs['name']] = array();
-				$this->currentMessage = $attrs['name'];
-				break;
-			case 'portType':
-				$this->status = 'portType';
-				$this->portTypes[$attrs['name']] = array();
-				$this->currentPortType = $attrs['name'];
-				break;
-			case "binding":
-				if (isset($attrs['name'])) {
-				// get binding name
-					if (strpos($attrs['name'], ':')) {
-			    		$this->currentBinding = $this->getLocalPart($attrs['name']);
-					} else {
-			    		$this->currentBinding = $attrs['name'];
-					} 
-					$this->status = 'binding';
-					$this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
-					$this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
-				} 
-				break;
-			case 'service':
-				$this->serviceName = $attrs['name'];
-				$this->status = 'service';
-				$this->debug('current service: ' . $this->serviceName);
-				break;
-			case 'definitions':
-				foreach ($attrs as $name => $value) {
-					$this->wsdl_info[$name] = $value;
-				} 
-				break;
-			} 
-		} 
-	} 
-
-	/**
-	* end-element handler
-	* 
-	* @param string $parser XML parser object
-	* @param string $name element name
-	* @access private 
-	*/
-	function end_element($parser, $name){ 
-		// unset schema status
-		if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
-			$this->status = "";
-            $this->appendDebug($this->currentSchema->getDebug());
-            $this->currentSchema->clearDebug();
-			$this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
-        	$this->debug('Parsing WSDL schema done');
-		} 
-		if ($this->status == 'schema') {
-			$this->currentSchema->schemaEndElement($parser, $name);
-		} else {
-			// bring depth down a notch
-			$this->depth--;
-		} 
-		// end documentation
-		if ($this->documentation) {
-			//TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
-			//$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
-			$this->documentation = false;
-		} 
-	} 
-
-	/**
-	 * element content handler
-	 * 
-	 * @param string $parser XML parser object
-	 * @param string $data element content
-	 * @access private 
-	 */
-	function character_data($parser, $data)
-	{
-		$pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
-		if (isset($this->message[$pos]['cdata'])) {
-			$this->message[$pos]['cdata'] .= $data;
-		} 
-		if ($this->documentation) {
-			$this->documentation .= $data;
-		} 
-	} 
-	
-	function getBindingData($binding)
-	{
-		if (is_array($this->bindings[$binding])) {
-			return $this->bindings[$binding];
-		} 
-	}
-	
-	/**
-	 * returns an assoc array of operation names => operation data
-	 * 
-	 * @param string $bindingType eg: soap, smtp, dime (only soap is currently supported)
-	 * @return array 
-	 * @access public 
-	 */
-	function getOperations($bindingType = 'soap')
-	{
-		$ops = array();
-		if ($bindingType == 'soap') {
-			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		}
-		// loop thru ports
-		foreach($this->ports as $port => $portData) {
-			// binding type of port matches parameter
-			if ($portData['bindingType'] == $bindingType) {
-				//$this->debug("getOperations for port $port");
-				//$this->debug("port data: " . $this->varDump($portData));
-				//$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
-				// merge bindings
-				if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
-					$ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
-				}
-			}
-		} 
-		return $ops;
-	} 
-	
-	/**
-	 * returns an associative array of data necessary for calling an operation
-	 * 
-	 * @param string $operation , name of operation
-	 * @param string $bindingType , type of binding eg: soap
-	 * @return array 
-	 * @access public 
-	 */
-	function getOperationData($operation, $bindingType = 'soap')
-	{
-		if ($bindingType == 'soap') {
-			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		}
-		// loop thru ports
-		foreach($this->ports as $port => $portData) {
-			// binding type of port matches parameter
-			if ($portData['bindingType'] == $bindingType) {
-				// get binding
-				//foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
-				foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
-					// note that we could/should also check the namespace here
-					if ($operation == $bOperation) {
-						$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
-					    return $opData;
-					} 
-				} 
-			}
-		} 
-	}
-	
-	/**
-	 * returns an associative array of data necessary for calling an operation
-	 * 
-	 * @param string $soapAction soapAction for operation
-	 * @param string $bindingType type of binding eg: soap
-	 * @return array 
-	 * @access public 
-	 */
-	function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') {
-		if ($bindingType == 'soap') {
-			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		}
-		// loop thru ports
-		foreach($this->ports as $port => $portData) {
-			// binding type of port matches parameter
-			if ($portData['bindingType'] == $bindingType) {
-				// loop through operations for the binding
-				foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
-					if ($opData['soapAction'] == $soapAction) {
-					    return $opData;
-					} 
-				} 
-			}
-		} 
-	}
-	
-	/**
-    * returns an array of information about a given type
-    * returns false if no type exists by the given name
-    *
-	*	 typeDef = array(
-	*	 'elements' => array(), // refs to elements array
-	*	'restrictionBase' => '',
-	*	'phpType' => '',
-	*	'order' => '(sequence|all)',
-	*	'attrs' => array() // refs to attributes array
-	*	)
-    *
-    * @param $type string the type
-    * @param $ns string namespace (not prefix) of the type
-    * @return mixed
-    * @access public
-    * @see xmlschema
-    */
-	function getTypeDef($type, $ns) {
-		$this->debug("in getTypeDef: type=$type, ns=$ns");
-		if ((! $ns) && isset($this->namespaces['tns'])) {
-			$ns = $this->namespaces['tns'];
-			$this->debug("in getTypeDef: type namespace forced to $ns");
-		}
-		if (isset($this->schemas[$ns])) {
-			$this->debug("in getTypeDef: have schema for namespace $ns");
-			for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
-				$xs = &$this->schemas[$ns][$i];
-				$t = $xs->getTypeDef($type);
-				$this->appendDebug($xs->getDebug());
-				$xs->clearDebug();
-				if ($t) {
-					if (!isset($t['phpType'])) {
-						// get info for type to tack onto the element
-						$uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
-						$ns = substr($t['type'], 0, strrpos($t['type'], ':'));
-						$etype = $this->getTypeDef($uqType, $ns);
-						if ($etype) {
-							$this->debug("found type for [element] $type:");
-							$this->debug($this->varDump($etype));
-							if (isset($etype['phpType'])) {
-								$t['phpType'] = $etype['phpType'];
-							}
-							if (isset($etype['elements'])) {
-								$t['elements'] = $etype['elements'];
-							}
-							if (isset($etype['attrs'])) {
-								$t['attrs'] = $etype['attrs'];
-							}
-						}
-					}
-					return $t;
-				}
-			}
-		} else {
-			$this->debug("in getTypeDef: do not have schema for namespace $ns");
-		}
-		return false;
-	}
-
-    /**
-    * prints html description of services
-    *
-    * @access private
-    */
-    function webDescription(){
-    	global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER)) {
-			$PHP_SELF = $_SERVER['PHP_SELF'];
-		} elseif (isset($HTTP_SERVER_VARS)) {
-			$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
-		} else {
-			$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
-		}
-
-		$b = '
-		<html><head><title>NuSOAP: '.$this->serviceName.'</title>
-		<style type="text/css">
-		    body    { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
-		    p       { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
-		    pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
-		    ul      { margin-top: 10px; margin-left: 20px; }
-		    li      { list-style-type: none; margin-top: 10px; color: #000000; }
-		    .content{
-			margin-left: 0px; padding-bottom: 2em; }
-		    .nav {
-			padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
-			margin-top: 10px; margin-left: 0px; color: #000000;
-			background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
-		    .title {
-			font-family: arial; font-size: 26px; color: #ffffff;
-			background-color: #999999; width: 105%; margin-left: 0px;
-			padding-top: 10px; padding-bottom: 10px; padding-left: 15px;}
-		    .hidden {
-			position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
-			font-family: arial; overflow: hidden; width: 600;
-			padding: 20px; font-size: 10px; background-color: #999999;
-			layer-background-color:#FFFFFF; }
-		    a,a:active  { color: charcoal; font-weight: bold; }
-		    a:visited   { color: #666666; font-weight: bold; }
-		    a:hover     { color: cc3300; font-weight: bold; }
-		</style>
-		<script language="JavaScript" type="text/javascript">
-		<!--
-		// POP-UP CAPTIONS...
-		function lib_bwcheck(){ //Browsercheck (needed)
-		    this.ver=navigator.appVersion
-		    this.agent=navigator.userAgent
-		    this.dom=document.getElementById?1:0
-		    this.opera5=this.agent.indexOf("Opera 5")>-1
-		    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
-		    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
-		    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
-		    this.ie=this.ie4||this.ie5||this.ie6
-		    this.mac=this.agent.indexOf("Mac")>-1
-		    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
-		    this.ns4=(document.layers && !this.dom)?1:0;
-		    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
-		    return this
-		}
-		var bw = new lib_bwcheck()
-		//Makes crossbrowser object.
-		function makeObj(obj){
-		    this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
-		    if(!this.evnt) return false
-		    this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
-		    this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
-		    this.writeIt=b_writeIt;
-		    return this
-		}
-		// A unit of measure that will be added when setting the position of a layer.
-		//var px = bw.ns4||window.opera?"":"px";
-		function b_writeIt(text){
-		    if (bw.ns4){this.wref.write(text);this.wref.close()}
-		    else this.wref.innerHTML = text
-		}
-		//Shows the messages
-		var oDesc;
-		function popup(divid){
-		    if(oDesc = new makeObj(divid)){
-			oDesc.css.visibility = "visible"
-		    }
-		}
-		function popout(){ // Hides message
-		    if(oDesc) oDesc.css.visibility = "hidden"
-		}
-		//-->
-		</script>
-		</head>
-		<body>
-		<div class=content>
-			<br><br>
-			<div class=title>'.$this->serviceName.'</div>
-			<div class=nav>
-				<p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service.
-				Click on an operation name to view it&apos;s details.</p>
-				<ul>';
-				foreach($this->getOperations() as $op => $data){
-				    $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
-				    // create hidden div
-				    $b .= "<div id='$op' class='hidden'>
-				    <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
-				    foreach($data as $donnie => $marie){ // loop through opdata
-						if($donnie == 'input' || $donnie == 'output'){ // show input/output data
-						    $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
-						    foreach($marie as $captain => $tenille){ // loop through data
-								if($captain == 'parts'){ // loop thru parts
-								    $b .= "&nbsp;&nbsp;$captain:<br>";
-					                //if(is_array($tenille)){
-								    	foreach($tenille as $joanie => $chachi){
-											$b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
-								    	}
-					        		//}
-								} else {
-								    $b .= "&nbsp;&nbsp;$captain: $tenille<br>";
-								}
-						    }
-						} else {
-						    $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>";
-						}
-				    }
-					$b .= '</div>';
-				}
-				$b .= '
-				<ul>
-			</div>
-		</div></body></html>';
-		return $b;
-    }
-
-	/**
-	* serialize the parsed wsdl
-	*
-	* @param mixed $debug whether to put debug=1 in endpoint URL
-	* @return string serialization of WSDL
-	* @access public 
-	*/
-	function serialize($debug = 0)
-	{
-		$xml = '<?xml version="1.0" encoding="UTF-8"?>';
-		$xml .= "\n<definitions";
-		foreach($this->namespaces as $k => $v) {
-			$xml .= " xmlns:$k=\"$v\"";
-		} 
-		// 10.9.02 - add poulter fix for wsdl and tns declarations
-		if (isset($this->namespaces['wsdl'])) {
-			$xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
-		} 
-		if (isset($this->namespaces['tns'])) {
-			$xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
-		} 
-		$xml .= '>'; 
-		// imports
-		if (sizeof($this->import) > 0) {
-			foreach($this->import as $ns => $list) {
-				foreach ($list as $ii) {
-					if ($ii['location'] != '') {
-						$xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
-					} else {
-						$xml .= '<import namespace="' . $ns . '" />';
-					}
-				}
-			} 
-		} 
-		// types
-		if (count($this->schemas)>=1) {
-			$xml .= "\n<types>";
-			foreach ($this->schemas as $ns => $list) {
-				foreach ($list as $xs) {
-					$xml .= $xs->serializeSchema();
-				}
-			}
-			$xml .= '</types>';
-		} 
-		// messages
-		if (count($this->messages) >= 1) {
-			foreach($this->messages as $msgName => $msgParts) {
-				$xml .= "\n<message name=\"" . $msgName . '">';
-				if(is_array($msgParts)){
-					foreach($msgParts as $partName => $partType) {
-						// print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
-						if (strpos($partType, ':')) {
-						    $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
-						} elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
-						    // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
-						    $typePrefix = 'xsd';
-						} else {
-						    foreach($this->typemap as $ns => $types) {
-						        if (isset($types[$partType])) {
-						            $typePrefix = $this->getPrefixFromNamespace($ns);
-						        } 
-						    } 
-						    if (!isset($typePrefix)) {
-						        die("$partType has no namespace!");
-						    } 
-						}
-						$ns = $this->getNamespaceFromPrefix($typePrefix);
-						$typeDef = $this->getTypeDef($this->getLocalPart($partType), $ns);
-						if ($typeDef['typeClass'] == 'element') {
-							$elementortype = 'element';
-						} else {
-							$elementortype = 'type';
-						}
-						$xml .= '<part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $this->getLocalPart($partType) . '" />';
-					}
-				}
-				$xml .= '</message>';
-			} 
-		} 
-		// bindings & porttypes
-		if (count($this->bindings) >= 1) {
-			$binding_xml = '';
-			$portType_xml = '';
-			foreach($this->bindings as $bindingName => $attrs) {
-				$binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
-				$binding_xml .= '<soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
-				$portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
-				foreach($attrs['operations'] as $opName => $opParts) {
-					$binding_xml .= '<operation name="' . $opName . '">';
-					$binding_xml .= '<soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
-					if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
-						$enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
-					} else {
-						$enc_style = '';
-					}
-					$binding_xml .= '<input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
-					if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
-						$enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
-					} else {
-						$enc_style = '';
-					}
-					$binding_xml .= '<output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
-					$binding_xml .= '</operation>';
-					$portType_xml .= '<operation name="' . $opParts['name'] . '"';
-					if (isset($opParts['parameterOrder'])) {
-					    $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
-					} 
-					$portType_xml .= '>';
-					if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
-						$portType_xml .= '<documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
-					}
-					$portType_xml .= '<input message="tns:' . $opParts['input']['message'] . '"/>';
-					$portType_xml .= '<output message="tns:' . $opParts['output']['message'] . '"/>';
-					$portType_xml .= '</operation>';
-				} 
-				$portType_xml .= '</portType>';
-				$binding_xml .= '</binding>';
-			} 
-			$xml .= $portType_xml . $binding_xml;
-		} 
-		// services
-		$xml .= "\n<service name=\"" . $this->serviceName . '">';
-		if (count($this->ports) >= 1) {
-			foreach($this->ports as $pName => $attrs) {
-				$xml .= '<port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
-				$xml .= '<soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
-				$xml .= '</port>';
-			} 
-		} 
-		$xml .= '</service>';
-		return $xml . "\n</definitions>";
-	} 
-	
-	/**
-	 * serialize PHP values according to a WSDL message definition
-	 *
-	 * TODO
-	 * - multi-ref serialization
-	 * - validate PHP values against type definitions, return errors if invalid
-	 * 
-	 * @param string $operation operation name
-	 * @param string $direction (input|output)
-	 * @param mixed $parameters parameter value(s)
-	 * @return mixed parameters serialized as XML or false on error (e.g. operation not found)
-	 * @access public
-	 */
-	function serializeRPCParameters($operation, $direction, $parameters)
-	{
-		$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); 
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
-		
-		if ($direction != 'input' && $direction != 'output') {
-			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
-			$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
-			return false;
-		} 
-		if (!$opData = $this->getOperationData($operation)) {
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
-			return false;
-		}
-		$this->debug('opData:');
-		$this->appendDebug($this->varDump($opData));
-
-		// Get encoding style for output and set to current
-		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
-			$encodingStyle = $opData['output']['encodingStyle'];
-			$enc_style = $encodingStyle;
-		}
-
-		// set input params
-		$xml = '';
-		if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
-			
-			$use = $opData[$direction]['use'];
-			$this->debug('have ' . count($opData[$direction]['parts']) . ' part(s) to serialize');
-			if (is_array($parameters)) {
-				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
-				$this->debug('have ' . count($parameters) . ' parameter(s) provided as ' . $parametersArrayType . ' to serialize');
-				foreach($opData[$direction]['parts'] as $name => $type) {
-					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
-					// Track encoding style
-					if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
-						$encodingStyle = $opData[$direction]['encodingStyle'];			
-						$enc_style = $encodingStyle;
-					} else {
-						$enc_style = false;
-					}
-					// NOTE: add error handling here
-					// if serializeType returns false, then catch global error and fault
-					if ($parametersArrayType == 'arraySimple') {
-						$p = array_shift($parameters);
-						$this->debug('calling serializeType w/indexed param');
-						$xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
-					} elseif (isset($parameters[$name])) {
-						$this->debug('calling serializeType w/named param');
-						$xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
-					} else {
-						// TODO: only send nillable
-						$this->debug('calling serializeType w/null param');
-						$xml .= $this->serializeType($name, $type, null, $use, $enc_style);
-					}
-				}
-			} else {
-				$this->debug('no parameters passed.');
-			}
-		}
-		$this->debug("serializeRPCParameters returning: $xml");
-		return $xml;
-	} 
-	
-	/**
-	 * serialize a PHP value according to a WSDL message definition
-	 * 
-	 * TODO
-	 * - multi-ref serialization
-	 * - validate PHP values against type definitions, return errors if invalid
-	 * 
-	 * @param string $ type name
-	 * @param mixed $ param value
-	 * @return mixed new param or false if initial value didn't validate
-	 * @access public
-	 * @deprecated
-	 */
-	function serializeParameters($operation, $direction, $parameters)
-	{
-		$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); 
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
-		
-		if ($direction != 'input' && $direction != 'output') {
-			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
-			$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
-			return false;
-		} 
-		if (!$opData = $this->getOperationData($operation)) {
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
-			return false;
-		}
-		$this->debug('opData:');
-		$this->appendDebug($this->varDump($opData));
-		
-		// Get encoding style for output and set to current
-		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
-			$encodingStyle = $opData['output']['encodingStyle'];
-			$enc_style = $encodingStyle;
-		}
-		
-		// set input params
-		$xml = '';
-		if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
-			
-			$use = $opData[$direction]['use'];
-			$this->debug("use=$use");
-			$this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
-			if (is_array($parameters)) {
-				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
-				$this->debug('have ' . $parametersArrayType . ' parameters');
-				foreach($opData[$direction]['parts'] as $name => $type) {
-					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
-					// Track encoding style
-					if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
-						$encodingStyle = $opData[$direction]['encodingStyle'];			
-						$enc_style = $encodingStyle;
-					} else {
-						$enc_style = false;
-					}
-					// NOTE: add error handling here
-					// if serializeType returns false, then catch global error and fault
-					if ($parametersArrayType == 'arraySimple') {
-						$p = array_shift($parameters);
-						$this->debug('calling serializeType w/indexed param');
-						$xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
-					} elseif (isset($parameters[$name])) {
-						$this->debug('calling serializeType w/named param');
-						$xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
-					} else {
-						// TODO: only send nillable
-						$this->debug('calling serializeType w/null param');
-						$xml .= $this->serializeType($name, $type, null, $use, $enc_style);
-					}
-				}
-			} else {
-				$this->debug('no parameters passed.');
-			}
-		}
-		$this->debug("serializeParameters returning: $xml");
-		return $xml;
-	} 
-	
-	/**
-	 * serializes a PHP value according a given type definition
-	 * 
-	 * @param string $name name of value (part or element)
-	 * @param string $type XML schema type of value (type or element)
-	 * @param mixed $value a native PHP value (parameter value)
-	 * @param string $use use for part (encoded|literal)
-	 * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style)
-	 * @param boolean $unqualified a kludge for what should be XML namespace form handling
-	 * @return string value serialized as an XML string
-	 * @access private
-	 */
-	function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
-	{
-		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
-		$this->appendDebug("value=" . $this->varDump($value));
-		if($use == 'encoded' && $encodingStyle) {
-			$encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
-		}
-
-		// if a soapval has been supplied, let its type override the WSDL
-    	if (is_object($value) && get_class($value) == 'soapval') {
-    		if ($value->type_ns) {
-    			$type = $value->type_ns . ':' . $value->type;
-		    	$forceType = true;
-		    	$this->debug("in serializeType: soapval overrides type to $type");
-    		} elseif ($value->type) {
-	    		$type = $value->type;
-		    	$forceType = true;
-		    	$this->debug("in serializeType: soapval overrides type to $type");
-	    	} else {
-	    		$forceType = false;
-		    	$this->debug("in serializeType: soapval does not override type");
-	    	}
-	    	$attrs = $value->attributes;
-	    	$value = $value->value;
-	    	$this->debug("in serializeType: soapval overrides value to $value");
-	    	if ($attrs) {
-	    		if (!is_array($value)) {
-	    			$value['!'] = $value;
-	    		}
-	    		foreach ($attrs as $n => $v) {
-	    			$value['!' . $n] = $v;
-	    		}
-		    	$this->debug("in serializeType: soapval provides attributes");
-		    }
-        } else {
-        	$forceType = false;
-        }
-
-		$xml = '';
-		if (strpos($type, ':')) {
-			$uqType = substr($type, strrpos($type, ':') + 1);
-			$ns = substr($type, 0, strrpos($type, ':'));
-			$this->debug("in serializeType: got a prefixed type: $uqType, $ns");
-			if ($this->getNamespaceFromPrefix($ns)) {
-				$ns = $this->getNamespaceFromPrefix($ns);
-				$this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
-			}
-
-			if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
-				$this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
-				if ($unqualified  && $use == 'literal') {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-				if (is_null($value)) {
-					if ($use == 'literal') {
-						// TODO: depends on minOccurs
-						$xml = "<$name$elementNS/>";
-					} else {
-						// TODO: depends on nillable, which should be checked before calling this method
-						$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
-					}
-					$this->debug("in serializeType: returning: $xml");
-					return $xml;
-				}
-		    	if ($uqType == 'boolean') {
-		    		if ((is_string($value) && $value == 'false') || (! $value)) {
-						$value = 'false';
-					} else {
-						$value = 'true';
-					}
-				} 
-				if ($uqType == 'string' && gettype($value) == 'string') {
-					$value = $this->expandEntities($value);
-				}
-				if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') {
-					$value = sprintf("%.0lf", $value);
-				}
-				// it's a scalar
-				// TODO: what about null/nil values?
-				// check type isn't a custom type extending xmlschema namespace
-				if (!$this->getTypeDef($uqType, $ns)) {
-					if ($use == 'literal') {
-						if ($forceType) {
-							$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
-						} else {
-							$xml = "<$name$elementNS>$value</$name>";
-						}
-					} else {
-						$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
-					}
-					$this->debug("in serializeType: returning: $xml");
-					return $xml;
-				}
-				$this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
-			} else if ($ns == 'http://xml.apache.org/xml-soap') {
-				$this->debug('in serializeType: appears to be Apache SOAP type');
-				if ($uqType == 'Map') {
-					$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
-					if (! $tt_prefix) {
-						$this->debug('in serializeType: Add namespace for Apache SOAP type');
-						$tt_prefix = 'ns' . rand(1000, 9999);
-						$this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
-						// force this to be added to usedNamespaces
-						$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
-					}
-					$contents = '';
-					foreach($value as $k => $v) {
-						$this->debug("serializing map element: key $k, value $v");
-						$contents .= '<item>';
-						$contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
-						$contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
-						$contents .= '</item>';
-					}
-					if ($use == 'literal') {
-						if ($forceType) {
-							$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
-						} else {
-							$xml = "<$name>$contents</$name>";
-						}
-					} else {
-						$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
-					}
-					$this->debug("in serializeType: returning: $xml");
-					return $xml;
-				}
-				$this->debug('in serializeType: Apache SOAP type, but only support Map');
-			}
-		} else {
-			// TODO: should the type be compared to types in XSD, and the namespace
-			// set to XSD if the type matches?
-			$this->debug("in serializeType: No namespace for type $type");
-			$ns = '';
-			$uqType = $type;
-		}
-		if(!$typeDef = $this->getTypeDef($uqType, $ns)){
-			$this->setError("$type ($uqType) is not a supported type.");
-			$this->debug("in serializeType: $type ($uqType) is not a supported type.");
-			return false;
-		} else {
-			$this->debug("in serializeType: found typeDef");
-			$this->appendDebug('typeDef=' . $this->varDump($typeDef));
-		}
-		$phpType = $typeDef['phpType'];
-		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); 
-		// if php type == struct, map value to the <all> element names
-		if ($phpType == 'struct') {
-			if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
-				$elementName = $uqType;
-				if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
-					$elementNS = " xmlns=\"$ns\"";
-				} else {
-					$elementNS = " xmlns=\"\"";
-				}
-			} else {
-				$elementName = $name;
-				if ($unqualified) {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-			}
-			if (is_null($value)) {
-				if ($use == 'literal') {
-					// TODO: depends on minOccurs
-					$xml = "<$elementName$elementNS/>";
-				} else {
-					$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
-				}
-				$this->debug("in serializeType: returning: $xml");
-				return $xml;
-			}
-			if (is_object($value)) {
-				$value = get_object_vars($value);
-			}
-			if (is_array($value)) {
-				$elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
-				if ($use == 'literal') {
-					if ($forceType) {
-						$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
-					} else {
-						$xml = "<$elementName$elementNS$elementAttrs>";
-					}
-				} else {
-					$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
-				}
-	
-				$xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
-				$xml .= "</$elementName>";
-			} else {
-				$this->debug("in serializeType: phpType is struct, but value is not an array");
-				$this->setError("phpType is struct, but value is not an array: see debug output for details");
-				$xml = '';
-			}
-		} elseif ($phpType == 'array') {
-			if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
-				$elementNS = " xmlns=\"$ns\"";
-			} else {
-				if ($unqualified) {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-			}
-			if (is_null($value)) {
-				if ($use == 'literal') {
-					// TODO: depends on minOccurs
-					$xml = "<$name$elementNS/>";
-				} else {
-					$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
-						":Array\" " .
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
-						':arrayType="' .
-						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
-						':' .
-						$this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
-				}
-				$this->debug("in serializeType: returning: $xml");
-				return $xml;
-			}
-			if (isset($typeDef['multidimensional'])) {
-				$nv = array();
-				foreach($value as $v) {
-					$cols = ',' . sizeof($v);
-					$nv = array_merge($nv, $v);
-				} 
-				$value = $nv;
-			} else {
-				$cols = '';
-			} 
-			if (is_array($value) && sizeof($value) >= 1) {
-				$rows = sizeof($value);
-				$contents = '';
-				foreach($value as $k => $v) {
-					$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
-					//if (strpos($typeDef['arrayType'], ':') ) {
-					if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
-					    $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
-					} else {
-					    $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
-					} 
-				}
-			} else {
-				$rows = 0;
-				$contents = null;
-			}
-			// TODO: for now, an empty value will be serialized as a zero element
-			// array.  Revisit this when coding the handling of null/nil values.
-			if ($use == 'literal') {
-				$xml = "<$name$elementNS>"
-					.$contents
-					."</$name>";
-			} else {
-				$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '.
-					$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
-					.':arrayType="'
-					.$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
-					.":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
-					.$contents
-					."</$name>";
-			}
-		} elseif ($phpType == 'scalar') {
-			if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
-				$elementNS = " xmlns=\"$ns\"";
-			} else {
-				if ($unqualified) {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-			}
-			if ($use == 'literal') {
-				if ($forceType) {
-					$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
-				} else {
-					$xml = "<$name$elementNS>$value</$name>";
-				}
-			} else {
-				$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
-			}
-		}
-		$this->debug("in serializeType: returning: $xml");
-		return $xml;
-	}
-	
-	/**
-	 * serializes the attributes for a complexType
-	 *
-	 * @param array $typeDef our internal representation of an XML schema type (or element)
-	 * @param mixed $value a native PHP value (parameter value)
-	 * @param string $ns the namespace of the type
-	 * @param string $uqType the local part of the type
-	 * @return string value serialized as an XML string
-	 * @access private
-	 */
-	function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) {
-		$xml = '';
-		if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
-			$this->debug("serialize attributes for XML Schema type $ns:$uqType");
-			if (is_array($value)) {
-				$xvalue = $value;
-			} elseif (is_object($value)) {
-				$xvalue = get_object_vars($value);
-			} else {
-				$this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
-				$xvalue = array();
-			}
-			foreach ($typeDef['attrs'] as $aName => $attrs) {
-				if (isset($xvalue['!' . $aName])) {
-					$xname = '!' . $aName;
-					$this->debug("value provided for attribute $aName with key $xname");
-				} elseif (isset($xvalue[$aName])) {
-					$xname = $aName;
-					$this->debug("value provided for attribute $aName with key $xname");
-				} elseif (isset($attrs['default'])) {
-					$xname = '!' . $aName;
-					$xvalue[$xname] = $attrs['default'];
-					$this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
-				} else {
-					$xname = '';
-					$this->debug("no value provided for attribute $aName");
-				}
-				if ($xname) {
-					$xml .=  " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
-				}
-			} 
-		} else {
-			$this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
-		}
-		if (isset($typeDef['extensionBase'])) {
-			$ns = $this->getPrefix($typeDef['extensionBase']);
-			$uqType = $this->getLocalPart($typeDef['extensionBase']);
-			if ($this->getNamespaceFromPrefix($ns)) {
-				$ns = $this->getNamespaceFromPrefix($ns);
-			}
-			if ($typeDef = $this->getTypeDef($uqType, $ns)) {
-				$this->debug("serialize attributes for extension base $ns:$uqType");
-				$xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
-			} else {
-				$this->debug("extension base $ns:$uqType is not a supported type");
-			}
-		}
-		return $xml;
-	}
-
-	/**
-	 * serializes the elements for a complexType
-	 *
-	 * @param array $typeDef our internal representation of an XML schema type (or element)
-	 * @param mixed $value a native PHP value (parameter value)
-	 * @param string $ns the namespace of the type
-	 * @param string $uqType the local part of the type
-	 * @param string $use use for part (encoded|literal)
-	 * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style)
-	 * @return string value serialized as an XML string
-	 * @access private
-	 */
-	function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) {
-		$xml = '';
-		if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
-			$this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
-			if (is_array($value)) {
-				$xvalue = $value;
-			} elseif (is_object($value)) {
-				$xvalue = get_object_vars($value);
-			} else {
-				$this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
-				$xvalue = array();
-			}
-			// toggle whether all elements are present - ideally should validate against schema
-			if (count($typeDef['elements']) != count($xvalue)){
-				$optionals = true;
-			}
-			foreach ($typeDef['elements'] as $eName => $attrs) {
-				if (!isset($xvalue[$eName])) {
-					if (isset($attrs['default'])) {
-						$xvalue[$eName] = $attrs['default'];
-						$this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
-					}
-				}
-				// if user took advantage of a minOccurs=0, then only serialize named parameters
-				if (isset($optionals)
-				    && (!isset($xvalue[$eName])) 
-					&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
-					){
-					if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
-						$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
-					}
-					// do nothing
-					$this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
-				} else {
-					// get value
-					if (isset($xvalue[$eName])) {
-					    $v = $xvalue[$eName];
-					} else {
-					    $v = null;
-					}
-					if (isset($attrs['form'])) {
-						$unqualified = ($attrs['form'] == 'unqualified');
-					} else {
-						$unqualified = false;
-					}
-					if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
-						$vv = $v;
-						foreach ($vv as $k => $v) {
-							if (isset($attrs['type']) || isset($attrs['ref'])) {
-								// serialize schema-defined type
-							    $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
-							} else {
-								// serialize generic type (can this ever really happen?)
-							    $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
-							    $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
-							}
-						}
-					} else {
-						if (isset($attrs['type']) || isset($attrs['ref'])) {
-							// serialize schema-defined type
-						    $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
-						} else {
-							// serialize generic type (can this ever really happen?)
-						    $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
-						    $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
-						}
-					}
-				}
-			} 
-		} else {
-			$this->debug("no elements to serialize for XML Schema type $ns:$uqType");
-		}
-		if (isset($typeDef['extensionBase'])) {
-			$ns = $this->getPrefix($typeDef['extensionBase']);
-			$uqType = $this->getLocalPart($typeDef['extensionBase']);
-			if ($this->getNamespaceFromPrefix($ns)) {
-				$ns = $this->getNamespaceFromPrefix($ns);
-			}
-			if ($typeDef = $this->getTypeDef($uqType, $ns)) {
-				$this->debug("serialize elements for extension base $ns:$uqType");
-				$xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
-			} else {
-				$this->debug("extension base $ns:$uqType is not a supported type");
-			}
-		}
-		return $xml;
-	}
-
-	/**
-	* adds an XML Schema complex type to the WSDL types
-	*
-	* @param string	name
-	* @param string typeClass (complexType|simpleType|attribute)
-	* @param string phpType: currently supported are array and struct (php assoc array)
-	* @param string compositor (all|sequence|choice)
-	* @param string restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param array elements = array ( name => array(name=>'',type=>'') )
-	* @param array attrs = 	array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
-	* @param string arrayType: namespace:name (xsd:string)
-	* @see xmlschema
-	* @access public
-	*/
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') {
-		if (count($elements) > 0) {
-	    	foreach($elements as $n => $e){
-	            // expand each element
-	            foreach ($e as $k => $v) {
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
-		            $ee[$k] = $v;
-		    	}
-	    		$eElements[$n] = $ee;
-	    	}
-	    	$elements = $eElements;
-		}
-		
-		if (count($attrs) > 0) {
-	    	foreach($attrs as $n => $a){
-	            // expand each attribute
-	            foreach ($a as $k => $v) {
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
-		            $aa[$k] = $v;
-		    	}
-	    		$eAttrs[$n] = $aa;
-	    	}
-	    	$attrs = $eAttrs;
-		}
-
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
-		$arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
-
-		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
-		$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
-	}
-
-	/**
-	* adds an XML Schema simple type to the WSDL types
-	*
-	* @param string $name
-	* @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param string $typeClass (should always be simpleType)
-	* @param string $phpType (should always be scalar)
-	* @param array $enumeration array of values
-	* @see xmlschema
-	* @access public
-	*/
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
-
-		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
-		$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
-	}
-
-	/**
-	* adds an element to the WSDL types
-	*
-	* @param array $attrs attributes that must include name and type
-	* @see xmlschema
-	* @access public
-	*/
-	function addElement($attrs) {
-		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
-		$this->schemas[$typens][0]->addElement($attrs);
-	}
-
-	/**
-	* register an operation with the server
-	* 
-	* @param string $name operation (method) name
-	* @param array $in assoc array of input values: key = param name, value = param type
-	* @param array $out assoc array of output values: key = param name, value = param type
-	* @param string $namespace optional The namespace for the operation
-	* @param string $soapaction optional The soapaction for the operation
-	* @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically
-	* @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now)
-	* @param string $documentation optional The description to include in the WSDL
-	* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
-	* @access public 
-	*/
-	function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
-		if ($use == 'encoded' && $encodingStyle == '') {
-			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		}
-
-		if ($style == 'document') {
-			$elements = array();
-			foreach ($in as $n => $t) {
-				$elements[$n] = array('name' => $n, 'type' => $t);
-			}
-			$this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
-			$this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
-			$in = array('parameters' => 'tns:' . $name);
-
-			$elements = array();
-			foreach ($out as $n => $t) {
-				$elements[$n] = array('name' => $n, 'type' => $t);
-			}
-			$this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
-			$this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType'));
-			$out = array('parameters' => 'tns:' . $name . 'Response');
-		}
-
-		// get binding
-		$this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
-		array(
-		'name' => $name,
-		'binding' => $this->serviceName . 'Binding',
-		'endpoint' => $this->endpoint,
-		'soapAction' => $soapaction,
-		'style' => $style,
-		'input' => array(
-			'use' => $use,
-			'namespace' => $namespace,
-			'encodingStyle' => $encodingStyle,
-			'message' => $name . 'Request',
-			'parts' => $in),
-		'output' => array(
-			'use' => $use,
-			'namespace' => $namespace,
-			'encodingStyle' => $encodingStyle,
-			'message' => $name . 'Response',
-			'parts' => $out),
-		'namespace' => $namespace,
-		'transport' => 'http://schemas.xmlsoap.org/soap/http',
-		'documentation' => $documentation); 
-		// add portTypes
-		// add messages
-		if($in)
-		{
-			foreach($in as $pName => $pType)
-			{
-				if(strpos($pType,':')) {
-					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
-				}
-				$this->messages[$name.'Request'][$pName] = $pType;
-			}
-		} else {
-            $this->messages[$name.'Request']= '0';
-        }
-		if($out)
-		{
-			foreach($out as $pName => $pType)
-			{
-				if(strpos($pType,':')) {
-					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
-				}
-				$this->messages[$name.'Response'][$pName] = $pType;
-			}
-		} else {
-            $this->messages[$name.'Response']= '0';
-        }
-		return true;
-	} 
-}
-
-?>
diff --git a/libraries/nusoap/class.wsdlcache.php b/libraries/nusoap/class.wsdlcache.php
deleted file mode 100644
index 976cf84ac..000000000
--- a/libraries/nusoap/class.wsdlcache.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-
-
-
-/**
-* caches instances of the wsdl class
-* 
-* @author   Scott Nichol <snichol@computer.org>
-* @author	Ingo Fischer <ingo@apollon.de>
-* @version  $Id: class.wsdlcache.php,v 1.5 2005/05/20 17:58:17 snichol Exp $
-* @access public 
-*/
-class wsdlcache {
-	/**
-	 *	@var resource
-	 *	@access private
-	 */
-	var $fplock;
-	/**
-	 *	@var integer
-	 *	@access private
-	 */
-	var $cache_lifetime;
-	/**
-	 *	@var string
-	 *	@access private
-	 */
-	var $cache_dir;
-	/**
-	 *	@var string
-	 *	@access public
-	 */
-	var $debug_str = '';
-
-	/**
-	* constructor
-	*
-	* @param string $cache_dir directory for cache-files
-	* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
-	* @access public
-	*/
-	function wsdlcache($cache_dir='.', $cache_lifetime=0) {
-		$this->fplock = array();
-		$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
-		$this->cache_lifetime = $cache_lifetime;
-	}
-
-	/**
-	* creates the filename used to cache a wsdl instance
-	*
-	* @param string $wsdl The URL of the wsdl instance
-	* @return string The filename used to cache the instance
-	* @access private
-	*/
-	function createFilename($wsdl) {
-		return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
-	}
-
-	/**
-	* adds debug data to the class level debug string
-	*
-	* @param    string $string debug data
-	* @access   private
-	*/
-	function debug($string){
-		$this->debug_str .= get_class($this).": $string\n";
-	}
-
-	/**
-	* gets a wsdl instance from the cache
-	*
-	* @param string $wsdl The URL of the wsdl instance
-	* @return object wsdl The cached wsdl instance, null if the instance is not in the cache
-	* @access public
-	*/
-	function get($wsdl) {
-		$filename = $this->createFilename($wsdl);
-		if ($this->obtainMutex($filename, "r")) {
-			// check for expired WSDL that must be removed from the cache
- 			if ($this->cache_lifetime > 0) {
-				if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
-					unlink($filename);
-					$this->debug("Expired $wsdl ($filename) from cache");
-					$this->releaseMutex($filename);
-					return null;
-  				}
-			}
-			// see what there is to return
-			$fp = @fopen($filename, "r");
-			if ($fp) {
-				$s = implode("", @file($filename));
-				fclose($fp);
-				$this->debug("Got $wsdl ($filename) from cache");
-			} else {
-				$s = null;
-				$this->debug("$wsdl ($filename) not in cache");
-			}
-			$this->releaseMutex($filename);
-			return (!is_null($s)) ? unserialize($s) : null;
-		} else {
-			$this->debug("Unable to obtain mutex for $filename in get");
-		}
-		return null;
-	}
-
-	/**
-	* obtains the local mutex
-	*
-	* @param string $filename The Filename of the Cache to lock
-	* @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
-	* @return boolean Lock successfully obtained ?!
-	* @access private
-	*/
-	function obtainMutex($filename, $mode) {
-		if (isset($this->fplock[md5($filename)])) {
-			$this->debug("Lock for $filename already exists");
-			return false;
-		}
-		$this->fplock[md5($filename)] = fopen($filename.".lock", "w");
-		if ($mode == "r") {
-			return flock($this->fplock[md5($filename)], LOCK_SH);
-		} else {
-			return flock($this->fplock[md5($filename)], LOCK_EX);
-		}
-	}
-
-	/**
-	* adds a wsdl instance to the cache
-	*
-	* @param object wsdl $wsdl_instance The wsdl instance to add
-	* @return boolean WSDL successfully cached
-	* @access public
-	*/
-	function put($wsdl_instance) {
-		$filename = $this->createFilename($wsdl_instance->wsdl);
-		$s = serialize($wsdl_instance);
-		if ($this->obtainMutex($filename, "w")) {
-			$fp = fopen($filename, "w");
-			fputs($fp, $s);
-			fclose($fp);
-			$this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
-			$this->releaseMutex($filename);
-			return true;
-		} else {
-			$this->debug("Unable to obtain mutex for $filename in put");
-		}
-		return false;
-	}
-
-	/**
-	* releases the local mutex
-	*
-	* @param string $filename The Filename of the Cache to lock
-	* @return boolean Lock successfully released
-	* @access private
-	*/
-	function releaseMutex($filename) {
-		$ret = flock($this->fplock[md5($filename)], LOCK_UN);
-		fclose($this->fplock[md5($filename)]);
-		unset($this->fplock[md5($filename)]);
-		if (! $ret) {
-			$this->debug("Not able to release lock for $filename");
-		}
-		return $ret;
-	}
-
-	/**
-	* removes a wsdl instance from the cache
-	*
-	* @param string $wsdl The URL of the wsdl instance
-	* @return boolean Whether there was an instance to remove
-	* @access public
-	*/
-	function remove($wsdl) {
-		$filename = $this->createFilename($wsdl);
-		// ignore errors obtaining mutex
-		$this->obtainMutex($filename, "w");
-		$ret = unlink($filename);
-		$this->debug("Removed ($ret) $wsdl ($filename) from cache");
-		$this->releaseMutex($filename);
-		return $ret;
-	}
-}
-?>
diff --git a/libraries/nusoap/class.xmlschema.php b/libraries/nusoap/class.xmlschema.php
deleted file mode 100644
index 30d8558d7..000000000
--- a/libraries/nusoap/class.xmlschema.php
+++ /dev/null
@@ -1,906 +0,0 @@
-<?php
-
-
-
-
-/**
-* parses an XML Schema, allows access to it's data, other utility methods
-* no validation... yet.
-* very experimental and limited. As is discussed on XML-DEV, I'm one of the people
-* that just doesn't have time to read the spec(s) thoroughly, and just have a couple of trusty
-* tutorials I refer to :)
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: class.xmlschema.php,v 1.39 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class XMLSchema extends nusoap_base  {
-	
-	// files
-	var $schema = '';
-	var $xml = '';
-	// namespaces
-	var $enclosingNamespaces;
-	// schema info
-	var $schemaInfo = array();
-	var $schemaTargetNamespace = '';
-	// types, elements, attributes defined by the schema
-	var $attributes = array();
-	var $complexTypes = array();
-	var $complexTypeStack = array();
-	var $currentComplexType = null;
-	var $elements = array();
-	var $elementStack = array();
-	var $currentElement = null;
-	var $simpleTypes = array();
-	var $simpleTypeStack = array();
-	var $currentSimpleType = null;
-	// imports
-	var $imports = array();
-	// parser vars
-	var $parser;
-	var $position = 0;
-	var $depth = 0;
-	var $depth_array = array();
-	var $message = array();
-	var $defaultNamespace = array();
-    
-	/**
-	* constructor
-	*
-	* @param    string $schema schema document URI
-	* @param    string $xml xml document URI
-	* @param	string $namespaces namespaces defined in enclosing XML
-	* @access   public
-	*/
-	function XMLSchema($schema='',$xml='',$namespaces=array()){
-		parent::nusoap_base();
-		$this->debug('xmlschema class instantiated, inside constructor');
-		// files
-		$this->schema = $schema;
-		$this->xml = $xml;
-
-		// namespaces
-		$this->enclosingNamespaces = $namespaces;
-		$this->namespaces = array_merge($this->namespaces, $namespaces);
-
-		// parse schema file
-		if($schema != ''){
-			$this->debug('initial schema file: '.$schema);
-			$this->parseFile($schema, 'schema');
-		}
-
-		// parse xml file
-		if($xml != ''){
-			$this->debug('initial xml file: '.$xml);
-			$this->parseFile($xml, 'xml');
-		}
-
-	}
-
-    /**
-    * parse an XML file
-    *
-    * @param string $xml, path/URL to XML file
-    * @param string $type, (schema | xml)
-	* @return boolean
-    * @access public
-    */
-	function parseFile($xml,$type){
-		// parse xml file
-		if($xml != ""){
-			$xmlStr = @join("",@file($xml));
-			if($xmlStr == ""){
-				$msg = 'Error reading XML from '.$xml;
-				$this->setError($msg);
-				$this->debug($msg);
-			return false;
-			} else {
-				$this->debug("parsing $xml");
-				$this->parseString($xmlStr,$type);
-				$this->debug("done parsing $xml");
-			return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	* parse an XML string
-	*
-	* @param    string $xml path or URL
-    * @param string $type, (schema|xml)
-	* @access   private
-	*/
-	function parseString($xml,$type){
-		// parse xml string
-		if($xml != ""){
-
-	    	// Create an XML parser.
-	    	$this->parser = xml_parser_create();
-	    	// Set the options for parsing the XML data.
-	    	xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
-
-	    	// Set the object for the parser.
-	    	xml_set_object($this->parser, $this);
-
-	    	// Set the element handlers for the parser.
-			if($type == "schema"){
-		    	xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
-		    	xml_set_character_data_handler($this->parser,'schemaCharacterData');
-			} elseif($type == "xml"){
-				xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
-		    	xml_set_character_data_handler($this->parser,'xmlCharacterData');
-			}
-
-		    // Parse the XML file.
-		    if(!xml_parse($this->parser,$xml,true)){
-			// Display an error message.
-				$errstr = sprintf('XML error parsing XML schema on line %d: %s',
-				xml_get_current_line_number($this->parser),
-				xml_error_string(xml_get_error_code($this->parser))
-				);
-				$this->debug($errstr);
-				$this->debug("XML payload:\n" . $xml);
-				$this->setError($errstr);
-	    	}
-            
-			xml_parser_free($this->parser);
-		} else{
-			$this->debug('no xml passed to parseString()!!');
-			$this->setError('no xml passed to parseString()!!');
-		}
-	}
-
-	/**
-	* start-element handler
-	*
-	* @param    string $parser XML parser object
-	* @param    string $name element name
-	* @param    string $attrs associative array of attributes
-	* @access   private
-	*/
-	function schemaStartElement($parser, $name, $attrs) {
-		
-		// position in the total number of elements, starting from 0
-		$pos = $this->position++;
-		$depth = $this->depth++;
-		// set self as current value for this depth
-		$this->depth_array[$depth] = $pos;
-		$this->message[$pos] = array('cdata' => ''); 
-		if ($depth > 0) {
-			$this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
-		} else {
-			$this->defaultNamespace[$pos] = false;
-		}
-
-		// get element prefix
-		if($prefix = $this->getPrefix($name)){
-			// get unqualified name
-			$name = $this->getLocalPart($name);
-		} else {
-        	$prefix = '';
-        }
-		
-        // loop thru attributes, expanding, and registering namespace declarations
-        if(count($attrs) > 0){
-        	foreach($attrs as $k => $v){
-                // if ns declarations, add to class level array of valid namespaces
-				if(ereg("^xmlns",$k)){
-                	//$this->xdebug("$k: $v");
-                	//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
-                	if($ns_prefix = substr(strrchr($k,':'),1)){
-                		//$this->xdebug("Add namespace[$ns_prefix] = $v");
-						$this->namespaces[$ns_prefix] = $v;
-					} else {
-						$this->defaultNamespace[$pos] = $v;
-						if (! $this->getPrefixFromNamespace($v)) {
-							$this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
-						}
-					}
-					if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
-						$this->XMLSchemaVersion = $v;
-						$this->namespaces['xsi'] = $v.'-instance';
-					}
-				}
-        	}
-        	foreach($attrs as $k => $v){
-                // expand each attribute
-                $k = strpos($k,':') ? $this->expandQname($k) : $k;
-                $v = strpos($v,':') ? $this->expandQname($v) : $v;
-        		$eAttrs[$k] = $v;
-        	}
-        	$attrs = $eAttrs;
-        } else {
-        	$attrs = array();
-        }
-		// find status, register data
-		switch($name){
-			case 'all':			// (optional) compositor content for a complexType
-			case 'choice':
-			case 'group':
-			case 'sequence':
-				//$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
-				$this->complexTypes[$this->currentComplexType]['compositor'] = $name;
-				//if($name == 'all' || $name == 'sequence'){
-				//	$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
-				//}
-			break;
-			case 'attribute':	// complexType attribute
-            	//$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
-            	$this->xdebug("parsing attribute:");
-            	$this->appendDebug($this->varDump($attrs));
-				if (!isset($attrs['form'])) {
-					$attrs['form'] = $this->schemaInfo['attributeFormDefault'];
-				}
-            	if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
-					$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-					if (!strpos($v, ':')) {
-						// no namespace in arrayType attribute value...
-						if ($this->defaultNamespace[$pos]) {
-							// ...so use the default
-							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-						}
-					}
-            	}
-                if(isset($attrs['name'])){
-					$this->attributes[$attrs['name']] = $attrs;
-					$aname = $attrs['name'];
-				} elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
-					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
-	                	$aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-	                } else {
-	                	$aname = '';
-	                }
-				} elseif(isset($attrs['ref'])){
-					$aname = $attrs['ref'];
-                    $this->attributes[$attrs['ref']] = $attrs;
-				}
-                
-				if($this->currentComplexType){	// This should *always* be
-					$this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
-				}
-				// arrayType attribute
-				if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
-					$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-                	$prefix = $this->getPrefix($aname);
-					if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
-						$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-					} else {
-						$v = '';
-					}
-                    if(strpos($v,'[,]')){
-                        $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
-                    }
-                    $v = substr($v,0,strpos($v,'[')); // clip the []
-                    if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
-                        $v = $this->XMLSchemaVersion.':'.$v;
-                    }
-                    $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
-				}
-			break;
-			case 'complexContent':	// (optional) content for a complexType
-			break;
-			case 'complexType':
-				array_push($this->complexTypeStack, $this->currentComplexType);
-				if(isset($attrs['name'])){
-					$this->xdebug('processing named complexType '.$attrs['name']);
-					//$this->currentElement = false;
-					$this->currentComplexType = $attrs['name'];
-					$this->complexTypes[$this->currentComplexType] = $attrs;
-					$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
-					// This is for constructs like
-					//           <complexType name="ListOfString" base="soap:Array">
-					//                <sequence>
-					//                    <element name="string" type="xsd:string"
-					//                        minOccurs="0" maxOccurs="unbounded" />
-					//                </sequence>
-					//            </complexType>
-					if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
-						$this->xdebug('complexType is unusual array');
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-					} else {
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
-					}
-				}else{
-					$this->xdebug('processing unnamed complexType for element '.$this->currentElement);
-					$this->currentComplexType = $this->currentElement . '_ContainedType';
-					//$this->currentElement = false;
-					$this->complexTypes[$this->currentComplexType] = $attrs;
-					$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
-					// This is for constructs like
-					//           <complexType name="ListOfString" base="soap:Array">
-					//                <sequence>
-					//                    <element name="string" type="xsd:string"
-					//                        minOccurs="0" maxOccurs="unbounded" />
-					//                </sequence>
-					//            </complexType>
-					if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
-						$this->xdebug('complexType is unusual array');
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-					} else {
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
-					}
-				}
-			break;
-			case 'element':
-				array_push($this->elementStack, $this->currentElement);
-				// elements defined as part of a complex type should
-				// not really be added to $this->elements, but for some
-				// reason, they are
-				if (!isset($attrs['form'])) {
-					$attrs['form'] = $this->schemaInfo['elementFormDefault'];
-				}
-				if(isset($attrs['type'])){
-					$this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
-					if (! $this->getPrefix($attrs['type'])) {
-						if ($this->defaultNamespace[$pos]) {
-							$attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
-							$this->xdebug('used default namespace to make type ' . $attrs['type']);
-						}
-					}
-					// This is for constructs like
-					//           <complexType name="ListOfString" base="soap:Array">
-					//                <sequence>
-					//                    <element name="string" type="xsd:string"
-					//                        minOccurs="0" maxOccurs="unbounded" />
-					//                </sequence>
-					//            </complexType>
-					if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
-						$this->xdebug('arrayType for unusual array is ' . $attrs['type']);
-						$this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
-					}
-					$this->currentElement = $attrs['name'];
-					$this->elements[ $attrs['name'] ] = $attrs;
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-					$ename = $attrs['name'];
-				} elseif(isset($attrs['ref'])){
-					$this->xdebug("processing element as ref to ".$attrs['ref']);
-					$this->currentElement = "ref to ".$attrs['ref'];
-					$ename = $this->getLocalPart($attrs['ref']);
-				} else {
-					$this->xdebug("processing untyped element ".$attrs['name']);
-					$this->currentElement = $attrs['name'];
-					$this->elements[ $attrs['name'] ] = $attrs;
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-					$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['name'] . '_ContainedType';
-					$this->elements[ $attrs['name'] ]['type'] = $attrs['type'];
-					$ename = $attrs['name'];
-				}
-				if(isset($ename) && $this->currentComplexType){
-					$this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
-				}
-			break;
-			case 'enumeration':	//	restriction value list member
-				$this->xdebug('enumeration ' . $attrs['value']);
-				if ($this->currentSimpleType) {
-					$this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
-				} elseif ($this->currentComplexType) {
-					$this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
-				}
-			break;
-			case 'extension':	// simpleContent or complexContent type extension
-				$this->xdebug('extension ' . $attrs['base']);
-				if ($this->currentComplexType) {
-					$this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
-				}
-			break;
-			case 'import':
-			    if (isset($attrs['schemaLocation'])) {
-					//$this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
-                    $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
-				} else {
-					//$this->xdebug('import namespace ' . $attrs['namespace']);
-                    $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
-					}
-				}
-			break;
-			case 'list':	// simpleType value list
-			break;
-			case 'restriction':	// simpleType, simpleContent or complexContent value restriction
-				$this->xdebug('restriction ' . $attrs['base']);
-				if($this->currentSimpleType){
-					$this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
-				} elseif($this->currentComplexType){
-					$this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
-					if(strstr($attrs['base'],':') == ':Array'){
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-					}
-				}
-			break;
-			case 'schema':
-				$this->schemaInfo = $attrs;
-				$this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
-				if (isset($attrs['targetNamespace'])) {
-					$this->schemaTargetNamespace = $attrs['targetNamespace'];
-				}
-				if (!isset($attrs['elementFormDefault'])) {
-					$this->schemaInfo['elementFormDefault'] = 'unqualified';
-				}
-				if (!isset($attrs['attributeFormDefault'])) {
-					$this->schemaInfo['attributeFormDefault'] = 'unqualified';
-				}
-			break;
-			case 'simpleContent':	// (optional) content for a complexType
-			break;
-			case 'simpleType':
-				array_push($this->simpleTypeStack, $this->currentSimpleType);
-				if(isset($attrs['name'])){
-					$this->xdebug("processing simpleType for name " . $attrs['name']);
-					$this->currentSimpleType = $attrs['name'];
-					$this->simpleTypes[ $attrs['name'] ] = $attrs;
-					$this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
-					$this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
-				} else {
-					$this->xdebug('processing unnamed simpleType for element '.$this->currentElement);
-					$this->currentSimpleType = $this->currentElement . '_ContainedType';
-					//$this->currentElement = false;
-					$this->simpleTypes[$this->currentSimpleType] = $attrs;
-					$this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
-				}
-			break;
-			case 'union':	// simpleType type list
-			break;
-			default:
-				//$this->xdebug("do not have anything to do for element $name");
-		}
-	}
-
-	/**
-	* end-element handler
-	*
-	* @param    string $parser XML parser object
-	* @param    string $name element name
-	* @access   private
-	*/
-	function schemaEndElement($parser, $name) {
-		// bring depth down a notch
-		$this->depth--;
-		// position of current element is equal to the last value left in depth_array for my depth
-		if(isset($this->depth_array[$this->depth])){
-        	$pos = $this->depth_array[$this->depth];
-        }
-		// get element prefix
-		if ($prefix = $this->getPrefix($name)){
-			// get unqualified name
-			$name = $this->getLocalPart($name);
-		} else {
-        	$prefix = '';
-        }
-		// move on...
-		if($name == 'complexType'){
-			$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
-			$this->currentComplexType = array_pop($this->complexTypeStack);
-			//$this->currentElement = false;
-		}
-		if($name == 'element'){
-			$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
-			$this->currentElement = array_pop($this->elementStack);
-		}
-		if($name == 'simpleType'){
-			$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
-			$this->currentSimpleType = array_pop($this->simpleTypeStack);
-		}
-	}
-
-	/**
-	* element content handler
-	*
-	* @param    string $parser XML parser object
-	* @param    string $data element content
-	* @access   private
-	*/
-	function schemaCharacterData($parser, $data){
-		$pos = $this->depth_array[$this->depth - 1];
-		$this->message[$pos]['cdata'] .= $data;
-	}
-
-	/**
-	* serialize the schema
-	*
-	* @access   public
-	*/
-	function serializeSchema(){
-
-		$schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
-		$xml = '';
-		// imports
-		if (sizeof($this->imports) > 0) {
-			foreach($this->imports as $ns => $list) {
-				foreach ($list as $ii) {
-					if ($ii['location'] != '') {
-						$xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
-					} else {
-						$xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
-					}
-				}
-			} 
-		} 
-		// complex types
-		foreach($this->complexTypes as $typeName => $attrs){
-			$contentStr = '';
-			// serialize child elements
-			if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
-				foreach($attrs['elements'] as $element => $eParts){
-					if(isset($eParts['ref'])){
-						$contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
-					} else {
-						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
-						foreach ($eParts as $aName => $aValue) {
-							// handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
-							if ($aName != 'name' && $aName != 'type') {
-								$contentStr .= " $aName=\"$aValue\"";
-							}
-						}
-						$contentStr .= "/>\n";
-					}
-				}
-				// compositor wraps elements
-				if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) {
-					$contentStr = "  <$schemaPrefix:$attrs[compositor]>\n".$contentStr."  </$schemaPrefix:$attrs[compositor]>\n";
-				}
-			}
-			// attributes
-			if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
-				foreach($attrs['attrs'] as $attr => $aParts){
-					$contentStr .= "    <$schemaPrefix:attribute";
-					foreach ($aParts as $a => $v) {
-						if ($a == 'ref' || $a == 'type') {
-							$contentStr .= " $a=\"".$this->contractQName($v).'"';
-						} elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') {
-							$this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
-							$contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
-						} else {
-							$contentStr .= " $a=\"$v\"";
-						}
-					}
-					$contentStr .= "/>\n";
-				}
-			}
-			// if restriction
-			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
-				$contentStr = "   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr."   </$schemaPrefix:restriction>\n";
-				// complex or simple content
-				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
-					$contentStr = "  <$schemaPrefix:complexContent>\n".$contentStr."  </$schemaPrefix:complexContent>\n";
-				}
-			}
-			// finalize complex type
-			if($contentStr != ''){
-				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
-			} else {
-				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
-			}
-			$xml .= $contentStr;
-		}
-		// simple types
-		if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
-			foreach($this->simpleTypes as $typeName => $eParts){
-				$xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\"/>\n";
-				if (isset($eParts['enumeration'])) {
-					foreach ($eParts['enumeration'] as $e) {
-						$xml .= "  <$schemaPrefix:enumeration value=\"$e\"/>\n";
-					}
-				}
-				$xml .= " </$schemaPrefix:simpleType>";
-			}
-		}
-		// elements
-		if(isset($this->elements) && count($this->elements) > 0){
-			foreach($this->elements as $element => $eParts){
-				$xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
-			}
-		}
-		// attributes
-		if(isset($this->attributes) && count($this->attributes) > 0){
-			foreach($this->attributes as $attr => $aParts){
-				$xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
-			}
-		}
-		// finish 'er up
-		$el = "<$schemaPrefix:schema targetNamespace=\"$this->schemaTargetNamespace\"\n";
-		foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
-			$el .= " xmlns:$nsp=\"$ns\"\n";
-		}
-		$xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
-		return $xml;
-	}
-
-	/**
-	* adds debug data to the clas level debug string
-	*
-	* @param    string $string debug data
-	* @access   private
-	*/
-	function xdebug($string){
-		$this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
-	}
-
-    /**
-    * get the PHP type of a user defined type in the schema
-    * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays
-    * returns false if no type exists, or not w/ the given namespace
-    * else returns a string that is either a native php type, or 'struct'
-    *
-    * @param string $type, name of defined type
-    * @param string $ns, namespace of type
-    * @return mixed
-    * @access public
-    * @deprecated
-    */
-	function getPHPType($type,$ns){
-		if(isset($this->typemap[$ns][$type])){
-			//print "found type '$type' and ns $ns in typemap<br>";
-			return $this->typemap[$ns][$type];
-		} elseif(isset($this->complexTypes[$type])){
-			//print "getting type '$type' and ns $ns from complexTypes array<br>";
-			return $this->complexTypes[$type]['phpType'];
-		}
-		return false;
-	}
-
-	/**
-    * returns an associative array of information about a given type
-    * returns false if no type exists by the given name
-    *
-	*	For a complexType typeDef = array(
-	*	'restrictionBase' => '',
-	*	'phpType' => '',
-	*	'compositor' => '(sequence|all)',
-	*	'elements' => array(), // refs to elements array
-	*	'attrs' => array() // refs to attributes array
-	*	... and so on (see addComplexType)
-	*	)
-	*
-	*   For simpleType or element, the array has different keys.
-    *
-    * @param string
-    * @return mixed
-    * @access public
-    * @see addComplexType
-    * @see addSimpleType
-    * @see addElement
-    */
-	function getTypeDef($type){
-		//$this->debug("in getTypeDef for type $type");
-		if(isset($this->complexTypes[$type])){
-			$this->xdebug("in getTypeDef, found complexType $type");
-			return $this->complexTypes[$type];
-		} elseif(isset($this->simpleTypes[$type])){
-			$this->xdebug("in getTypeDef, found simpleType $type");
-			if (!isset($this->simpleTypes[$type]['phpType'])) {
-				// get info for type to tack onto the simple type
-				// TODO: can this ever really apply (i.e. what is a simpleType really?)
-				$uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1);
-				$ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':'));
-				$etype = $this->getTypeDef($uqType);
-				if ($etype) {
-					$this->xdebug("in getTypeDef, found type for simpleType $type:");
-					$this->xdebug($this->varDump($etype));
-					if (isset($etype['phpType'])) {
-						$this->simpleTypes[$type]['phpType'] = $etype['phpType'];
-					}
-					if (isset($etype['elements'])) {
-						$this->simpleTypes[$type]['elements'] = $etype['elements'];
-					}
-				}
-			}
-			return $this->simpleTypes[$type];
-		} elseif(isset($this->elements[$type])){
-			$this->xdebug("in getTypeDef, found element $type");
-			if (!isset($this->elements[$type]['phpType'])) {
-				// get info for type to tack onto the element
-				$uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
-				$ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
-				$etype = $this->getTypeDef($uqType);
-				if ($etype) {
-					$this->xdebug("in getTypeDef, found type for element $type:");
-					$this->xdebug($this->varDump($etype));
-					if (isset($etype['phpType'])) {
-						$this->elements[$type]['phpType'] = $etype['phpType'];
-					}
-					if (isset($etype['elements'])) {
-						$this->elements[$type]['elements'] = $etype['elements'];
-					}
-				} elseif ($ns == 'http://www.w3.org/2001/XMLSchema') {
-					$this->xdebug("in getTypeDef, element $type is an XSD type");
-					$this->elements[$type]['phpType'] = 'scalar';
-				}
-			}
-			return $this->elements[$type];
-		} elseif(isset($this->attributes[$type])){
-			$this->xdebug("in getTypeDef, found attribute $type");
-			return $this->attributes[$type];
-		} elseif (ereg('_ContainedType$', $type)) {
-			$this->xdebug("in getTypeDef, have an untyped element $type");
-			$typeDef['typeClass'] = 'simpleType';
-			$typeDef['phpType'] = 'scalar';
-			$typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string';
-			return $typeDef;
-		}
-		$this->xdebug("in getTypeDef, did not find $type");
-		return false;
-	}
-
-	/**
-    * returns a sample serialization of a given type, or false if no type by the given name
-    *
-    * @param string $type, name of type
-    * @return mixed
-    * @access public
-    * @deprecated
-    */
-    function serializeTypeDef($type){
-    	//print "in sTD() for type $type<br>";
-	if($typeDef = $this->getTypeDef($type)){
-		$str .= '<'.$type;
-	    if(is_array($typeDef['attrs'])){
-		foreach($attrs as $attName => $data){
-		    $str .= " $attName=\"{type = ".$data['type']."}\"";
-		}
-	    }
-	    $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
-	    if(count($typeDef['elements']) > 0){
-		$str .= ">";
-		foreach($typeDef['elements'] as $element => $eData){
-		    $str .= $this->serializeTypeDef($element);
-		}
-		$str .= "</$type>";
-	    } elseif($typeDef['typeClass'] == 'element') {
-		$str .= "></$type>";
-	    } else {
-		$str .= "/>";
-	    }
-			return $str;
-	}
-    	return false;
-    }
-
-    /**
-    * returns HTML form elements that allow a user
-    * to enter values for creating an instance of the given type.
-    *
-    * @param string $name, name for type instance
-    * @param string $type, name of type
-    * @return string
-    * @access public
-    * @deprecated
-	*/
-	function typeToForm($name,$type){
-		// get typedef
-		if($typeDef = $this->getTypeDef($type)){
-			// if struct
-			if($typeDef['phpType'] == 'struct'){
-				$buffer .= '<table>';
-				foreach($typeDef['elements'] as $child => $childDef){
-					$buffer .= "
-					<tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
-					<td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>";
-				}
-				$buffer .= '</table>';
-			// if array
-			} elseif($typeDef['phpType'] == 'array'){
-				$buffer .= '<table>';
-				for($i=0;$i < 3; $i++){
-					$buffer .= "
-					<tr><td align='right'>array item (type: $typeDef[arrayType]):</td>
-					<td><input type='text' name='parameters[".$name."][]'></td></tr>";
-				}
-				$buffer .= '</table>';
-			// if scalar
-			} else {
-				$buffer .= "<input type='text' name='parameters[$name]'>";
-			}
-		} else {
-			$buffer .= "<input type='text' name='parameters[$name]'>";
-		}
-		return $buffer;
-	}
-	
-	/**
-	* adds a complex type to the schema
-	* 
-	* example: array
-	* 
-	* addType(
-	* 	'ArrayOfstring',
-	* 	'complexType',
-	* 	'array',
-	* 	'',
-	* 	'SOAP-ENC:Array',
-	* 	array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
-	* 	'xsd:string'
-	* );
-	* 
-	* example: PHP associative array ( SOAP Struct )
-	* 
-	* addType(
-	* 	'SOAPStruct',
-	* 	'complexType',
-	* 	'struct',
-	* 	'all',
-	* 	array('myVar'=> array('name'=>'myVar','type'=>'string')
-	* );
-	* 
-	* @param name
-	* @param typeClass (complexType|simpleType|attribute)
-	* @param phpType: currently supported are array and struct (php assoc array)
-	* @param compositor (all|sequence|choice)
-	* @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param elements = array ( name = array(name=>'',type=>'') )
-	* @param attrs = array(
-	* 	array(
-	*		'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType",
-	*		"http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]"
-	* 	)
-	* )
-	* @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
-	* @access public
-	* @see getTypeDef
-	*/
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
-		$this->complexTypes[$name] = array(
-	    'name'		=> $name,
-	    'typeClass'	=> $typeClass,
-	    'phpType'	=> $phpType,
-		'compositor'=> $compositor,
-	    'restrictionBase' => $restrictionBase,
-		'elements'	=> $elements,
-	    'attrs'		=> $attrs,
-	    'arrayType'	=> $arrayType
-		);
-		
-		$this->xdebug("addComplexType $name:");
-		$this->appendDebug($this->varDump($this->complexTypes[$name]));
-	}
-	
-	/**
-	* adds a simple type to the schema
-	*
-	* @param string $name
-	* @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param string $typeClass (should always be simpleType)
-	* @param string $phpType (should always be scalar)
-	* @param array $enumeration array of values
-	* @access public
-	* @see xmlschema
-	* @see getTypeDef
-	*/
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
-		$this->simpleTypes[$name] = array(
-	    'name'			=> $name,
-	    'typeClass'		=> $typeClass,
-	    'phpType'		=> $phpType,
-	    'type'			=> $restrictionBase,
-	    'enumeration'	=> $enumeration
-		);
-		
-		$this->xdebug("addSimpleType $name:");
-		$this->appendDebug($this->varDump($this->simpleTypes[$name]));
-	}
-
-	/**
-	* adds an element to the schema
-	*
-	* @param array $attrs attributes that must include name and type
-	* @see xmlschema
-	* @access public
-	*/
-	function addElement($attrs) {
-		if (! $this->getPrefix($attrs['type'])) {
-			$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
-		}
-		$this->elements[ $attrs['name'] ] = $attrs;
-		$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-		
-		$this->xdebug("addElement " . $attrs['name']);
-		$this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
-	}
-}
-
-
-
-
-?>
\ No newline at end of file
diff --git a/libraries/nusoap/nusoap.php b/libraries/nusoap/nusoap.php
deleted file mode 100644
index b9ddd7a64..000000000
--- a/libraries/nusoap/nusoap.php
+++ /dev/null
@@ -1,7264 +0,0 @@
-<?php
-
-require_once('include/logging.php');
-/*
-$Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-
-NuSOAP - Web Services Toolkit for PHP
-
-Copyright (c) 2002 NuSphere Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-If you have any questions or comments, please email:
-
-Dietrich Ayala
-dietrich@ganx4.com
-http://dietrich.ganx4.com/nusoap
-
-NuSphere Corporation
-http://www.nusphere.com
-
-*/
-
-/* load classes
-
-// necessary classes
-require_once('class.soapclient.php');
-require_once('class.soap_val.php');
-require_once('class.soap_parser.php');
-require_once('class.soap_fault.php');
-
-// transport classes
-require_once('class.soap_transport_http.php');
-
-// optional add-on classes
-require_once('class.xmlschema.php');
-require_once('class.wsdl.php');
-
-// server class
-require_once('class.soap_server.php');*/
-
-// class variable emulation
-// cf. http://www.webkreator.com/php/techniques/php-static-class-variables.html
-if (!isset($GLOBALS['_transient']['static']['nusoap_base'])) {
-    $GLOBALS['_transient']['static']['nusoap_base'] = new stdClass();
-}
-
-$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
-global $soap_log;
-$soap_log = Logger::getLogger('SOAP');
-/**
-*
-* nusoap_base
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class nusoap_base {
-	/**
-	 * Identification for HTTP headers.
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $title = 'NuSOAP';
-	/**
-	 * Version for HTTP headers.
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $version = '0.7.2';
-	/**
-	 * CVS revision for HTTP headers.
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $revision = '$Revision: 1.94 $';
-    /**
-     * Current error string (manipulated by getError/setError)
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $error_str = '';
-    /**
-     * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
-	 *
-	 * @var string
-	 * @access private
-	 */
-    var $debug_str = '';
-    /**
-	 * toggles automatic encoding of special characters as entities
-	 * (should always be true, I think)
-	 *
-	 * @var boolean
-	 * @access private
-	 */
-	var $charencoding = true;
-	/**
-	 * the debug level for this instance
-	 *
-	 * @var	integer
-	 * @access private
-	 */
-	var $debugLevel = 9;
-
-    /**
-	* set schema version
-	*
-	* @var      string
-	* @access   public
-	*/
-	var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
-	
-    /**
-	* charset encoding for outgoing messages
-	*
-	* @var      string
-	* @access   public
-	*/
-    	//var $soap_defencoding = 'ISO-8859-1';
-	var $soap_defencoding = 'UTF-8';
-
-	/**
-	* namespaces in an array of prefix => uri
-	*
-	* this is "seeded" by a set of constants, but it may be altered by code
-	*
-	* @var      array
-	* @access   public
-	*/
-	var $namespaces = array(
-		'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
-		'xsd' => 'http://www.w3.org/2001/XMLSchema',
-		'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
-		'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
-		);
-
-	/**
-	* namespaces used in the current context, e.g. during serialization
-	*
-	* @var      array
-	* @access   private
-	*/
-	var $usedNamespaces = array();
-
-	/**
-	* XML Schema types in an array of uri => (array of xml type => php type)
-	* is this legacy yet?
-	* no, this is used by the xmlschema class to verify type => namespace mappings.
-	* @var      array
-	* @access   public
-	*/
-	var $typemap = array(
-	'http://www.w3.org/2001/XMLSchema' => array(
-		'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
-		'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
-		'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
-		// abstract "any" types
-		'anyType'=>'string','anySimpleType'=>'string',
-		// derived datatypes
-		'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
-		'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
-		'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
-		'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
-	'http://www.w3.org/2000/10/XMLSchema' => array(
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
-		'float'=>'double','dateTime'=>'string',
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
-	'http://www.w3.org/1999/XMLSchema' => array(
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
-		'float'=>'double','dateTime'=>'string',
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
-	'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
-	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
-    'http://xml.apache.org/xml-soap' => array('Map')
-	);
-
-	/**
-	* XML entities to convert
-	*
-	* @var      array
-	* @access   public
-	* @deprecated
-	* @see	expandEntities
-	*/
-	var $xmlEntities = array('quot' => '"','amp' => '&',
-		'lt' => '<','gt' => '>','apos' => "'");
-	
-	
-
-	/**
-	* constructor
-	*
-	* @access	public
-	*/
-	function nusoap_base() {
-		$this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
-	}
-
-	/**
-	* gets the global debug level, which applies to future instances
-	*
-	* @return	integer	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function getGlobalDebugLevel() {
-		return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
-	}
-
-	/**
-	* sets the global debug level, which applies to future instances
-	*
-	* @param	int	$level	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function setGlobalDebugLevel($level) {
-		$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
-	}
-
-	/**
-	* gets the debug level for this instance
-	*
-	* @return	int	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function getDebugLevel() {
-		return $this->debugLevel;
-	}
-
-	/**
-	* sets the debug level for this instance
-	*
-	* @param	int	$level	Debug level 0-9, where 0 turns off
-	* @access	public
-	*/
-	function setDebugLevel($level) {
-		$this->debugLevel = $level;
-	}
-
-	/**
-	* adds debug data to the instance debug string with formatting
-	*
-	* @param    string $string debug data
-	* @access   private
-	*/
-	function debug($string){
-		if ($this->debugLevel > 0) {
-			$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
-		}
-	}
-
-	/**
-	* adds debug data to the instance debug string without formatting
-	*
-	* @param    string $string debug data
-	* @access   public
-	*/
-	function appendDebug($string){
-		if ($this->debugLevel > 0) {
-			// it would be nice to use a memory stream here to use
-			// memory more efficiently
-			global $soap_log;
-			$soap_log->debug($string);
-			$this->debug_str .= $string;
-		}
-	}
-
-	/**
-	* clears the current debug data for this instance
-	*
-	* @access   public
-	*/
-	function clearDebug() {
-		// it would be nice to use a memory stream here to use
-		// memory more efficiently
-		$this->debug_str = '';
-	}
-
-	/**
-	* gets the current debug data for this instance
-	*
-	* @return   debug data
-	* @access   public
-	*/
-	function &getDebug() {
-		// it would be nice to use a memory stream here to use
-		// memory more efficiently
-		return $this->debug_str;
-	}
-
-	/**
-	* gets the current debug data for this instance as an XML comment
-	* this may change the contents of the debug data
-	*
-	* @return   debug data as an XML comment
-	* @access   public
-	*/
-	function &getDebugAsXMLComment() {
-		// it would be nice to use a memory stream here to use
-		// memory more efficiently
-		while (strpos($this->debug_str, '--')) {
-			$this->debug_str = str_replace('--', '- -', $this->debug_str);
-		}
-    	return "<!--\n" . $this->debug_str . "\n-->";
-	}
-
-	/**
-	* expands entities, e.g. changes '<' to '&lt;'.
-	*
-	* @param	string	$val	The string in which to expand entities.
-	* @access	private
-	*/
-	function expandEntities($val) {
-		if ($this->charencoding) {
-	    	$val = str_replace('&', '&amp;', $val);
-	    	$val = str_replace("'", '&apos;', $val);
-	    	$val = str_replace('"', '&quot;', $val);
-	    	$val = str_replace('<', '&lt;', $val);
-	    	$val = str_replace('>', '&gt;', $val);
-	    }
-	    return $val;
-	}
-
-	/**
-	* returns error string if present
-	*
-	* @return   mixed error string or false
-	* @access   public
-	*/
-	function getError(){
-		if($this->error_str != ''){
-			return $this->error_str;
-		}
-		return false;
-	}
-
-	/**
-	* sets error string
-	*
-	* @return   boolean $string error string
-	* @access   private
-	*/
-	function setError($str){
-		$this->error_str = $str;
-	}
-
-	/**
-	* detect if array is a simple array or a struct (associative array)
-	*
-	* @param	mixed	$val	The PHP array
-	* @return	string	(arraySimple|arrayStruct)
-	* @access	private
-	*/
-	function isArraySimpleOrStruct($val) {
-        $keyList = array_keys($val);
-		foreach ($keyList as $keyListValue) {
-			if (!is_int($keyListValue)) {
-				return 'arrayStruct';
-			}
-		}
-		return 'arraySimple';
-	}
-
-	/**
-	* serializes PHP values in accordance w/ section 5. Type information is
-	* not serialized if $use == 'literal'.
-	*
-	* @param	mixed	$val	The value to serialize
-	* @param	string	$name	The name (local part) of the XML element
-	* @param	string	$type	The XML schema type (local part) for the element
-	* @param	string	$name_ns	The namespace for the name of the XML element
-	* @param	string	$type_ns	The namespace for the type of the element
-	* @param	array	$attributes	The attributes to serialize as name=>value pairs
-	* @param	string	$use	The WSDL "use" (encoded|literal)
-	* @return	string	The serialized element, possibly with child elements
-    * @access	public
-	*/
-	function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded'){
-		$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use");
-		$this->appendDebug('value=' . $this->varDump($val));
-		$this->appendDebug('attributes=' . $this->varDump($attributes));
-		
-    	if(is_object($val) && get_class($val) == 'soapval'){
-        	return $val->serialize($use);
-        }
-		// force valid name if necessary
-		if (is_numeric($name)) {
-			$name = '__numeric_' . $name;
-		} elseif (! $name) {
-			$name = 'noname';
-		}
-		// if name has ns, add ns prefix to name
-		$xmlns = '';
-        if($name_ns){
-			$prefix = 'nu'.rand(1000,9999);
-			$name = $prefix.':'.$name;
-			$xmlns .= " xmlns:$prefix=\"$name_ns\"";
-		}
-		// if type is prefixed, create type prefix
-		if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
-			// need to fix this. shouldn't default to xsd if no ns specified
-		    // w/o checking against typemap
-			$type_prefix = 'xsd';
-		} elseif($type_ns){
-			$type_prefix = 'ns'.rand(1000,9999);
-			$xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
-		}
-		// serialize attributes if present
-		$atts = '';
-		if($attributes){
-			foreach($attributes as $k => $v){
-				$atts .= " $k=\"".$this->expandEntities($v).'"';
-			}
-		}
-		// serialize null value
-		if (is_null($val)) {
-			if ($use == 'literal') {
-				// TODO: depends on minOccurs
-	        	return "<$name$xmlns $atts/>";
-        	} else {
-				if (isset($type) && isset($type_prefix)) {
-					$type_str = " xsi:type=\"$type_prefix:$type\"";
-				} else {
-					$type_str = '';
-				}
-	        	return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
-        	}
-		}
-        // serialize if an xsd built-in primitive type
-        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
-        	if (is_bool($val)) {
-        		if ($type == 'boolean') {
-	        		$val = $val ? 'true' : 'false';
-	        	} elseif (! $val) {
-	        		$val = 0;
-	        	}
-			} else if (is_string($val)) {
-				$val = $this->expandEntities($val);
-			}
-			if ($use == 'literal') {
-	        	return "<$name$xmlns $atts>$val</$name>";
-        	} else {
-	        	return "<$name$xmlns $atts xsi:type=\"xsd:$type\">$val</$name>";
-        	}
-        }
-		// detect type and serialize
-		$xml = '';
-		switch(true) {
-			case (is_bool($val) || $type == 'boolean'):
-        		if ($type == 'boolean') {
-	        		$val = $val ? 'true' : 'false';
-	        	} elseif (! $val) {
-	        		$val = 0;
-	        	}
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
-				}
-				break;
-			case (is_int($val) || is_long($val) || $type == 'int'):
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
-				}
-				break;
-			case (is_float($val)|| is_double($val) || $type == 'float'):
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
-				}
-				break;
-			case (is_string($val) || $type == 'string'):
-				$val = $this->expandEntities($val);
-				if ($use == 'literal') {
-					$xml .= "<$name$xmlns $atts>$val</$name>";
-				} else {
-					$xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
-				}
-				break;
-			case is_object($val):
-				if (! $name) {
-					$name = get_class($val);
-					$this->debug("In serialize_val, used class name $name as element name");
-				} else {
-					$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
-				}
-				foreach(get_object_vars($val) as $k => $v){
-					$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
-				}
-				$xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
-				break;
-			break;
-			case (is_array($val) || $type):
-				// detect if struct or array
-				$valueType = $this->isArraySimpleOrStruct($val);
-                if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
-					$i = 0;
-					if(is_array($val) && count($val)> 0){
-						foreach($val as $v){
-	                    	if(is_object($v) && get_class($v) ==  'soapval'){
-								$tt_ns = $v->type_ns;
-								$tt = $v->type;
-							} elseif (is_array($v)) {
-								$tt = $this->isArraySimpleOrStruct($v);
-							} else {
-								$tt = gettype($v);
-	                        }
-							$array_types[$tt] = 1;
-							// TODO: for literal, the name should be $name
-							$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
-							++$i;
-						}
-						if(count($array_types) > 1){
-							$array_typename = 'xsd:anyType';
-						} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
-							if ($tt == 'integer') {
-								$tt = 'int';
-							}
-							$array_typename = 'xsd:'.$tt;
-						} elseif(isset($tt) && $tt == 'arraySimple'){
-							$array_typename = 'SOAP-ENC:Array';
-						} elseif(isset($tt) && $tt == 'arrayStruct'){
-							$array_typename = 'unnamed_struct_use_soapval';
-						} else {
-							// if type is prefixed, create type prefix
-							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
-								 $array_typename = 'xsd:' . $tt;
-							} elseif ($tt_ns) {
-								$tt_prefix = 'ns' . rand(1000, 9999);
-								$array_typename = "$tt_prefix:$tt";
-								$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
-							} else {
-								$array_typename = $tt;
-							}
-						}
-						$array_type = $i;
-						if ($use == 'literal') {
-							$type_str = '';
-						} else if (isset($type) && isset($type_prefix)) {
-							$type_str = " xsi:type=\"$type_prefix:$type\"";
-						} else {
-							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
-						}
-					// empty array
-					} else {
-						if ($use == 'literal') {
-							$type_str = '';
-						} else if (isset($type) && isset($type_prefix)) {
-							$type_str = " xsi:type=\"$type_prefix:$type\"";
-						} else {
-							$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
-						}
-					}
-					// TODO: for array in literal, there is no wrapper here
-					$xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
-				} else {
-					// got a struct
-					if(isset($type) && isset($type_prefix)){
-						$type_str = " xsi:type=\"$type_prefix:$type\"";
-					} else {
-						$type_str = '';
-					}
-					if ($use == 'literal') {
-						$xml .= "<$name$xmlns $atts>";
-					} else {
-						$xml .= "<$name$xmlns$type_str$atts>";
-					}
-					foreach($val as $k => $v){
-						// Apache Map
-						if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
-							$xml .= '<item>';
-							$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
-							$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
-							$xml .= '</item>';
-						} else {
-							$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
-						}
-					}
-					$xml .= "</$name>";
-				}
-				break;
-			default:
-				$xml .= 'not detected, got '.gettype($val).' for '.$val;
-				break;
-		}
-		return $xml;
-	}
-
-    /**
-    * serializes a message
-    *
-    * @param string $body the XML of the SOAP body
-    * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
-    * @param array $namespaces optional the namespaces used in generating the body and headers
-    * @param string $style optional (rpc|document)
-    * @param string $use optional (encoded|literal)
-    * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
-    * @return string the message
-    * @access public
-    */
-    function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
-    // TODO: add an option to automatically run utf8_encode on $body and $headers
-    // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
-    // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
-
-	$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
-	$this->debug("headers:");
-	$this->appendDebug($this->varDump($headers));
-	$this->debug("namespaces:");
-	$this->appendDebug($this->varDump($namespaces));
-
-	// serialize namespaces
-    $ns_string = '';
-	foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
-		$ns_string .= " xmlns:$k=\"$v\"";
-	}
-	if($encodingStyle) {
-		$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
-	}
-
-	// serialize headers
-	if($headers){
-		if (is_array($headers)) {
-			$xml = '';
-			foreach ($headers as $header) {
-				$xml .= $this->serialize_val($header, false, false, false, false, false, $use);
-			}
-			$headers = $xml;
-			$this->debug("In serializeEnvelope, serialzied array of headers to $headers");
-		}
-		$headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
-	}
-	// serialize envelope
-	return
-	'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
-	'<SOAP-ENV:Envelope'.$ns_string.">".
-	$headers.
-	"<SOAP-ENV:Body>".
-		$body.
-	"</SOAP-ENV:Body>".
-	"</SOAP-ENV:Envelope>";
-    }
-
-	/**
-	 * formats a string to be inserted into an HTML stream
-	 *
-	 * @param string $str The string to format
-	 * @return string The formatted string
-	 * @access public
-	 * @deprecated
-	 */
-    function formatDump($str){
-		$str = htmlspecialchars($str);
-		return nl2br($str);
-    }
-
-	/**
-	* contracts (changes namespace to prefix) a qualified name
-	*
-	* @param    string $qname qname
-	* @return	string contracted qname
-	* @access   private
-	*/
-	function contractQname($qname){
-		// get element namespace
-		//$this->xdebug("Contract $qname");
-		if (strrpos($qname, ':')) {
-			// get unqualified name
-			$name = substr($qname, strrpos($qname, ':') + 1);
-			// get ns
-			$ns = substr($qname, 0, strrpos($qname, ':'));
-			$p = $this->getPrefixFromNamespace($ns);
-			if ($p) {
-				return $p . ':' . $name;
-			}
-			return $qname;
-		} else {
-			return $qname;
-		}
-	}
-
-	/**
-	* expands (changes prefix to namespace) a qualified name
-	*
-	* @param    string $string qname
-	* @return	string expanded qname
-	* @access   private
-	*/
-	function expandQname($qname){
-		// get element prefix
-		if(strpos($qname,':') && !ereg('^http://',$qname)){
-			// get unqualified name
-			$name = substr(strstr($qname,':'),1);
-			// get ns prefix
-			$prefix = substr($qname,0,strpos($qname,':'));
-			if(isset($this->namespaces[$prefix])){
-				return $this->namespaces[$prefix].':'.$name;
-			} else {
-				return $qname;
-			}
-		} else {
-			return $qname;
-		}
-	}
-
-    /**
-    * returns the local part of a prefixed string
-    * returns the original string, if not prefixed
-    *
-    * @param string $str The prefixed string
-    * @return string The local part
-    * @access public
-    */
-	function getLocalPart($str){
-		if($sstr = strrchr($str,':')){
-			// get unqualified name
-			return substr( $sstr, 1 );
-		} else {
-			return $str;
-		}
-	}
-
-	/**
-    * returns the prefix part of a prefixed string
-    * returns false, if not prefixed
-    *
-    * @param string $str The prefixed string
-    * @return mixed The prefix or false if there is no prefix
-    * @access public
-    */
-	function getPrefix($str){
-		if($pos = strrpos($str,':')){
-			// get prefix
-			return substr($str,0,$pos);
-		}
-		return false;
-	}
-
-	/**
-    * pass it a prefix, it returns a namespace
-    *
-    * @param string $prefix The prefix
-    * @return mixed The namespace, false if no namespace has the specified prefix
-    * @access public
-    */
-	function getNamespaceFromPrefix($prefix){
-		if (isset($this->namespaces[$prefix])) {
-			return $this->namespaces[$prefix];
-		}
-		//$this->setError("No namespace registered for prefix '$prefix'");
-		return false;
-	}
-
-	/**
-    * returns the prefix for a given namespace (or prefix)
-    * or false if no prefixes registered for the given namespace
-    *
-    * @param string $ns The namespace
-    * @return mixed The prefix, false if the namespace has no prefixes
-    * @access public
-    */
-	function getPrefixFromNamespace($ns) {
-		foreach ($this->namespaces as $p => $n) {
-			if ($ns == $n || $ns == $p) {
-			    $this->usedNamespaces[$p] = $n;
-				return $p;
-			}
-		}
-		return false;
-	}
-
-	/**
-    * returns the time in ODBC canonical form with microseconds
-    *
-    * @return string The time in ODBC canonical form with microseconds
-    * @access public
-    */
-	function getmicrotime() {
-		if (function_exists('gettimeofday')) {
-			$tod = gettimeofday();
-			$sec = $tod['sec'];
-			$usec = $tod['usec'];
-		} else {
-			$sec = time();
-			$usec = 0;
-		}
-		return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
-	}
-
-	/**
-	 * Returns a string with the output of var_dump
-	 *
-	 * @param mixed $data The variable to var_dump
-	 * @return string The output of var_dump
-	 * @access public
-	 */
-    function varDump($data) {
-		/** To increase performance we have commented this. */
-		return 'varDump';
-	}
-}
-
-// XML Schema Datatype Helper Functions
-
-//xsd:dateTime helpers
-
-/**
-* convert unix timestamp to ISO 8601 compliant date string
-*
-* @param    string $timestamp Unix time stamp
-* @access   public
-*/
-function timestamp_to_iso8601($timestamp,$utc=true){
-	$datestr = date('Y-m-d\TH:i:sO',$timestamp);
-	if($utc){
-		$eregStr =
-		'([0-9]{4})-'.	// centuries & years CCYY-
-		'([0-9]{2})-'.	// months MM-
-		'([0-9]{2})'.	// days DD
-		'T'.			// separator T
-		'([0-9]{2}):'.	// hours hh:
-		'([0-9]{2}):'.	// minutes mm:
-		'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
-		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
-
-		if(ereg($eregStr,$datestr,$regs)){
-			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
-		}
-		return false;
-	} else {
-		return $datestr;
-	}
-}
-
-/**
-* convert ISO 8601 compliant date string to unix timestamp
-*
-* @param    string $datestr ISO 8601 compliant date string
-* @access   public
-*/
-function iso8601_to_timestamp($datestr){
-	$eregStr =
-	'([0-9]{4})-'.	// centuries & years CCYY-
-	'([0-9]{2})-'.	// months MM-
-	'([0-9]{2})'.	// days DD
-	'T'.			// separator T
-	'([0-9]{2}):'.	// hours hh:
-	'([0-9]{2}):'.	// minutes mm:
-	'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
-	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
-	if(ereg($eregStr,$datestr,$regs)){
-		// not utc
-		if($regs[8] != 'Z'){
-			$op = substr($regs[8],0,1);
-			$h = substr($regs[8],1,2);
-			$m = substr($regs[8],strlen($regs[8])-2,2);
-			if($op == '-'){
-				$regs[4] = $regs[4] + $h;
-				$regs[5] = $regs[5] + $m;
-			} elseif($op == '+'){
-				$regs[4] = $regs[4] - $h;
-				$regs[5] = $regs[5] - $m;
-			}
-		}
-		return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z");
-	} else {
-		return false;
-	}
-}
-
-/**
-* sleeps some number of microseconds
-*
-* @param    string $usec the number of microseconds to sleep
-* @access   public
-* @deprecated
-*/
-function usleepWindows($usec)
-{
-	$start = gettimeofday();
-	
-	do
-	{
-		$stop = gettimeofday();
-		$timePassed = 1000000 * ($stop['sec'] - $start['sec'])
-		+ $stop['usec'] - $start['usec'];
-	}
-	while ($timePassed < $usec);
-}
-
-?><?php
-
-
-
-/**
-* Contains information for a SOAP fault.
-* Mainly used for returning faults from deployed functions
-* in a server instance.
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access public
-*/
-class soap_fault extends nusoap_base {
-	/**
-	 * The fault code (client|server)
-	 * @var string
-	 * @access private
-	 */
-	var $faultcode;
-	/**
-	 * The fault actor
-	 * @var string
-	 * @access private
-	 */
-	var $faultactor;
-	/**
-	 * The fault string, a description of the fault
-	 * @var string
-	 * @access private
-	 */
-	var $faultstring;
-	/**
-	 * The fault detail, typically a string or array of string
-	 * @var mixed
-	 * @access private
-	 */
-	var $faultdetail;
-
-	/**
-	* constructor
-    *
-    * @param string $faultcode (client | server)
-    * @param string $faultactor only used when msg routed between multiple actors
-    * @param string $faultstring human readable error message
-    * @param mixed $faultdetail detail, typically a string or array of string
-	*/
-	function soap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
-		parent::nusoap_base();
-		$this->faultcode = $faultcode;
-		$this->faultactor = $faultactor;
-		$this->faultstring = $faultstring;
-		$this->faultdetail = $faultdetail;
-	}
-
-	/**
-	* serialize a fault
-	*
-	* @return	string	The serialization of the fault instance.
-	* @access   public
-	*/
-	function serialize(){
-		$ns_string = '';
-		foreach($this->namespaces as $k => $v){
-			$ns_string .= "\n  xmlns:$k=\"$v\"";
-		}
-		$return_msg =
-			'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
-			'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
-				'<SOAP-ENV:Body>'.
-				'<SOAP-ENV:Fault>'.
-					$this->serialize_val($this->faultcode, 'faultcode').
-					$this->serialize_val($this->faultactor, 'faultactor').
-					$this->serialize_val($this->faultstring, 'faultstring').
-					$this->serialize_val($this->faultdetail, 'detail').
-				'</SOAP-ENV:Fault>'.
-				'</SOAP-ENV:Body>'.
-			'</SOAP-ENV:Envelope>';
-		return $return_msg;
-	}
-}
-
-
-
-?><?php
-
-
-
-/**
-* parses an XML Schema, allows access to it's data, other utility methods
-* no validation... yet.
-* very experimental and limited. As is discussed on XML-DEV, I'm one of the people
-* that just doesn't have time to read the spec(s) thoroughly, and just have a couple of trusty
-* tutorials I refer to :)
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class XMLSchema extends nusoap_base  {
-	
-	// files
-	var $schema = '';
-	var $xml = '';
-	// namespaces
-	var $enclosingNamespaces;
-	// schema info
-	var $schemaInfo = array();
-	var $schemaTargetNamespace = '';
-	// types, elements, attributes defined by the schema
-	var $attributes = array();
-	var $complexTypes = array();
-	var $complexTypeStack = array();
-	var $currentComplexType = null;
-	var $elements = array();
-	var $elementStack = array();
-	var $currentElement = null;
-	var $simpleTypes = array();
-	var $simpleTypeStack = array();
-	var $currentSimpleType = null;
-	// imports
-	var $imports = array();
-	// parser vars
-	var $parser;
-	var $position = 0;
-	var $depth = 0;
-	var $depth_array = array();
-	var $message = array();
-	var $defaultNamespace = array();
-    
-	/**
-	* constructor
-	*
-	* @param    string $schema schema document URI
-	* @param    string $xml xml document URI
-	* @param	string $namespaces namespaces defined in enclosing XML
-	* @access   public
-	*/
-	function XMLSchema($schema='',$xml='',$namespaces=array()){
-		parent::nusoap_base();
-		$this->debug('xmlschema class instantiated, inside constructor');
-		// files
-		$this->schema = $schema;
-		$this->xml = $xml;
-
-		// namespaces
-		$this->enclosingNamespaces = $namespaces;
-		$this->namespaces = array_merge($this->namespaces, $namespaces);
-
-		// parse schema file
-		if($schema != ''){
-			$this->debug('initial schema file: '.$schema);
-			$this->parseFile($schema, 'schema');
-		}
-
-		// parse xml file
-		if($xml != ''){
-			$this->debug('initial xml file: '.$xml);
-			$this->parseFile($xml, 'xml');
-		}
-
-	}
-
-    /**
-    * parse an XML file
-    *
-    * @param string $xml, path/URL to XML file
-    * @param string $type, (schema | xml)
-	* @return boolean
-    * @access public
-    */
-	function parseFile($xml,$type){
-		// parse xml file
-		if($xml != ""){
-			$xmlStr = @join("",@file($xml));
-			if($xmlStr == ""){
-				$msg = 'Error reading XML from '.$xml;
-				$this->setError($msg);
-				$this->debug($msg);
-			return false;
-			} else {
-				$this->debug("parsing $xml");
-				$this->parseString($xmlStr,$type);
-				$this->debug("done parsing $xml");
-			return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	* parse an XML string
-	*
-	* @param    string $xml path or URL
-    * @param string $type, (schema|xml)
-	* @access   private
-	*/
-	function parseString($xml,$type){
-		// parse xml string
-		if($xml != ""){
-
-	    	// Create an XML parser.
-	    	$this->parser = xml_parser_create();
-	    	// Set the options for parsing the XML data.
-	    	xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
-
-	    	// Set the object for the parser.
-	    	xml_set_object($this->parser, $this);
-
-	    	// Set the element handlers for the parser.
-			if($type == "schema"){
-		    	xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
-		    	xml_set_character_data_handler($this->parser,'schemaCharacterData');
-			} elseif($type == "xml"){
-				xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
-		    	xml_set_character_data_handler($this->parser,'xmlCharacterData');
-			}
-
-		    // Parse the XML file.
-		    if(!xml_parse($this->parser,$xml,true)){
-			// Display an error message.
-				$errstr = sprintf('XML error parsing XML schema on line %d: %s',
-				xml_get_current_line_number($this->parser),
-				xml_error_string(xml_get_error_code($this->parser))
-				);
-				$this->debug($errstr);
-				$this->debug("XML payload:\n" . $xml);
-				$this->setError($errstr);
-	    	}
-            
-			xml_parser_free($this->parser);
-		} else{
-			$this->debug('no xml passed to parseString()!!');
-			$this->setError('no xml passed to parseString()!!');
-		}
-	}
-
-	/**
-	* start-element handler
-	*
-	* @param    string $parser XML parser object
-	* @param    string $name element name
-	* @param    string $attrs associative array of attributes
-	* @access   private
-	*/
-	function schemaStartElement($parser, $name, $attrs) {
-		
-		// position in the total number of elements, starting from 0
-		$pos = $this->position++;
-		$depth = $this->depth++;
-		// set self as current value for this depth
-		$this->depth_array[$depth] = $pos;
-		$this->message[$pos] = array('cdata' => ''); 
-		if ($depth > 0) {
-			$this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
-		} else {
-			$this->defaultNamespace[$pos] = false;
-		}
-
-		// get element prefix
-		if($prefix = $this->getPrefix($name)){
-			// get unqualified name
-			$name = $this->getLocalPart($name);
-		} else {
-        	$prefix = '';
-        }
-		
-        // loop thru attributes, expanding, and registering namespace declarations
-        if(count($attrs) > 0){
-        	foreach($attrs as $k => $v){
-                // if ns declarations, add to class level array of valid namespaces
-				if(ereg("^xmlns",$k)){
-                	//$this->xdebug("$k: $v");
-                	//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
-                	if($ns_prefix = substr(strrchr($k,':'),1)){
-                		//$this->xdebug("Add namespace[$ns_prefix] = $v");
-						$this->namespaces[$ns_prefix] = $v;
-					} else {
-						$this->defaultNamespace[$pos] = $v;
-						if (! $this->getPrefixFromNamespace($v)) {
-							$this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
-						}
-					}
-					if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
-						$this->XMLSchemaVersion = $v;
-						$this->namespaces['xsi'] = $v.'-instance';
-					}
-				}
-        	}
-        	foreach($attrs as $k => $v){
-                // expand each attribute
-                $k = strpos($k,':') ? $this->expandQname($k) : $k;
-                $v = strpos($v,':') ? $this->expandQname($v) : $v;
-        		$eAttrs[$k] = $v;
-        	}
-        	$attrs = $eAttrs;
-        } else {
-        	$attrs = array();
-        }
-		// find status, register data
-		switch($name){
-			case 'all':			// (optional) compositor content for a complexType
-			case 'choice':
-			case 'group':
-			case 'sequence':
-				//$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
-				$this->complexTypes[$this->currentComplexType]['compositor'] = $name;
-				//if($name == 'all' || $name == 'sequence'){
-				//	$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
-				//}
-			break;
-			case 'attribute':	// complexType attribute
-            	//$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
-            	$this->xdebug("parsing attribute:");
-            	$this->appendDebug($this->varDump($attrs));
-				if (!isset($attrs['form'])) {
-					$attrs['form'] = $this->schemaInfo['attributeFormDefault'];
-				}
-            	if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
-					$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-					if (!strpos($v, ':')) {
-						// no namespace in arrayType attribute value...
-						if ($this->defaultNamespace[$pos]) {
-							// ...so use the default
-							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-						}
-					}
-            	}
-                if(isset($attrs['name'])){
-					$this->attributes[$attrs['name']] = $attrs;
-					$aname = $attrs['name'];
-				} elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
-					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
-	                	$aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-	                } else {
-	                	$aname = '';
-	                }
-				} elseif(isset($attrs['ref'])){
-					$aname = $attrs['ref'];
-                    $this->attributes[$attrs['ref']] = $attrs;
-				}
-                
-				if($this->currentComplexType){	// This should *always* be
-					$this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
-				}
-				// arrayType attribute
-				if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
-					$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-                	$prefix = $this->getPrefix($aname);
-					if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
-						$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
-					} else {
-						$v = '';
-					}
-                    if(strpos($v,'[,]')){
-                        $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
-                    }
-                    $v = substr($v,0,strpos($v,'[')); // clip the []
-                    if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
-                        $v = $this->XMLSchemaVersion.':'.$v;
-                    }
-                    $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
-				}
-			break;
-			case 'complexContent':	// (optional) content for a complexType
-			break;
-			case 'complexType':
-				array_push($this->complexTypeStack, $this->currentComplexType);
-				if(isset($attrs['name'])){
-					$this->xdebug('processing named complexType '.$attrs['name']);
-					//$this->currentElement = false;
-					$this->currentComplexType = $attrs['name'];
-					$this->complexTypes[$this->currentComplexType] = $attrs;
-					$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
-					// This is for constructs like
-					//           <complexType name="ListOfString" base="soap:Array">
-					//                <sequence>
-					//                    <element name="string" type="xsd:string"
-					//                        minOccurs="0" maxOccurs="unbounded" />
-					//                </sequence>
-					//            </complexType>
-					if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
-						$this->xdebug('complexType is unusual array');
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-					} else {
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
-					}
-				}else{
-					$this->xdebug('processing unnamed complexType for element '.$this->currentElement);
-					$this->currentComplexType = $this->currentElement . '_ContainedType';
-					//$this->currentElement = false;
-					$this->complexTypes[$this->currentComplexType] = $attrs;
-					$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
-					// This is for constructs like
-					//           <complexType name="ListOfString" base="soap:Array">
-					//                <sequence>
-					//                    <element name="string" type="xsd:string"
-					//                        minOccurs="0" maxOccurs="unbounded" />
-					//                </sequence>
-					//            </complexType>
-					if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
-						$this->xdebug('complexType is unusual array');
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-					} else {
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
-					}
-				}
-			break;
-			case 'element':
-				array_push($this->elementStack, $this->currentElement);
-				// elements defined as part of a complex type should
-				// not really be added to $this->elements, but for some
-				// reason, they are
-				if (!isset($attrs['form'])) {
-					$attrs['form'] = $this->schemaInfo['elementFormDefault'];
-				}
-				if(isset($attrs['type'])){
-					$this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
-					if (! $this->getPrefix($attrs['type'])) {
-						if ($this->defaultNamespace[$pos]) {
-							$attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
-							$this->xdebug('used default namespace to make type ' . $attrs['type']);
-						}
-					}
-					// This is for constructs like
-					//           <complexType name="ListOfString" base="soap:Array">
-					//                <sequence>
-					//                    <element name="string" type="xsd:string"
-					//                        minOccurs="0" maxOccurs="unbounded" />
-					//                </sequence>
-					//            </complexType>
-					if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
-						$this->xdebug('arrayType for unusual array is ' . $attrs['type']);
-						$this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
-					}
-					$this->currentElement = $attrs['name'];
-					$this->elements[ $attrs['name'] ] = $attrs;
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-					$ename = $attrs['name'];
-				} elseif(isset($attrs['ref'])){
-					$this->xdebug("processing element as ref to ".$attrs['ref']);
-					$this->currentElement = "ref to ".$attrs['ref'];
-					$ename = $this->getLocalPart($attrs['ref']);
-				} else {
-					$this->xdebug("processing untyped element ".$attrs['name']);
-					$this->currentElement = $attrs['name'];
-					$this->elements[ $attrs['name'] ] = $attrs;
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-					$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['name'] . '_ContainedType';
-					$this->elements[ $attrs['name'] ]['type'] = $attrs['type'];
-					$ename = $attrs['name'];
-				}
-				if(isset($ename) && $this->currentComplexType){
-					$this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
-				}
-			break;
-			case 'enumeration':	//	restriction value list member
-				$this->xdebug('enumeration ' . $attrs['value']);
-				if ($this->currentSimpleType) {
-					$this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
-				} elseif ($this->currentComplexType) {
-					$this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
-				}
-			break;
-			case 'extension':	// simpleContent or complexContent type extension
-				$this->xdebug('extension ' . $attrs['base']);
-				if ($this->currentComplexType) {
-					$this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
-				}
-			break;
-			case 'import':
-			    if (isset($attrs['schemaLocation'])) {
-					//$this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
-                    $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
-				} else {
-					//$this->xdebug('import namespace ' . $attrs['namespace']);
-                    $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
-					}
-				}
-			break;
-			case 'list':	// simpleType value list
-			break;
-			case 'restriction':	// simpleType, simpleContent or complexContent value restriction
-				$this->xdebug('restriction ' . $attrs['base']);
-				if($this->currentSimpleType){
-					$this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
-				} elseif($this->currentComplexType){
-					$this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
-					if(strstr($attrs['base'],':') == ':Array'){
-						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
-					}
-				}
-			break;
-			case 'schema':
-				$this->schemaInfo = $attrs;
-				$this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
-				if (isset($attrs['targetNamespace'])) {
-					$this->schemaTargetNamespace = $attrs['targetNamespace'];
-				}
-				if (!isset($attrs['elementFormDefault'])) {
-					$this->schemaInfo['elementFormDefault'] = 'unqualified';
-				}
-				if (!isset($attrs['attributeFormDefault'])) {
-					$this->schemaInfo['attributeFormDefault'] = 'unqualified';
-				}
-			break;
-			case 'simpleContent':	// (optional) content for a complexType
-			break;
-			case 'simpleType':
-				array_push($this->simpleTypeStack, $this->currentSimpleType);
-				if(isset($attrs['name'])){
-					$this->xdebug("processing simpleType for name " . $attrs['name']);
-					$this->currentSimpleType = $attrs['name'];
-					$this->simpleTypes[ $attrs['name'] ] = $attrs;
-					$this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
-					$this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
-				} else {
-					$this->xdebug('processing unnamed simpleType for element '.$this->currentElement);
-					$this->currentSimpleType = $this->currentElement . '_ContainedType';
-					//$this->currentElement = false;
-					$this->simpleTypes[$this->currentSimpleType] = $attrs;
-					$this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
-				}
-			break;
-			case 'union':	// simpleType type list
-			break;
-			default:
-				//$this->xdebug("do not have anything to do for element $name");
-		}
-	}
-
-	/**
-	* end-element handler
-	*
-	* @param    string $parser XML parser object
-	* @param    string $name element name
-	* @access   private
-	*/
-	function schemaEndElement($parser, $name) {
-		// bring depth down a notch
-		$this->depth--;
-		// position of current element is equal to the last value left in depth_array for my depth
-		if(isset($this->depth_array[$this->depth])){
-        	$pos = $this->depth_array[$this->depth];
-        }
-		// get element prefix
-		if ($prefix = $this->getPrefix($name)){
-			// get unqualified name
-			$name = $this->getLocalPart($name);
-		} else {
-        	$prefix = '';
-        }
-		// move on...
-		if($name == 'complexType'){
-			$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
-			$this->currentComplexType = array_pop($this->complexTypeStack);
-			//$this->currentElement = false;
-		}
-		if($name == 'element'){
-			$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
-			$this->currentElement = array_pop($this->elementStack);
-		}
-		if($name == 'simpleType'){
-			$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
-			$this->currentSimpleType = array_pop($this->simpleTypeStack);
-		}
-	}
-
-	/**
-	* element content handler
-	*
-	* @param    string $parser XML parser object
-	* @param    string $data element content
-	* @access   private
-	*/
-	function schemaCharacterData($parser, $data){
-		$pos = $this->depth_array[$this->depth - 1];
-		$this->message[$pos]['cdata'] .= $data;
-	}
-
-	/**
-	* serialize the schema
-	*
-	* @access   public
-	*/
-	function serializeSchema(){
-
-		$schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
-		$xml = '';
-		// imports
-		if (sizeof($this->imports) > 0) {
-			foreach($this->imports as $ns => $list) {
-				foreach ($list as $ii) {
-					if ($ii['location'] != '') {
-						$xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
-					} else {
-						$xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
-					}
-				}
-			} 
-		} 
-		// complex types
-		foreach($this->complexTypes as $typeName => $attrs){
-			$contentStr = '';
-			// serialize child elements
-			if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
-				foreach($attrs['elements'] as $element => $eParts){
-					if(isset($eParts['ref'])){
-						$contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
-					} else {
-						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
-						foreach ($eParts as $aName => $aValue) {
-							// handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
-							if ($aName != 'name' && $aName != 'type') {
-								$contentStr .= " $aName=\"$aValue\"";
-							}
-						}
-						$contentStr .= "/>\n";
-					}
-				}
-				// compositor wraps elements
-				if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) {
-					$contentStr = "  <$schemaPrefix:$attrs[compositor]>\n".$contentStr."  </$schemaPrefix:$attrs[compositor]>\n";
-				}
-			}
-			// attributes
-			if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
-				foreach($attrs['attrs'] as $attr => $aParts){
-					$contentStr .= "    <$schemaPrefix:attribute";
-					foreach ($aParts as $a => $v) {
-						if ($a == 'ref' || $a == 'type') {
-							$contentStr .= " $a=\"".$this->contractQName($v).'"';
-						} elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') {
-							$this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
-							$contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
-						} else {
-							$contentStr .= " $a=\"$v\"";
-						}
-					}
-					$contentStr .= "/>\n";
-				}
-			}
-			// if restriction
-			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
-				$contentStr = "   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr."   </$schemaPrefix:restriction>\n";
-				// complex or simple content
-				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
-					$contentStr = "  <$schemaPrefix:complexContent>\n".$contentStr."  </$schemaPrefix:complexContent>\n";
-				}
-			}
-			// finalize complex type
-			if($contentStr != ''){
-				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
-			} else {
-				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
-			}
-			$xml .= $contentStr;
-		}
-		// simple types
-		if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
-			foreach($this->simpleTypes as $typeName => $eParts){
-				$xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\"/>\n";
-				if (isset($eParts['enumeration'])) {
-					foreach ($eParts['enumeration'] as $e) {
-						$xml .= "  <$schemaPrefix:enumeration value=\"$e\"/>\n";
-					}
-				}
-				$xml .= " </$schemaPrefix:simpleType>";
-			}
-		}
-		// elements
-		if(isset($this->elements) && count($this->elements) > 0){
-			foreach($this->elements as $element => $eParts){
-				$xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
-			}
-		}
-		// attributes
-		if(isset($this->attributes) && count($this->attributes) > 0){
-			foreach($this->attributes as $attr => $aParts){
-				$xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
-			}
-		}
-		// finish 'er up
-		$el = "<$schemaPrefix:schema targetNamespace=\"$this->schemaTargetNamespace\"\n";
-		foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
-			$el .= " xmlns:$nsp=\"$ns\"\n";
-		}
-		$xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
-		return $xml;
-	}
-
-	/**
-	* adds debug data to the clas level debug string
-	*
-	* @param    string $string debug data
-	* @access   private
-	*/
-	function xdebug($string){
-		$this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
-	}
-
-    /**
-    * get the PHP type of a user defined type in the schema
-    * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays
-    * returns false if no type exists, or not w/ the given namespace
-    * else returns a string that is either a native php type, or 'struct'
-    *
-    * @param string $type, name of defined type
-    * @param string $ns, namespace of type
-    * @return mixed
-    * @access public
-    * @deprecated
-    */
-	function getPHPType($type,$ns){
-		if(isset($this->typemap[$ns][$type])){
-			//print "found type '$type' and ns $ns in typemap<br>";
-			return $this->typemap[$ns][$type];
-		} elseif(isset($this->complexTypes[$type])){
-			//print "getting type '$type' and ns $ns from complexTypes array<br>";
-			return $this->complexTypes[$type]['phpType'];
-		}
-		return false;
-	}
-
-	/**
-    * returns an associative array of information about a given type
-    * returns false if no type exists by the given name
-    *
-	*	For a complexType typeDef = array(
-	*	'restrictionBase' => '',
-	*	'phpType' => '',
-	*	'compositor' => '(sequence|all)',
-	*	'elements' => array(), // refs to elements array
-	*	'attrs' => array() // refs to attributes array
-	*	... and so on (see addComplexType)
-	*	)
-	*
-	*   For simpleType or element, the array has different keys.
-    *
-    * @param string
-    * @return mixed
-    * @access public
-    * @see addComplexType
-    * @see addSimpleType
-    * @see addElement
-    */
-	function getTypeDef($type){
-		//$this->debug("in getTypeDef for type $type");
-		if(isset($this->complexTypes[$type])){
-			$this->xdebug("in getTypeDef, found complexType $type");
-			return $this->complexTypes[$type];
-		} elseif(isset($this->simpleTypes[$type])){
-			$this->xdebug("in getTypeDef, found simpleType $type");
-			if (!isset($this->simpleTypes[$type]['phpType'])) {
-				// get info for type to tack onto the simple type
-				// TODO: can this ever really apply (i.e. what is a simpleType really?)
-				$uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1);
-				$ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':'));
-				$etype = $this->getTypeDef($uqType);
-				if ($etype) {
-					$this->xdebug("in getTypeDef, found type for simpleType $type:");
-					$this->xdebug($this->varDump($etype));
-					if (isset($etype['phpType'])) {
-						$this->simpleTypes[$type]['phpType'] = $etype['phpType'];
-					}
-					if (isset($etype['elements'])) {
-						$this->simpleTypes[$type]['elements'] = $etype['elements'];
-					}
-				}
-			}
-			return $this->simpleTypes[$type];
-		} elseif(isset($this->elements[$type])){
-			$this->xdebug("in getTypeDef, found element $type");
-			if (!isset($this->elements[$type]['phpType'])) {
-				// get info for type to tack onto the element
-				$uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
-				$ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
-				$etype = $this->getTypeDef($uqType);
-				if ($etype) {
-					$this->xdebug("in getTypeDef, found type for element $type:");
-					$this->xdebug($this->varDump($etype));
-					if (isset($etype['phpType'])) {
-						$this->elements[$type]['phpType'] = $etype['phpType'];
-					}
-					if (isset($etype['elements'])) {
-						$this->elements[$type]['elements'] = $etype['elements'];
-					}
-				} elseif ($ns == 'http://www.w3.org/2001/XMLSchema') {
-					$this->xdebug("in getTypeDef, element $type is an XSD type");
-					$this->elements[$type]['phpType'] = 'scalar';
-				}
-			}
-			return $this->elements[$type];
-		} elseif(isset($this->attributes[$type])){
-			$this->xdebug("in getTypeDef, found attribute $type");
-			return $this->attributes[$type];
-		} elseif (ereg('_ContainedType$', $type)) {
-			$this->xdebug("in getTypeDef, have an untyped element $type");
-			$typeDef['typeClass'] = 'simpleType';
-			$typeDef['phpType'] = 'scalar';
-			$typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string';
-			return $typeDef;
-		}
-		$this->xdebug("in getTypeDef, did not find $type");
-		return false;
-	}
-
-	/**
-    * returns a sample serialization of a given type, or false if no type by the given name
-    *
-    * @param string $type, name of type
-    * @return mixed
-    * @access public
-    * @deprecated
-    */
-    function serializeTypeDef($type){
-    	//print "in sTD() for type $type<br>";
-	if($typeDef = $this->getTypeDef($type)){
-		$str .= '<'.$type;
-	    if(is_array($typeDef['attrs'])){
-		foreach($attrs as $attName => $data){
-		    $str .= " $attName=\"{type = ".$data['type']."}\"";
-		}
-	    }
-	    $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
-	    if(count($typeDef['elements']) > 0){
-		$str .= ">";
-		foreach($typeDef['elements'] as $element => $eData){
-		    $str .= $this->serializeTypeDef($element);
-		}
-		$str .= "</$type>";
-	    } elseif($typeDef['typeClass'] == 'element') {
-		$str .= "></$type>";
-	    } else {
-		$str .= "/>";
-	    }
-			return $str;
-	}
-    	return false;
-    }
-
-    /**
-    * returns HTML form elements that allow a user
-    * to enter values for creating an instance of the given type.
-    *
-    * @param string $name, name for type instance
-    * @param string $type, name of type
-    * @return string
-    * @access public
-    * @deprecated
-	*/
-	function typeToForm($name,$type){
-		// get typedef
-		if($typeDef = $this->getTypeDef($type)){
-			// if struct
-			if($typeDef['phpType'] == 'struct'){
-				$buffer .= '<table>';
-				foreach($typeDef['elements'] as $child => $childDef){
-					$buffer .= "
-					<tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
-					<td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>";
-				}
-				$buffer .= '</table>';
-			// if array
-			} elseif($typeDef['phpType'] == 'array'){
-				$buffer .= '<table>';
-				for($i=0;$i < 3; $i++){
-					$buffer .= "
-					<tr><td align='right'>array item (type: $typeDef[arrayType]):</td>
-					<td><input type='text' name='parameters[".$name."][]'></td></tr>";
-				}
-				$buffer .= '</table>';
-			// if scalar
-			} else {
-				$buffer .= "<input type='text' name='parameters[$name]'>";
-			}
-		} else {
-			$buffer .= "<input type='text' name='parameters[$name]'>";
-		}
-		return $buffer;
-	}
-	
-	/**
-	* adds a complex type to the schema
-	* 
-	* example: array
-	* 
-	* addType(
-	* 	'ArrayOfstring',
-	* 	'complexType',
-	* 	'array',
-	* 	'',
-	* 	'SOAP-ENC:Array',
-	* 	array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
-	* 	'xsd:string'
-	* );
-	* 
-	* example: PHP associative array ( SOAP Struct )
-	* 
-	* addType(
-	* 	'SOAPStruct',
-	* 	'complexType',
-	* 	'struct',
-	* 	'all',
-	* 	array('myVar'=> array('name'=>'myVar','type'=>'string')
-	* );
-	* 
-	* @param name
-	* @param typeClass (complexType|simpleType|attribute)
-	* @param phpType: currently supported are array and struct (php assoc array)
-	* @param compositor (all|sequence|choice)
-	* @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param elements = array ( name = array(name=>'',type=>'') )
-	* @param attrs = array(
-	* 	array(
-	*		'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType",
-	*		"http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]"
-	* 	)
-	* )
-	* @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
-	* @access public
-	* @see getTypeDef
-	*/
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
-		$this->complexTypes[$name] = array(
-	    'name'		=> $name,
-	    'typeClass'	=> $typeClass,
-	    'phpType'	=> $phpType,
-		'compositor'=> $compositor,
-	    'restrictionBase' => $restrictionBase,
-		'elements'	=> $elements,
-	    'attrs'		=> $attrs,
-	    'arrayType'	=> $arrayType
-		);
-		
-		$this->xdebug("addComplexType $name:");
-		$this->appendDebug($this->varDump($this->complexTypes[$name]));
-	}
-	
-	/**
-	* adds a simple type to the schema
-	*
-	* @param string $name
-	* @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param string $typeClass (should always be simpleType)
-	* @param string $phpType (should always be scalar)
-	* @param array $enumeration array of values
-	* @access public
-	* @see xmlschema
-	* @see getTypeDef
-	*/
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
-		$this->simpleTypes[$name] = array(
-	    'name'			=> $name,
-	    'typeClass'		=> $typeClass,
-	    'phpType'		=> $phpType,
-	    'type'			=> $restrictionBase,
-	    'enumeration'	=> $enumeration
-		);
-		
-		$this->xdebug("addSimpleType $name:");
-		$this->appendDebug($this->varDump($this->simpleTypes[$name]));
-	}
-
-	/**
-	* adds an element to the schema
-	*
-	* @param array $attrs attributes that must include name and type
-	* @see xmlschema
-	* @access public
-	*/
-	function addElement($attrs) {
-		if (! $this->getPrefix($attrs['type'])) {
-			$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
-		}
-		$this->elements[ $attrs['name'] ] = $attrs;
-		$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-		
-		$this->xdebug("addElement " . $attrs['name']);
-		$this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
-	}
-}
-
-
-
-?><?php
-
-
-
-/**
-* For creating serializable abstractions of native PHP types.  This class
-* allows element name/namespace, XSD type, and XML attributes to be
-* associated with a value.  This is extremely useful when WSDL is not
-* used, but is also useful when WSDL is used with polymorphic types, including
-* xsd:anyType and user-defined types.
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class soapval extends nusoap_base {
-	/**
-	 * The XML element name
-	 *
-	 * @var string
-	 * @access private
-	 */
-	var $name;
-	/**
-	 * The XML type name (string or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $type;
-	/**
-	 * The PHP value
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $value;
-	/**
-	 * The XML element namespace (string or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $element_ns;
-	/**
-	 * The XML type namespace (string or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $type_ns;
-	/**
-	 * The XML element attributes (array or false)
-	 *
-	 * @var mixed
-	 * @access private
-	 */
-	var $attributes;
-
-	/**
-	* constructor
-	*
-	* @param    string $name optional name
-	* @param    mixed $type optional type name
-	* @param	mixed $value optional value
-	* @param	mixed $element_ns optional namespace of value
-	* @param	mixed $type_ns optional namespace of type
-	* @param	mixed $attributes associative array of attributes to add to element serialization
-	* @access   public
-	*/
-  	function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
-		parent::nusoap_base();
-		$this->name = $name;
-		$this->type = $type;
-		$this->value = $value;
-		$this->element_ns = $element_ns;
-		$this->type_ns = $type_ns;
-		$this->attributes = $attributes;
-    }
-
-	/**
-	* return serialized value
-	*
-	* @param	string $use The WSDL use value (encoded|literal)
-	* @return	string XML data
-	* @access   public
-	*/
-	function serialize($use='encoded') {
-		return $this->serialize_val($this->value,$this->name,$this->type,$this->element_ns,$this->type_ns,$this->attributes,$use);
-    }
-
-	/**
-	* decodes a soapval object into a PHP native type
-	*
-	* @return	mixed
-	* @access   public
-	*/
-	function decode(){
-		return $this->value;
-	}
-}
-
-
-
-?><?php
-
-
-
-/**
-* transport class for sending/receiving data via HTTP and HTTPS
-* NOTE: PHP must be compiled with the CURL extension for HTTPS support
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access public
-*/
-class soap_transport_http extends nusoap_base {
-
-	var $url = '';
-	var $uri = '';
-	var $digest_uri = '';
-	var $scheme = '';
-	var $host = '';
-	var $port = '';
-	var $path = '';
-	var $request_method = 'POST';
-	var $protocol_version = '1.0';
-	var $encoding = '';
-	var $outgoing_headers = array();
-	var $incoming_headers = array();
-	var $incoming_cookies = array();
-	var $outgoing_payload = '';
-	var $incoming_payload = '';
-	var $useSOAPAction = true;
-	var $persistentConnection = false;
-	var $ch = false;	// cURL handle
-	var $username = '';
-	var $password = '';
-	var $authtype = '';
-	var $digestRequest = array();
-	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional)
-								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
-								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
-								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
-								// passphrase: SSL key password/passphrase
-								// verifypeer: default is 1
-								// verifyhost: default is 1
-
-	/**
-	* constructor
-	*/
-	function soap_transport_http($url){
-		parent::nusoap_base();
-		$this->setURL($url);
-		ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
-		$this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
-		$this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
-	}
-
-	function setURL($url) {
-		$this->url = $url;
-
-		$u = parse_url($url);
-		foreach($u as $k => $v){
-			$this->debug("$k = $v");
-			$this->$k = $v;
-		}
-		
-		// add any GET params to path
-		if(isset($u['query']) && $u['query'] != ''){
-            $this->path .= '?' . $u['query'];
-		}
-		
-		// set default port
-		if(!isset($u['port'])){
-			if($u['scheme'] == 'https'){
-				$this->port = 443;
-			} else {
-				$this->port = 80;
-			}
-		}
-		
-		$this->uri = $this->path;
-		$this->digest_uri = $this->uri;
-		
-		// build headers
-		if (!isset($u['port'])) {
-			$this->outgoing_headers['Host'] = $this->host;
-		} else {
-			$this->outgoing_headers['Host'] = $this->host.':'.$this->port;
-		}
-		$this->debug('set Host: ' . $this->outgoing_headers['Host']);
-
-		if (isset($u['user']) && $u['user'] != '') {
-			$this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
-		}
-	}
-	
-	function connect($connection_timeout=0,$response_timeout=30){
-	  	// For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
-	  	// "regular" socket.
-	  	// TODO: disabled for now because OpenSSL must be *compiled* in (not just
-	  	//       loaded), and until PHP5 stream_get_wrappers is not available.
-//	  	if ($this->scheme == 'https') {
-//		  	if (version_compare(phpversion(), '4.3.0') >= 0) {
-//		  		if (extension_loaded('openssl')) {
-//		  			$this->scheme = 'ssl';
-//		  			$this->debug('Using SSL over OpenSSL');
-//		  		}
-//		  	}
-//		}
-		$this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-		// use persistent connection
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
-			if (!feof($this->fp)) {
-				$this->debug('Re-use persistent connection');
-				return true;
-			}
-			fclose($this->fp);
-			$this->debug('Closed persistent connection at EOF');
-		}
-
-		// munge host if using OpenSSL
-		if ($this->scheme == 'ssl') {
-			$host = 'ssl://' . $this->host;
-		} else {
-			$host = $this->host;
-		}
-		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
-
-		// open socket
-		if($connection_timeout > 0){
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
-		} else {
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
-		}
-		
-		// test pointer
-		if(!$this->fp) {
-			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
-			if ($this->errno) {
-				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
-			} else {
-				$msg .= ' prior to connect().  This is often a problem looking up the host name.';
-			}
-			$this->debug($msg);
-			$this->setError($msg);
-			return false;
-		}
-		
-		// set response timeout
-		$this->debug('set response timeout to ' . $response_timeout);
-		socket_set_timeout( $this->fp, $response_timeout);
-
-		$this->debug('socket connected');
-		return true;
-	  } else if ($this->scheme == 'https') {
-		if (!extension_loaded('curl')) {
-			$this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
-			return false;
-		}
-		$this->debug('connect using https');
-		// init CURL
-		$this->ch = curl_init();
-		// set url
-		$hostURL = ($this->port != '') ? "https://$this->host:$this->port" : "https://$this->host";
-		// add path
-		$hostURL .= $this->path;
-		curl_setopt($this->ch, CURLOPT_URL, $hostURL);
-		// follow location headers (re-directs)
-		curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
-		// ask for headers in the response output
-		curl_setopt($this->ch, CURLOPT_HEADER, 1);
-		// ask for the response output as the return value
-		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
-		// encode
-		// We manage this ourselves through headers and encoding
-//		if(function_exists('gzuncompress')){
-//			curl_setopt($this->ch, CURLOPT_ENCODING, 'deflate');
-//		}
-		// persistent connection
-		if ($this->persistentConnection) {
-			// The way we send data, we cannot use persistent connections, since
-			// there will be some "junk" at the end of our request.
-			//curl_setopt($this->ch, CURL_HTTP_VERSION_1_1, true);
-			$this->persistentConnection = false;
-			$this->outgoing_headers['Connection'] = 'close';
-			$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-		}
-		// set timeout
-		if ($connection_timeout != 0) {
-			curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
-		}
-		// TODO: cURL has added a connection timeout separate from the response timeout
-		//if ($connection_timeout != 0) {
-		//	curl_setopt($this->ch, CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
-		//}
-		//if ($response_timeout != 0) {
-		//	curl_setopt($this->ch, CURLOPT_TIMEOUT, $response_timeout);
-		//}
-
-		// recent versions of cURL turn on peer/host checking by default,
-		// while PHP binaries are not compiled with a default location for the
-		// CA cert bundle, so disable peer/host checking.
-//curl_setopt($this->ch, CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');		
-		curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
-		curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
-
-		// support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
-		if ($this->authtype == 'certificate') {
-			if (isset($this->certRequest['cainfofile'])) {
-				curl_setopt($this->ch, CURLOPT_CAINFO, $this->certRequest['cainfofile']);
-			}
-			if (isset($this->certRequest['verifypeer'])) {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
-			} else {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
-			}
-			if (isset($this->certRequest['verifyhost'])) {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
-			} else {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
-			}
-			if (isset($this->certRequest['sslcertfile'])) {
-				curl_setopt($this->ch, CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
-			}
-			if (isset($this->certRequest['sslkeyfile'])) {
-				curl_setopt($this->ch, CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
-			}
-			if (isset($this->certRequest['passphrase'])) {
-				curl_setopt($this->ch, CURLOPT_SSLKEYPASSWD , $this->certRequest['passphrase']);
-			}
-		}
-		$this->debug('cURL connection set up');
-		return true;
-	  } else {
-		$this->setError('Unknown scheme ' . $this->scheme);
-		$this->debug('Unknown scheme ' . $this->scheme);
-		return false;
-	  }
-	}
-	
-	/**
-	* send the SOAP message via HTTP
-	*
-	* @param    string $data message data
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @param	array $cookies cookies to send
-	* @return	string data
-	* @access   public
-	*/
-	function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
-		
-		$this->debug('entered send() with data of length: '.strlen($data));
-
-		$this->tryagain = true;
-		$tries = 0;
-		while ($this->tryagain) {
-			$this->tryagain = false;
-			if ($tries++ < 2) {
-				// make connnection
-				if (!$this->connect($timeout, $response_timeout)){
-					return false;
-				}
-				
-				// send request
-				if (!$this->sendRequest($data, $cookies)){
-					return false;
-				}
-				
-				// get response
-				$respdata = $this->getResponse();
-			} else {
-				$this->setError('Too many tries to get an OK response');
-			}
-		}		
-		$this->debug('end of send()');
-		return $respdata;
-	}
-
-
-	/**
-	* send the SOAP message via HTTPS 1.0 using CURL
-	*
-	* @param    string $msg message data
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @param	array $cookies cookies to send
-	* @return	string data
-	* @access   public
-	*/
-	function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
-		return $this->send($data, $timeout, $response_timeout, $cookies);
-	}
-	
-	/**
-	* if authenticating, set user credentials here
-	*
-	* @param    string $username
-	* @param    string $password
-	* @param	string $authtype (basic, digest, certificate)
-	* @param	array $digestRequest (keys must be nonce, nc, realm, qop)
-	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
-	* @access   public
-	*/
-	function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
-		$this->debug("Set credentials for authtype $authtype");
-		// cf. RFC 2617
-		if ($authtype == 'basic') {
-			$this->outgoing_headers['Authorization'] = 'Basic '.base64_encode(str_replace(':','',$username).':'.$password);
-		} elseif ($authtype == 'digest') {
-			if (isset($digestRequest['nonce'])) {
-				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
-				
-				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
-	
-				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
-	
-				// H(A1) = MD5(A1)
-				$HA1 = md5($A1);
-	
-				// A2 = Method ":" digest-uri-value
-				$A2 = 'POST:' . $this->digest_uri;
-	
-				// H(A2)
-				$HA2 =  md5($A2);
-	
-				// KD(secret, data) = H(concat(secret, ":", data))
-				// if qop == auth:
-				// request-digest  = <"> < KD ( H(A1),     unq(nonce-value)
-				//                              ":" nc-value
-				//                              ":" unq(cnonce-value)
-				//                              ":" unq(qop-value)
-				//                              ":" H(A2)
-				//                            ) <">
-				// if qop is missing,
-				// request-digest  = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
-	
-				$unhashedDigest = '';
-				$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
-				$cnonce = $nonce;
-				if ($digestRequest['qop'] != '') {
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
-				} else {
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
-				}
-	
-				$hashedDigest = md5($unhashedDigest);
-	
-				$this->outgoing_headers['Authorization'] = 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"';
-			}
-		} elseif ($authtype == 'certificate') {
-			$this->certRequest = $certRequest;
-		}
-		$this->username = $username;
-		$this->password = $password;
-		$this->authtype = $authtype;
-		$this->digestRequest = $digestRequest;
-		
-		if (isset($this->outgoing_headers['Authorization'])) {
-			$this->debug('set Authorization: ' . substr($this->outgoing_headers['Authorization'], 0, 12) . '...');
-		} else {
-			$this->debug('Authorization header not set');
-		}
-	}
-	
-	/**
-	* set the soapaction value
-	*
-	* @param    string $soapaction
-	* @access   public
-	*/
-	function setSOAPAction($soapaction) {
-		$this->outgoing_headers['SOAPAction'] = '"' . $soapaction . '"';
-		$this->debug('set SOAPAction: ' . $this->outgoing_headers['SOAPAction']);
-	}
-	
-	/**
-	* use http encoding
-	*
-	* @param    string $enc encoding style. supported values: gzip, deflate, or both
-	* @access   public
-	*/
-	function setEncoding($enc='gzip, deflate') {
-		if (function_exists('gzdeflate')) {
-			$this->protocol_version = '1.1';
-			$this->outgoing_headers['Accept-Encoding'] = $enc;
-			$this->debug('set Accept-Encoding: ' . $this->outgoing_headers['Accept-Encoding']);
-			if (!isset($this->outgoing_headers['Connection'])) {
-				$this->outgoing_headers['Connection'] = 'close';
-				$this->persistentConnection = false;
-				$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-			}
-			set_magic_quotes_runtime(0);
-			// deprecated
-			$this->encoding = $enc;
-		}
-	}
-	
-	/**
-	* set proxy info here
-	*
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @access   public
-	*/
-	function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
-		$this->uri = $this->url;
-		$this->host = $proxyhost;
-		$this->port = $proxyport;
-		if ($proxyusername != '' && $proxypassword != '') {
-			$this->outgoing_headers['Proxy-Authorization'] = ' Basic '.base64_encode($proxyusername.':'.$proxypassword);
-			$this->debug('set Proxy-Authorization: ' . $this->outgoing_headers['Proxy-Authorization']);
-		}
-	}
-	
-	/**
-	* decode a string that is encoded w/ "chunked' transfer encoding
- 	* as defined in RFC2068 19.4.6
-	*
-	* @param    string $buffer
-	* @param    string $lb
-	* @returns	string
-	* @access   public
-	* @deprecated
-	*/
-	function decodeChunked($buffer, $lb){
-		// length := 0
-		$length = 0;
-		$new = '';
-		
-		// read chunk-size, chunk-extension (if any) and CRLF
-		// get the position of the linebreak
-		$chunkend = strpos($buffer, $lb);
-		if ($chunkend == FALSE) {
-			$this->debug('no linebreak found in decodeChunked');
-			return $new;
-		}
-		$temp = substr($buffer,0,$chunkend);
-		$chunk_size = hexdec( trim($temp) );
-		$chunkstart = $chunkend + strlen($lb);
-		// while (chunk-size > 0) {
-		while ($chunk_size > 0) {
-			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
-		  	
-			// Just in case we got a broken connection
-		  	if ($chunkend == FALSE) {
-		  	    $chunk = substr($buffer,$chunkstart);
-				// append chunk-data to entity-body
-		    	$new .= $chunk;
-		  	    $length += strlen($chunk);
-		  	    break;
-			}
-			
-		  	// read chunk-data and CRLF
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
-		  	// append chunk-data to entity-body
-		  	$new .= $chunk;
-		  	// length := length + chunk-size
-		  	$length += strlen($chunk);
-		  	// read chunk-size and CRLF
-		  	$chunkstart = $chunkend + strlen($lb);
-			
-		  	$chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
-			if ($chunkend == FALSE) {
-				break; //Just in case we got a broken connection
-			}
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
-			$chunk_size = hexdec( trim($temp) );
-			$chunkstart = $chunkend;
-		}
-		return $new;
-	}
-	
-	/*
-	 *	Writes payload, including HTTP headers, to $this->outgoing_payload.
-	 */
-	function buildPayload($data, $cookie_str = '') {
-		// add content-length header
-		$this->outgoing_headers['Content-Length'] = strlen($data);
-		$this->debug('set Content-Length: ' . $this->outgoing_headers['Content-Length']);
-
-		// start building outgoing payload:
-		$req = "$this->request_method $this->uri HTTP/$this->protocol_version";
-		$this->debug("HTTP request: $req");
-		$this->outgoing_payload = "$req\r\n";
-
-		// loop thru headers, serializing
-		foreach($this->outgoing_headers as $k => $v){
-			$hdr = $k.': '.$v;
-			$this->debug("HTTP header: $hdr");
-			$this->outgoing_payload .= "$hdr\r\n";
-		}
-
-		// add any cookies
-		if ($cookie_str != '') {
-			$hdr = 'Cookie: '.$cookie_str;
-			$this->debug("HTTP header: $hdr");
-			$this->outgoing_payload .= "$hdr\r\n";
-		}
-
-		// header/body separator
-		$this->outgoing_payload .= "\r\n";
-		
-		// add data
-		$this->outgoing_payload .= $data;
-	}
-
-	function sendRequest($data, $cookies = NULL) {
-		// build cookie string
-		$cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
-
-		// build payload
-		$this->buildPayload($data, $cookie_str);
-
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-		// send payload
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
-			$this->setError('couldn\'t write message data to socket');
-			$this->debug('couldn\'t write message data to socket');
-			return false;
-		}
-		$this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
-		return true;
-	  } else if ($this->scheme == 'https') {
-		// set payload
-		// TODO: cURL does say this should only be the verb, and in fact it
-		// turns out that the URI and HTTP version are appended to this, which
-		// some servers refuse to work with
-		//curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
-		foreach($this->outgoing_headers as $k => $v){
-			$curl_headers[] = "$k: $v";
-		}
-		if ($cookie_str != '') {
-			$curl_headers[] = 'Cookie: ' . $cookie_str;
-		}
-		curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
-		if ($this->request_method == "POST") {
-	  		curl_setopt($this->ch, CURLOPT_POST, 1);
-	  		curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
-	  	} else {
-	  	}
-		$this->debug('set cURL payload');
-		return true;
-	  }
-	}
-
-	function getResponse(){
-		$this->incoming_payload = '';
-	    
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-	    // loop until headers have been retrieved
-	    $data = '';
-	    while (!isset($lb)){
-
-			// We might EOF during header read.
-			if(feof($this->fp)) {
-				$this->incoming_payload = $data;
-				$this->debug('found no headers before EOF after length ' . strlen($data));
-				$this->debug("received before EOF:\n" . $data);
-				$this->setError('server failed to send headers');
-				return false;
-			}
-
-			$tmp = fgets($this->fp, 256);
-			$tmplen = strlen($tmp);
-			$this->debug("read line of $tmplen bytes: " . trim($tmp));
-
-			if ($tmplen == 0) {
-				$this->incoming_payload = $data;
-				$this->debug('socket read of headers timed out after length ' . strlen($data));
-				$this->debug("read before timeout: " . $data);
-				$this->setError('socket read of headers timed out');
-				return false;
-			}
-
-			$data .= $tmp;
-			$pos = strpos($data,"\r\n\r\n");
-			if($pos > 1){
-				$lb = "\r\n";
-			} else {
-				$pos = strpos($data,"\n\n");
-				if($pos > 1){
-					$lb = "\n";
-				}
-			}
-			// remove 100 header
-			if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
-				unset($lb);
-				$data = '';
-			}//
-		}
-		// store header data
-		$this->incoming_payload .= $data;
-		$this->debug('found end of headers after length ' . strlen($data));
-		// process headers
-		$header_data = trim(substr($data,0,$pos));
-		$header_array = explode($lb,$header_data);
-		$this->incoming_headers = array();
-		$this->incoming_cookies = array();
-		foreach($header_array as $header_line){
-			$arr = explode(':',$header_line, 2);
-			if(count($arr) > 1){
-				$header_name = strtolower(trim($arr[0]));
-				$this->incoming_headers[$header_name] = trim($arr[1]);
-				if ($header_name == 'set-cookie') {
-					// TODO: allow multiple cookies from parseCookie
-					$cookie = $this->parseCookie(trim($arr[1]));
-					if ($cookie) {
-						$this->incoming_cookies[] = $cookie;
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
-					} else {
-						$this->debug('did not find cookie in ' . trim($arr[1]));
-					}
-    			}
-			} else if (isset($header_name)) {
-				// append continuation line to previous header
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
-			}
-		}
-		
-		// loop until msg has been received
-		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
-			$content_length =  2147483647;	// ignore any content-length header
-			$chunked = true;
-			$this->debug("want to read chunked content");
-		} elseif (isset($this->incoming_headers['content-length'])) {
-			$content_length = $this->incoming_headers['content-length'];
-			$chunked = false;
-			$this->debug("want to read content of length $content_length");
-		} else {
-			$content_length =  2147483647;
-			$chunked = false;
-			$this->debug("want to read content to EOF");
-		}
-		$data = '';
-		do {
-			if ($chunked) {
-				$tmp = fgets($this->fp, 256);
-				$tmplen = strlen($tmp);
-				$this->debug("read chunk line of $tmplen bytes");
-				if ($tmplen == 0) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of chunk length timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of chunk length timed out');
-					return false;
-				}
-				$content_length = hexdec(trim($tmp));
-				$this->debug("chunk length $content_length");
-			}
-			$strlen = 0;
-		    while (($strlen < $content_length) && (!feof($this->fp))) {
-		    	$readlen = min(8192, $content_length - $strlen);
-				$tmp = fread($this->fp, $readlen);
-				$tmplen = strlen($tmp);
-				$this->debug("read buffer of $tmplen bytes");
-				if (($tmplen == 0) && (!feof($this->fp))) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of body timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of body timed out');
-					return false;
-				}
-				$strlen += $tmplen;
-				$data .= $tmp;
-			}
-			if ($chunked && ($content_length > 0)) {
-				$tmp = fgets($this->fp, 256);
-				$tmplen = strlen($tmp);
-				$this->debug("read chunk terminator of $tmplen bytes");
-				if ($tmplen == 0) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of chunk terminator timed out');
-					return false;
-				}
-			}
-		} while ($chunked && ($content_length > 0) && (!feof($this->fp)));
-		if (feof($this->fp)) {
-			$this->debug('read to EOF');
-		}
-		$this->debug('read body of length ' . strlen($data));
-		$this->incoming_payload .= $data;
-		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
-		
-		// close filepointer
-		if(
-			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
-			(! $this->persistentConnection) || feof($this->fp)){
-			fclose($this->fp);
-			$this->fp = false;
-			$this->debug('closed socket');
-		}
-		
-		// connection was closed unexpectedly
-		if($this->incoming_payload == ''){
-			$this->setError('no response from server');
-			return false;
-		}
-		
-		// decode transfer-encoding
-//		if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
-//			if(!$data = $this->decodeChunked($data, $lb)){
-//				$this->setError('Decoding of chunked data failed');
-//				return false;
-//			}
-			//print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
-			// set decoded payload
-//			$this->incoming_payload = $header_data.$lb.$lb.$data;
-//		}
-	
-	  } else if ($this->scheme == 'https') {
-		// send and receive
-		$this->debug('send and receive with cURL');
-		$this->incoming_payload = curl_exec($this->ch);
-		$data = $this->incoming_payload;
-
-        $cErr = curl_error($this->ch);
-		if ($cErr != '') {
-        	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
-        	// TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
-			foreach(curl_getinfo($this->ch) as $k => $v){
-				$err .= "$k: $v<br>";
-			}
-			$this->debug($err);
-			$this->setError($err);
-			curl_close($this->ch);
-	    	return false;
-		} else {
-			//echo '<pre>';
-			//var_dump(curl_getinfo($this->ch));
-			//echo '</pre>';
-		}
-		// close curl
-		$this->debug('No cURL error, closing cURL');
-		curl_close($this->ch);
-		
-		// remove 100 header(s)
-		while (ereg('^HTTP/1.1 100',$data)) {
-			if ($pos = strpos($data,"\r\n\r\n")) {
-				$data = ltrim(substr($data,$pos));
-			} elseif($pos = strpos($data,"\n\n") ) {
-				$data = ltrim(substr($data,$pos));
-			}
-		}
-		
-		// separate content from HTTP headers
-		if ($pos = strpos($data,"\r\n\r\n")) {
-			$lb = "\r\n";
-		} elseif( $pos = strpos($data,"\n\n")) {
-			$lb = "\n";
-		} else {
-			$this->debug('no proper separation of headers and document');
-			$this->setError('no proper separation of headers and document');
-			return false;
-		}
-		$header_data = trim(substr($data,0,$pos));
-		$header_array = explode($lb,$header_data);
-		$data = ltrim(substr($data,$pos));
-		$this->debug('found proper separation of headers and document');
-		$this->debug('cleaned data, stringlen: '.strlen($data));
-		// clean headers
-		foreach ($header_array as $header_line) {
-			$arr = explode(':',$header_line,2);
-			if(count($arr) > 1){
-				$header_name = strtolower(trim($arr[0]));
-				$this->incoming_headers[$header_name] = trim($arr[1]);
-				if ($header_name == 'set-cookie') {
-					// TODO: allow multiple cookies from parseCookie
-					$cookie = $this->parseCookie(trim($arr[1]));
-					if ($cookie) {
-						$this->incoming_cookies[] = $cookie;
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
-					} else {
-						$this->debug('did not find cookie in ' . trim($arr[1]));
-					}
-    			}
-			} else if (isset($header_name)) {
-				// append continuation line to previous header
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
-			}
-		}
-	  }
-
-		$arr = explode(' ', $header_array[0], 3);
-		$http_version = $arr[0];
-		$http_status = intval($arr[1]);
-		$http_reason = count($arr) > 2 ? $arr[2] : '';
-
- 		// see if we need to resend the request with http digest authentication
- 		if (isset($this->incoming_headers['location']) && $http_status == 301) {
- 			$this->debug("Got 301 $http_reason with Location: " . $this->incoming_headers['location']);
- 			$this->setURL($this->incoming_headers['location']);
-			$this->tryagain = true;
-			return false;
-		}
-
- 		// see if we need to resend the request with http digest authentication
- 		if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
- 			$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
- 			if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
- 				$this->debug('Server wants digest authentication');
- 				// remove "Digest " from our elements
- 				$digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
- 				
- 				// parse elements into array
- 				$digestElements = explode(',', $digestString);
- 				foreach ($digestElements as $val) {
- 					$tempElement = explode('=', trim($val), 2);
- 					$digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
- 				}
-
-				// should have (at least) qop, realm, nonce
- 				if (isset($digestRequest['nonce'])) {
- 					$this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
- 					$this->tryagain = true;
- 					return false;
- 				}
- 			}
-			$this->debug('HTTP authentication failed');
-			$this->setError('HTTP authentication failed');
-			return false;
- 		}
-		
-		if (
-			($http_status >= 300 && $http_status <= 307) ||
-			($http_status >= 400 && $http_status <= 417) ||
-			($http_status >= 501 && $http_status <= 505)
-		   ) {
-			$this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient2->response has contents of the response)");
-			return false;
-		}
-
-		// decode content-encoding
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
-    			// if decoding works, use it. else assume data wasn't gzencoded
-    			if(function_exists('gzinflate')){
-					//$timer->setMarker('starting decoding of gzip/deflated content');
-					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
-					// this means there are no Zlib headers, although there should be
-					$this->debug('The gzinflate function exists');
-					$datalen = strlen($data);
-					if ($this->incoming_headers['content-encoding'] == 'deflate') {
-						if ($degzdata = @gzinflate($data)) {
-	    					$data = $degzdata;
-	    					$this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
-	    					if (strlen($data) < $datalen) {
-	    						// test for the case that the payload has been compressed twice
-		    					$this->debug('The inflated payload is smaller than the gzipped one; try again');
-								if ($degzdata = @gzinflate($data)) {
-			    					$data = $degzdata;
-			    					$this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
-								}
-	    					}
-	    				} else {
-	    					$this->debug('Error using gzinflate to inflate the payload');
-	    					$this->setError('Error using gzinflate to inflate the payload');
-	    				}
-					} elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
-						if ($degzdata = @gzinflate(substr($data, 10))) {	// do our best
-							$data = $degzdata;
-	    					$this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
-	    					if (strlen($data) < $datalen) {
-	    						// test for the case that the payload has been compressed twice
-		    					$this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
-								if ($degzdata = @gzinflate(substr($data, 10))) {
-			    					$data = $degzdata;
-			    					$this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
-								}
-	    					}
-	    				} else {
-	    					$this->debug('Error using gzinflate to un-gzip the payload');
-							$this->setError('Error using gzinflate to un-gzip the payload');
-	    				}
-					}
-					//$timer->setMarker('finished decoding of gzip/deflated content');
-					//print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
-					// set decoded payload
-					$this->incoming_payload = $header_data.$lb.$lb.$data;
-    			} else {
-					$this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
-					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
-				}
-			} else {
-				$this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
-				$this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
-			}
-		} else {
-			$this->debug('No Content-Encoding header');
-		}
-		
-		if(strlen($data) == 0){
-			$this->debug('no data after headers!');
-			$this->setError('no data present after HTTP headers');
-			return false;
-		}
-		
-		return $data;
-	}
-
-	function setContentType($type, $charset = false) {
-		$this->outgoing_headers['Content-Type'] = $type . ($charset ? '; charset=' . $charset : '');
-		$this->debug('set Content-Type: ' . $this->outgoing_headers['Content-Type']);
-	}
-
-	function usePersistentConnection(){
-		if (isset($this->outgoing_headers['Accept-Encoding'])) {
-			return false;
-		}
-		$this->protocol_version = '1.1';
-		$this->persistentConnection = true;
-		$this->outgoing_headers['Connection'] = 'Keep-Alive';
-		$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-		return true;
-	}
-
-	/**
-	 * parse an incoming Cookie into it's parts
-	 *
-	 * @param	string $cookie_str content of cookie
-	 * @return	array with data of that cookie
-	 * @access	private
-	 */
-	/*
-	 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
-	 */
-	function parseCookie($cookie_str) {
-		$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
-		$data = split(';', $cookie_str);
-		$value_str = $data[0];
-
-		$cookie_param = 'domain=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ($start > 0) {
-			$domain = substr($cookie_str, $start + strlen($cookie_param));
-			$domain = substr($domain, 0, strpos($domain, ';'));
-		} else {
-			$domain = '';
-		}
-
-		$cookie_param = 'expires=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ($start > 0) {
-			$expires = substr($cookie_str, $start + strlen($cookie_param));
-			$expires = substr($expires, 0, strpos($expires, ';'));
-		} else {
-			$expires = '';
-		}
-
-		$cookie_param = 'path=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ( $start > 0 ) {
-			$path = substr($cookie_str, $start + strlen($cookie_param));
-			$path = substr($path, 0, strpos($path, ';'));
-		} else {
-			$path = '/';
-		}
-						
-		$cookie_param = ';secure;';
-		if (strpos($cookie_str, $cookie_param) !== FALSE) {
-			$secure = true;
-		} else {
-			$secure = false;
-		}
-
-		$sep_pos = strpos($value_str, '=');
-
-		if ($sep_pos) {
-			$name = substr($value_str, 0, $sep_pos);
-			$value = substr($value_str, $sep_pos + 1);
-			$cookie= array(	'name' => $name,
-			                'value' => $value,
-							'domain' => $domain,
-							'path' => $path,
-							'expires' => $expires,
-							'secure' => $secure
-							);		
-			return $cookie;
-		}
-		return false;
-	}
-  
-	/**
-	 * sort out cookies for the current request
-	 *
-	 * @param	array $cookies array with all cookies
-	 * @param	boolean $secure is the send-content secure or not?
-	 * @return	string for Cookie-HTTP-Header
-	 * @access	private
-	 */
-	function getCookiesForRequest($cookies, $secure=false) {
-		$cookie_str = '';
-		if ((! is_null($cookies)) && (is_array($cookies))) {
-			foreach ($cookies as $cookie) {
-				if (! is_array($cookie)) {
-					continue;
-				}
-	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
-					if (strtotime($cookie['expires']) <= time()) {
-						$this->debug('cookie has expired');
-						continue;
-					}
-				}
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
-					$domain = preg_quote($cookie['domain']);
-					if (! preg_match("'.*$domain$'i", $this->host)) {
-						$this->debug('cookie has different domain');
-						continue;
-					}
-				}
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
-					$path = preg_quote($cookie['path']);
-					if (! preg_match("'^$path.*'i", $this->path)) {
-						$this->debug('cookie is for a different path');
-						continue;
-					}
-				}
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
-					$this->debug('cookie is secure, transport is not');
-					continue;
-				}
-				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
-	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
-			}
-		}
-		return $cookie_str;
-  }
-}
-
-?><?php
-
-
-
-/**
-*
-* soap_server allows the user to create a SOAP server
-* that is capable of receiving messages and returning responses
-*
-* NOTE: WSDL functionality is experimental
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class soap_server extends nusoap_base {
-	/**
-	 * HTTP headers of request
-	 * @var array
-	 * @access private
-	 */
-	var $headers = array();
-	/**
-	 * HTTP request
-	 * @var string
-	 * @access private
-	 */
-	var $request = '';
-	/**
-	 * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text)
-	 * @var string
-	 * @access public
-	 */
-	var $requestHeaders = '';
-	/**
-	 * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text)
-	 * @var string
-	 * @access public
-	 */
-	var $document = '';
-	/**
-	 * SOAP payload for request (text)
-	 * @var string
-	 * @access public
-	 */
-	var $requestSOAP = '';
-	/**
-	 * requested method namespace URI
-	 * @var string
-	 * @access private
-	 */
-	var $methodURI = '';
-	/**
-	 * name of method requested
-	 * @var string
-	 * @access private
-	 */
-	var $methodname = '';
-	/**
-	 * method parameters from request
-	 * @var array
-	 * @access private
-	 */
-	var $methodparams = array();
-	/**
-	 * SOAP Action from request
-	 * @var string
-	 * @access private
-	 */
-	var $SOAPAction = '';
-	/**
-	 * character set encoding of incoming (request) messages
-	 * @var string
-	 * @access public
-	 */
-	var $xml_encoding = '';
-	/**
-	 * toggles whether the parser decodes element content w/ utf8_decode()
-	 * @var boolean
-	 * @access public
-	 */
-    var $decode_utf8 = true;
-
-	/**
-	 * HTTP headers of response
-	 * @var array
-	 * @access public
-	 */
-	var $outgoing_headers = array();
-	/**
-	 * HTTP response
-	 * @var string
-	 * @access private
-	 */
-	var $response = '';
-	/**
-	 * SOAP headers for response (text)
-	 * @var string
-	 * @access public
-	 */
-	var $responseHeaders = '';
-	/**
-	 * SOAP payload for response (text)
-	 * @var string
-	 * @access private
-	 */
-	var $responseSOAP = '';
-	/**
-	 * method return value to place in response
-	 * @var mixed
-	 * @access private
-	 */
-	var $methodreturn = false;
-	/**
-	 * whether $methodreturn is a string of literal XML
-	 * @var boolean
-	 * @access public
-	 */
-	var $methodreturnisliteralxml = false;
-	/**
-	 * SOAP fault for response (or false)
-	 * @var mixed
-	 * @access private
-	 */
-	var $fault = false;
-	/**
-	 * text indication of result (for debugging)
-	 * @var string
-	 * @access private
-	 */
-	var $result = 'successful';
-
-	/**
-	 * assoc array of operations => opData; operations are added by the register()
-	 * method or by parsing an external WSDL definition
-	 * @var array
-	 * @access private
-	 */
-	var $operations = array();
-	/**
-	 * wsdl instance (if one)
-	 * @var mixed
-	 * @access private
-	 */
-	var $wsdl = false;
-	/**
-	 * URL for WSDL (if one)
-	 * @var mixed
-	 * @access private
-	 */
-	var $externalWSDLURL = false;
-	/**
-	 * whether to append debug to response as XML comment
-	 * @var boolean
-	 * @access public
-	 */
-	var $debug_flag = false;
-
-
-	/**
-	* constructor
-    * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
-	*
-    * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
-	* @access   public
-	*/
-	function soap_server($wsdl=false){
-		parent::nusoap_base();
-		// turn on debugging?
-		global $debug;
-		global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER)) {
-			$this->debug("_SERVER is defined:");
-			$this->appendDebug($this->varDump($_SERVER));
-		} elseif (isset($HTTP_SERVER_VARS)) {
-			$this->debug("HTTP_SERVER_VARS is defined:");
-			$this->appendDebug($this->varDump($HTTP_SERVER_VARS));
-		} else {
-			$this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
-		}
-
-		if (isset($debug)) {
-			$this->debug("In soap_server, set debug_flag=$debug based on global flag");
-			$this->debug_flag = $debug;
-		} elseif (isset($_SERVER['QUERY_STRING'])) {
-			$qs = explode('&', $_SERVER['QUERY_STRING']);
-			foreach ($qs as $v) {
-				if (substr($v, 0, 6) == 'debug=') {
-					$this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
-					$this->debug_flag = substr($v, 6);
-				}
-			}
-		} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
-			$qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
-			foreach ($qs as $v) {
-				if (substr($v, 0, 6) == 'debug=') {
-					$this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
-					$this->debug_flag = substr($v, 6);
-				}
-			}
-		}
-
-		// wsdl
-		if($wsdl){
-			$this->debug("In soap_server, WSDL is specified");
-			if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
-				$this->wsdl = $wsdl;
-				$this->externalWSDLURL = $this->wsdl->wsdl;
-				$this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
-			} else {
-				$this->debug('Create wsdl from ' . $wsdl);
-				$this->wsdl = new wsdl($wsdl);
-				$this->externalWSDLURL = $wsdl;
-			}
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			if($err = $this->wsdl->getError()){
-				die('WSDL ERROR: '.$err);
-			}
-		}
-	}
-
-	/**
-	* processes request and returns response
-	*
-	* @param    string $data usually is the value of $HTTP_RAW_POST_DATA
-	* @access   public
-	*/
-	function service($data){
-		global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER['QUERY_STRING'])) {
-			$qs = $_SERVER['QUERY_STRING'];
-		} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
-			$qs = $HTTP_SERVER_VARS['QUERY_STRING'];
-		} else {
-			$qs = '';
-		}
-		$this->debug("In service, query string=$qs");
-
-		if (ereg('wsdl', $qs) ){
-			$this->debug("In service, this is a request for WSDL");
-			if($this->externalWSDLURL){
-              if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
-				header('Location: '.$this->externalWSDLURL);
-              } else { // assume file
-                header("Content-Type: text/xml\r\n");
-                $fp = fopen($this->externalWSDLURL, 'r');
-                fpassthru($fp);
-              }
-			} elseif ($this->wsdl) {
-				header("Content-Type: text/xml; charset=UTF-8\r\n");
-				print $this->wsdl->serialize($this->debug_flag);
-				if ($this->debug_flag) {
-					$this->debug('wsdl:');
-					$this->appendDebug($this->varDump($this->wsdl));
-					print $this->getDebugAsXMLComment();
-				}
-			} else {
-				header("Content-Type: text/html; charset=UTF-8\r\n");
-				print "This service does not provide WSDL";
-			}
-		} elseif ($data == '' && $this->wsdl) {
-			$this->debug("In service, there is no data, so return Web description");
-			print $this->wsdl->webDescription();
-		} else {
-			$this->debug("In service, invoke the request");
-			$this->parse_request($data);
-			if (! $this->fault) {
-				$this->invoke_method();
-			}
-			if (! $this->fault) {
-				$this->serialize_return();
-			}
-			$this->send_response();
-		}
-	}
-
-	/**
-	* parses HTTP request headers.
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* headers
-	* request
-	* xml_encoding
-	* SOAPAction
-	*
-	* @access   private
-	*/
-	function parse_http_headers() {
-		global $HTTP_SERVER_VARS;
-
-		$this->request = '';
-		$this->SOAPAction = '';
-
-		//Commented to fix the issue in PHP 5 Windows system ---Jeri
-		//when we use getallheaders function  we are geting an error description invalid gzip crc value when parsing the response in VB
-		// hence the function is commented out and $_SERVER is used to get all the header informations.
-		
-		/*if(function_exists('getallheaders')){
-			$this->debug("In parse_http_headers, use getallheaders");
-			$headers = getallheaders();
-			foreach($headers as $k=>$v){
-				$k = strtolower($k);
-				$this->headers[$k] = $v;
-				$this->request .= "$k: $v\r\n";
-				$this->debug("$k: $v");
-			}
-			// get SOAPAction header
-			if(isset($this->headers['soapaction'])){
-				$this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
-			}
-			// get the character encoding of the incoming request
-			if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
-				$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
-				if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
-					$this->xml_encoding = strtoupper($enc);
-				} else {
-					$this->xml_encoding = 'US-ASCII';
-				}
-			} else {
-				// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-				$this->xml_encoding = 'ISO-8859-1';
-			}
-		} else*/if(isset($_SERVER) && is_array($_SERVER)){
-			$this->debug("In parse_http_headers, use _SERVER");
-			foreach ($_SERVER as $k => $v) {
-				if (substr($k, 0, 5) == 'HTTP_') {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
-				} else {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
-				}
-				if ($k == 'soapaction') {
-					// get SOAPAction header
-					$k = 'SOAPAction';
-					$v = str_replace('"', '', $v);
-					$v = str_replace('\\', '', $v);
-					$this->SOAPAction = $v;
-				} else if ($k == 'content-type') {
-					// get the character encoding of the incoming request
-					if (strpos($v, '=')) {
-						$enc = substr(strstr($v, '='), 1);
-						$enc = str_replace('"', '', $enc);
-						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
-							$this->xml_encoding = strtoupper($enc);
-						} else {
-							$this->xml_encoding = 'US-ASCII';
-						}
-					} else {
-						// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-						$this->xml_encoding = 'UTF-8';
-					}
-				}
-				$this->headers[$k] = $v;
-				$this->request .= "$k: $v\r\n";
-				$this->debug("$k: $v");
-			}
-		} elseif (is_array($HTTP_SERVER_VARS)) {
-			$this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
-			foreach ($HTTP_SERVER_VARS as $k => $v) {
-				if (substr($k, 0, 5) == 'HTTP_') {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
-				} else {
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
-				}
-				if ($k == 'soapaction') {
-					// get SOAPAction header
-					$k = 'SOAPAction';
-					$v = str_replace('"', '', $v);
-					$v = str_replace('\\', '', $v);
-					$this->SOAPAction = $v;
-				} else if ($k == 'content-type') {
-					// get the character encoding of the incoming request
-					if (strpos($v, '=')) {
-						$enc = substr(strstr($v, '='), 1);
-						$enc = str_replace('"', '', $enc);
-						$enc = str_replace('\\', '', $enc);
-						if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
-							$this->xml_encoding = strtoupper($enc);
-						} else {
-							$this->xml_encoding = 'US-ASCII';
-						}
-					} else {
-						// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-						$this->xml_encoding = 'UTF-8';
-					}
-				}
-				$this->headers[$k] = $v;
-				$this->request .= "$k: $v\r\n";
-				$this->debug("$k: $v");
-			}
-		} else {
-			$this->debug("In parse_http_headers, HTTP headers not accessible");
-			$this->setError("HTTP headers not accessible");
-		}
-	}
-
-	/**
-	* parses a request
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* headers
-	* request
-	* xml_encoding
-	* SOAPAction
-	* request
-	* requestSOAP
-	* methodURI
-	* methodname
-	* methodparams
-	* requestHeaders
-	* document
-	*
-	* This sets the fault field on error
-	*
-	* @param    string $data XML string
-	* @access   private
-	*/
-	function parse_request($data='') {
-		$this->debug('entering parse_request()');
-		$this->parse_http_headers();
-		$this->debug('got character encoding: '.$this->xml_encoding);
-		// uncompress if necessary
-		if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
-			$this->debug('got content encoding: ' . $this->headers['content-encoding']);
-			if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
-		    	// if decoding works, use it. else assume data wasn't gzencoded
-				if (function_exists('gzuncompress')) {
-					if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
-						$data = $degzdata;
-					} elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
-						$data = $degzdata;
-					} else {
-						$this->fault('Client', 'Errors occurred when trying to decode the data');
-						return;
-					}
-				} else {
-					$this->fault('Client', 'This Server does not support compressed data');
-					return;
-				}
-			}
-		}
-		$this->request .= "\r\n".$data;
-		$data = $this->parseRequest($this->headers, $data);
-		$this->requestSOAP = $data;
-		$this->debug('leaving parse_request');
-	}
-
-	/**
-	* invokes a PHP function for the requested SOAP method
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* methodreturn
-	*
-	* Note that the PHP function that is called may also set the following
-	* fields to affect the response sent to the client
-	*
-	* responseHeaders
-	* outgoing_headers
-	*
-	* This sets the fault field on error
-	*
-	* @access   private
-	*/
-	function invoke_method() {
-		$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
-
-		if ($this->wsdl) {
-			if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
-				$this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
-			} elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
-				// Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
-				$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
-				$this->methodname = $this->opData['name'];
-			} else {
-				$this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
-				$this->fault('Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
-				return;
-			}
-		} else {
-			$this->debug('in invoke_method, no WSDL to validate method');
-		}
-
-		// if a . is present in $this->methodname, we see if there is a class in scope,
-		// which could be referred to. We will also distinguish between two deliminators,
-		// to allow methods to be called a the class or an instance
-		$class = '';
-		$method = '';
-		if (strpos($this->methodname, '..') > 0) {
-			$delim = '..';
-		} else if (strpos($this->methodname, '.') > 0) {
-			$delim = '.';
-		} else {
-			$delim = '';
-		}
-
-		if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
-			class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
-			// get the class and method name
-			$class = substr($this->methodname, 0, strpos($this->methodname, $delim));
-			$method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
-			$this->debug("in invoke_method, class=$class method=$method delim=$delim");
-		}
-
-		// does method exist?
-		if ($class == '') {
-			if (!function_exists($this->methodname)) {
-				$this->debug("in invoke_method, function '$this->methodname' not found!");
-				$this->result = 'fault: method not found';
-				$this->fault('Client',"method '$this->methodname' not defined in service");
-				return;
-			}
-		} else {
-			$method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
-			if (!in_array($method_to_compare, get_class_methods($class))) {
-				$this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
-				$this->result = 'fault: method not found';
-				$this->fault('Client',"method '$this->methodname' not defined in service");
-				return;
-			}
-		}
-
-		// evaluate message, getting back parameters
-		// verify that request parameters match the method's signature
-		if(! $this->verify_method($this->methodname,$this->methodparams)){
-			// debug
-			$this->debug('ERROR: request not verified against method signature');
-			$this->result = 'fault: request failed validation against method signature';
-			// return fault
-			$this->fault('Client',"Operation '$this->methodname' not defined in service.");
-			return;
-		}
-
-		// if there are parameters to pass
-		$this->debug('in invoke_method, params:');
-		$this->appendDebug($this->varDump($this->methodparams));
-		$this->debug("in invoke_method, calling '$this->methodname'");
-		if (!function_exists('call_user_func_array')) {
-			if ($class == '') {
-				$this->debug('in invoke_method, calling function using eval()');
-				$funcCall = "\$this->methodreturn = $this->methodname(";
-			} else {
-				if ($delim == '..') {
-					$this->debug('in invoke_method, calling class method using eval()');
-					$funcCall = "\$this->methodreturn = ".$class."::".$method."(";
-				} else {
-					$this->debug('in invoke_method, calling instance method using eval()');
-					// generate unique instance name
-					$instname = "\$inst_".time();
-					$funcCall = $instname." = new ".$class."(); ";
-					$funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
-				}
-			}
-			if ($this->methodparams) {
-				foreach ($this->methodparams as $param) {
-					if (is_array($param)) {
-						$this->fault('Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
-						return;
-					}
-					$funcCall .= "\"$param\",";
-				}
-				$funcCall = substr($funcCall, 0, -1);
-			}
-			$funcCall .= ');';
-			$this->debug('in invoke_method, function call: '.$funcCall);
-			@eval($funcCall);
-		} else {
-			if ($class == '') {
-				$this->debug('in invoke_method, calling function using call_user_func_array()');
-				$call_arg = "$this->methodname";	// straight assignment changes $this->methodname to lower case after call_user_func_array()
-			} elseif ($delim == '..') {
-				$this->debug('in invoke_method, calling class method using call_user_func_array()');
-				$call_arg = array ($class, $method);
-			} else {
-				$this->debug('in invoke_method, calling instance method using call_user_func_array()');
-				$instance = new $class ();
-				$call_arg = array(&$instance, $method);
-			}
-			$this->methodreturn = call_user_func_array($call_arg, $this->methodparams);
-		}
-        $this->debug('in invoke_method, methodreturn:');
-        $this->appendDebug($this->varDump($this->methodreturn));
-		$this->debug("in invoke_method, called method $this->methodname, received $this->methodreturn of type ".gettype($this->methodreturn));
-	}
-
-	/**
-	* serializes the return value from a PHP function into a full SOAP Envelope
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* responseSOAP
-	*
-	* This sets the fault field on error
-	*
-	* @access   private
-	*/
-	function serialize_return() {
-		$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
-		// if fault
-		if (isset($this->methodreturn) && (get_class($this->methodreturn) == 'soap_fault')) {
-			$this->debug('got a fault object from method');
-			$this->fault = $this->methodreturn;
-			return;
-		} elseif ($this->methodreturnisliteralxml) {
-			$return_val = $this->methodreturn;
-		// returned value(s)
-		} else {
-			$this->debug('got a(n) '.gettype($this->methodreturn).' from method');
-			$this->debug('serializing return value');
-			if($this->wsdl){
-				// weak attempt at supporting multiple output params
-				if(sizeof($this->opData['output']['parts']) > 1){
-			    	$opParams = $this->methodreturn;
-			    } else {
-			    	// TODO: is this really necessary?
-			    	$opParams = array($this->methodreturn);
-			    }
-			    $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
-			    $this->appendDebug($this->wsdl->getDebug());
-			    $this->wsdl->clearDebug();
-				if($errstr = $this->wsdl->getError()){
-					$this->debug('got wsdl error: '.$errstr);
-					$this->fault('Server', 'unable to serialize result');
-					return;
-				}
-			} else {
-				if (isset($this->methodreturn)) {
-					$return_val = $this->serialize_val($this->methodreturn, 'return');
-				} else {
-					$return_val = '';
-					$this->debug('in absence of WSDL, assume void return for backward compatibility');
-				}
-			}
-		}
-		$this->debug('return value:');
-		$this->appendDebug($this->varDump($return_val));
-
-		$this->debug('serializing response');
-		if ($this->wsdl) {
-			$this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
-			if ($this->opData['style'] == 'rpc') {
-				$this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
-				if ($this->opData['output']['use'] == 'literal') {
-					$payload = '<'.$this->methodname.'Response xmlns="'.$this->methodURI.'">'.$return_val.'</'.$this->methodname."Response>";
-				} else {
-					$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
-				}
-			} else {
-				$this->debug('style is not rpc for serialization: assume document');
-				$payload = $return_val;
-			}
-		} else {
-			$this->debug('do not have WSDL for serialization: assume rpc/encoded');
-			$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
-		}
-		$this->result = 'successful';
-		if($this->wsdl){
-			//if($this->debug_flag){
-            	$this->appendDebug($this->wsdl->getDebug());
-            //	}
-			if (isset($opData['output']['encodingStyle'])) {
-				$encodingStyle = $opData['output']['encodingStyle'];
-			} else {
-				$encodingStyle = '';
-			}
-			// Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$encodingStyle);
-		} else {
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
-		}
-		$this->debug("Leaving serialize_return");
-	}
-
-	/**
-	* sends an HTTP response
-	*
-	* The following fields are set by this function (when successful)
-	*
-	* outgoing_headers
-	* response
-	*
-	* @access   private
-	*/
-	function send_response() {
-		$this->debug('Enter send_response');
-		if ($this->fault) {
-			$payload = $this->fault->serialize();
-			$this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
-			$this->outgoing_headers[] = "Status: 500 Internal Server Error";
-		} else {
-			$payload = $this->responseSOAP;
-			// Some combinations of PHP+Web server allow the Status
-			// to come through as a header.  Since OK is the default
-			// just do nothing.
-			// $this->outgoing_headers[] = "HTTP/1.0 200 OK";
-			// $this->outgoing_headers[] = "Status: 200 OK";
-		}
-        // add debug data if in debug mode
-		if(isset($this->debug_flag) && $this->debug_flag){
-        	$payload .= $this->getDebugAsXMLComment();
-        }
-		$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
-		ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
-		$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
-		// Let the Web server decide about this
-		//$this->outgoing_headers[] = "Connection: Close\r\n";
-		$payload = $this->getHTTPBody($payload);
-		$type = $this->getHTTPContentType();
-		$charset = $this->getHTTPContentTypeCharset();
-		$this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
-		//begin code to compress payload - by John
-		// NOTE: there is no way to know whether the Web server will also compress
-		// this data.
-		if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {	
-			if (strstr($this->headers['accept-encoding'], 'gzip')) {
-				if (function_exists('gzencode')) {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content being gzipped -->";
-					}
-					$this->outgoing_headers[] = "Content-Encoding: gzip";
-					$payload = gzencode($payload);
-				} else {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content will not be gzipped: no gzencode -->";
-					}
-				}
-			} elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
-				// Note: MSIE requires gzdeflate output (no Zlib header and checksum),
-				// instead of gzcompress output,
-				// which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
-				if (function_exists('gzdeflate')) {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content being deflated -->";
-					}
-					$this->outgoing_headers[] = "Content-Encoding: deflate";
-					$payload = gzdeflate($payload);
-				} else {
-					if (isset($this->debug_flag) && $this->debug_flag) {
-						$payload .= "<!-- Content will not be deflated: no gzcompress -->";
-					}
-				}
-			}
-		}
-		//end code
-		$this->outgoing_headers[] = "Content-Length: ".strlen($payload);
-		reset($this->outgoing_headers);
-		foreach($this->outgoing_headers as $hdr){
-			header($hdr, false);
-		}
-		print $payload;
-		$this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
-	}
-
-	/**
-	* takes the value that was created by parsing the request
-	* and compares to the method's signature, if available.
-	*
-	* @param	string	$operation	The operation to be invoked
-	* @param	array	$request	The array of parameter values
-	* @return	boolean	Whether the operation was found
-	* @access   private
-	*/
-	function verify_method($operation,$request){
-		if(isset($this->wsdl) && is_object($this->wsdl)){
-			if($this->wsdl->getOperationData($operation)){
-				return true;
-			}
-	    } elseif(isset($this->operations[$operation])){
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	* processes SOAP message received from client
-	*
-	* @param	array	$headers	The HTTP headers
-	* @param	string	$data		unprocessed request data from client
-	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
-	*/
-    function parseRequest($headers, $data) {
-		$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
-		if (!strstr($headers['content-type'], 'text/xml')) {
-			$this->setError('Request not of type text/xml');
-			return false;
-		}
-		if (strpos($headers['content-type'], '=')) {
-			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
-			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
-				$this->xml_encoding = strtoupper($enc);
-			} else {
-				$this->xml_encoding = 'US-ASCII';
-			}
-		} else {
-			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-			$this->xml_encoding = 'UTF-8';
-		}
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
-		// parse response, get soap parser obj
-		$parser = new soap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
-		// parser debug
-		$this->debug("parser debug: \n".$parser->getDebug());
-		// if fault occurred during message parsing
-		if($err = $parser->getError()){
-			$this->result = 'fault: error in msg parsing: '.$err;
-			$this->fault('Client',"error in msg parsing:\n".$err);
-		// else successfully parsed request into soapval object
-		} else {
-			// get/set methodname
-			$this->methodURI = $parser->root_struct_namespace;
-			$this->methodname = $parser->root_struct_name;
-			$this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
-			$this->debug('calling parser->get_response()');
-			$this->methodparams = $parser->get_response();
-			// get SOAP headers
-			$this->requestHeaders = $parser->getHeaders();
-            // add document for doclit support
-            $this->document = $parser->document;
-		}
-	 }
-
-	/**
-	* gets the HTTP body for the current response.
-	*
-	* @param string $soapmsg The SOAP payload
-	* @return string The HTTP body, which includes the SOAP payload
-	* @access private
-	*/
-	function getHTTPBody($soapmsg) {
-		return $soapmsg;
-	}
-	
-	/**
-	* gets the HTTP content type for the current response.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type for the current response.
-	* @access private
-	*/
-	function getHTTPContentType() {
-		return 'text/xml';
-	}
-	
-	/**
-	* gets the HTTP content type charset for the current response.
-	* returns false for non-text content types.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type charset for the current response.
-	* @access private
-	*/
-	function getHTTPContentTypeCharset() {
-		return $this->soap_defencoding;
-	}
-
-	/**
-	* add a method to the dispatch map (this has been replaced by the register method)
-	*
-	* @param    string $methodname
-	* @param    string $in array of input values
-	* @param    string $out array of output values
-	* @access   public
-	* @deprecated
-	*/
-	function add_to_map($methodname,$in,$out){
-			$this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
-	}
-
-	/**
-	* register a service function with the server
-	*
-	* @param    string $name the name of the PHP function, class.method or class..method
-	* @param    array $in assoc array of input values: key = param name, value = param type
-	* @param    array $out assoc array of output values: key = param name, value = param type
-	* @param	mixed $namespace the element namespace for the method or false
-	* @param	mixed $soapaction the soapaction for the method or false
-	* @param	mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
-	* @param	mixed $use optional (encoded|literal) or false
-	* @param	string $documentation optional Description to include in WSDL
-	* @param	string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
-	* @access   public
-	*/
-	function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
-		global $HTTP_SERVER_VARS;
-
-		if($this->externalWSDLURL){
-			die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
-		}
-		if (! $name) {
-			die('You must specify a name when you register an operation');
-		}
-		if (!is_array($in)) {
-			die('You must provide an array for operation inputs');
-		}
-		if (!is_array($out)) {
-			die('You must provide an array for operation outputs');
-		}
-		if(false == $namespace) {
-		}
-		if(false == $soapaction) {
-			if (isset($_SERVER)) {
-				$SERVER_NAME = $_SERVER['SERVER_NAME'];
-				$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
-			} elseif (isset($HTTP_SERVER_VARS)) {
-				$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
-				$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
-			} else {
-				$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
-			}
-			// Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5303
-			if (isset($_SERVER)) {
-				$SERVER_PORT = $_SERVER['SERVER_PORT'];
-				$HTTPS = $_SERVER['HTTPS'];
-    		} elseif (isset($HTTP_SERVER_VARS)) {
-				$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
-				$HTTPS = $HTTP_SERVER_VARS['HTTPS'];
-    		} 
-    		if ($SERVER_PORT == 80) { $SERVER_PORT = ''; } else { $SERVER_PORT = ':' . $SERVER_PORT; }
-    		if ($HTTPS == '1' || $HTTPS == 'on') { $SCHEME = 'https'; } else { $SCHEME = 'http'; }
-
-    		$soapaction = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME/$name";
-		}
-		if(false == $style) {
-			$style = "rpc";
-		}
-		if(false == $use) {
-			$use = "encoded";
-		}
-		if ($use == 'encoded' && $encodingStyle = '') {
-			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		}
-
-		$this->operations[$name] = array(
-	    'name' => $name,
-	    'in' => $in,
-	    'out' => $out,
-	    'namespace' => $namespace,
-	    'soapaction' => $soapaction,
-	    'style' => $style);
-        if($this->wsdl){
-        	$this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
-	    }
-		return true;
-	}
-
-	/**
-	* Specify a fault to be returned to the client.
-	* This also acts as a flag to the server that a fault has occured.
-	*
-	* @param	string $faultcode
-	* @param	string $faultstring
-	* @param	string $faultactor
-	* @param	string $faultdetail
-	* @access   public
-	*/
-	function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
-		if ($faultdetail == '' && $this->debug_flag) {
-			$faultdetail = $this->getDebug();
-		}
-		$this->fault = new soap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
-		$this->fault->soap_defencoding = $this->soap_defencoding;
-	}
-
-    /**
-    * Sets up wsdl object.
-    * Acts as a flag to enable internal WSDL generation
-    *
-    * @param string $serviceName, name of the service
-    * @param mixed $namespace optional 'tns' service namespace or false
-    * @param mixed $endpoint optional URL of service endpoint or false
-    * @param string $style optional (rpc|document) WSDL style (also specified by operation)
-    * @param string $transport optional SOAP transport
-    * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false
-    */
-    function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
-    {
-    	global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER)) {
-			$SERVER_NAME = $_SERVER['SERVER_NAME'];
-			$SERVER_PORT = $_SERVER['SERVER_PORT'];
-			$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
-			$HTTPS = $_SERVER['HTTPS'];
-		} elseif (isset($HTTP_SERVER_VARS)) {
-			$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
-			$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
-			$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
-			$HTTPS = $HTTP_SERVER_VARS['HTTPS'];
-		} else {
-			$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
-		}
-		if ($SERVER_PORT == 80) {
-			$SERVER_PORT = '';
-		} else {
-			$SERVER_PORT = ':' . $SERVER_PORT;
-		}
-        if(false == $namespace) {
-            $namespace = "http://$SERVER_NAME/soap/$serviceName";
-        }
-        
-        if(false == $endpoint) {
-        	if ($HTTPS == '1' || $HTTPS == 'on') {
-        		$SCHEME = 'https';
-        	} else {
-        		$SCHEME = 'http';
-        	}
-            $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
-        }
-        
-        if(false == $schemaTargetNamespace) {
-            $schemaTargetNamespace = $namespace;
-        }
-        
-		$this->wsdl = new wsdl;
-		$this->wsdl->serviceName = $serviceName;
-        $this->wsdl->endpoint = $endpoint;
-		$this->wsdl->namespaces['tns'] = $namespace;
-		$this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		$this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
-		if ($schemaTargetNamespace != $namespace) {
-			$this->wsdl->namespaces['types'] = $schemaTargetNamespace;
-		}
-        $this->wsdl->schemas[$schemaTargetNamespace][0] = new xmlschema('', '', $this->wsdl->namespaces);
-        $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
-        $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
-        $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
-        $this->wsdl->bindings[$serviceName.'Binding'] = array(
-        	'name'=>$serviceName.'Binding',
-            'style'=>$style,
-            'transport'=>$transport,
-            'portType'=>$serviceName.'PortType');
-        $this->wsdl->ports[$serviceName.'Port'] = array(
-        	'binding'=>$serviceName.'Binding',
-            'location'=>$endpoint,
-            'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/');
-    }
-}
-
-
-
-?><?php
-
-
-
-/**
-* parses a WSDL file, allows access to it's data, other utility methods
-* 
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access public 
-*/
-class wsdl extends nusoap_base {
-	// URL or filename of the root of this WSDL
-    var $wsdl; 
-    // define internal arrays of bindings, ports, operations, messages, etc.
-    var $schemas = array();
-    var $currentSchema;
-    var $message = array();
-    var $complexTypes = array();
-    var $messages = array();
-    var $currentMessage;
-    var $currentOperation;
-    var $portTypes = array();
-    var $currentPortType;
-    var $bindings = array();
-    var $currentBinding;
-    var $ports = array();
-    var $currentPort;
-    var $opData = array();
-    var $status = '';
-    var $documentation = false;
-    var $endpoint = ''; 
-    // array of wsdl docs to import
-    var $import = array(); 
-    // parser vars
-    var $parser;
-    var $position = 0;
-    var $depth = 0;
-    var $depth_array = array();
-	// for getting wsdl
-	var $proxyhost = '';
-    var $proxyport = '';
-	var $proxyusername = '';
-	var $proxypassword = '';
-	var $timeout = 0;
-	var $response_timeout = 30;
-
-    /**
-     * constructor
-     * 
-     * @param string $wsdl WSDL document URL
-	 * @param string $proxyhost
-	 * @param string $proxyport
-	 * @param string $proxyusername
-	 * @param string $proxypassword
-	 * @param integer $timeout set the connection timeout
-	 * @param integer $response_timeout set the response timeout
-     * @access public 
-     */
-    function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30){
-		parent::nusoap_base();
-        $this->wsdl = $wsdl;
-        $this->proxyhost = $proxyhost;
-        $this->proxyport = $proxyport;
-		$this->proxyusername = $proxyusername;
-		$this->proxypassword = $proxypassword;
-		$this->timeout = $timeout;
-		$this->response_timeout = $response_timeout;
-        
-        // parse wsdl file
-        if ($wsdl != "") {
-            $this->debug('initial wsdl URL: ' . $wsdl);
-            $this->parseWSDL($wsdl);
-        }
-        // imports
-        // TODO: handle imports more properly, grabbing them in-line and nesting them
-        	$imported_urls = array();
-        	$imported = 1;
-        	while ($imported > 0) {
-        		$imported = 0;
-        		// Schema imports
-        		foreach ($this->schemas as $ns => $list) {
-        			foreach ($list as $xs) {
-						$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
-			            foreach ($xs->imports as $ns2 => $list2) {
-			                for ($ii = 0; $ii < count($list2); $ii++) {
-			                	if (! $list2[$ii]['loaded']) {
-			                		$this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
-			                		$url = $list2[$ii]['location'];
-									if ($url != '') {
-										$urlparts = parse_url($url);
-										if (!isset($urlparts['host'])) {
-											$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
-													substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
-										}
-										if (! in_array($url, $imported_urls)) {
-						                	$this->parseWSDL($url);
-					                		$imported++;
-					                		$imported_urls[] = $url;
-					                	}
-									} else {
-										$this->debug("Unexpected scenario: empty URL for unloaded import");
-									}
-								}
-							}
-			            } 
-        			}
-        		}
-        		// WSDL imports
-				$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
-	            foreach ($this->import as $ns => $list) {
-	                for ($ii = 0; $ii < count($list); $ii++) {
-	                	if (! $list[$ii]['loaded']) {
-	                		$this->import[$ns][$ii]['loaded'] = true;
-	                		$url = $list[$ii]['location'];
-							if ($url != '') {
-								$urlparts = parse_url($url);
-								if (!isset($urlparts['host'])) {
-									$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
-											substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
-								}
-								if (! in_array($url, $imported_urls)) {
-				                	$this->parseWSDL($url);
-			                		$imported++;
-			                		$imported_urls[] = $url;
-			                	}
-							} else {
-								$this->debug("Unexpected scenario: empty URL for unloaded import");
-							}
-						}
-					}
-	            } 
-			}
-        // add new data to operation data
-        foreach($this->bindings as $binding => $bindingData) {
-            if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
-                foreach($bindingData['operations'] as $operation => $data) {
-                    $this->debug('post-parse data gathering for ' . $operation);
-                    $this->bindings[$binding]['operations'][$operation]['input'] = 
-						isset($this->bindings[$binding]['operations'][$operation]['input']) ? 
-						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
-						$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
-                    $this->bindings[$binding]['operations'][$operation]['output'] = 
-						isset($this->bindings[$binding]['operations'][$operation]['output']) ?
-						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
-						$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
-                    if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
-						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
-					}
-					if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
-                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
-                    }
-					if (isset($bindingData['style'])) {
-                        $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
-                    }
-                    $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
-                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
-                    $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
-                } 
-            } 
-        }
-    }
-
-    /**
-     * parses the wsdl document
-     * 
-     * @param string $wsdl path or URL
-     * @access private 
-     */
-    function parseWSDL($wsdl = '')
-    {
-        if ($wsdl == '') {
-            $this->debug('no wsdl passed to parseWSDL()!!');
-            $this->setError('no wsdl passed to parseWSDL()!!');
-            return false;
-        }
-        
-        // parse $wsdl for url format
-        $wsdl_props = parse_url($wsdl);
-
-        if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
-            $this->debug('getting WSDL http(s) URL ' . $wsdl);
-        	// get wsdl
-	        $tr = new soap_transport_http($wsdl);
-			$tr->request_method = 'GET';
-			$tr->useSOAPAction = false;
-			if($this->proxyhost && $this->proxyport){
-				$tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
-			}
-			$tr->setEncoding('gzip, deflate');
-			$wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
-			//$this->debug("WSDL request\n" . $tr->outgoing_payload);
-			//$this->debug("WSDL response\n" . $tr->incoming_payload);
-			$this->appendDebug($tr->getDebug());
-			// catch errors
-			if($err = $tr->getError() ){
-				$errstr = 'HTTP ERROR: '.$err;
-				$this->debug($errstr);
-	            $this->setError($errstr);
-				unset($tr);
-	            return false;
-			}
-			unset($tr);
-			$this->debug("got WSDL URL");
-        } else {
-            // $wsdl is not http(s), so treat it as a file URL or plain file path
-        	if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
-        		$path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
-        	} else {
-        		$path = $wsdl;
-        	}
-            $this->debug('getting WSDL file ' . $path);
-            if ($fp = @fopen($path, 'r')) {
-                $wsdl_string = '';
-                while ($data = fread($fp, 32768)) {
-                    $wsdl_string .= $data;
-                } 
-                fclose($fp);
-            } else {
-            	$errstr = "Bad path to WSDL file $path";
-            	$this->debug($errstr);
-                $this->setError($errstr);
-                return false;
-            } 
-        }
-        $this->debug('Parse WSDL');
-        // end new code added
-        // Create an XML parser.
-        $this->parser = xml_parser_create(); 
-        // Set the options for parsing the XML data.
-        // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
-        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); 
-        // Set the object for the parser.
-        xml_set_object($this->parser, $this); 
-        // Set the element handlers for the parser.
-        xml_set_element_handler($this->parser, 'start_element', 'end_element');
-        xml_set_character_data_handler($this->parser, 'character_data');
-        // Parse the XML file.
-        if (!xml_parse($this->parser, $wsdl_string, true)) {
-            // Display an error message.
-            $errstr = sprintf(
-				'XML error parsing WSDL from %s on line %d: %s',
-				$wsdl,
-                xml_get_current_line_number($this->parser),
-                xml_error_string(xml_get_error_code($this->parser))
-                );
-            $this->debug($errstr);
-			$this->debug("XML payload:\n" . $wsdl_string);
-            $this->setError($errstr);
-            return false;
-        } 
-		// free the parser
-        xml_parser_free($this->parser);
-        $this->debug('Parsing WSDL done');
-		// catch wsdl parse errors
-		if($this->getError()){
-			return false;
-		}
-        return true;
-    } 
-
-    /**
-     * start-element handler
-     * 
-     * @param string $parser XML parser object
-     * @param string $name element name
-     * @param string $attrs associative array of attributes
-     * @access private 
-     */
-    function start_element($parser, $name, $attrs)
-    {
-        if ($this->status == 'schema') {
-            $this->currentSchema->schemaStartElement($parser, $name, $attrs);
-            $this->appendDebug($this->currentSchema->getDebug());
-            $this->currentSchema->clearDebug();
-        } elseif (ereg('schema$', $name)) {
-        	$this->debug('Parsing WSDL schema');
-            // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
-            $this->status = 'schema';
-            $this->currentSchema = new xmlschema('', '', $this->namespaces);
-            $this->currentSchema->schemaStartElement($parser, $name, $attrs);
-            $this->appendDebug($this->currentSchema->getDebug());
-            $this->currentSchema->clearDebug();
-        } else {
-            // position in the total number of elements, starting from 0
-            $pos = $this->position++;
-            $depth = $this->depth++; 
-            // set self as current value for this depth
-            $this->depth_array[$depth] = $pos;
-            $this->message[$pos] = array('cdata' => ''); 
-            // process attributes
-            if (count($attrs) > 0) {
-				// register namespace declarations
-                foreach($attrs as $k => $v) {
-                    if (ereg("^xmlns", $k)) {
-                        if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
-                            $this->namespaces[$ns_prefix] = $v;
-                        } else {
-                            $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
-                        } 
-                        if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
-                            $this->XMLSchemaVersion = $v;
-                            $this->namespaces['xsi'] = $v . '-instance';
-                        } 
-                    }
-                }
-                // expand each attribute prefix to its namespace
-                foreach($attrs as $k => $v) {
-                    $k = strpos($k, ':') ? $this->expandQname($k) : $k;
-                    if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
-                        $v = strpos($v, ':') ? $this->expandQname($v) : $v;
-                    } 
-                    $eAttrs[$k] = $v;
-                } 
-                $attrs = $eAttrs;
-            } else {
-                $attrs = array();
-            } 
-            // get element prefix, namespace and name
-            if (ereg(':', $name)) {
-                // get ns prefix
-                $prefix = substr($name, 0, strpos($name, ':')); 
-                // get ns
-                $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; 
-                // get unqualified name
-                $name = substr(strstr($name, ':'), 1);
-            } 
-			// process attributes, expanding any prefixes to namespaces
-            // find status, register data
-            switch ($this->status) {
-                case 'message':
-                    if ($name == 'part') {
-			            if (isset($attrs['type'])) {
-		                    $this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs));
-		                    $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
-            			} 
-			            if (isset($attrs['element'])) {
-		                    $this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs));
-			                $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'];
-			            } 
-        			} 
-        			break;
-			    case 'portType':
-			        switch ($name) {
-			            case 'operation':
-			                $this->currentPortOperation = $attrs['name'];
-			                $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
-			                if (isset($attrs['parameterOrder'])) {
-			                	$this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
-			        		} 
-			        		break;
-					    case 'documentation':
-					        $this->documentation = true;
-					        break; 
-					    // merge input/output data
-					    default:
-					        $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
-					        $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
-					        break;
-					} 
-			    	break;
-				case 'binding':
-				    switch ($name) {
-				        case 'binding': 
-				            // get ns prefix
-				            if (isset($attrs['style'])) {
-				            $this->bindings[$this->currentBinding]['prefix'] = $prefix;
-					    	} 
-					    	$this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
-					    	break;
-						case 'header':
-						    $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
-						    break;
-						case 'operation':
-						    if (isset($attrs['soapAction'])) {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
-						    } 
-						    if (isset($attrs['style'])) {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
-						    } 
-						    if (isset($attrs['name'])) {
-						        $this->currentOperation = $attrs['name'];
-						        $this->debug("current binding operation: $this->currentOperation");
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
-						    } 
-						    break;
-						case 'input':
-						    $this->opStatus = 'input';
-						    break;
-						case 'output':
-						    $this->opStatus = 'output';
-						    break;
-						case 'body':
-						    if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
-						    } else {
-						        $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
-						    } 
-						    break;
-					} 
-					break;
-				case 'service':
-					switch ($name) {
-					    case 'port':
-					        $this->currentPort = $attrs['name'];
-					        $this->debug('current port: ' . $this->currentPort);
-					        $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
-					
-					        break;
-					    case 'address':
-					        $this->ports[$this->currentPort]['location'] = $attrs['location'];
-					        $this->ports[$this->currentPort]['bindingType'] = $namespace;
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
-					        break;
-					} 
-					break;
-			} 
-		// set status
-		switch ($name) {
-			case 'import':
-			    if (isset($attrs['location'])) {
-                    $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
-				} else {
-                    $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
-					}
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
-				}
-				break;
-			//wait for schema
-			//case 'types':
-			//	$this->status = 'schema';
-			//	break;
-			case 'message':
-				$this->status = 'message';
-				$this->messages[$attrs['name']] = array();
-				$this->currentMessage = $attrs['name'];
-				break;
-			case 'portType':
-				$this->status = 'portType';
-				$this->portTypes[$attrs['name']] = array();
-				$this->currentPortType = $attrs['name'];
-				break;
-			case "binding":
-				if (isset($attrs['name'])) {
-				// get binding name
-					if (strpos($attrs['name'], ':')) {
-			    		$this->currentBinding = $this->getLocalPart($attrs['name']);
-					} else {
-			    		$this->currentBinding = $attrs['name'];
-					} 
-					$this->status = 'binding';
-					$this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
-					$this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
-				} 
-				break;
-			case 'service':
-				$this->serviceName = $attrs['name'];
-				$this->status = 'service';
-				$this->debug('current service: ' . $this->serviceName);
-				break;
-			case 'definitions':
-				foreach ($attrs as $name => $value) {
-					$this->wsdl_info[$name] = $value;
-				} 
-				break;
-			} 
-		} 
-	} 
-
-	/**
-	* end-element handler
-	* 
-	* @param string $parser XML parser object
-	* @param string $name element name
-	* @access private 
-	*/
-	function end_element($parser, $name){ 
-		// unset schema status
-		if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
-			$this->status = "";
-            $this->appendDebug($this->currentSchema->getDebug());
-            $this->currentSchema->clearDebug();
-			$this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
-        	$this->debug('Parsing WSDL schema done');
-		} 
-		if ($this->status == 'schema') {
-			$this->currentSchema->schemaEndElement($parser, $name);
-		} else {
-			// bring depth down a notch
-			$this->depth--;
-		} 
-		// end documentation
-		if ($this->documentation) {
-			//TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
-			//$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
-			$this->documentation = false;
-		} 
-	} 
-
-	/**
-	 * element content handler
-	 * 
-	 * @param string $parser XML parser object
-	 * @param string $data element content
-	 * @access private 
-	 */
-	function character_data($parser, $data)
-	{
-		$pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
-		if (isset($this->message[$pos]['cdata'])) {
-			$this->message[$pos]['cdata'] .= $data;
-		} 
-		if ($this->documentation) {
-			$this->documentation .= $data;
-		} 
-	} 
-	
-	function getBindingData($binding)
-	{
-		if (is_array($this->bindings[$binding])) {
-			return $this->bindings[$binding];
-		} 
-	}
-	
-	/**
-	 * returns an assoc array of operation names => operation data
-	 * 
-	 * @param string $bindingType eg: soap, smtp, dime (only soap is currently supported)
-	 * @return array 
-	 * @access public 
-	 */
-	function getOperations($bindingType = 'soap')
-	{
-		$ops = array();
-		if ($bindingType == 'soap') {
-			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		}
-		// loop thru ports
-		foreach($this->ports as $port => $portData) {
-			// binding type of port matches parameter
-			if ($portData['bindingType'] == $bindingType) {
-				//$this->debug("getOperations for port $port");
-				//$this->debug("port data: " . $this->varDump($portData));
-				//$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
-				// merge bindings
-				if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
-					$ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
-				}
-			}
-		} 
-		return $ops;
-	} 
-	
-	/**
-	 * returns an associative array of data necessary for calling an operation
-	 * 
-	 * @param string $operation , name of operation
-	 * @param string $bindingType , type of binding eg: soap
-	 * @return array 
-	 * @access public 
-	 */
-	function getOperationData($operation, $bindingType = 'soap')
-	{
-		if ($bindingType == 'soap') {
-			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		}
-		// loop thru ports
-		foreach($this->ports as $port => $portData) {
-			// binding type of port matches parameter
-			if ($portData['bindingType'] == $bindingType) {
-				// get binding
-				//foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
-				foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
-					// note that we could/should also check the namespace here
-					if ($operation == $bOperation) {
-						$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
-					    return $opData;
-					} 
-				} 
-			}
-		} 
-	}
-	
-	/**
-	 * returns an associative array of data necessary for calling an operation
-	 * 
-	 * @param string $soapAction soapAction for operation
-	 * @param string $bindingType type of binding eg: soap
-	 * @return array 
-	 * @access public 
-	 */
-	function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') {
-		if ($bindingType == 'soap') {
-			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
-		}
-		// loop thru ports
-		foreach($this->ports as $port => $portData) {
-			// binding type of port matches parameter
-			if ($portData['bindingType'] == $bindingType) {
-				// loop through operations for the binding
-				foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
-					if ($opData['soapAction'] == $soapAction) {
-					    return $opData;
-					} 
-				} 
-			}
-		} 
-	}
-	
-	/**
-    * returns an array of information about a given type
-    * returns false if no type exists by the given name
-    *
-	*	 typeDef = array(
-	*	 'elements' => array(), // refs to elements array
-	*	'restrictionBase' => '',
-	*	'phpType' => '',
-	*	'order' => '(sequence|all)',
-	*	'attrs' => array() // refs to attributes array
-	*	)
-    *
-    * @param $type string the type
-    * @param $ns string namespace (not prefix) of the type
-    * @return mixed
-    * @access public
-    * @see xmlschema
-    */
-	function getTypeDef($type, $ns) {
-		$this->debug("in getTypeDef: type=$type, ns=$ns");
-		if ((! $ns) && isset($this->namespaces['tns'])) {
-			$ns = $this->namespaces['tns'];
-			$this->debug("in getTypeDef: type namespace forced to $ns");
-		}
-		if (isset($this->schemas[$ns])) {
-			$this->debug("in getTypeDef: have schema for namespace $ns");
-			for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
-				$xs = $this->schemas[$ns][$i];
-				$t = $xs->getTypeDef($type);
-				$this->appendDebug($xs->getDebug());
-				$xs->clearDebug();
-				if ($t) {
-					if (!isset($t['phpType'])) {
-						// get info for type to tack onto the element
-						$uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
-						$ns = substr($t['type'], 0, strrpos($t['type'], ':'));
-						$etype = $this->getTypeDef($uqType, $ns);
-						if ($etype) {
-							$this->debug("found type for [element] $type:");
-							$this->debug($this->varDump($etype));
-							if (isset($etype['phpType'])) {
-								$t['phpType'] = $etype['phpType'];
-							}
-							if (isset($etype['elements'])) {
-								$t['elements'] = $etype['elements'];
-							}
-							if (isset($etype['attrs'])) {
-								$t['attrs'] = $etype['attrs'];
-							}
-						}
-					}
-					return $t;
-				}
-			}
-		} else {
-			$this->debug("in getTypeDef: do not have schema for namespace $ns");
-		}
-		return false;
-	}
-
-    /**
-    * prints html description of services
-    *
-    * @access private
-    */
-    function webDescription(){
-    	global $HTTP_SERVER_VARS;
-
-		if (isset($_SERVER)) {
-			$PHP_SELF = $_SERVER['PHP_SELF'];
-		} elseif (isset($HTTP_SERVER_VARS)) {
-			$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
-		} else {
-			$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
-		}
-
-		$b = '
-		<html><head><title>NuSOAP: '.$this->serviceName.'</title>
-		<style type="text/css">
-		    body    { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
-		    p       { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
-		    pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
-		    ul      { margin-top: 10px; margin-left: 20px; }
-		    li      { list-style-type: none; margin-top: 10px; color: #000000; }
-		    .content{
-			margin-left: 0px; padding-bottom: 2em; }
-		    .nav {
-			padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
-			margin-top: 10px; margin-left: 0px; color: #000000;
-			background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
-		    .title {
-			font-family: arial; font-size: 26px; color: #ffffff;
-			background-color: #999999; width: 105%; margin-left: 0px;
-			padding-top: 10px; padding-bottom: 10px; padding-left: 15px;}
-		    .hidden {
-			position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
-			font-family: arial; overflow: hidden; width: 600;
-			padding: 20px; font-size: 10px; background-color: #999999;
-			layer-background-color:#FFFFFF; }
-		    a,a:active  { color: charcoal; font-weight: bold; }
-		    a:visited   { color: #666666; font-weight: bold; }
-		    a:hover     { color: cc3300; font-weight: bold; }
-		</style>
-		<script language="JavaScript" type="text/javascript">
-		<!--
-		// POP-UP CAPTIONS...
-		function lib_bwcheck(){ //Browsercheck (needed)
-		    this.ver=navigator.appVersion
-		    this.agent=navigator.userAgent
-		    this.dom=document.getElementById?1:0
-		    this.opera5=this.agent.indexOf("Opera 5")>-1
-		    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
-		    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
-		    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
-		    this.ie=this.ie4||this.ie5||this.ie6
-		    this.mac=this.agent.indexOf("Mac")>-1
-		    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
-		    this.ns4=(document.layers && !this.dom)?1:0;
-		    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
-		    return this
-		}
-		var bw = new lib_bwcheck()
-		//Makes crossbrowser object.
-		function makeObj(obj){
-		    this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
-		    if(!this.evnt) return false
-		    this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
-		    this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
-		    this.writeIt=b_writeIt;
-		    return this
-		}
-		// A unit of measure that will be added when setting the position of a layer.
-		//var px = bw.ns4||window.opera?"":"px";
-		function b_writeIt(text){
-		    if (bw.ns4){this.wref.write(text);this.wref.close()}
-		    else this.wref.innerHTML = text
-		}
-		//Shows the messages
-		var oDesc;
-		function popup(divid){
-		    if(oDesc = new makeObj(divid)){
-			oDesc.css.visibility = "visible"
-		    }
-		}
-		function popout(){ // Hides message
-		    if(oDesc) oDesc.css.visibility = "hidden"
-		}
-		//-->
-		</script>
-		</head>
-		<body>
-		<div class=content>
-			<br><br>
-			<div class=title>'.$this->serviceName.'</div>
-			<div class=nav>
-				<p>View the <a href="'.$PHP_SELF.'?service='.$_REQUEST[service].'&wsdl">WSDL</a> for the service.
-				Click on an operation name to view it&apos;s details.</p>
-				<ul>';
-				foreach($this->getOperations() as $op => $data){
-				    $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
-				    // create hidden div
-				    $b .= "<div id='$op' class='hidden'>
-				    <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
-				    foreach($data as $donnie => $marie){ // loop through opdata
-						if($donnie == 'input' || $donnie == 'output'){ // show input/output data
-						    $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
-						    foreach($marie as $captain => $tenille){ // loop through data
-								if($captain == 'parts'){ // loop thru parts
-								    $b .= "&nbsp;&nbsp;$captain:<br>";
-					                //if(is_array($tenille)){
-								    	foreach($tenille as $joanie => $chachi){
-											$b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
-								    	}
-					        		//}
-								} else {
-								    $b .= "&nbsp;&nbsp;$captain: $tenille<br>";
-								}
-						    }
-						} else {
-						    $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>";
-						}
-				    }
-					$b .= '</div>';
-				}
-				$b .= '
-				<ul>
-			</div>
-		</div></body></html>';
-		return $b;
-    }
-
-	/**
-	* serialize the parsed wsdl
-	*
-	* @param mixed $debug whether to put debug=1 in endpoint URL
-	* @return string serialization of WSDL
-	* @access public 
-	*/
-	function serialize($debug = 0)
-	{
-		$xml = '<?xml version="1.0" encoding="UTF-8"?>';
-		$xml .= "\n<definitions";
-		foreach($this->namespaces as $k => $v) {
-			$xml .= " xmlns:$k=\"$v\"";
-		} 
-		// 10.9.02 - add poulter fix for wsdl and tns declarations
-		if (isset($this->namespaces['wsdl'])) {
-			$xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
-		} 
-		if (isset($this->namespaces['tns'])) {
-			$xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
-		} 
-		$xml .= '>'; 
-		// imports
-		if (sizeof($this->import) > 0) {
-			foreach($this->import as $ns => $list) {
-				foreach ($list as $ii) {
-					if ($ii['location'] != '') {
-						$xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
-					} else {
-						$xml .= '<import namespace="' . $ns . '" />';
-					}
-				}
-			} 
-		} 
-		// types
-		if (count($this->schemas)>=1) {
-			$xml .= "\n<types>";
-			foreach ($this->schemas as $ns => $list) {
-				foreach ($list as $xs) {
-					$xml .= $xs->serializeSchema();
-				}
-			}
-			$xml .= '</types>';
-		} 
-		// messages
-		if (count($this->messages) >= 1) {
-			foreach($this->messages as $msgName => $msgParts) {
-				$xml .= "\n<message name=\"" . $msgName . '">';
-				if(is_array($msgParts)){
-					foreach($msgParts as $partName => $partType) {
-						// print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
-						if (strpos($partType, ':')) {
-						    $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
-						} elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
-						    // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
-						    $typePrefix = 'xsd';
-						} else {
-						    foreach($this->typemap as $ns => $types) {
-						        if (isset($types[$partType])) {
-						            $typePrefix = $this->getPrefixFromNamespace($ns);
-						        } 
-						    } 
-						    if (!isset($typePrefix)) {
-						        die("$partType has no namespace!");
-						    } 
-						}
-						$ns = $this->getNamespaceFromPrefix($typePrefix);
-						$typeDef = $this->getTypeDef($this->getLocalPart($partType), $ns);
-						if ($typeDef['typeClass'] == 'element') {
-							$elementortype = 'element';
-						} else {
-							$elementortype = 'type';
-						}
-						$xml .= '<part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $this->getLocalPart($partType) . '" />';
-					}
-				}
-				$xml .= '</message>';
-			} 
-		} 
-		// bindings & porttypes
-		if (count($this->bindings) >= 1) {
-			$binding_xml = '';
-			$portType_xml = '';
-			foreach($this->bindings as $bindingName => $attrs) {
-				$binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
-				$binding_xml .= '<soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
-				$portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
-				foreach($attrs['operations'] as $opName => $opParts) {
-					$binding_xml .= '<operation name="' . $opName . '">';
-					$binding_xml .= '<soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
-					if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
-						$enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
-					} else {
-						$enc_style = '';
-					}
-					$binding_xml .= '<input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
-					if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
-						$enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
-					} else {
-						$enc_style = '';
-					}
-					$binding_xml .= '<output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
-					$binding_xml .= '</operation>';
-					$portType_xml .= '<operation name="' . $opParts['name'] . '"';
-					if (isset($opParts['parameterOrder'])) {
-					    $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
-					} 
-					$portType_xml .= '>';
-					if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
-						$portType_xml .= '<documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
-					}
-					$portType_xml .= '<input message="tns:' . $opParts['input']['message'] . '"/>';
-					$portType_xml .= '<output message="tns:' . $opParts['output']['message'] . '"/>';
-					$portType_xml .= '</operation>';
-				} 
-				$portType_xml .= '</portType>';
-				$binding_xml .= '</binding>';
-			} 
-			$xml .= $portType_xml . $binding_xml;
-		} 
-		// services
-		$xml .= "\n<service name=\"" . $this->serviceName . '">';
-		if (count($this->ports) >= 1) {
-			foreach($this->ports as $pName => $attrs) {
-				$xml .= '<port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
-				$xml .= '<soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
-				$xml .= '</port>';
-			} 
-		} 
-		$xml .= '</service>';
-		return $xml . "\n</definitions>";
-	} 
-	
-	/**
-	 * serialize PHP values according to a WSDL message definition
-	 *
-	 * TODO
-	 * - multi-ref serialization
-	 * - validate PHP values against type definitions, return errors if invalid
-	 * 
-	 * @param string $operation operation name
-	 * @param string $direction (input|output)
-	 * @param mixed $parameters parameter value(s)
-	 * @return mixed parameters serialized as XML or false on error (e.g. operation not found)
-	 * @access public
-	 */
-	function serializeRPCParameters($operation, $direction, $parameters)
-	{
-		$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); 
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
-		
-		if ($direction != 'input' && $direction != 'output') {
-			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
-			$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
-			return false;
-		} 
-		if (!$opData = $this->getOperationData($operation)) {
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
-			return false;
-		}
-		$this->debug('opData:');
-		$this->appendDebug($this->varDump($opData));
-
-		// Get encoding style for output and set to current
-		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
-			$encodingStyle = $opData['output']['encodingStyle'];
-			$enc_style = $encodingStyle;
-		}
-
-		// set input params
-		$xml = '';
-		if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
-			
-			$use = $opData[$direction]['use'];
-			$this->debug('have ' . count($opData[$direction]['parts']) . ' part(s) to serialize');
-			if (is_array($parameters)) {
-				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
-				$this->debug('have ' . count($parameters) . ' parameter(s) provided as ' . $parametersArrayType . ' to serialize');
-				foreach($opData[$direction]['parts'] as $name => $type) {
-					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
-					// Track encoding style
-					if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
-						$encodingStyle = $opData[$direction]['encodingStyle'];			
-						$enc_style = $encodingStyle;
-					} else {
-						$enc_style = false;
-					}
-					// NOTE: add error handling here
-					// if serializeType returns false, then catch global error and fault
-					if ($parametersArrayType == 'arraySimple') {
-						$p = array_shift($parameters);
-						$this->debug('calling serializeType w/indexed param');
-						$xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
-					} elseif (isset($parameters[$name])) {
-						$this->debug('calling serializeType w/named param');
-						$xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
-					} else {
-						// TODO: only send nillable
-						$this->debug('calling serializeType w/null param');
-						$xml .= $this->serializeType($name, $type, null, $use, $enc_style);
-					}
-				}
-			} else {
-				$this->debug('no parameters passed.');
-			}
-		}
-		$this->debug("serializeRPCParameters returning: $xml");
-		return $xml;
-	} 
-	
-	/**
-	 * serialize a PHP value according to a WSDL message definition
-	 * 
-	 * TODO
-	 * - multi-ref serialization
-	 * - validate PHP values against type definitions, return errors if invalid
-	 * 
-	 * @param string $ type name
-	 * @param mixed $ param value
-	 * @return mixed new param or false if initial value didn't validate
-	 * @access public
-	 * @deprecated
-	 */
-	function serializeParameters($operation, $direction, $parameters)
-	{
-		$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); 
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
-		
-		if ($direction != 'input' && $direction != 'output') {
-			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
-			$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
-			return false;
-		} 
-		if (!$opData = $this->getOperationData($operation)) {
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
-			return false;
-		}
-		$this->debug('opData:');
-		$this->appendDebug($this->varDump($opData));
-		
-		// Get encoding style for output and set to current
-		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
-			$encodingStyle = $opData['output']['encodingStyle'];
-			$enc_style = $encodingStyle;
-		}
-		
-		// set input params
-		$xml = '';
-		if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
-			
-			$use = $opData[$direction]['use'];
-			$this->debug("use=$use");
-			$this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
-			if (is_array($parameters)) {
-				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
-				$this->debug('have ' . $parametersArrayType . ' parameters');
-				foreach($opData[$direction]['parts'] as $name => $type) {
-					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
-					// Track encoding style
-					if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
-						$encodingStyle = $opData[$direction]['encodingStyle'];			
-						$enc_style = $encodingStyle;
-					} else {
-						$enc_style = false;
-					}
-					// NOTE: add error handling here
-					// if serializeType returns false, then catch global error and fault
-					if ($parametersArrayType == 'arraySimple') {
-						$p = array_shift($parameters);
-						$this->debug('calling serializeType w/indexed param');
-						$xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
-					} elseif (isset($parameters[$name])) {
-						$this->debug('calling serializeType w/named param');
-						$xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
-					} else {
-						// TODO: only send nillable
-						$this->debug('calling serializeType w/null param');
-						$xml .= $this->serializeType($name, $type, null, $use, $enc_style);
-					}
-				}
-			} else {
-				$this->debug('no parameters passed.');
-			}
-		}
-		$this->debug("serializeParameters returning: $xml");
-		return $xml;
-	} 
-	
-	/**
-	 * serializes a PHP value according a given type definition
-	 * 
-	 * @param string $name name of value (part or element)
-	 * @param string $type XML schema type of value (type or element)
-	 * @param mixed $value a native PHP value (parameter value)
-	 * @param string $use use for part (encoded|literal)
-	 * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style)
-	 * @param boolean $unqualified a kludge for what should be XML namespace form handling
-	 * @return string value serialized as an XML string
-	 * @access private
-	 */
-	function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
-	{
-		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
-		$this->appendDebug("value=" . $this->varDump($value));
-		if($use == 'encoded' && $encodingStyle) {
-			$encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
-		}
-
-		// if a soapval has been supplied, let its type override the WSDL
-    	if (is_object($value) && get_class($value) == 'soapval') {
-    		if ($value->type_ns) {
-    			$type = $value->type_ns . ':' . $value->type;
-		    	$forceType = true;
-		    	$this->debug("in serializeType: soapval overrides type to $type");
-    		} elseif ($value->type) {
-	    		$type = $value->type;
-		    	$forceType = true;
-		    	$this->debug("in serializeType: soapval overrides type to $type");
-	    	} else {
-	    		$forceType = false;
-		    	$this->debug("in serializeType: soapval does not override type");
-	    	}
-	    	$attrs = $value->attributes;
-	    	$value = $value->value;
-	    	$this->debug("in serializeType: soapval overrides value to $value");
-	    	if ($attrs) {
-	    		if (!is_array($value)) {
-	    			$value['!'] = $value;
-	    		}
-	    		foreach ($attrs as $n => $v) {
-	    			$value['!' . $n] = $v;
-	    		}
-		    	$this->debug("in serializeType: soapval provides attributes");
-		    }
-        } else {
-        	$forceType = false;
-        }
-
-		$xml = '';
-		if (strpos($type, ':')) {
-			$uqType = substr($type, strrpos($type, ':') + 1);
-			$ns = substr($type, 0, strrpos($type, ':'));
-			$this->debug("in serializeType: got a prefixed type: $uqType, $ns");
-			if ($this->getNamespaceFromPrefix($ns)) {
-				$ns = $this->getNamespaceFromPrefix($ns);
-				$this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
-			}
-
-			if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
-				$this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
-				if ($unqualified  && $use == 'literal') {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-				if (is_null($value)) {
-					if ($use == 'literal') {
-						// TODO: depends on minOccurs
-						$xml = "<$name$elementNS/>";
-					} else {
-						// TODO: depends on nillable, which should be checked before calling this method
-						$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
-					}
-					$this->debug("in serializeType: returning: $xml");
-					return $xml;
-				}
-		    	if ($uqType == 'boolean') {
-		    		if ((is_string($value) && $value == 'false') || (! $value)) {
-						$value = 'false';
-					} else {
-						$value = 'true';
-					}
-				} 
-				if ($uqType == 'string' && gettype($value) == 'string') {
-					$value = $this->expandEntities($value);
-				}
-				if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') {
-					$value = sprintf("%.0lf", $value);
-				}
-				// it's a scalar
-				// TODO: what about null/nil values?
-				// check type isn't a custom type extending xmlschema namespace
-				if (!$this->getTypeDef($uqType, $ns)) {
-					if ($use == 'literal') {
-						if ($forceType) {
-							$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
-						} else {
-							$xml = "<$name$elementNS>$value</$name>";
-						}
-					} else {
-						$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
-					}
-					$this->debug("in serializeType: returning: $xml");
-					return $xml;
-				}
-				$this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
-			} else if ($ns == 'http://xml.apache.org/xml-soap') {
-				$this->debug('in serializeType: appears to be Apache SOAP type');
-				if ($uqType == 'Map') {
-					$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
-					if (! $tt_prefix) {
-						$this->debug('in serializeType: Add namespace for Apache SOAP type');
-						$tt_prefix = 'ns' . rand(1000, 9999);
-						$this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
-						// force this to be added to usedNamespaces
-						$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
-					}
-					$contents = '';
-					foreach($value as $k => $v) {
-						$this->debug("serializing map element: key $k, value $v");
-						$contents .= '<item>';
-						$contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
-						$contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
-						$contents .= '</item>';
-					}
-					if ($use == 'literal') {
-						if ($forceType) {
-							$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
-						} else {
-							$xml = "<$name>$contents</$name>";
-						}
-					} else {
-						$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
-					}
-					$this->debug("in serializeType: returning: $xml");
-					return $xml;
-				}
-				$this->debug('in serializeType: Apache SOAP type, but only support Map');
-			}
-		} else {
-			// TODO: should the type be compared to types in XSD, and the namespace
-			// set to XSD if the type matches?
-			$this->debug("in serializeType: No namespace for type $type");
-			$ns = '';
-			$uqType = $type;
-		}
-		if(!$typeDef = $this->getTypeDef($uqType, $ns)){
-			$this->setError("$type ($uqType) is not a supported type.");
-			$this->debug("in serializeType: $type ($uqType) is not a supported type.");
-			return false;
-		} else {
-			$this->debug("in serializeType: found typeDef");
-			$this->appendDebug('typeDef=' . $this->varDump($typeDef));
-		}
-		$phpType = $typeDef['phpType'];
-		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); 
-		// if php type == struct, map value to the <all> element names
-		if ($phpType == 'struct') {
-			if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
-				$elementName = $uqType;
-				if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
-					$elementNS = " xmlns=\"$ns\"";
-				} else {
-					$elementNS = " xmlns=\"\"";
-				}
-			} else {
-				$elementName = $name;
-				if ($unqualified) {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-			}
-			if (is_null($value)) {
-				if ($use == 'literal') {
-					// TODO: depends on minOccurs
-					$xml = "<$elementName$elementNS/>";
-				} else {
-					$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
-				}
-				$this->debug("in serializeType: returning: $xml");
-				return $xml;
-			}
-			if (is_object($value)) {
-				$value = get_object_vars($value);
-			}
-			if (is_array($value)) {
-				$elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
-				if ($use == 'literal') {
-					if ($forceType) {
-						$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
-					} else {
-						$xml = "<$elementName$elementNS$elementAttrs>";
-					}
-				} else {
-					$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
-				}
-	
-				$xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
-				$xml .= "</$elementName>";
-			} else {
-				$this->debug("in serializeType: phpType is struct, but value is not an array");
-				$this->setError("phpType is struct, but value is not an array: see debug output for details");
-				$xml = '';
-			}
-		} elseif ($phpType == 'array') {
-			if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
-				$elementNS = " xmlns=\"$ns\"";
-			} else {
-				if ($unqualified) {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-			}
-			if (is_null($value)) {
-				if ($use == 'literal') {
-					// TODO: depends on minOccurs
-					$xml = "<$name$elementNS/>";
-				} else {
-					$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
-						":Array\" " .
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
-						':arrayType="' .
-						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
-						':' .
-						$this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
-				}
-				$this->debug("in serializeType: returning: $xml");
-				return $xml;
-			}
-			if (isset($typeDef['multidimensional'])) {
-				$nv = array();
-				foreach($value as $v) {
-					$cols = ',' . sizeof($v);
-					$nv = array_merge($nv, $v);
-				} 
-				$value = $nv;
-			} else {
-				$cols = '';
-			} 
-			if (is_array($value) && sizeof($value) >= 1) {
-				$rows = sizeof($value);
-				$contents = '';
-				foreach($value as $k => $v) {
-					$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
-					//if (strpos($typeDef['arrayType'], ':') ) {
-					if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
-					    $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
-					} else {
-					    $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
-					} 
-				}
-			} else {
-				$rows = 0;
-				$contents = null;
-			}
-			// TODO: for now, an empty value will be serialized as a zero element
-			// array.  Revisit this when coding the handling of null/nil values.
-			if ($use == 'literal') {
-				$xml = "<$name$elementNS>"
-					.$contents
-					."</$name>";
-			} else {
-				$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '.
-					$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
-					.':arrayType="'
-					.$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
-					.":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
-					.$contents
-					."</$name>";
-			}
-		} elseif ($phpType == 'scalar') {
-			if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
-				$elementNS = " xmlns=\"$ns\"";
-			} else {
-				if ($unqualified) {
-					$elementNS = " xmlns=\"\"";
-				} else {
-					$elementNS = '';
-				}
-			}
-			if ($use == 'literal') {
-				if ($forceType) {
-					$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
-				} else {
-					$xml = "<$name$elementNS>$value</$name>";
-				}
-			} else {
-				$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
-			}
-		}
-		$this->debug("in serializeType: returning: $xml");
-		return $xml;
-	}
-	
-	/**
-	 * serializes the attributes for a complexType
-	 *
-	 * @param array $typeDef our internal representation of an XML schema type (or element)
-	 * @param mixed $value a native PHP value (parameter value)
-	 * @param string $ns the namespace of the type
-	 * @param string $uqType the local part of the type
-	 * @return string value serialized as an XML string
-	 * @access private
-	 */
-	function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) {
-		$xml = '';
-		if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
-			$this->debug("serialize attributes for XML Schema type $ns:$uqType");
-			if (is_array($value)) {
-				$xvalue = $value;
-			} elseif (is_object($value)) {
-				$xvalue = get_object_vars($value);
-			} else {
-				$this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
-				$xvalue = array();
-			}
-			foreach ($typeDef['attrs'] as $aName => $attrs) {
-				if (isset($xvalue['!' . $aName])) {
-					$xname = '!' . $aName;
-					$this->debug("value provided for attribute $aName with key $xname");
-				} elseif (isset($xvalue[$aName])) {
-					$xname = $aName;
-					$this->debug("value provided for attribute $aName with key $xname");
-				} elseif (isset($attrs['default'])) {
-					$xname = '!' . $aName;
-					$xvalue[$xname] = $attrs['default'];
-					$this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
-				} else {
-					$xname = '';
-					$this->debug("no value provided for attribute $aName");
-				}
-				if ($xname) {
-					$xml .=  " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
-				}
-			} 
-		} else {
-			$this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
-		}
-		if (isset($typeDef['extensionBase'])) {
-			$ns = $this->getPrefix($typeDef['extensionBase']);
-			$uqType = $this->getLocalPart($typeDef['extensionBase']);
-			if ($this->getNamespaceFromPrefix($ns)) {
-				$ns = $this->getNamespaceFromPrefix($ns);
-			}
-			if ($typeDef = $this->getTypeDef($uqType, $ns)) {
-				$this->debug("serialize attributes for extension base $ns:$uqType");
-				$xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
-			} else {
-				$this->debug("extension base $ns:$uqType is not a supported type");
-			}
-		}
-		return $xml;
-	}
-
-	/**
-	 * serializes the elements for a complexType
-	 *
-	 * @param array $typeDef our internal representation of an XML schema type (or element)
-	 * @param mixed $value a native PHP value (parameter value)
-	 * @param string $ns the namespace of the type
-	 * @param string $uqType the local part of the type
-	 * @param string $use use for part (encoded|literal)
-	 * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style)
-	 * @return string value serialized as an XML string
-	 * @access private
-	 */
-	function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) {
-		$xml = '';
-		if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
-			$this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
-			if (is_array($value)) {
-				$xvalue = $value;
-			} elseif (is_object($value)) {
-				$xvalue = get_object_vars($value);
-			} else {
-				$this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
-				$xvalue = array();
-			}
-			// toggle whether all elements are present - ideally should validate against schema
-			if (count($typeDef['elements']) != count($xvalue)){
-				$optionals = true;
-			}
-			foreach ($typeDef['elements'] as $eName => $attrs) {
-				if (!isset($xvalue[$eName])) {
-					if (isset($attrs['default'])) {
-						$xvalue[$eName] = $attrs['default'];
-						$this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
-					}
-				}
-				// if user took advantage of a minOccurs=0, then only serialize named parameters
-				if (isset($optionals)
-				    && (!isset($xvalue[$eName])) 
-					&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
-					){
-					if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
-						$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
-					}
-					// do nothing
-					$this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
-				} else {
-					// get value
-					if (isset($xvalue[$eName])) {
-					    $v = $xvalue[$eName];
-					} else {
-					    $v = null;
-					}
-					if (isset($attrs['form'])) {
-						$unqualified = ($attrs['form'] == 'unqualified');
-					} else {
-						$unqualified = false;
-					}
-					if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
-						$vv = $v;
-						foreach ($vv as $k => $v) {
-							if (isset($attrs['type']) || isset($attrs['ref'])) {
-								// serialize schema-defined type
-							    $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
-							} else {
-								// serialize generic type (can this ever really happen?)
-							    $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
-							    $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
-							}
-						}
-					} else {
-						if (isset($attrs['type']) || isset($attrs['ref'])) {
-							// serialize schema-defined type
-						    $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
-						} else {
-							// serialize generic type (can this ever really happen?)
-						    $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
-						    $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
-						}
-					}
-				}
-			} 
-		} else {
-			$this->debug("no elements to serialize for XML Schema type $ns:$uqType");
-		}
-		if (isset($typeDef['extensionBase'])) {
-			$ns = $this->getPrefix($typeDef['extensionBase']);
-			$uqType = $this->getLocalPart($typeDef['extensionBase']);
-			if ($this->getNamespaceFromPrefix($ns)) {
-				$ns = $this->getNamespaceFromPrefix($ns);
-			}
-			if ($typeDef = $this->getTypeDef($uqType, $ns)) {
-				$this->debug("serialize elements for extension base $ns:$uqType");
-				$xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
-			} else {
-				$this->debug("extension base $ns:$uqType is not a supported type");
-			}
-		}
-		return $xml;
-	}
-
-	/**
-	* adds an XML Schema complex type to the WSDL types
-	*
-	* @param string	name
-	* @param string typeClass (complexType|simpleType|attribute)
-	* @param string phpType: currently supported are array and struct (php assoc array)
-	* @param string compositor (all|sequence|choice)
-	* @param string restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param array elements = array ( name => array(name=>'',type=>'') )
-	* @param array attrs = 	array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
-	* @param string arrayType: namespace:name (xsd:string)
-	* @see xmlschema
-	* @access public
-	*/
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') {
-		if (count($elements) > 0) {
-	    	foreach($elements as $n => $e){
-	            // expand each element
-	            foreach ($e as $k => $v) {
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
-		            $ee[$k] = $v;
-		    	}
-	    		$eElements[$n] = $ee;
-	    	}
-	    	$elements = $eElements;
-		}
-		
-		if (count($attrs) > 0) {
-	    	foreach($attrs as $n => $a){
-	            // expand each attribute
-	            foreach ($a as $k => $v) {
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
-		            $aa[$k] = $v;
-		    	}
-	    		$eAttrs[$n] = $aa;
-	    	}
-	    	$attrs = $eAttrs;
-		}
-
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
-		$arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
-
-		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
-		$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
-	}
-
-	/**
-	* adds an XML Schema simple type to the WSDL types
-	*
-	* @param string $name
-	* @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
-	* @param string $typeClass (should always be simpleType)
-	* @param string $phpType (should always be scalar)
-	* @param array $enumeration array of values
-	* @see xmlschema
-	* @access public
-	*/
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
-
-		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
-		$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
-	}
-
-	/**
-	* adds an element to the WSDL types
-	*
-	* @param array $attrs attributes that must include name and type
-	* @see xmlschema
-	* @access public
-	*/
-	function addElement($attrs) {
-		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
-		$this->schemas[$typens][0]->addElement($attrs);
-	}
-
-	/**
-	* register an operation with the server
-	* 
-	* @param string $name operation (method) name
-	* @param array $in assoc array of input values: key = param name, value = param type
-	* @param array $out assoc array of output values: key = param name, value = param type
-	* @param string $namespace optional The namespace for the operation
-	* @param string $soapaction optional The soapaction for the operation
-	* @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically
-	* @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now)
-	* @param string $documentation optional The description to include in the WSDL
-	* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
-	* @access public 
-	*/
-	function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
-		if ($use == 'encoded' && $encodingStyle == '') {
-			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-		}
-
-		if ($style == 'document') {
-			$elements = array();
-			foreach ($in as $n => $t) {
-				$elements[$n] = array('name' => $n, 'type' => $t);
-			}
-			$this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
-			$this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
-			$in = array('parameters' => 'tns:' . $name);
-
-			$elements = array();
-			foreach ($out as $n => $t) {
-				$elements[$n] = array('name' => $n, 'type' => $t);
-			}
-			$this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
-			$this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType'));
-			$out = array('parameters' => 'tns:' . $name . 'Response');
-		}
-
-		// get binding
-		$this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
-		array(
-		'name' => $name,
-		'binding' => $this->serviceName . 'Binding',
-		'endpoint' => $this->endpoint,
-		'soapAction' => $soapaction,
-		'style' => $style,
-		'input' => array(
-			'use' => $use,
-			'namespace' => $namespace,
-			'encodingStyle' => $encodingStyle,
-			'message' => $name . 'Request',
-			'parts' => $in),
-		'output' => array(
-			'use' => $use,
-			'namespace' => $namespace,
-			'encodingStyle' => $encodingStyle,
-			'message' => $name . 'Response',
-			'parts' => $out),
-		'namespace' => $namespace,
-		'transport' => 'http://schemas.xmlsoap.org/soap/http',
-		'documentation' => $documentation); 
-		// add portTypes
-		// add messages
-		if($in)
-		{
-			foreach($in as $pName => $pType)
-			{
-				if(strpos($pType,':')) {
-					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
-				}
-				$this->messages[$name.'Request'][$pName] = $pType;
-			}
-		} else {
-            $this->messages[$name.'Request']= '0';
-        }
-		if($out)
-		{
-			foreach($out as $pName => $pType)
-			{
-				if(strpos($pType,':')) {
-					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
-				}
-				$this->messages[$name.'Response'][$pName] = $pType;
-			}
-		} else {
-            $this->messages[$name.'Response']= '0';
-        }
-		return true;
-	} 
-}
-?><?php
-
-
-
-/**
-*
-* soap_parser class parses SOAP XML messages into native PHP values
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class soap_parser extends nusoap_base {
-
-	var $xml = '';
-	var $xml_encoding = '';
-	var $method = '';
-	var $root_struct = '';
-	var $root_struct_name = '';
-	var $root_struct_namespace = '';
-	var $root_header = '';
-    var $document = '';			// incoming SOAP body (text)
-	// determines where in the message we are (envelope,header,body,method)
-	var $status = '';
-	var $position = 0;
-	var $depth = 0;
-	var $default_namespace = '';
-	var $namespaces = array();
-	var $message = array();
-    var $parent = '';
-	var $fault = false;
-	var $fault_code = '';
-	var $fault_str = '';
-	var $fault_detail = '';
-	var $depth_array = array();
-	var $debug_flag = true;
-	var $soapresponse = NULL;
-	var $responseHeaders = '';	// incoming SOAP headers (text)
-	var $body_position = 0;
-	// for multiref parsing:
-	// array of id => pos
-	var $ids = array();
-	// array of id => hrefs => pos
-	var $multirefs = array();
-	// toggle for auto-decoding element content
-	var $decode_utf8 = true;
-
-	/**
-	* constructor that actually does the parsing
-	*
-	* @param    string $xml SOAP message
-	* @param    string $encoding character encoding scheme of message
-	* @param    string $method method for which XML is parsed (unused?)
-	* @param    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
-	* @access   public
-	*/
-	function soap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
-		parent::nusoap_base();
-		$this->xml = $xml;
-		$this->xml_encoding = $encoding;
-		$this->method = $method;
-		$this->decode_utf8 = $decode_utf8;
-
-		// Check whether content has been read.
-		if(!empty($xml)){
-			// Check XML encoding
-			$pos_xml = strpos($xml, '<?xml');
-			if ($pos_xml !== FALSE) {
-				$xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
-				if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
-					$xml_encoding = $res[1];
-					if (strtoupper($xml_encoding) != $encoding) {
-						$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
-						$this->debug($err);
-						if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
-							$this->setError($err);
-							return;
-						}
-						// when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
-					} else {
-						$this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
-					}
-				} else {
-					$this->debug('No encoding specified in XML declaration');
-				}
-			} else {
-				$this->debug('No XML declaration');
-			}
-			$this->debug('Entering soap_parser(), length='.strlen($xml).', encoding='.$encoding);
-			// Create an XML parser - why not xml_parser_create_ns?
-			$this->parser = xml_parser_create($this->xml_encoding);
-			// Set the options for parsing the XML data.
-			//xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
-			xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
-			xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
-			// Set the object for the parser.
-			xml_set_object($this->parser, $this);
-			// Set the element handlers for the parser.
-			xml_set_element_handler($this->parser, 'start_element','end_element');
-			xml_set_character_data_handler($this->parser,'character_data');
-
-			// Parse the XML file.
-			if(!xml_parse($this->parser,$xml,true)){
-			    // Display an error message.
-			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
-			    xml_get_current_line_number($this->parser),
-			    xml_error_string(xml_get_error_code($this->parser)));
-				$this->debug($err);
-				$this->debug("XML payload:\n" . $xml);
-				$this->setError($err);
-			} else {
-				$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
-				// get final value
-				$this->soapresponse = $this->message[$this->root_struct]['result'];
-				// get header value: no, because this is documented as XML string
-//				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
-//					$this->responseHeaders = $this->message[$this->root_header]['result'];
-//				}
-				// resolve hrefs/ids
-				if(sizeof($this->multirefs) > 0){
-					foreach($this->multirefs as $id => $hrefs){
-						$this->debug('resolving multirefs for id: '.$id);
-						$idVal = $this->buildVal($this->ids[$id]);
-						if (is_array($idVal) && isset($idVal['!id'])) {
-							unset($idVal['!id']);
-						}
-						foreach($hrefs as $refPos => $ref){
-							$this->debug('resolving href at pos '.$refPos);
-							$this->multirefs[$id][$refPos] = $idVal;
-						}
-					}
-				}
-			}
-			xml_parser_free($this->parser);
-		} else {
-			$this->debug('xml was empty, didn\'t parse!');
-			$this->setError('xml was empty, didn\'t parse!');
-		}
-	}
-
-	/**
-	* start-element handler
-	*
-	* @param    resource $parser XML parser object
-	* @param    string $name element name
-	* @param    array $attrs associative array of attributes
-	* @access   private
-	*/
-	function start_element($parser, $name, $attrs) {
-		// position in a total number of elements, starting from 0
-		// update class level pos
-		$pos = $this->position++;
-		// and set mine
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
-		// depth = how many levels removed from root?
-		// set mine as current global depth and increment global depth value
-		$this->message[$pos]['depth'] = $this->depth++;
-
-		// else add self as child to whoever the current parent is
-		if($pos != 0){
-			$this->message[$this->parent]['children'] .= '|'.$pos;
-		}
-		// set my parent
-		$this->message[$pos]['parent'] = $this->parent;
-		// set self as current parent
-		$this->parent = $pos;
-		// set self as current value for this depth
-		$this->depth_array[$this->depth] = $pos;
-		// get element prefix
-		if(strpos($name,':')){
-			// get ns prefix
-			$prefix = substr($name,0,strpos($name,':'));
-			// get unqualified name
-			$name = substr(strstr($name,':'),1);
-		}
-		// set status
-		if($name == 'Envelope'){
-			$this->status = 'envelope';
-		} elseif($name == 'Header'){
-			$this->root_header = $pos;
-			$this->status = 'header';
-		} elseif($name == 'Body'){
-			$this->status = 'body';
-			$this->body_position = $pos;
-		// set method
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)){
-			$this->status = 'method';
-			$this->root_struct_name = $name;
-			$this->root_struct = $pos;
-			$this->message[$pos]['type'] = 'struct';
-			$this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
-		}
-		// set my status
-		$this->message[$pos]['status'] = $this->status;
-		// set name
-		$this->message[$pos]['name'] = htmlspecialchars($name);
-		// set attrs
-		$this->message[$pos]['attrs'] = $attrs;
-
-		// loop through atts, logging ns and type declarations
-        $attstr = '';
-		foreach($attrs as $key => $value){
-        	$key_prefix = $this->getPrefix($key);
-			$key_localpart = $this->getLocalPart($key);
-			// if ns declarations, add to class level array of valid namespaces
-            if($key_prefix == 'xmlns'){
-				if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
-					$this->XMLSchemaVersion = $value;
-					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
-					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
-				}
-                $this->namespaces[$key_localpart] = $value;
-				// set method namespace
-				if($name == $this->root_struct_name){
-					$this->methodNamespace = $value;
-				}
-			// if it's a type declaration, set type
-            } elseif($key_localpart == 'type'){
-            	$value_prefix = $this->getPrefix($value);
-                $value_localpart = $this->getLocalPart($value);
-				$this->message[$pos]['type'] = $value_localpart;
-				$this->message[$pos]['typePrefix'] = $value_prefix;
-                if(isset($this->namespaces[$value_prefix])){
-                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
-                } else if(isset($attrs['xmlns:'.$value_prefix])) {
-					$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
-                }
-				// should do something here with the namespace of specified type?
-			} elseif($key_localpart == 'arrayType'){
-				$this->message[$pos]['type'] = 'array';
-				/* do arrayType ereg here
-				[1]    arrayTypeValue    ::=    atype asize
-				[2]    atype    ::=    QName rank*
-				[3]    rank    ::=    '[' (',')* ']'
-				[4]    asize    ::=    '[' length~ ']'
-				[5]    length    ::=    nextDimension* Digit+
-				[6]    nextDimension    ::=    Digit+ ','
-				*/
-				$expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
-				if(ereg($expr,$value,$regs)){
-					$this->message[$pos]['typePrefix'] = $regs[1];
-					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
-	                if (isset($this->namespaces[$regs[1]])) {
-	                	$this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
-	                } else if (isset($attrs['xmlns:'.$regs[1]])) {
-						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
-	                }
-					$this->message[$pos]['arrayType'] = $regs[2];
-					$this->message[$pos]['arraySize'] = $regs[3];
-					$this->message[$pos]['arrayCols'] = $regs[4];
-				}
-			// specifies nil value (or not)
-			} elseif ($key_localpart == 'nil'){
-				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
-			// some other attribute
-			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
-				$this->message[$pos]['xattrs']['!' . $key] = $value;
-			}
-
-			if ($key == 'xmlns') {
-				$this->default_namespace = $value;
-			}
-			// log id
-			if($key == 'id'){
-				$this->ids[$value] = $pos;
-			}
-			// root
-			if($key_localpart == 'root' && $value == 1){
-				$this->status = 'method';
-				$this->root_struct_name = $name;
-				$this->root_struct = $pos;
-				$this->debug("found root struct $this->root_struct_name, pos $pos");
-			}
-            // for doclit
-            $attstr .= " $key=\"$value\"";
-		}
-        // get namespace - must be done after namespace atts are processed
-		if(isset($prefix)){
-			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
-			$this->default_namespace = $this->namespaces[$prefix];
-		} else {
-			$this->message[$pos]['namespace'] = $this->default_namespace;
-		}
-        if($this->status == 'header'){
-        	if ($this->root_header != $pos) {
-	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
-	        }
-        } elseif($this->root_struct_name != ''){
-        	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
-        }
-	}
-
-	/**
-	* end-element handler
-	*
-	* @param    resource $parser XML parser object
-	* @param    string $name element name
-	* @access   private
-	*/
-	function end_element($parser, $name) {
-		// position of current element is equal to the last value left in depth_array for my depth
-		$pos = $this->depth_array[$this->depth--];
-
-        // get element prefix
-		if(strpos($name,':')){
-			// get ns prefix
-			$prefix = substr($name,0,strpos($name,':'));
-			// get unqualified name
-			$name = substr(strstr($name,':'),1);
-		}
-		
-		// build to native type
-		if(isset($this->body_position) && $pos > $this->body_position){
-			// deal w/ multirefs
-			if(isset($this->message[$pos]['attrs']['href'])){
-				// get id
-				$id = substr($this->message[$pos]['attrs']['href'],1);
-				// add placeholder to href array
-				$this->multirefs[$id][$pos] = 'placeholder';
-				// add set a reference to it as the result value
-				$this->message[$pos]['result'] = $this->multirefs[$id][$pos];
-            // build complexType values
-			} elseif($this->message[$pos]['children'] != ''){
-				// if result has already been generated (struct/array)
-				if(!isset($this->message[$pos]['result'])){
-					$this->message[$pos]['result'] = $this->buildVal($pos);
-				}
-			// build complexType values of attributes and possibly simpleContent
-			} elseif (isset($this->message[$pos]['xattrs'])) {
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
-					$this->message[$pos]['xattrs']['!'] = null;
-				} elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
-	            	if (isset($this->message[$pos]['type'])) {
-						$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-					} else {
-						$parent = $this->message[$pos]['parent'];
-						if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-							$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-						} else {
-							$this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
-						}
-					}
-				}
-				$this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
-			// set value of simpleType (or nil complexType)
-			} else {
-            	//$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
-					$this->message[$pos]['xattrs']['!'] = null;
-				} elseif (isset($this->message[$pos]['type'])) {
-					$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-				} else {
-					$parent = $this->message[$pos]['parent'];
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-						$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-					} else {
-						$this->message[$pos]['result'] = $this->message[$pos]['cdata'];
-					}
-				}
-
-				/* add value to parent's result, if parent is struct/array
-				$parent = $this->message[$pos]['parent'];
-				if($this->message[$parent]['type'] != 'map'){
-					if(strtolower($this->message[$parent]['type']) == 'array'){
-						$this->message[$parent]['result'][] = $this->message[$pos]['result'];
-					} else {
-						$this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
-					}
-				}
-				*/
-			}
-		}
-		
-        // for doclit
-        if($this->status == 'header'){
-        	if ($this->root_header != $pos) {
-	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
-	        }
-        } elseif($pos >= $this->root_struct){
-        	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
-        }
-		// switch status
-		if($pos == $this->root_struct){
-			$this->status = 'body';
-			$this->root_struct_namespace = $this->message[$pos]['namespace'];
-		} elseif($name == 'Body'){
-			$this->status = 'envelope';
-		 } elseif($name == 'Header'){
-			$this->status = 'envelope';
-		} elseif($name == 'Envelope'){
-			//
-		}
-		// set parent back to my parent
-		$this->parent = $this->message[$pos]['parent'];
-	}
-
-	/**
-	* element content handler
-	*
-	* @param    resource $parser XML parser object
-	* @param    string $data element content
-	* @access   private
-	*/
-	function character_data($parser, $data){
-		$pos = $this->depth_array[$this->depth];
-		if ($this->xml_encoding=='UTF-8'){
-			// TODO: add an option to disable this for folks who want
-			// raw UTF-8 that, e.g., might not map to iso-8859-1
-			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
-			if($this->decode_utf8){
-			//	$data = utf8_decode($data);
-			}
-		}
-        $this->message[$pos]['cdata'] .= $data;
-        // for doclit
-        if($this->status == 'header'){
-        	$this->responseHeaders .= $data;
-        } else {
-        	$this->document .= $data;
-        }
-	}
-
-	/**
-	* get the parsed message
-	*
-	* @return	mixed
-	* @access   public
-	*/
-	function get_response(){
-		return $this->soapresponse;
-	}
-
-	/**
-	* get the parsed headers
-	*
-	* @return	string XML or empty if no headers
-	* @access   public
-	*/
-	function getHeaders(){
-	    return $this->responseHeaders;
-	}
-
-	/**
-	* decodes simple types into PHP variables
-	*
-	* @param    string $value value to decode
-	* @param    string $type XML type to decode
-	* @param    string $typens XML type namespace to decode
-	* @return	mixed PHP value
-	* @access   private
-	*/
-	function decodeSimple($value, $type, $typens) {
-		// TODO: use the namespace!
-		if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
-			return (string) $value;
-		}
-		if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
-			return (int) $value;
-		}
-		if ($type == 'float' || $type == 'double' || $type == 'decimal') {
-			return (double) $value;
-		}
-		if ($type == 'boolean') {
-			if (strtolower($value) == 'false' || strtolower($value) == 'f') {
-				return false;
-			}
-			return (boolean) $value;
-		}
-		if ($type == 'base64' || $type == 'base64Binary') {
-			$this->debug('Decode base64 value');
-			return base64_decode($value);
-		}
-		// obscure numeric types
-		if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
-			|| $type == 'nonNegativeInteger' || $type == 'positiveInteger'
-			|| $type == 'unsignedInt'
-			|| $type == 'unsignedShort' || $type == 'unsignedByte') {
-			return (int) $value;
-		}
-		// bogus: parser treats array with no elements as a simple type
-		if ($type == 'array') {
-			return array();
-		}
-		// everything else
-		return (string) $value;
-	}
-
-	/**
-	* builds response structures for compound values (arrays/structs)
-	* and scalars
-	*
-	* @param    integer $pos position in node tree
-	* @return	mixed	PHP value
-	* @access   private
-	*/
-	function buildVal($pos){
-		if(!isset($this->message[$pos]['type'])){
-			$this->message[$pos]['type'] = '';
-		}
-		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
-		// if there are children...
-		if($this->message[$pos]['children'] != ''){
-			$this->debug('in buildVal, there are children');
-			$children = explode('|',$this->message[$pos]['children']);
-			array_shift($children); // knock off empty
-			// md array
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
-            	$r=0; // rowcount
-            	$c=0; // colcount
-            	foreach($children as $child_pos){
-					$this->debug("in buildVal, got an MD array element: $r, $c");
-					$params[$r][] = $this->message[$child_pos]['result'];
-				    $c++;
-				    if($c == $this->message[$pos]['arrayCols']){
-				    	$c = 0;
-						$r++;
-				    }
-                }
-            // array
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
-                $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
-                foreach($children as $child_pos){
-                	$params[] = $this->message[$child_pos]['result'];
-                }
-            // apache Map type: java hashtable
-            } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
-                $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
-                foreach($children as $child_pos){
-                	$kv = explode("|",$this->message[$child_pos]['children']);
-                   	$params[$this->message[$kv[1]]['result']] = $this->message[$kv[2]]['result'];
-                }
-            // generic compound type
-            //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
-		    } else {
-	    		// Apache Vector type: treat as an array
-                $this->debug('in buildVal, adding Java Vector '.$this->message[$pos]['name']);
-				if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
-					$notstruct = 1;
-				} else {
-					$notstruct = 0;
-	            }
-            	//
-            	foreach($children as $child_pos){
-            		if($notstruct){
-            			$params[] = $this->message[$child_pos]['result'];
-            		} else {
-            			if (isset($params[$this->message[$child_pos]['name']])) {
-            				// de-serialize repeated element name into an array
-            				if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
-            					$params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
-            				}
-            				$params[$this->message[$child_pos]['name']][] = $this->message[$child_pos]['result'];
-            			} else {
-					    	$params[$this->message[$child_pos]['name']] = $this->message[$child_pos]['result'];
-					    }
-                	}
-                }
-			}
-			if (isset($this->message[$pos]['xattrs'])) {
-                $this->debug('in buildVal, handling attributes');
-				foreach ($this->message[$pos]['xattrs'] as $n => $v) {
-					$params[$n] = $v;
-				}
-			}
-			// handle simpleContent
-			if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
-                $this->debug('in buildVal, handling simpleContent');
-            	if (isset($this->message[$pos]['type'])) {
-					$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-				} else {
-					$parent = $this->message[$pos]['parent'];
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-						$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-					} else {
-						$params['!'] = $this->message[$pos]['cdata'];
-					}
-				}
-			}
-			return is_array($params) ? $params : array();
-		} else {
-        	$this->debug('in buildVal, no children, building scalar');
-			$cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
-        	if (isset($this->message[$pos]['type'])) {
-				return $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
-			}
-			$parent = $this->message[$pos]['parent'];
-			if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
-				return $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
-			}
-           	return $this->message[$pos]['cdata'];
-		}
-	}
-}
-
-
-
-?><?php
-
-
-
-/**
-*
-* soapclient2 higher level class for easy usage.
-*
-* usage:
-*
-* // instantiate client with server info
-* $soapclient2 = new soapclient2( string path [ ,boolean wsdl] );
-*
-* // call method, get results
-* echo $soapclient2->call( string methodname [ ,array parameters] );
-*
-* // bye bye client
-* unset($soapclient2);
-*
-* @author   Dietrich Ayala <dietrich@ganx4.com>
-* @version  $Id: nusoap.php,v 1.94 2005/08/04 01:27:42 snichol Exp $
-* @access   public
-*/
-class soapclient2 extends nusoap_base  {
-
-	var $username = '';
-	var $password = '';
-	var $authtype = '';
-	var $certRequest = array();
-	var $requestHeaders = false;	// SOAP headers in request (text)
-	var $responseHeaders = '';		// SOAP headers from response (incomplete namespace resolution) (text)
-	var $document = '';				// SOAP body response portion (incomplete namespace resolution) (text)
-	var $endpoint;
-	var $forceEndpoint = '';		// overrides WSDL endpoint
-    var $proxyhost = '';
-    var $proxyport = '';
-	var $proxyusername = '';
-	var $proxypassword = '';
-    var $xml_encoding = '';			// character set encoding of incoming (response) messages
-	var $http_encoding = false;
-	var $timeout = 0;				// HTTP connection timeout
-	var $response_timeout = 30;		// HTTP response timeout
-	var $endpointType = '';			// soap|wsdl, empty for WSDL initialization error
-	var $persistentConnection = false;
-	var $defaultRpcParams = false;	// This is no longer used
-	var $request = '';				// HTTP request
-	var $response = '';				// HTTP response
-	var $responseData = '';			// SOAP payload of response
-	var $cookies = array();			// Cookies from response or for request
-    var $decode_utf8 = true;		// toggles whether the parser decodes element content w/ utf8_decode()
-	var $operations = array();		// WSDL operations, empty for WSDL initialization error
-	
-	/*
-	 * fault related variables
-	 */
-	/**
-	 * @var      fault
-	 * @access   public
-	 */
-	var $fault;
-	/**
-	 * @var      faultcode
-	 * @access   public
-	 */
-	var $faultcode;
-	/**
-	 * @var      faultstring
-	 * @access   public
-	 */
-	var $faultstring;
-	/**
-	 * @var      faultdetail
-	 * @access   public
-	 */
-	var $faultdetail;
-
-	/**
-	* constructor
-	*
-	* @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
-	* @param    bool $wsdl optional, set to true if using WSDL
-	* @param	int $portName optional portName in WSDL document
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @param	integer $timeout set the connection timeout
-	* @param	integer $response_timeout set the response timeout
-	* @access   public
-	*/
-	function soapclient2($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30){
-		parent::nusoap_base();
-		$this->endpoint = $endpoint;
-		$this->proxyhost = $proxyhost;
-		$this->proxyport = $proxyport;
-		$this->proxyusername = $proxyusername;
-		$this->proxypassword = $proxypassword;
-		$this->timeout = $timeout;
-		$this->response_timeout = $response_timeout;
-
-		// make values
-		if($wsdl){
-			if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
-				$this->wsdl = $endpoint;
-				$this->endpoint = $this->wsdl->wsdl;
-				$this->wsdlFile = $this->endpoint;
-				$this->debug('existing wsdl instance created from ' . $this->endpoint);
-			} else {
-				$this->wsdlFile = $this->endpoint;
-				
-				// instantiate wsdl object and parse wsdl file
-				$this->debug('instantiating wsdl class with doc: '.$endpoint);
-				$this->wsdl = new wsdl($this->wsdlFile,$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout);
-			}
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			// catch errors
-			if($errstr = $this->wsdl->getError()){
-				$this->debug('got wsdl error: '.$errstr);
-				$this->setError('wsdl error: '.$errstr);
-			} elseif($this->operations = $this->wsdl->getOperations()){
-				$this->debug( 'got '.count($this->operations).' operations from wsdl '.$this->wsdlFile);
-				$this->endpointType = 'wsdl';
-			} else {
-				$this->debug( 'getOperations returned false');
-				$this->setError('no operations defined in the WSDL document!');
-			}
-		} else {
-			$this->debug("instantiate SOAP with endpoint at $endpoint");
-			$this->endpointType = 'soap';
-		}
-	}
-
-	/**
-	* calls method, returns PHP native type
-	*
-	* @param    string $method SOAP server URL or path
-	* @param    mixed $params An array, associative or simple, of the parameters
-	*			              for the method call, or a string that is the XML
-	*			              for the call.  For rpc style, this call will
-	*			              wrap the XML in a tag named after the method, as
-	*			              well as the SOAP Envelope and Body.  For document
-	*			              style, this will only wrap with the Envelope and Body.
-	*			              IMPORTANT: when using an array with document style,
-	*			              in which case there
-	*                         is really one parameter, the root of the fragment
-	*                         used in the call, which encloses what programmers
-	*                         normally think of parameters.  A parameter array
-	*                         *must* include the wrapper.
-	* @param	string $namespace optional method namespace (WSDL can override)
-	* @param	string $soapAction optional SOAPAction value (WSDL can override)
-	* @param	mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
-	* @param	boolean $rpcParams optional (no longer used)
-	* @param	string	$style optional (rpc|document) the style to use when serializing parameters (WSDL can override)
-	* @param	string	$use optional (encoded|literal) the use when serializing parameters (WSDL can override)
-	* @return	mixed	response from SOAP call
-	* @access   public
-	*/
-	function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
-		$this->operation = $operation;
-		$this->fault = false;
-		$this->setError('');
-		$this->request = '';
-		$this->response = '';
-		$this->responseData = '';
-		$this->faultstring = '';
-		$this->faultcode = '';
-		$this->opData = array();
-		
-		$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
-		$this->appendDebug('params=' . $this->varDump($params));
-		$this->appendDebug('headers=' . $this->varDump($headers));
-		if ($headers) {
-			$this->requestHeaders = $headers;
-		}
-		// serialize parameters
-		if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
-			// use WSDL for operation
-			$this->opData = $opData;
-			$this->debug("found operation");
-			$this->appendDebug('opData=' . $this->varDump($opData));
-			if (isset($opData['soapAction'])) {
-				$soapAction = $opData['soapAction'];
-			}
-			if (! $this->forceEndpoint) {
-				$this->endpoint = $opData['endpoint'];
-			} else {
-				$this->endpoint = $this->forceEndpoint;
-			}
-			$namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] :	$namespace;
-			$style = $opData['style'];
-			$use = $opData['input']['use'];
-			// add ns to ns array
-			if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
-				$nsPrefix = 'ns' . rand(1000, 9999);
-				$this->wsdl->namespaces[$nsPrefix] = $namespace;
-			}
-            $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
-			// serialize payload
-			if (is_string($params)) {
-				$this->debug("serializing param string for WSDL operation $operation");
-				$payload = $params;
-			} elseif (is_array($params)) {
-				$this->debug("serializing param array for WSDL operation $operation");
-				$payload = $this->wsdl->serializeRPCParameters($operation,'input',$params);
-			} else {
-				$this->debug('params must be array or string');
-				$this->setError('params must be array or string');
-				return false;
-			}
-            $usedNamespaces = $this->wsdl->usedNamespaces;
-			if (isset($opData['input']['encodingStyle'])) {
-				$encodingStyle = $opData['input']['encodingStyle'];
-			} else {
-				$encodingStyle = '';
-			}
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			if ($errstr = $this->wsdl->getError()) {
-				$this->debug('got wsdl error: '.$errstr);
-				$this->setError('wsdl error: '.$errstr);
-				return false;
-			}
-		} elseif($this->endpointType == 'wsdl') {
-			// operation not in WSDL
-			$this->appendDebug($this->wsdl->getDebug());
-			$this->wsdl->clearDebug();
-			$this->setError( 'operation '.$operation.' not present.');
-			$this->debug("operation '$operation' not present.");
-			return false;
-		} else {
-			// no WSDL
-			//$this->namespaces['ns1'] = $namespace;
-			$nsPrefix = 'ns' . rand(1000, 9999);
-			// serialize 
-			$payload = '';
-			if (is_string($params)) {
-				$this->debug("serializing param string for operation $operation");
-				$payload = $params;
-			} elseif (is_array($params)) {
-				$this->debug("serializing param array for operation $operation");
-				foreach($params as $k => $v){
-					$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
-				}
-			} else {
-				$this->debug('params must be array or string');
-				$this->setError('params must be array or string');
-				return false;
-			}
-			$usedNamespaces = array();
-			if ($use == 'encoded') {
-				$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
-			} else {
-				$encodingStyle = '';
-			}
-		}
-		// wrap RPC calls with method element
-		if ($style == 'rpc') {
-			if ($use == 'literal') {
-				$this->debug("wrapping RPC request with literal method element");
-				if ($namespace) {
-					$payload = "<$operation xmlns=\"$namespace\">" . $payload . "</$operation>";
-				} else {
-					$payload = "<$operation>" . $payload . "</$operation>";
-				}
-			} else {
-				$this->debug("wrapping RPC request with encoded method element");
-				if ($namespace) {
-					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
-								$payload .
-								"</$nsPrefix:$operation>";
-				} else {
-					$payload = "<$operation>" .
-								$payload .
-								"</$operation>";
-				}
-			}
-		}
-		// serialize envelope
-		$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
-		$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
-		$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
-		// send
-		$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
-		if($errstr = $this->getError()){
-			$this->debug('Error: '.$errstr);
-			return false;
-		} else {
-			$this->return = $return;
-			$this->debug('sent message successfully and got a(n) '.gettype($return));
-           	$this->appendDebug('return=' . $this->varDump($return));
-			
-			// fault?
-			if(is_array($return) && isset($return['faultcode'])){
-				$this->debug('got fault');
-				$this->setError($return['faultcode'].': '.$return['faultstring']);
-				$this->fault = true;
-				foreach($return as $k => $v){
-					$this->$k = $v;
-					$this->debug("$k = $v<br>");
-				}
-				return $return;
-			} elseif ($style == 'document') {
-				// NOTE: if the response is defined to have multiple parts (i.e. unwrapped),
-				// we are only going to return the first part here...sorry about that
-				return $return;
-			} else {
-				// array of return values
-				if(is_array($return)){
-					// multiple 'out' parameters, which we return wrapped up
-					// in the array
-					if(sizeof($return) > 1){
-						return $return;
-					}
-					// single 'out' parameter (normally the return value)
-					$return = array_shift($return);
-					$this->debug('return shifted value: ');
-					$this->appendDebug($this->varDump($return));
-           			return $return;
-				// nothing returned (ie, echoVoid)
-				} else {
-					return "";
-				}
-			}
-		}
-	}
-
-	/**
-	* get available data pertaining to an operation
-	*
-	* @param    string $operation operation name
-	* @return	array array of data pertaining to the operation
-	* @access   public
-	*/
-	function getOperationData($operation){
-		if(isset($this->operations[$operation])){
-			return $this->operations[$operation];
-		}
-		$this->debug("No data for operation: $operation");
-	}
-
-    /**
-    * send the SOAP message
-    *
-    * Note: if the operation has multiple return values
-    * the return value of this method will be an array
-    * of those values.
-    *
-	* @param    string $msg a SOAPx4 soapmsg object
-	* @param    string $soapaction SOAPAction value
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @return	mixed native PHP types.
-	* @access   private
-	*/
-	function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
-		$this->checkCookies();
-		// detect transport
-		switch(true){
-			// http(s)
-			case ereg('^http',$this->endpoint):
-				$this->debug('transporting via HTTP');
-				if($this->persistentConnection == true && is_object($this->persistentConnection)){
-					$http = $this->persistentConnection;
-				} else {
-					$http = new soap_transport_http($this->endpoint);
-					if ($this->persistentConnection) {
-						$http->usePersistentConnection();
-					}
-				}
-				$http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
-				$http->setSOAPAction($soapaction);
-				if($this->proxyhost && $this->proxyport){
-					$http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
-				}
-                if($this->authtype != '') {
-					$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
-				}
-				if($this->http_encoding != ''){
-					$http->setEncoding($this->http_encoding);
-				}
-				$this->debug('sending message, length='.strlen($msg));
-				if(ereg('^http:',$this->endpoint)){
-				//if(strpos($this->endpoint,'http:')){
-					$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
-				} elseif(ereg('^https',$this->endpoint)){
-				//} elseif(strpos($this->endpoint,'https:')){
-					//if(phpversion() == '4.3.0-dev'){
-						//$response = $http->send($msg,$timeout,$response_timeout);
-                   		//$this->request = $http->outgoing_payload;
-						//$this->response = $http->incoming_payload;
-					//} else
-					$this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
-				} else {
-					$this->setError('no http/s in endpoint url');
-				}
-				$this->request = $http->outgoing_payload;
-				$this->response = $http->incoming_payload;
-				$this->appendDebug($http->getDebug());
-				$this->UpdateCookies($http->incoming_cookies);
-
-				// save transport object if using persistent connections
-				if ($this->persistentConnection) {
-					$http->clearDebug();
-					if (!is_object($this->persistentConnection)) {
-						$this->persistentConnection = $http;
-					}
-				}
-				
-				if($err = $http->getError()){
-					$this->setError('HTTP Error: '.$err);
-					return false;
-				} elseif($this->getError()){
-					return false;
-				} else {
-					$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
-					return $this->parseResponse($http->incoming_headers, $this->responseData);
-				}
-			break;
-			default:
-				$this->setError('no transport found, or selected transport is not yet supported!');
-			return false;
-			break;
-		}
-	}
-
-	/**
-	* processes SOAP message returned from server
-	*
-	* @param	array	$headers	The HTTP headers
-	* @param	string	$data		unprocessed response data from server
-	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
-	*/
-    function parseResponse($headers, $data) {
-		$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
-		if (!strstr($headers['content-type'], 'text/xml')) {
-			$this->setError('Response not of type text/xml');
-			return false;
-		}
-		if (strpos($headers['content-type'], '=')) {
-			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
-			$this->debug('Got response encoding: ' . $enc);
-			if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
-				$this->xml_encoding = strtoupper($enc);
-			} else {
-				$this->xml_encoding = 'US-ASCII';
-			}
-		} else {
-			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
-			$this->xml_encoding = 'UTF-8';
-		}
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
-		$parser = new soap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
-		// add parser debug data to our debug
-		$this->appendDebug($parser->getDebug());
-		// if parse errors
-		if($errstr = $parser->getError()){
-			$this->setError( $errstr);
-			// destroy the parser object
-			unset($parser);
-			return false;
-		} else {
-			// get SOAP headers
-			$this->responseHeaders = $parser->getHeaders();
-			// get decoded message
-			$return = $parser->get_response();
-            // add document for doclit support
-            $this->document = $parser->document;
-			// destroy the parser object
-			unset($parser);
-			// return decode message
-			return $return;
-		}
-	 }
-
-	/**
-	* sets the SOAP endpoint, which can override WSDL
-	*
-	* @param	$endpoint string The endpoint URL to use, or empty string or false to prevent override
-	* @access   public
-	*/
-	function setEndpoint($endpoint) {
-		$this->forceEndpoint = $endpoint;
-	}
-
-	/**
-	* set the SOAP headers
-	*
-	* @param	$headers mixed String of XML with SOAP header content, or array of soapval objects for SOAP headers
-	* @access   public
-	*/
-	function setHeaders($headers){
-		$this->requestHeaders = $headers;
-	}
-
-	/**
-	* get the SOAP response headers (namespace resolution incomplete)
-	*
-	* @return	string
-	* @access   public
-	*/
-	function getHeaders(){
-		return $this->responseHeaders;
-	}
-
-	/**
-	* set proxy info here
-	*
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @access   public
-	*/
-	function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
-		$this->proxyhost = $proxyhost;
-		$this->proxyport = $proxyport;
-		$this->proxyusername = $proxyusername;
-		$this->proxypassword = $proxypassword;
-	}
-
-	/**
-	* if authenticating, set user credentials here
-	*
-	* @param    string $username
-	* @param    string $password
-	* @param	string $authtype (basic|digest|certificate)
-	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
-	* @access   public
-	*/
-	function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) {
-		$this->username = $username;
-		$this->password = $password;
-		$this->authtype = $authtype;
-		$this->certRequest = $certRequest;
-	}
-	
-	/**
-	* use HTTP encoding
-	*
-	* @param    string $enc
-	* @access   public
-	*/
-	function setHTTPEncoding($enc='gzip, deflate'){
-		$this->http_encoding = $enc;
-	}
-	
-	/**
-	* use HTTP persistent connections if possible
-	*
-	* @access   public
-	*/
-	function useHTTPPersistentConnection(){
-		$this->persistentConnection = true;
-	}
-	
-	/**
-	* gets the default RPC parameter setting.
-	* If true, default is that call params are like RPC even for document style.
-	* Each call() can override this value.
-	*
-	* This is no longer used.
-	*
-	* @return boolean
-	* @access public
-	* @deprecated
-	*/
-	function getDefaultRpcParams() {
-		return $this->defaultRpcParams;
-	}
-
-	/**
-	* sets the default RPC parameter setting.
-	* If true, default is that call params are like RPC even for document style
-	* Each call() can override this value.
-	*
-	* This is no longer used.
-	*
-	* @param    boolean $rpcParams
-	* @access public
-	* @deprecated
-	*/
-	function setDefaultRpcParams($rpcParams) {
-		$this->defaultRpcParams = $rpcParams;
-	}
-	
-	/**
-	* dynamically creates an instance of a proxy class,
-	* allowing user to directly call methods from wsdl
-	*
-	* @return   object soap_proxy object
-	* @access   public
-	*/
-	function getProxy(){
-		$r = rand();
-		$evalStr = $this->_getProxyClassCode($r);
-		//$this->debug("proxy class: $evalStr";
-		// eval the class
-		eval($evalStr);
-		// instantiate proxy object
-		eval("\$proxy = new soap_proxy_$r('');");
-		// transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice
-		$proxy->endpointType = 'wsdl';
-		$proxy->wsdlFile = $this->wsdlFile;
-		$proxy->wsdl = $this->wsdl;
-		$proxy->operations = $this->operations;
-		$proxy->defaultRpcParams = $this->defaultRpcParams;
-		// transfer other state
-		$proxy->username = $this->username;
-		$proxy->password = $this->password;
-		$proxy->authtype = $this->authtype;
-		$proxy->proxyhost = $this->proxyhost;
-		$proxy->proxyport = $this->proxyport;
-		$proxy->proxyusername = $this->proxyusername;
-		$proxy->proxypassword = $this->proxypassword;
-		$proxy->timeout = $this->timeout;
-		$proxy->response_timeout = $this->response_timeout;
-		$proxy->http_encoding = $this->http_encoding;
-		$proxy->persistentConnection = $this->persistentConnection;
-		$proxy->requestHeaders = $this->requestHeaders;
-		$proxy->soap_defencoding = $this->soap_defencoding;
-		$proxy->endpoint = $this->endpoint;
-		$proxy->forceEndpoint = $this->forceEndpoint;
-		return $proxy;
-	}
-
-	/**
-	* dynamically creates proxy class code
-	*
-	* @return   string PHP/NuSOAP code for the proxy class
-	* @access   private
-	*/
-	function _getProxyClassCode($r) {
-		if ($this->endpointType != 'wsdl') {
-			$evalStr = 'A proxy can only be created for a WSDL client';
-			$this->setError($evalStr);
-			return $evalStr;
-		}
-		$evalStr = '';
-		foreach ($this->operations as $operation => $opData) {
-			if ($operation != '') {
-				// create param string and param comment string
-				if (sizeof($opData['input']['parts']) > 0) {
-					$paramStr = '';
-					$paramArrayStr = '';
-					$paramCommentStr = '';
-					foreach ($opData['input']['parts'] as $name => $type) {
-						$paramStr .= "\$$name, ";
-						$paramArrayStr .= "'$name' => \$$name, ";
-						$paramCommentStr .= "$type \$$name, ";
-					}
-					$paramStr = substr($paramStr, 0, strlen($paramStr)-2);
-					$paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
-					$paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
-				} else {
-					$paramStr = '';
-					$paramCommentStr = 'void';
-				}
-				$opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
-				$evalStr .= "// $paramCommentStr
-	function " . str_replace('.', '__', $operation) . "($paramStr) {
-		\$params = array($paramArrayStr);
-		return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
-	}
-	";
-				unset($paramStr);
-				unset($paramCommentStr);
-			}
-		}
-		$evalStr = 'class soap_proxy_'.$r.' extends soapclient2 {
-	'.$evalStr.'
-}';
-		return $evalStr;
-	}
-
-	/**
-	* dynamically creates proxy class code
-	*
-	* @return   string PHP/NuSOAP code for the proxy class
-	* @access   public
-	*/
-	function getProxyClassCode() {
-		$r = rand();
-		return $this->_getProxyClassCode($r);
-	}
-
-	/**
-	* gets the HTTP body for the current request.
-	*
-	* @param string $soapmsg The SOAP payload
-	* @return string The HTTP body, which includes the SOAP payload
-	* @access private
-	*/
-	function getHTTPBody($soapmsg) {
-		return $soapmsg;
-	}
-	
-	/**
-	* gets the HTTP content type for the current request.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type for the current request.
-	* @access private
-	*/
-	function getHTTPContentType() {
-		return 'text/xml';
-	}
-	
-	/**
-	* gets the HTTP content type charset for the current request.
-	* returns false for non-text content types.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type charset for the current request.
-	* @access private
-	*/
-	function getHTTPContentTypeCharset() {
-		return $this->soap_defencoding;
-	}
-
-	/*
-	* whether or not parser should decode utf8 element content
-    *
-    * @return   always returns true
-    * @access   public
-    */
-    function decodeUTF8($bool){
-		$this->decode_utf8 = $bool;
-		return true;
-    }
-
-	/**
-	 * adds a new Cookie into $this->cookies array
-	 *
-	 * @param	string $name Cookie Name
-	 * @param	string $value Cookie Value
-	 * @return	if cookie-set was successful returns true, else false
-	 * @access	public
-	 */
-	function setCookie($name, $value) {
-		if (strlen($name) == 0) {
-			return false;
-		}
-		$this->cookies[] = array('name' => $name, 'value' => $value);
-		return true;
-	}
-
-	/**
-	 * gets all Cookies
-	 *
-	 * @return   array with all internal cookies
-	 * @access   public
-	 */
-	function getCookies() {
-		return $this->cookies;
-	}
-
-	/**
-	 * checks all Cookies and delete those which are expired
-	 *
-	 * @return   always return true
-	 * @access   private
-	 */
-	function checkCookies() {
-		if (sizeof($this->cookies) == 0) {
-			return true;
-		}
-		$this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
-		$curr_cookies = $this->cookies;
-		$this->cookies = array();
-		foreach ($curr_cookies as $cookie) {
-			if (! is_array($cookie)) {
-				$this->debug('Remove cookie that is not an array');
-				continue;
-			}
-			if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
-				if (strtotime($cookie['expires']) > time()) {
-					$this->cookies[] = $cookie;
-				} else {
-					$this->debug('Remove expired cookie ' . $cookie['name']);
-				}
-			} else {
-				$this->cookies[] = $cookie;
-			}
-		}
-		$this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
-		return true;
-	}
-
-	/**
-	 * updates the current cookies with a new set
-	 *
-	 * @param	array $cookies new cookies with which to update current ones
-	 * @return	always return true
-	 * @access	private
-	 */
-	function UpdateCookies($cookies) {
-		if (sizeof($this->cookies) == 0) {
-			// no existing cookies: take whatever is new
-			if (sizeof($cookies) > 0) {
-				$this->debug('Setting new cookie(s)');
-				$this->cookies = $cookies;
-			}
-			return true;
-		}
-		if (sizeof($cookies) == 0) {
-			// no new cookies: keep what we've got
-			return true;
-		}
-		// merge
-		foreach ($cookies as $newCookie) {
-			if (!is_array($newCookie)) {
-				continue;
-			}
-			if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
-				continue;
-			}
-			$newName = $newCookie['name'];
-
-			$found = false;
-			for ($i = 0; $i < count($this->cookies); $i++) {
-				$cookie = $this->cookies[$i];
-				if (!is_array($cookie)) {
-					continue;
-				}
-				if (!isset($cookie['name'])) {
-					continue;
-				}
-				if ($newName != $cookie['name']) {
-					continue;
-				}
-				$newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
-				$domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
-				if ($newDomain != $domain) {
-					continue;
-				}
-				$newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
-				$path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
-				if ($newPath != $path) {
-					continue;
-				}
-				$this->cookies[$i] = $newCookie;
-				$found = true;
-				$this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
-				break;
-			}
-			if (! $found) {
-				$this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
-				$this->cookies[] = $newCookie;
-			}
-		}
-		return true;
-	}
-}
-?>
diff --git a/libraries/nusoap/nusoapmime.php b/libraries/nusoap/nusoapmime.php
deleted file mode 100644
index e27200eb9..000000000
--- a/libraries/nusoap/nusoapmime.php
+++ /dev/null
@@ -1,478 +0,0 @@
-<?php
-/*
-$Id: nusoapmime.php,v 1.7 2005/07/27 19:24:42 snichol Exp $
-
-NuSOAP - Web Services Toolkit for PHP
-
-Copyright (c) 2002 NuSphere Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-If you have any questions or comments, please email:
-
-Dietrich Ayala
-dietrich@ganx4.com
-http://dietrich.ganx4.com/nusoap
-
-NuSphere Corporation
-http://www.nusphere.com
-
-*/
-
-/*require_once('nusoap.php');*/
-/* PEAR Mail_MIME library */
-require_once('Mail/mimeDecode.php');
-require_once('Mail/mimePart.php');
-
-/**
-* soapclient2mime client supporting MIME attachments defined at
-* http://www.w3.org/TR/SOAP-attachments.  It depends on the PEAR Mail_MIME library.
-*
-* @author   Scott Nichol <snichol@sourceforge.net>
-* @author	Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
-* @version  $Id: nusoapmime.php,v 1.7 2005/07/27 19:24:42 snichol Exp $
-* @access   public
-*/
-class soapclient2mime extends soapclient2 {
-	/**
-	 * @var array Each array element in the return is an associative array with keys
-	 * data, filename, contenttype, cid
-	 * @access private
-	 */
-	var $requestAttachments = array();
-	/**
-	 * @var array Each array element in the return is an associative array with keys
-	 * data, filename, contenttype, cid
-	 * @access private
-	 */
-	var $responseAttachments;
-	/**
-	 * @var string
-	 * @access private
-	 */
-	var $mimeContentType;
-	
-	/**
-	* adds a MIME attachment to the current request.
-	*
-	* If the $data parameter contains an empty string, this method will read
-	* the contents of the file named by the $filename parameter.
-	*
-	* If the $cid parameter is false, this method will generate the cid.
-	*
-	* @param string $data The data of the attachment
-	* @param string $filename The filename of the attachment (default is empty string)
-	* @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
-	* @param string $cid The content-id (cid) of the attachment (default is false)
-	* @return string The content-id (cid) of the attachment
-	* @access public
-	*/
-	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
-		if (! $cid) {
-			$cid = md5(uniqid(time()));
-		}
-
-		$info['data'] = $data;
-		$info['filename'] = $filename;
-		$info['contenttype'] = $contenttype;
-		$info['cid'] = $cid;
-		
-		$this->requestAttachments[] = $info;
-
-		return $cid;
-	}
-
-	/**
-	* clears the MIME attachments for the current request.
-	*
-	* @access public
-	*/
-	function clearAttachments() {
-		$this->requestAttachments = array();
-	}
-
-	/**
-	* gets the MIME attachments from the current response.
-	*
-	* Each array element in the return is an associative array with keys
-	* data, filename, contenttype, cid.  These keys correspond to the parameters
-	* for addAttachment.
-	*
-	* @return array The attachments.
-	* @access public
-	*/
-	function getAttachments() {
-		return $this->responseAttachments;
-	}
-
-	/**
-	* gets the HTTP body for the current request.
-	*
-	* @param string $soapmsg The SOAP payload
-	* @return string The HTTP body, which includes the SOAP payload
-	* @access private
-	*/
-	function getHTTPBody($soapmsg) {
-		if (count($this->requestAttachments) > 0) {
-			$params['content_type'] = 'multipart/related; type=text/xml';
-			$mimeMessage = new Mail_mimePart('', $params);
-			unset($params);
-
-			$params['content_type'] = 'text/xml';
-			$params['encoding']     = '8bit';
-			$params['charset']      = $this->soap_defencoding;
-			$mimeMessage->addSubpart($soapmsg, $params);
-			
-			foreach ($this->requestAttachments as $att) {
-				unset($params);
-
-				$params['content_type'] = $att['contenttype'];
-				$params['encoding']     = 'base64';
-				$params['disposition']  = 'attachment';
-				$params['dfilename']    = $att['filename'];
-				$params['cid']          = $att['cid'];
-
-				if ($att['data'] == '' && $att['filename'] <> '') {
-					if ($fd = fopen($att['filename'], 'rb')) {
-						$data = fread($fd, filesize($att['filename']));
-						fclose($fd);
-					} else {
-						$data = '';
-					}
-					$mimeMessage->addSubpart($data, $params);
-				} else {
-					$mimeMessage->addSubpart($att['data'], $params);
-				}
-			}
-
-			$output = $mimeMessage->encode();
-			$mimeHeaders = $output['headers'];
-	
-			foreach ($mimeHeaders as $k => $v) {
-				$this->debug("MIME header $k: $v");
-				if (strtolower($k) == 'content-type') {
-					// PHP header() seems to strip leading whitespace starting
-					// the second line, so force everything to one line
-					$this->mimeContentType = str_replace("\r\n", " ", $v);
-				}
-			}
-	
-			return $output['body'];
-		}
-
-		return parent::getHTTPBody($soapmsg);
-	}
-	
-	/**
-	* gets the HTTP content type for the current request.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type for the current request.
-	* @access private
-	*/
-	function getHTTPContentType() {
-		if (count($this->requestAttachments) > 0) {
-			return $this->mimeContentType;
-		}
-		return parent::getHTTPContentType();
-	}
-	
-	/**
-	* gets the HTTP content type charset for the current request.
-	* returns false for non-text content types.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type charset for the current request.
-	* @access private
-	*/
-	function getHTTPContentTypeCharset() {
-		if (count($this->requestAttachments) > 0) {
-			return false;
-		}
-		return parent::getHTTPContentTypeCharset();
-	}
-
-	/**
-	* processes SOAP message returned from server
-	*
-	* @param	array	$headers	The HTTP headers
-	* @param	string	$data		unprocessed response data from server
-	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
-	*/
-    function parseResponse($headers, $data) {
-		$this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
-		$this->responseAttachments = array();
-		if (strstr($headers['content-type'], 'multipart/related')) {
-			$this->debug('Decode multipart/related');
-			$input = '';
-			foreach ($headers as $k => $v) {
-				$input .= "$k: $v\r\n";
-			}
-			$params['input'] = $input . "\r\n" . $data;
-			$params['include_bodies'] = true;
-			$params['decode_bodies'] = true;
-			$params['decode_headers'] = true;
-			
-			$structure = Mail_mimeDecode::decode($params);
-
-			foreach ($structure->parts as $part) {
-				if (!isset($part->disposition)) {
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
-					$return = parent::parseResponse($part->headers, $part->body);
-				} else {
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
-					$info['data'] = $part->body;
-					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
-					$info['contenttype'] = $part->headers['content-type'];
-					$info['cid'] = $part->headers['content-id'];
-					$this->responseAttachments[] = $info;
-				}
-			}
-		
-			if (isset($return)) {
-				return $return;
-			}
-			
-			$this->setError('No root part found in multipart/related content');
-			return;
-		}
-		$this->debug('Not multipart/related');
-		return parent::parseResponse($headers, $data);
-	}
-}
-
-/**
-* nusoapservermime server supporting MIME attachments defined at
-* http://www.w3.org/TR/SOAP-attachments.  It depends on the PEAR Mail_MIME library.
-*
-* @author   Scott Nichol <snichol@sourceforge.net>
-* @author	Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
-* @version  $Id: nusoapmime.php,v 1.7 2005/07/27 19:24:42 snichol Exp $
-* @access   public
-*/
-class nusoapservermime extends soap_server {
-	/**
-	 * @var array Each array element in the return is an associative array with keys
-	 * data, filename, contenttype, cid
-	 * @access private
-	 */
-	var $requestAttachments = array();
-	/**
-	 * @var array Each array element in the return is an associative array with keys
-	 * data, filename, contenttype, cid
-	 * @access private
-	 */
-	var $responseAttachments;
-	/**
-	 * @var string
-	 * @access private
-	 */
-	var $mimeContentType;
-	
-	/**
-	* adds a MIME attachment to the current response.
-	*
-	* If the $data parameter contains an empty string, this method will read
-	* the contents of the file named by the $filename parameter.
-	*
-	* If the $cid parameter is false, this method will generate the cid.
-	*
-	* @param string $data The data of the attachment
-	* @param string $filename The filename of the attachment (default is empty string)
-	* @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
-	* @param string $cid The content-id (cid) of the attachment (default is false)
-	* @return string The content-id (cid) of the attachment
-	* @access public
-	*/
-	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
-		if (! $cid) {
-			$cid = md5(uniqid(time()));
-		}
-
-		$info['data'] = $data;
-		$info['filename'] = $filename;
-		$info['contenttype'] = $contenttype;
-		$info['cid'] = $cid;
-		
-		$this->responseAttachments[] = $info;
-
-		return $cid;
-	}
-
-	/**
-	* clears the MIME attachments for the current response.
-	*
-	* @access public
-	*/
-	function clearAttachments() {
-		$this->responseAttachments = array();
-	}
-
-	/**
-	* gets the MIME attachments from the current request.
-	*
-	* Each array element in the return is an associative array with keys
-	* data, filename, contenttype, cid.  These keys correspond to the parameters
-	* for addAttachment.
-	*
-	* @return array The attachments.
-	* @access public
-	*/
-	function getAttachments() {
-		return $this->requestAttachments;
-	}
-
-	/**
-	* gets the HTTP body for the current response.
-	*
-	* @param string $soapmsg The SOAP payload
-	* @return string The HTTP body, which includes the SOAP payload
-	* @access private
-	*/
-	function getHTTPBody($soapmsg) {
-		if (count($this->responseAttachments) > 0) {
-			$params['content_type'] = 'multipart/related; type=text/xml';
-			$mimeMessage = new Mail_mimePart('', $params);
-			unset($params);
-
-			$params['content_type'] = 'text/xml';
-			$params['encoding']     = '8bit';
-			$params['charset']      = $this->soap_defencoding;
-			$mimeMessage->addSubpart($soapmsg, $params);
-			
-			foreach ($this->responseAttachments as $att) {
-				unset($params);
-
-				$params['content_type'] = $att['contenttype'];
-				$params['encoding']     = 'base64';
-				$params['disposition']  = 'attachment';
-				$params['dfilename']    = $att['filename'];
-				$params['cid']          = $att['cid'];
-
-				if ($att['data'] == '' && $att['filename'] <> '') {
-					if ($fd = fopen($att['filename'], 'rb')) {
-						$data = fread($fd, filesize($att['filename']));
-						fclose($fd);
-					} else {
-						$data = '';
-					}
-					$mimeMessage->addSubpart($data, $params);
-				} else {
-					$mimeMessage->addSubpart($att['data'], $params);
-				}
-			}
-
-			$output = $mimeMessage->encode();
-			$mimeHeaders = $output['headers'];
-	
-			foreach ($mimeHeaders as $k => $v) {
-				$this->debug("MIME header $k: $v");
-				if (strtolower($k) == 'content-type') {
-					// PHP header() seems to strip leading whitespace starting
-					// the second line, so force everything to one line
-					$this->mimeContentType = str_replace("\r\n", " ", $v);
-				}
-			}
-	
-			return $output['body'];
-		}
-
-		return parent::getHTTPBody($soapmsg);
-	}
-	
-	/**
-	* gets the HTTP content type for the current response.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type for the current response.
-	* @access private
-	*/
-	function getHTTPContentType() {
-		if (count($this->responseAttachments) > 0) {
-			return $this->mimeContentType;
-		}
-		return parent::getHTTPContentType();
-	}
-	
-	/**
-	* gets the HTTP content type charset for the current response.
-	* returns false for non-text content types.
-	*
-	* Note: getHTTPBody must be called before this.
-	*
-	* @return string the HTTP content type charset for the current response.
-	* @access private
-	*/
-	function getHTTPContentTypeCharset() {
-		if (count($this->responseAttachments) > 0) {
-			return false;
-		}
-		return parent::getHTTPContentTypeCharset();
-	}
-
-	/**
-	* processes SOAP message received from client
-	*
-	* @param	array	$headers	The HTTP headers
-	* @param	string	$data		unprocessed request data from client
-	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
-	*/
-    function parseRequest($headers, $data) {
-		$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
-		$this->requestAttachments = array();
-		if (strstr($headers['content-type'], 'multipart/related')) {
-			$this->debug('Decode multipart/related');
-			$input = '';
-			foreach ($headers as $k => $v) {
-				$input .= "$k: $v\r\n";
-			}
-			$params['input'] = $input . "\r\n" . $data;
-			$params['include_bodies'] = true;
-			$params['decode_bodies'] = true;
-			$params['decode_headers'] = true;
-			
-			$structure = Mail_mimeDecode::decode($params);
-
-			foreach ($structure->parts as $part) {
-				if (!isset($part->disposition)) {
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
-					$return = parent::parseRequest($part->headers, $part->body);
-				} else {
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
-					$info['data'] = $part->body;
-					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
-					$info['contenttype'] = $part->headers['content-type'];
-					$info['cid'] = $part->headers['content-id'];
-					$this->requestAttachments[] = $info;
-				}
-			}
-		
-			if (isset($return)) {
-				return $return;
-			}
-			
-			$this->setError('No root part found in multipart/related content');
-			return;
-		}
-		$this->debug('Not multipart/related');
-		return parent::parseRequest($headers, $data);
-	}
-}
-?>
-- 
GitLab