Browse Source

[svn r20667] clean library,htmlpurifier

Isaac Flores 16 years ago
parent
commit
907270cec9
100 changed files with 0 additions and 16862 deletions
  1. 0 1
      main/inc/lib/htmlpurifier/.gitattributes
  2. 0 18
      main/inc/lib/htmlpurifier/.gitignore
  3. 0 13
      main/inc/lib/htmlpurifier/FOCUS
  4. 0 842
      main/inc/lib/htmlpurifier/NEWS
  5. 0 131
      main/inc/lib/htmlpurifier/TODO
  6. 0 6
      main/inc/lib/htmlpurifier/WHATSNEW
  7. 0 1
      main/inc/lib/htmlpurifier/benchmarks/.htaccess
  8. 0 16
      main/inc/lib/htmlpurifier/benchmarks/ConfigSchema.php
  9. 0 158
      main/inc/lib/htmlpurifier/benchmarks/Lexer.php
  10. 0 21
      main/inc/lib/htmlpurifier/benchmarks/Trace.php
  11. 0 55
      main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/1.html
  12. 0 19
      main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/2.html
  13. 0 130
      main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/3.html
  14. 0 542
      main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/4.html
  15. 0 7
      main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/DISCLAIMER.txt
  16. 0 218
      main/inc/lib/htmlpurifier/docs/dev-advanced-api.html
  17. 0 29
      main/inc/lib/htmlpurifier/docs/dev-code-quality.txt
  18. 0 376
      main/inc/lib/htmlpurifier/docs/dev-config-schema.html
  19. 0 67
      main/inc/lib/htmlpurifier/docs/dev-flush.html
  20. 0 281
      main/inc/lib/htmlpurifier/docs/dev-includes.txt
  21. 0 82
      main/inc/lib/htmlpurifier/docs/dev-naming.html
  22. 0 32
      main/inc/lib/htmlpurifier/docs/dev-optimization.html
  23. 0 308
      main/inc/lib/htmlpurifier/docs/dev-progress.html
  24. 0 1201
      main/inc/lib/htmlpurifier/docs/dtd/xhtml1-transitional.dtd
  25. 0 798
      main/inc/lib/htmlpurifier/docs/enduser-customize.html
  26. 0 147
      main/inc/lib/htmlpurifier/docs/enduser-id.html
  27. 0 59
      main/inc/lib/htmlpurifier/docs/enduser-overview.txt
  28. 0 18
      main/inc/lib/htmlpurifier/docs/enduser-security.txt
  29. 0 119
      main/inc/lib/htmlpurifier/docs/enduser-slow.html
  30. 0 230
      main/inc/lib/htmlpurifier/docs/enduser-tidy.html
  31. 0 216
      main/inc/lib/htmlpurifier/docs/enduser-uri-filter.html
  32. 0 1059
      main/inc/lib/htmlpurifier/docs/enduser-utf8.html
  33. 0 152
      main/inc/lib/htmlpurifier/docs/enduser-youtube.html
  34. 0 196
      main/inc/lib/htmlpurifier/docs/entities/xhtml-lat1.ent
  35. 0 80
      main/inc/lib/htmlpurifier/docs/entities/xhtml-special.ent
  36. 0 237
      main/inc/lib/htmlpurifier/docs/entities/xhtml-symbol.ent
  37. 0 23
      main/inc/lib/htmlpurifier/docs/examples/basic.php
  38. 0 8
      main/inc/lib/htmlpurifier/docs/fixquotes.htc
  39. 0 181
      main/inc/lib/htmlpurifier/docs/index.html
  40. 0 48
      main/inc/lib/htmlpurifier/docs/proposal-colors.html
  41. 0 23
      main/inc/lib/htmlpurifier/docs/proposal-config.txt
  42. 0 34
      main/inc/lib/htmlpurifier/docs/proposal-css-extraction.txt
  43. 0 211
      main/inc/lib/htmlpurifier/docs/proposal-errors.txt
  44. 0 137
      main/inc/lib/htmlpurifier/docs/proposal-filter-levels.txt
  45. 0 64
      main/inc/lib/htmlpurifier/docs/proposal-language.txt
  46. 0 44
      main/inc/lib/htmlpurifier/docs/proposal-new-directives.txt
  47. 0 50
      main/inc/lib/htmlpurifier/docs/ref-content-models.txt
  48. 0 30
      main/inc/lib/htmlpurifier/docs/ref-css-length.txt
  49. 0 46
      main/inc/lib/htmlpurifier/docs/ref-devnetwork.html
  50. 0 166
      main/inc/lib/htmlpurifier/docs/ref-html-modularization.txt
  51. 0 26
      main/inc/lib/htmlpurifier/docs/ref-proprietary-tags.txt
  52. 0 26
      main/inc/lib/htmlpurifier/docs/ref-whatwg.txt
  53. 0 76
      main/inc/lib/htmlpurifier/docs/style.css
  54. 0 1
      main/inc/lib/htmlpurifier/maintenance/.htaccess
  55. 0 102
      main/inc/lib/htmlpurifier/maintenance/PH5P.patch
  56. 0 3824
      main/inc/lib/htmlpurifier/maintenance/PH5P.php
  57. 0 129
      main/inc/lib/htmlpurifier/maintenance/add-vimline.php
  58. 0 22
      main/inc/lib/htmlpurifier/maintenance/common.php
  59. 0 161
      main/inc/lib/htmlpurifier/maintenance/config-scanner.php
  60. 0 42
      main/inc/lib/htmlpurifier/maintenance/flush-definition-cache.php
  61. 0 30
      main/inc/lib/htmlpurifier/maintenance/flush.php
  62. 0 74
      main/inc/lib/htmlpurifier/maintenance/generate-entity-file.php
  63. 0 189
      main/inc/lib/htmlpurifier/maintenance/generate-includes.php
  64. 0 22
      main/inc/lib/htmlpurifier/maintenance/generate-ph5p-patch.php
  65. 0 31
      main/inc/lib/htmlpurifier/maintenance/generate-schema-cache.php
  66. 0 152
      main/inc/lib/htmlpurifier/maintenance/generate-standalone.php
  67. 0 11
      main/inc/lib/htmlpurifier/maintenance/merge-library.php
  68. 0 70
      main/inc/lib/htmlpurifier/maintenance/old-extract-schema.php
  69. 0 32
      main/inc/lib/htmlpurifier/maintenance/old-remove-require-once.php
  70. 0 32
      main/inc/lib/htmlpurifier/maintenance/old-remove-schema-def.php
  71. 0 367
      main/inc/lib/htmlpurifier/maintenance/phpt-modifications.patch
  72. 0 37
      main/inc/lib/htmlpurifier/maintenance/remove-trailing-whitespace.php
  73. 0 156
      main/inc/lib/htmlpurifier/maintenance/update-freshmeat.php
  74. 0 112
      main/inc/lib/htmlpurifier/plugins/modx.txt
  75. 0 2
      main/inc/lib/htmlpurifier/plugins/phorum/.gitignore
  76. 0 26
      main/inc/lib/htmlpurifier/plugins/phorum/Changelog
  77. 0 79
      main/inc/lib/htmlpurifier/plugins/phorum/INSTALL
  78. 0 45
      main/inc/lib/htmlpurifier/plugins/phorum/README
  79. 0 57
      main/inc/lib/htmlpurifier/plugins/phorum/config.default.php
  80. 0 309
      main/inc/lib/htmlpurifier/plugins/phorum/htmlpurifier.php
  81. 0 504
      main/inc/lib/htmlpurifier/plugins/phorum/htmlpurifier/LICENSE
  82. 0 3
      main/inc/lib/htmlpurifier/plugins/phorum/htmlpurifier/README
  83. 0 18
      main/inc/lib/htmlpurifier/plugins/phorum/info.txt
  84. 0 28
      main/inc/lib/htmlpurifier/plugins/phorum/init-config.php
  85. 0 30
      main/inc/lib/htmlpurifier/plugins/phorum/migrate.bbcode.php
  86. 0 64
      main/inc/lib/htmlpurifier/plugins/phorum/settings.php
  87. 0 93
      main/inc/lib/htmlpurifier/plugins/phorum/settings/form.php
  88. 0 22
      main/inc/lib/htmlpurifier/plugins/phorum/settings/migrate-sigs-form.php
  89. 0 77
      main/inc/lib/htmlpurifier/plugins/phorum/settings/migrate-sigs.php
  90. 0 27
      main/inc/lib/htmlpurifier/plugins/phorum/settings/save.php
  91. 0 44
      main/inc/lib/htmlpurifier/smoketests/all.php
  92. 0 72
      main/inc/lib/htmlpurifier/smoketests/attrTransform.php
  93. 0 191
      main/inc/lib/htmlpurifier/smoketests/attrTransform.xml
  94. 0 73
      main/inc/lib/htmlpurifier/smoketests/basic.php
  95. 0 50
      main/inc/lib/htmlpurifier/smoketests/basic/allElements.css
  96. 0 81
      main/inc/lib/htmlpurifier/smoketests/basic/allElements.html
  97. 0 73
      main/inc/lib/htmlpurifier/smoketests/basic/legacy.css
  98. 0 126
      main/inc/lib/htmlpurifier/smoketests/basic/legacy.html
  99. 0 37
      main/inc/lib/htmlpurifier/smoketests/common.php
  100. 0 77
      main/inc/lib/htmlpurifier/smoketests/configForm.php

+ 0 - 1
main/inc/lib/htmlpurifier/.gitattributes

@@ -1 +0,0 @@
-configdoc/usage.xml -crlf

+ 0 - 18
main/inc/lib/htmlpurifier/.gitignore

@@ -1,18 +0,0 @@
-conf/
-test-settings.php
-library/HTMLPurifier/DefinitionCache/Serializer/*/
-library/standalone/
-library/HTMLPurifier.standalone.php
-library/HTMLPurifier*.tgz
-library/package*.xml
-smoketests/test-schema.html
-configdoc/*.html
-configdoc/configdoc.xml
-docs/doxygen*
-*.phpt.diff
-*.phpt.exp
-*.phpt.log
-*.phpt.out
-*.phpt.php
-*.phpt.skip.php
-*.htmlt.ini

+ 0 - 13
main/inc/lib/htmlpurifier/FOCUS

@@ -1,13 +0,0 @@
-7 - Major bugfixes
-
-[ Appendix A: Release focus IDs ]
-0 - N/A
-1 - Initial freshmeat announcement
-2 - Documentation
-3 - Code cleanup
-4 - Minor feature enhancements
-5 - Major feature enhancements
-6 - Minor bugfixes
-7 - Major bugfixes
-8 - Minor security fixes
-9 - Major security fixes

+ 0 - 842
main/inc/lib/htmlpurifier/NEWS

@@ -1,842 +0,0 @@
-NEWS ( CHANGELOG and HISTORY )                                     HTMLPurifier
-|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
-= KEY ====================
-    # Breaks back-compat
-    ! Feature
-    - Bugfix
-      + Sub-comment
-    . Internal change
-==========================
-
-3.3.0, released 2009-02-16
-! Implement CSS property 'overflow' when %CSS.AllowTricky is true.
-! Implement generic property list classess
-- Fix bug with testEncodingSupportsASCII() algorithm when iconv() implementation
-  does not do the "right thing" with characters not supported in the output
-  set.
-- Spellcheck UTF-8: The Secret To Character Encoding
-- Fix improper removal of the contents of elements with only whitespace. Thanks
-  Eric Wald for reporting.
-- Fix broken test suite in versions of PHP without spl_autoload_register()
-- Fix degenerate case with YouTube filter involving double hyphens.
-  Thanks Pierre Attar for reporting.
-- Fix YouTube rendering problem on certain versions of Firefox.
-- Fix CSSDefinition Printer problems with decorators
-- Add text parameter to unit tests, forces text output
-. Add verbose mode to command line test runner, use (--verbose)
-. Turn on unit tests for UnitConverter
-. Fix missing version number in configuration %Attr.DefaultImageAlt (added 3.2.0)
-. Fix newline errors that caused spurious failures when CRLF HTML Purifier was
-  tested on Linux.
-. Removed trailing whitespace from all text files, see
-  remote-trailing-whitespace.php maintenance script.
-. Convert configuration to use property list backend.
-
-3.2.0, released 2008-10-31
-# Using %Core.CollectErrors forces line number/column tracking on, whereas
-  previously you could theoretically turn it off.
-# HTMLPurifier_Injector->notifyEnd() is formally deprecated. Please
-  use handleEnd() instead.
-! %Output.AttrSort for when you need your attributes in alphabetical order to
-  deal with a bug in FCKEditor. Requested by frank farmer.
-! Enable HTML comments when %HTML.Trusted is on. Requested by Waldo Jaquith.
-! Proper support for name attribute. It is now allowed and equivalent to the id
-  attribute in a and img tags, and is only converted to id when %HTML.TidyLevel
-  is heavy (for all doctypes).
-! %AutoFormat.RemoveEmpty to remove some empty tags from documents. Please don't
-  use on hand-written HTML.
-! Add error-cases for unsupported elements in MakeWellFormed. This enables
-  the strategy to be used, standalone, on untrusted input.
-! %Core.AggressivelyFixLt is on by default. This causes more sensible
-  processing of left angled brackets in smileys and other whatnot.
-! Test scripts now have a 'type' parameter, which lets you say 'htmlpurifier',
-  'phpt', 'vtest', etc. in order to only execute those tests. This supercedes
-  the --only-phpt parameter, although for backwards-compatibility the flag
-  will still work.
-! AutoParagraph auto-formatter will now preserve double-newlines upon output.
-  Users who are not performing inbound filtering, this may seem a little
-  useless, but as a bonus, the test suite and handling of edge cases is also
-  improved.
-! Experimental implementation of forms for %HTML.Trusted
-! Track column numbers when maintain line numbers is on
-! Proprietary 'background' attribute on table-related elements converted into
-  corresponding CSS.  Thanks Fusemail for sponsoring this feature!
-! Add forward(), forwardUntilEndToken(), backward() and current() to Injector
-  supertype.
-! HTMLPurifier_Injector->handleEnd() permits modification to end tokens. The
-  time of operation varies slightly from notifyEnd() as *all* end tokens are
-  processed by the injector before they are subject to the well-formedness rules.
-! %Attr.DefaultImageAlt allows overriding default behavior of setting alt to
-  basename of image when not present.
-! %AutoFormat.DisplayLinkURI neuters <a> tags into plain text URLs.
-- Fix two bugs in %URI.MakeAbsolute; one involving empty paths in base URLs,
-  the other involving an undefined $is_folder error.
-- Throw error when %Core.Encoding is set to a spurious value. Previously,
-  this errored silently and returned false.
-- Redirected stderr to stdout for flush error output.
-- %URI.DisableExternal will now use the host in %URI.Base if %URI.Host is not
-  available.
-- Do not re-munge URL if the output URL has the same host as the input URL.
-  Requested by Chris.
-- Fix error in documentation regarding %Filter.ExtractStyleBlocks
-- Prevent <![CDATA[<body></body>]]> from triggering %Core.ConvertDocumentToFragment
-- Fix bug with inline elements in blockquotes conflicting with strict doctype
-- Detect if HTML support is disabled for DOM by checking for loadHTML() method.
-- Fix bug where dots and double-dots in absolute URLs without hostname were
-  not collapsed by URIFilter_MakeAbsolute.
-- Fix bug with anonymous modules operating on SafeEmbed or SafeObject elements
-  by reordering their addition.
-- Will now throw exception on many error conditions during lexer creation; also
-  throw an exception when MaintainLineNumbers is true, but a non-tracksLineNumbers
-  is being used.
-- Detect if domxml extension is loaded, and use DirectLEx accordingly.
-- Improve handling of big numbers with floating point arithmetic in UnitConverter.
-  Reported by David Morton.
-. Strategy_MakeWellFormed now operates in-place, saving memory and allowing
-  for more interesting filter-backtracking
-. New HTMLPurifier_Injector->rewind() functionality, allows injectors to rewind
-  index to reprocess tokens.
-. StringHashParser now allows for multiline sections with "empty" content;
-  previously the section would remain undefined.
-. Added --quick option to multitest.php, which tests only the most recent
-  release for each series.
-. Added --distro option to multitest.php, which accepts either 'normal' or
-  'standalone'. This supercedes --exclude-normal and --exclude-standalone
-
-3.1.1, released 2008-06-19
-# %URI.Munge now, by default, does not munge resources (for example, <img src="">)
-  In order to enable this again, please set %URI.MungeResources to true.
-! More robust imagecrash protection with height/width CSS with %CSS.MaxImgLength,
-  and height/width HTML with %HTML.MaxImgLength.
-! %URI.MungeSecretKey for secure URI munging. Thanks Chris
-  for sponsoring this feature. Check out the corresponding documentation
-  for details. (Att Nightly testers: The API for this feature changed before
-  the general release. Namely, rename your directives %URI.SecureMungeSecretKey =>
-  %URI.MungeSecretKey and and %URI.SecureMunge => %URI.Munge)
-! Implemented post URI filtering. Set member variable $post to true to set
-  a URIFilter as such.
-! Allow modules to define injectors via $info_injector. Injectors are
-  automatically disabled if injector's needed elements are not found.
-! Support for "safe" objects added, use %HTML.SafeObject and %HTML.SafeEmbed.
-  Thanks Chris for sponsoring. If you've been using ad hoc code from the
-  forums, PLEASE use this instead.
-! Added substitutions for %e, %n, %a and %p in %URI.Munge (in order,
-  embedded, tag name, attribute name, CSS property name). See %URI.Munge
-  for more details. Requested by Jochem Blok.
-- Disable percent height/width attributes for img.
-- AttrValidator operations are now atomic; updates to attributes are not
-  manifest in token until end of operations. This prevents naughty internal
-  code from directly modifying CurrentToken when they're not supposed to.
-  This semantics change was requested by frank farmer.
-- Percent encoding checks enabled for URI query and fragment
-- Fix stray backslashes in font-family; CSS Unicode character escapes are
-  now properly resolved (although *only* in font-family). Thanks Takeshi Terada
-  for reporting.
-- Improve parseCDATA algorithm to take into account newline normalization
-- Account for browser confusion between Yen character and backslash in
-  Shift_JIS encoding. This fix generalizes to any other encoding which is not
-  a strict superset of printable ASCII. Thanks Takeshi Terada for reporting.
-- Fix missing configuration parameter in Generator calls. Thanks vs for the
-  partial patch.
-- Improved adherence to Unicode by checking for non-character codepoints.
-  Thanks Geoffrey Sneddon for reporting. This may result in degraded
-  performance for extremely large inputs.
-- Allow CSS property-value pair ''text-decoration: none''. Thanks Jochem Blok
-  for reporting.
-. Added HTMLPurifier_UnitConverter and HTMLPurifier_Length for convenient
-  handling of CSS-style lengths. HTMLPurifier_AttrDef_CSS_Length now uses
-  this class.
-. API of HTMLPurifier_AttrDef_CSS_Length changed from __construct($disable_negative)
-  to __construct($min, $max). __construct(true) is equivalent to
-  __construct('0').
-. Added HTMLPurifier_AttrDef_Switch class
-. Rename HTMLPurifier_HTMLModule_Tidy->construct() to setup() and bubble method
-  up inheritance hierarchy to HTMLPurifier_HTMLModule. All HTMLModules
-  get this called with the configuration object.  All modules now
-  use this rather than __construct(), although legacy code using constructors
-  will still work--the new format, however, lets modules access the
-  configuration object for HTML namespace dependant tweaks.
-. AttrDef_HTML_Pixels now takes a single construction parameter, pixels.
-. ConfigSchema data-structure heavily optimized; on average it uses a third
-  the memory it did previously. The interface has changed accordingly,
-  consult changes to HTMLPurifier_Config for details.
-. Variable parsing types now are magic integers instead of strings
-. Added benchmark for ConfigSchema
-. HTMLPurifier_Generator requires $config and $context parameters. If you
-  don't know what they should be, use HTMLPurifier_Config::createDefault()
-  and new HTMLPurifier_Context().
-. Printers now properly distinguish between output configuration, and
-  target configuration. This is not applicable to scripts using
-  the Printers for HTML Purifier related tasks.
-. HTML/CSS Printers must be primed with prepareGenerator($gen_config), otherwise
-  fatal errors will ensue.
-. URIFilter->prepare can return false in order to abort loading of the filter
-. Factory for AttrDef_URI implemented, URI#embedded to indicate URI that embeds
-  an external resource.
-. %URI.Munge functionality factored out into a post-filter class.
-. Added CurrentCSSProperty context variable during CSS validation
-
-3.1.0, released 2008-05-18
-# Unnecessary references to objects (vestiges of PHP4) removed from method
-  signatures.  The following methods do not need references when assigning from
-  them and will result in E_STRICT errors if you try:
-    + HTMLPurifier_Config->get*Definition() [* = HTML, CSS]
-    + HTMLPurifier_ConfigSchema::instance()
-    + HTMLPurifier_DefinitionCacheFactory::instance()
-    + HTMLPurifier_DefinitionCacheFactory->create()
-    + HTMLPurifier_DoctypeRegistry->register()
-    + HTMLPurifier_DoctypeRegistry->get()
-    + HTMLPurifier_HTMLModule->addElement()
-    + HTMLPurifier_HTMLModule->addBlankElement()
-    + HTMLPurifier_LanguageFactory::instance()
-# Printer_ConfigForm's get*() functions were static-ified
-# %HTML.ForbiddenAttributes requires attribute declarations to be in the
-  form of tag@attr, NOT tag.attr (which will throw an error and won't do
-  anything). This is for forwards compatibility with XML; you'd do best
-  to migrate an %HTML.AllowedAttributes directives to this syntax too.
-! Allow index to be false for config from form creation
-! Added HTMLPurifier::VERSION constant
-! Commas, not dashes, used for serializer IDs. This change is forwards-compatible
-  and allows for version numbers like "3.1.0-dev".
-! %HTML.Allowed deals gracefully with whitespace anywhere, anytime!
-! HTML Purifier's URI handling is a lot more robust, with much stricter
-  validation checks and better percent encoding handling. Thanks Gareth Heyes
-  for indicating security vulnerabilities from lax percent encoding.
-! Bootstrap autoloader deals more robustly with classes that don't exist,
-  preventing class_exists($class, true) from barfing.
-- InterchangeBuilder now alphabetizes its lists
-- Validation error in configdoc output fixed
-- Iconv and other encoding errors muted even with custom error handlers that
-  do not honor error_reporting
-- Add protection against imagecrash attack with CSS height/width
-- HTMLPurifier::instance() created for consistency, is equivalent to getInstance()
-- Fixed and revamped broken ConfigForm smoketest
-- Bug with bool/null fields in Printer_ConfigForm fixed
-- Bug with global forbidden attributes fixed
-- Improved error messages for allowed and forbidden HTML elements and attributes
-- Missing (or null) in configdoc documentation restored
-- If DOM throws and exception during parsing with PH5P (occurs in newer versions
-  of DOM), HTML Purifier punts to DirectLex
-- Fatal error with unserialization of ScriptRequired
-- Created directories are now chmod'ed properly
-- Fixed bug with fallback languages in LanguageFactory
-- Standalone testing setup properly with autoload
-. Out-of-date documentation revised
-. UTF-8 encoding check optimization as suggested by Diego
-. HTMLPurifier_Error removed in favor of exceptions
-. More copy() function removed; should use clone instead
-. More extensive unit tests for HTMLDefinition
-. assertPurification moved to central harness
-. HTMLPurifier_Generator accepts $config and $context parameters during
-  instantiation, not runtime
-. Double-quotes outside of attribute values are now unescaped
-
-3.1.0rc1, released 2008-04-22
-# Autoload support added. Internal require_once's removed in favor of an
-  explicit require list or autoloading. To use HTML Purifier,
-  you must now either use HTMLPurifier.auto.php
-  or HTMLPurifier.includes.php; setting the include path and including
-  HTMLPurifier.php is insufficient--in such cases include HTMLPurifier.autoload.php
-  as well to register our autoload handler (or modify your autoload function
-  to check HTMLPurifier_Bootstrap::getPath($class)). You can also use
-  HTMLPurifier.safe-includes.php for a less performance friendly but more
-  user-friendly library load.
-# HTMLPurifier_ConfigSchema static functions are officially deprecated. Schema
-  information is stored in the ConfigSchema directory, and the
-  maintenance/generate-schema-cache.php generates the schema.ser file, which
-  is now instantiated. Support for userland schema changes coming soon!
-# HTMLPurifier_Config will now throw E_USER_NOTICE when you use a directive
-  alias; to get rid of these errors just modify your configuration to use
-  the new directive name.
-# HTMLPurifier->addFilter is deprecated; built-in filters can now be
-  enabled using %Filter.$filter_name or by setting your own filters using
-  %Filter.Custom
-# Directive-level safety properties superceded in favor of module-level
-  safety. Internal method HTMLModule->addElement() has changed, although
-  the externally visible HTMLDefinition->addElement has *not* changed.
-! Extra utility classes for testing and non-library operations can
-  be found in extras/. Specifically, these are FSTools and ConfigDoc.
-  You may find a use for these in your own project, but right now they
-  are highly experimental and volatile.
-! Integration with PHPT allows for automated smoketests
-! Limited support for proprietary HTML elements, namely <marquee>, sponsored
-  by Chris. You can enable them with %HTML.Proprietary if your client
-  demands them.
-! Support for !important CSS cascade modifier. By default, this will be stripped
-  from CSS, but you can enable it using %CSS.AllowImportant
-! Support for display and visibility CSS properties added, set %CSS.AllowTricky
-  to true to use them.
-! HTML Purifier now has its own Exception hierarchy under HTMLPurifier_Exception.
-  Developer error (not enduser error) can cause these to be triggered.
-! Experimental kses() wrapper introduced with HTMLPurifier.kses.php
-! Finally %CSS.AllowedProperties for tweaking allowed CSS properties without
-  mucking around with HTMLPurifier_CSSDefinition
-! ConfigDoc output has been enhanced with version and deprecation info.
-! %HTML.ForbiddenAttributes and %HTML.ForbiddenElements implemented.
-- Autoclose now operates iteratively, i.e. <span><span><div> now has
-  both span tags closed.
-- Various HTMLPurifier_Config convenience functions now accept another parameter
-  $schema which defines what HTMLPurifier_ConfigSchema to use besides the
-  global default.
-- Fix bug with trusted script handling in libxml versions later than 2.6.28.
-- Fix bug in ExtractStyleBlocks with comments in style tags
-- Fix bug in comment parsing for DirectLex
-- Flush output now displayed when in command line mode for unit tester
-- Fix bug with rgb(0, 1, 2) color syntax with spaces inside shorthand syntax
-- HTMLPurifier_HTMLDefinition->addAttribute can now be called multiple times
-  on the same element without emitting errors.
-- Fixed fatal error in PH5P lexer with invalid tag names
-. Plugins now get their own changelogs according to project conventions.
-. Convert tokens to use instanceof, reducing memory footprint and
-  improving comparison speed.
-. Dry runs now supported in SimpleTest; testing facilities improved
-. Bootstrap class added for handling autoloading functionality
-. Implemented recursive glob at FSTools->globr
-. ConfigSchema now has instance methods for all corresponding define*
-  static methods.
-. A couple of new historical maintenance scripts were added.
-. HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php split into two files
-. tests/index.php can now be run from any directory.
-. HTMLPurifier_Token subclasses split into seperate files
-. HTMLPURIFIER_PREFIX now is defined in Bootstrap.php, NOT HTMLPurifier.php
-. HTMLPURIFIER_PREFIX can now be defined outside of HTML Purifier
-. New --php=php flag added, allows PHP executable to be specified (command
-  line only!)
-. htmlpurifier_add_test() preferred method to translate test files in to
-  classes, because it handles PHPT files too.
-. Debugger class is deprecated and will be removed soon.
-. Command line argument parsing for testing scripts revamped, now --opt value
-  format is supported.
-. Smoketests now cleanup after magic quotes
-. Generator now can output comments (however, comments are still stripped
-  from HTML Purifier output)
-. HTMLPurifier_ConfigSchema->validate() deprecated in favor of
-  HTMLPurifier_VarParser->parse()
-. Integers auto-cast into float type by VarParser.
-. HTMLPURIFIER_STRICT removed; no validation is performed on runtime, only
-  during cache generation
-. Reordered script calls in maintenance/flush.php
-. Command line scripts now honor exit codes
-. When --flush fails in unit testers, abort tests and print message
-. Improved documentation in docs/dev-flush.html about the maintenance scripts
-. copy() methods removed in favor of clone keyword
-
-3.0.0, released 2008-01-06
-# HTML Purifier is PHP 5 only! The 2.1.x branch will be maintained
-  until PHP 4 is completely deprecated, but no new features will be added
-  to it.
-  + Visibility declarations added
-  + Constructor methods renamed to __construct()
-  + PHP4 reference cruft removed (in progress)
-! CSS properties are now case-insensitive
-! DefinitionCacheFactory now can register new implementations
-! New HTMLPurifier_Filter_ExtractStyleBlocks for extracting <style> from
-  documents and cleaning their contents up. Requires the CSSTidy library
-  <http://csstidy.sourceforge.net/>. You can access the blocks with the
-  'StyleBlocks' Context variable ($purifier->context->get('StyleBlocks')).
-  The output CSS can also be "scoped" for a specific element, use:
-  %Filter.ExtractStyleBlocksScope
-! Experimental support for some proprietary CSS attributes allowed:
-  opacity (and all of the browser-specific equivalents) and scrollbar colors.
-  Enable by setting %CSS.Proprietary to true.
-- Colors missing # but in hex form will be corrected
-- CSS Number algorithm improved
-- Unit testing and multi-testing now on steroids: command lines,
-  XML output, and other goodies now added.
-. Unit tests for Injector improved
-. New classes:
-  + HTMLPurifier_AttrDef_CSS_AlphaValue
-  + HTMLPurifier_AttrDef_CSS_Filter
-. Multitest now has a file docblock
-
-2.1.3, released 2007-11-05
-! tests/multitest.php allows you to test multiple versions by running
-  tests/index.php through multiple interpreters using `phpv` shell
-  script (you must provide this script!)
-- Fixed poor include ordering for Email URI AttrDefs, causes fatal errors
-  on some systems.
-- Injector algorithm further refined: off-by-one error regarding skip
-  counts for dormant injectors fixed
-- Corrective blockquote definition now enabled for HTML 4.01 Strict
-- Fatal error when <img> tag (or any other element with required attributes)
-  has 'id' attribute fixed, thanks NykO18 for reporting
-- Fix warning emitted when a non-supported URI scheme is passed to the
-  MakeAbsolute URIFilter, thanks NykO18 (again)
-- Further refine AutoParagraph injector. Behavior inside of elements
-  allowing paragraph tags clarified: only inline content delimeted by
-  double newlines (not block elements) are paragraphed.
-- Buggy treatment of end tags of elements that have required attributes
-  fixed (does not manifest on default tag-set)
-- Spurious internal content reorganization error suppressed
-- HTMLDefinition->addElement now returns a reference to the created
-  element object, as implied by the documentation
-- Phorum mod's HTML Purifier help message expanded (unreleased elsewhere)
-- Fix a theoretical class of infinite loops from DirectLex reported
-  by Nate Abele
-- Work around unnecessary DOMElement type-cast in PH5P that caused errors
-  in PHP 5.1
-- Work around PHP 4 SimpleTest lack-of-error complaining for one-time-only
-  HTMLDefinition errors, this may indicate problems with error-collecting
-  facilities in PHP 5
-- Make ErrorCollectorEMock work in both PHP 4 and PHP 5
-- Make PH5P work with PHP 5.0 by removing unnecessary array parameter typedef
-. %Core.AcceptFullDocuments renamed to %Core.ConvertDocumentToFragment
-  to better communicate its purpose
-. Error unit tests can now specify the expectation of no errors. Future
-  iterations of the harness will be extremely strict about what errors
-  are allowed
-. Extend Injector hooks to allow for more powerful injector routines
-. HTMLDefinition->addBlankElement created, as according to the HTMLModule
-  method
-. Doxygen configuration file updated, with minor improvements
-. Test runner now checks for similarly named files in conf/ directory too.
-. Minor cosmetic change to flush-definition-cache.php: trailing newline is
-  outputted
-. Maintenance script for generating PH5P patch added, original PH5P source
-  file also added under version control
-. Full unit test runner script title made more descriptive with PHP version
-. Updated INSTALL file to state that 4.3.7 is the earliest version we
-  are actively testing
-
-2.1.2, released 2007-09-03
-! Implemented Object module for trusted users
-! Implemented experimental HTML5 parsing mode using PH5P. To use, add
-  this to your code:
-        require_once 'HTMLPurifier/Lexer/PH5P.php';
-        $config->set('Core', 'LexerImpl', 'PH5P');
-  Note that this Lexer introduces some classes not in the HTMLPurifier
-  namespace.  Also, this is PHP5 only.
-! CSS property border-spacing implemented
-- Fix non-visible parsing error in DirectLex with empty tags that have
-  slashes inside attribute values.
-- Fix typo in CSS definition: border-collapse:seperate; was incorrectly
-  accepted as valid CSS. Usually non-visible, because this styling is the
-  default for tables in most browsers. Thanks Brett Zamir for pointing
-  this out.
-- Fix validation errors in configuration form
-- Hammer out a bunch of edge-case bugs in the standalone distribution
-- Inclusion reflection removed from URISchemeRegistry; you must manually
-  include any new schema files you wish to use
-- Numerous typo fixes in documentation thanks to Brett Zamir
-. Unit test refactoring for one logical test per test function
-. Config and context parameters in ComplexHarness deprecated: instead, edit
-  the $config and $context member variables
-. HTML wrapper in DOMLex now takes DTD identifiers into account; doesn't
-  really make a difference, but is good for completeness sake
-. merge-library.php script refactored for greater code reusability and
-  PHP4 compatibility
-
-2.1.1, released 2007-08-04
-- Fix show-stopper bug in %URI.MakeAbsolute functionality
-- Fix PHP4 syntax error in standalone version
-. Add prefix directory to include path for standalone, this prevents
-  other installations from clobbering the standalone's URI schemes
-. Single test methods can be invoked by prefixing with __only
-
-2.1.0, released 2007-08-02
-# flush-htmldefinition-cache.php superseded in favor of a generic
-  flush-definition-cache.php script, you can clear a specific cache
-  by passing its name as a parameter to the script
-! Phorum mod implemented for HTML Purifier
-! With %Core.AggressivelyFixLt, <3 and similar emoticons no longer
-  trigger HTML removal in PHP5 (DOMLex). This directive is not necessary
-  for PHP4 (DirectLex).
-! Standalone file now available, which greatly reduces the amount of
-  includes (although there are still a few files that reside in the
-  standalone folder)
-! Relative URIs can now be transformed into their absolute equivalents
-  using %URI.Base and %URI.MakeAbsolute
-! Ruby implemented for XHTML 1.1
-! You can now define custom URI filtering behavior, see enduser-uri-filter.html
-  for more details
-! UTF-8 font names now supported in CSS
-- AutoFormatters emit friendly error messages if tags or attributes they
-  need are not allowed
-- ConfigForm's compactification of directive names is now configurable
-- AutoParagraph autoformatter algorithm refined after field-testing
-- XHTML 1.1 now applies XHTML 1.0 Strict cleanup routines, namely
-  blockquote wrapping
-- Contents of <style> tags removed by default when tags are removed
-. HTMLPurifier_Config->getSerial() implemented, this is extremely useful
-  for output cache invalidation
-. ConfigForm printer now can retrieve CSS and JS files as strings, in
-  case HTML Purifier's directory is not publically accessible
-. Introduce new text/itext configuration directive values: these represent
-  longer strings that would be more appropriately edited with a textarea
-. Allow newlines to act as separators for lists, hashes, lookups and
-  %HTML.Allowed
-. ConfigForm generates textareas instead of text inputs for lists, hashes,
-  lookups, text and itext fields
-. Hidden element content removal genericized: %Core.HiddenElements can
-  be used to customize this behavior, by default <script> and <style> are
-  hidden
-. Added HTMLPURIFIER_PREFIX constant, should be used instead of dirname(__FILE__)
-. Custom ChildDef added to default include list
-. URIScheme reflection improved: will not attempt to include file if class
-  already exists. May clobber autoload, so I need to keep an eye on it
-. ConfigSchema heavily optimized, will only collect information and validate
-  definitions when HTMLPURIFIER_SCHEMA_STRICT is true.
-. AttrDef_URI unit tests and implementation refactored
-. benchmarks/ directory now protected from public view with .htaccess file;
-  run the tests via command line
-. URI scheme is munged off if there is no authority and the scheme is the
-  default one
-. All unit tests inherit from HTMLPurifier_Harness, not UnitTestCase
-. Interface for URIScheme changed
-. Generic URI object to hold components of URI added, most systems involved
-  in URI validation have been migrated to use it
-. Custom filtering for URIs factored out to URIDefinition interface for
-  maximum extensibility
-
-2.0.1, released 2007-06-27
-! Tag auto-closing now based on a ChildDef heuristic rather than a
-  manually set auto_close array; some behavior may change
-! Experimental AutoFormat functionality added: auto-paragraph and
-  linkify your HTML input by setting %AutoFormat.AutoParagraph and
-  %AutoFormat.Linkify to true
-! Newlines normalized internally, and then converted back to the
-  value of PHP_EOL. If this is not desired, set your newline format
-  using %Output.Newline.
-! Beta error collection, messages are implemented for the most generic
-  cases involving Lexing or Strategies
-- Clean up special case code for <script> tags
-- Reorder includes for DefinitionCache decorators, fixes a possible
-  missing class error
-- Fixed bug where manually modified definitions were not saved via cache
-  (mostly harmless, except for the fact that it would be a little slower)
-- Configuration objects with different serials do not clobber each
-  others when revision numbers are unequal
-- Improve Serializer DefinitionCache directory permissions checks
-- DefinitionCache no longer throws errors when it encounters old
-  serial files that do not conform to the current style
-- Stray xmlns attributes removed from configuration documentation
-- configForm.php smoketest no longer has XSS vulnerability due to
-  unescaped print_r output
-- Printer adheres to configuration's directives on output format
-- Fix improperly named form field in ConfigForm printer
-. Rewire some test-cases to swallow errors rather than expect them
-. HTMLDefinition printer updated with some of the new attributes
-. DefinitionCache keys reordered to reflect precedence: version number,
-  hash, then revision number
-. %Core.DefinitionCache renamed to %Cache.DefinitionImpl
-. Interlinking in configuration documentation added using
-  Injector_PurifierLinkify
-. Directives now keep track of aliases to themselves
-. Error collector now requires a severity to be passed, use PHP's internal
-  error constants for this
-. HTMLPurifier_Config::getAllowedDirectivesForForm implemented, allows
-  much easier selective embedding of configuration values
-. Doctype objects now accept public and system DTD identifiers
-. %HTML.Doctype is now constrained by specific values, to specify a custom
-  doctype use new %HTML.CustomDoctype
-. ConfigForm truncates long directives to keep the form small, and does
-  not re-output namespaces
-
-2.0.0, released 2007-06-20
-# Completely refactored HTMLModuleManager, decentralizing safety
-  information
-# Transform modules changed to Tidy modules, which offer more flexibility
-  and better modularization
-# Configuration object now finalizes itself when a read operation is
-  performed on it, ensuring that its internal state stays consistent.
-  To revert this behavior, you can set the $autoFinalize member variable
-  off, but it's not recommended.
-# New compact syntax for AttrDef objects that can be used to instantiate
-  new objects via make()
-# Definitions (esp. HTMLDefinition) are now cached for a significant
-  performance boost. You can disable caching by setting %Core.DefinitionCache
-  to null. You CANNOT edit raw definitions without setting the corresponding
-  DefinitionID directive (%HTML.DefinitionID for HTMLDefinition).
-# Contents between <script> tags are now completely removed if <script>
-  is not allowed
-# Prototype-declarations for Lexer removed in favor of configuration
-  determination of Lexer implementations.
-! HTML Purifier now works in PHP 4.3.2.
-! Configuration form-editing API makes tweaking HTMLPurifier_Config a
-  breeze!
-! Configuration directives that accept hashes now allow new string
-  format: key1:value1,key2:value2
-! ConfigDoc now factored into OOP design
-! All deprecated elements now natively supported
-! Implement TinyMCE styled whitelist specification format in
-  %HTML.Allowed
-! Config object gives more friendly error messages when things go wrong
-! Advanced API implemented: easy functions for creating elements (addElement)
-  and attributes (addAttribute) on HTMLDefinition
-! Add native support for required attributes
-- Deprecated and removed EnableRedundantUTF8Cleaning. It didn't even work!
-- DOMLex will not emit errors when a custom error handler that does not
-  honor error_reporting is used
-- StrictBlockquote child definition refrains from wrapping whitespace
-  in tags now.
-- Bug resulting from tag transforms to non-allowed elements fixed
-- ChildDef_Custom's regex generation has been improved, removing several
-  false positives
-. Unit test for ElementDef created, ElementDef behavior modified to
-  be more flexible
-. Added convenience functions for HTMLModule constructors
-. AttrTypes now has accessor functions that should be used instead
-  of directly manipulating info
-. TagTransform_Center deprecated in favor of generic TagTransform_Simple
-. Add extra protection in AttrDef_URI against phantom Schemes
-. Doctype object added to HTMLDefinition which describes certain aspects
-  of the operational document type
-. Lexer is now pre-emptively included, with a conditional include for the
-  PHP5 only version.
-. HTMLDefinition and CSSDefinition have a common parent class: Definition.
-. DirectLex can now track line-numbers
-. Preliminary error collector is in place, although no code actually reports
-  errors yet
-. Factor out most of ValidateAttributes to new AttrValidator class
-
-1.6.1, released 2007-05-05
-! Support for more deprecated attributes via transformations:
-  + hspace and vspace in img
-  + size and noshade in hr
-  + nowrap in td
-  + clear in br
-  + align in caption, table, img and hr
-  + type in ul, ol and li
-! DirectLex now preserves text in which a < bracket is followed by
-  a non-alphanumeric character. This means that certain emoticons
-  are now preserved.
-! %Core.RemoveInvalidImg is now operational, when set to false invalid
-  images will hang around with an empty src
-! target attribute in a tag supported, use %Attr.AllowedFrameTargets
-  to enable
-! CSS property white-space now allows nowrap (supported in all modern
-  browsers) but not others (which have spotty browser implementations)
-! XHTML 1.1 mode now sort-of works without any fatal errors, and
-  lang is now moved over to xml:lang.
-! Attribute transformation smoketest available at smoketests/attrTransform.php
-! Transformation of font's size attribute now handles super-large numbers
-- Possibly fatal bug with __autoload() fixed in module manager
-- Invert HTMLModuleManager->addModule() processing order to check
-  prefixes first and then the literal module
-- Empty strings get converted to empty arrays instead of arrays with
-  an empty string in them.
-- Merging in attribute lists now works.
-. Demo script removed: it has been added to the website's repository
-. Basic.php script modified to work out of the box
-. Refactor AttrTransform classes to reduce duplication
-. AttrTransform_TextAlign axed in favor of a more general
-  AttrTransform_EnumToCSS, refer to HTMLModule/TransformToStrict.php to
-  see how the new equivalent is implemented
-. Unit tests now use exclusively assertIdentical
-
-1.6.0, released 2007-04-01
-! Support for most common deprecated attributes via transformations:
-  + bgcolor in td, th, tr and table
-  + border in img
-  + name in a and img
-  + width in td, th and hr
-  + height in td, th
-! Support for CSS attribute 'height' added
-! Support for rel and rev attributes in a tags added, use %Attr.AllowedRel
-  and %Attr.AllowedRev to activate
-- You can define ID blacklists using regular expressions via
-  %Attr.IDBlacklistRegexp
-- Error messages are emitted when you attempt to "allow" elements or
-  attributes that HTML Purifier does not support
-- Fix segfault in unit test. The problem is not very reproduceable and
-  I don't know what causes it, but a six line patch fixed it.
-
-1.5.0, released 2007-03-23
-! Added a rudimentary I18N and L10N system modeled off MediaWiki. It
-  doesn't actually do anything yet, but keep your eyes peeled.
-! docs/enduser-utf8.html explains how to use UTF-8 and HTML Purifier
-! Newly structured HTMLDefinition modeled off of XHTML 1.1 modules.
-  I am loathe to release beta quality APIs, but this is exactly that;
-  don't use the internal interfaces if you're not willing to do migration
-  later on.
-- Allow 'x' subtag in language codes
-- Fixed buggy chameleon-support for ins and del
-. Added support for IDREF attributes (i.e. for)
-. Renamed HTMLPurifier_AttrDef_Class to HTMLPurifier_AttrDef_Nmtokens
-. Removed context variable ParentType, replaced with IsInline, which
-  is false when you're not inline and an integer of the parent that
-  caused you to become inline when you are (so possibly zero)
-. Removed ElementDef->type in favor of ElementDef->descendants_are_inline
-  and HTMLDefinition->content_sets
-. StrictBlockquote now reports what elements its supposed to allow,
-  rather than what it does allow
-. Removed HTMLDefinition->info_flow_elements in favor of
-  HTMLDefinition->content_sets['Flow']
-. Removed redundant "exclusionary" definitions from DTD roster
-. StrictBlockquote now requires a construction parameter as if it
-  were an Required ChildDef, this is the "real" set of allowed elements
-. AttrDef partitioned into HTML, CSS and URI segments
-. Modify Youtube filter regexp to be multiline
-. Require both PHP5 and DOM extension in order to use DOMLex, fixes
-  some edge cases where a DOMDocument class exists in a PHP4 environment
-  due to DOM XML extension.
-
-1.4.1, released 2007-01-21
-! docs/enduser-youtube.html updated according to new functionality
-- YouTube IDs can have underscores and dashes
-
-1.4.0, released 2007-01-21
-! Implemented list-style-image, URIs now allowed in list-style
-! Implemented background-image, background-repeat, background-attachment
-  and background-position CSS properties. Shorthand property background
-  supports all of these properties.
-! Configuration documentation looks nicer
-! Added %Core.EscapeNonASCIICharacters to workaround loss of Unicode
-  characters while %Core.Encoding is set to a non-UTF-8 encoding.
-! Support for configuration directive aliases added
-! Config object can now be instantiated from ini files
-! YouTube preservation code added to the core, with two lines of code
-  you can add it as a filter to your code. See smoketests/preserveYouTube.php
-  for sample code.
-! Moved SLOW to docs/enduser-slow.html and added code examples
-- Replaced version check with functionality check for DOM (thanks Stephen
-  Khoo)
-. Added smoketest 'all.php', which loads all other smoketests via frames
-. Implemented AttrDef_CSSURI for url(http://google.com) style declarations
-. Added convenient single test selector form on test runner
-
-1.3.2, released 2006-12-25
-! HTMLPurifier object now accepts configuration arrays, no need to manually
-  instantiate a configuration object
-! Context object now accessible to outside
-! Added enduser-youtube.html, explains how to embed YouTube videos. See
-  also corresponding smoketest preserveYouTube.php.
-! Added purifyArray(), which takes a list of HTML and purifies it all
-! Added static member variable $version to HTML Purifier with PHP-compatible
-  version number string.
-- Fixed fatal error thrown by upper-cased language attributes
-- printDefinition.php: added labels, added better clarification
-. HTMLPurifier_Config::create() added, takes mixed variable and converts into
-  a HTMLPurifier_Config object.
-
-1.3.1, released 2006-12-06
-! Added HTMLPurifier.func.php stub for a convenient function to call the library
-- Fixed bug in RemoveInvalidImg code that caused all images to be dropped
-  (thanks to .mario for reporting this)
-. Standardized all attribute handling variables to attr, made it plural
-
-1.3.0, released 2006-11-26
-# Invalid images are now removed, rather than replaced with a dud
-  <img src="" alt="Invalid image" />. Previous behavior can be restored
-  with new directive %Core.RemoveInvalidImg set to false.
-! (X)HTML Strict now supported
-  + Transparently handles inline elements in block context (blockquote)
-! Added GET method to demo for easier validation, added 50kb max input size
-! New directive %HTML.BlockWrapper, for block-ifying inline elements
-! New directive %HTML.Parent, allows you to only allow inline content
-! New directives %HTML.AllowedElements and %HTML.AllowedAttributes to let
-  users narrow the set of allowed tags
-! <li value="4"> and <ul start="2"> now allowed in loose mode
-! New directives %URI.DisableExternalResources and %URI.DisableResources
-! New directive %Attr.DisableURI, which eliminates all hyperlinking
-! New directive %URI.Munge, munges URI so you can use some sort of redirector
-  service to avoid PageRank leaks or warn users that they are exiting your site.
-! Added spiffy new smoketest printDefinition.php, which lets you twiddle with
-  the configuration settings and see how the internal rules are affected.
-! New directive %URI.HostBlacklist for blocking links to bad hosts.
-  xssAttacks.php smoketest updated accordingly.
-- Added missing type to ChildDef_Chameleon
-- Remove Tidy option from demo if there is not Tidy available
-. ChildDef_Required guards against empty tags
-. Lookup table HTMLDefinition->info_flow_elements added
-. Added peace-of-mind variable initialization to Strategy_FixNesting
-. Added HTMLPurifier->info_parent_def, parent child processing made special
-. Added internal documents briefly summarizing future progression of HTML
-. HTMLPurifier_Config->getBatch($namespace) added
-. More lenient casting to bool from string in HTMLPurifier_ConfigSchema
-. Refactored ChildDef classes into their own files
-
-1.2.0, released 2006-11-19
-# ID attributes now disabled by default. New directives:
-  + %HTML.EnableAttrID - restores old behavior by allowing IDs
-  + %Attr.IDPrefix - %Attr.IDBlacklist alternative that munges all user IDs
-    so that they don't collide with your IDs
-  + %Attr.IDPrefixLocal - Same as above, but for when there are multiple
-    instances of user content on the page
-  + Profuse documentation on how to use these available in docs/enduser-id.txt
-! Added MODx plugin <http://modxcms.com/forums/index.php/topic,6604.0.html>
-! Added percent encoding normalization
-! XSS attacks smoketest given facelift
-! Configuration documentation now has table of contents
-! Added %URI.DisableExternal, which prevents links to external websites.  You
-  can also use %URI.Host to permit absolute linking to subdomains
-! Non-accessible resources (ex. mailto) blocked from embedded URIs (img src)
-- Type variable in HTMLDefinition was not being set properly, fixed
-- Documentation updated
-  + TODO added request Phalanger
-  + TODO added request Native compression
-  + TODO added request Remove redundant tags
-  + TODO added possible plaintext formatter for HTML Purifier documentation
-  + Updated ConfigDoc TODO
-  + Improved inline comments in AttrDef/Class.php, AttrDef/CSS.php
-    and AttrDef/Host.php
-  + Revamped documentation into HTML, along with misc updates
-- HTMLPurifier_Context doesn't throw a variable reference error if you attempt
-  to retrieve a non-existent variable
-. Switched to purify()-wide Context object registry
-. Refactored unit tests to minimize duplication
-. XSS attack sheet updated
-. configdoc.xml now has xml:space attached to default value nodes
-. Allow configuration directives to permit null values
-. Cleaned up test-cases to remove unnecessary swallowErrors()
-
-1.1.2, released 2006-09-30
-! Add HTMLPurifier.auto.php stub file that configures include_path
-- Documentation updated
-  + INSTALL document rewritten
-  + TODO added semi-lossy conversion
-  + API Doxygen docs' file exclusions updated
-  + Added notes on HTML versus XML attribute whitespace handling
-  + Noted that HTMLPurifier_ChildDef_Custom isn't being used
-  + Noted that config object's definitions are cached versions
-- Fixed lack of attribute parsing in HTMLPurifier_Lexer_PEARSax3
-- ftp:// URIs now have their typecodes checked
-- Hooked up HTMLPurifier_ChildDef_Custom's unit tests (they weren't being run)
-. Line endings standardized throughout project (svn:eol-style standardized)
-. Refactored parseData() to general Lexer class
-. Tester named "HTML Purifier" not "HTMLPurifier"
-
-1.1.1, released 2006-09-24
-! Configuration option to optionally Tidy up output for indentation to make up
-  for dropped whitespace by DOMLex (pretty-printing for the entire application
-  should be done by a page-wide Tidy)
-- Various documentation updates
-- Fixed parse error in configuration documentation script
-- Fixed fatal error in benchmark scripts, slightly augmented
-- As far as possible, whitespace is preserved in-between table children
-- Sample test-settings.php file included
-
-1.1.0, released 2006-09-16
-! Directive documentation generation using XSLT
-! XHTML can now be turned off, output becomes <br>
-- Made URI validator more forgiving: will ignore leading and trailing
-  quotes, apostrophes and less than or greater than signs.
-- Enforce alphanumeric namespace and directive names for configuration.
-- Table child definition made more flexible, will fix up poorly ordered elements
-. Renamed ConfigDef to ConfigSchema
-
-1.0.1, released 2006-09-04
-- Fixed slight bug in DOMLex attribute parsing
-- Fixed rejection of case-insensitive configuration values when there is a
-  set of allowed values.  This manifested in %Core.Encoding.
-- Fixed rejection of inline style declarations that had lots of extra
-  space in them.  This manifested in TinyMCE.
-
-1.0.0, released 2006-09-01
-! Shorthand CSS properties implemented: font, border, background, list-style
-! Basic color keywords translated into hexadecimal values
-! Table CSS properties implemented
-! Support for charsets other than UTF-8 (defined by iconv)
-! Malformed UTF-8 and non-SGML character detection and cleaning implemented
-- Fixed broken numeric entity conversion
-- API documentation completed
-. (HTML|CSS)Definition de-singleton-ized
-
-1.0.0beta, released 2006-08-16
-! First public release, most functionality implemented. Notable omissions are:
-  + Shorthand CSS properties
-  + Table CSS properties
-  + Deprecated attribute transformations
-
-    vim: et sw=4 sts=4

+ 0 - 131
main/inc/lib/htmlpurifier/TODO

@@ -1,131 +0,0 @@
-
-TODO List
-
-= KEY ====================
-    # Flagship
-    - Regular
-    ? Maybe I'll Do It
-==========================
-
-If no interest is expressed for a feature that may require a considerable
-amount of effort to implement, it may get endlessly delayed. Do not be
-afraid to cast your vote for the next feature to be implemented!
-
-- Investigate how early internal structures can be accessed; this would
-  prevent structures from being parsed and serialized multiple times.
-- Built-in support for target="_blank" on all external links
-- Allow <a id="asdf" name="asdf">
-- Convert configuration to allow an arbitrary number of namespaces;
-  then rename as appropriate.
-
-FUTURE VERSIONS
----------------
-
-4.1 release [It's All About Trust] (floating)
- # Implement untrusted, dangerous elements/attributes
- # Implement IDREF support (harder than it seems, since you cannot have
-   IDREFs to non-existent IDs)
- # Frameset XHTML 1.0 and HTML 4.01 doctypes
- - Implement <area>
- - Figure out how to simultaneously set %CSS.Trusted and %HTML.Trusted (?)
-
-4.2 release [Error'ed]
- # Error logging for filtering/cleanup procedures
- - XSS-attempt detection--certain errors are flagged XSS-like
-
-4.3 release [Do What I Mean, Not What I Say]
- # Additional support for poorly written HTML
-    - Microsoft Word HTML cleaning (i.e. MsoNormal, but research essential!)
-    - Friendly strict handling of <address> (block -> <br>)
- ? Remove redundant tags, ex. <u><u>Underlined</u></u>. Implementation notes:
-    1. Analyzing which tags to remove duplicants
-    2. Ensure attributes are merged into the parent tag
-    3. Extend the tag exclusion system to specify whether or not the
-    contents should be dropped or not (currently, there's code that could do
-    something like this if it didn't drop the inner text too.)
- - Remove <span> tags that don't do anything (no attributes)
- - Append something to duplicate IDs so they're still usable (impl. note: the
-   dupe detector would also need to detect the suffix as well)
- - Externalize inline CSS to promote clean HTML, proposed by Sander Tekelenburg
-
-5.0 release [Beyond HTML]
- # Legit token based CSS parsing (will require revamping almost every
-   AttrDef class). Probably will use CSSTidy class?
- # More control over allowed CSS properties using a modularization
- # HTML 5 support
- # IRI support (this includes IDN)
- - Standardize token armor for all areas of processing
- - Convert RTL/LTR override characters to <bdo> tags, or vice versa on demand.
-   Also, enable disabling of directionality
-
-6.0 release [To XML and Beyond]
- - Extended HTML capabilities based on namespacing and tag transforms (COMPLEX)
-    - Hooks for adding custom processors to custom namespaced tags and
-      attributes, offer default implementation
-    - Lots of documentation and samples
-
-Ongoing
- - More refactoring to take advantage of PHP5's facilities
- - Refactor unit tests into lots of test methods
- - Plugins for major CMSes (COMPLEX)
-    - phpBB
-    - Drupal needs loving!
-    - Phorum need loving!
-    - more! (look for ones that use WYSIWYGs)
-    - Also, maybe a FAQ for extension writers with HTML Purifier
-
-AutoFormat
- - Smileys
- - Syntax highlighting (with GeSHi) with <pre> and possibly <?php
- - Look at http://drupal.org/project/Modules/category/63 for ideas
-
-Optimizations
- - Reduce size of internal data-structures (esp. HTMLDefinition)
- - Research memory usage of objects versus arrays
- - Combine multiple strategies into a single, single-pass strategy
- - Get PH5P working with the latest versions of DOM, which have much more
-   stringent error checking procedures. Maybe convert straight to tokens.
- - Get rid of set_include_path(). Save this for another major release.
-
-Neat feature related
- ! Factor demo.php into a set of Printer classes, and then create a stub
-   file for users here (inside the actual HTML Purifier library)
- ! Support exporting configuration, so users can easily tweak settings
-   in the demo, and then copy-paste into their own setup
- - Advanced URI filtering schemes (see docs/proposal-new-directives.txt)
- - Allow scoped="scoped" attribute in <style> tags; may be troublesome
-   because regular CSS has no way of uniquely identifying nodes, so we'd
-   have to generate IDs
- - Explain how to use HTML Purifier in non-PHP languages / create
-   a simple command line stub (or complicated?)
- - Fixes for Firefox's inability to handle COL alignment props (Bug 915)
- - Automatically add non-breaking spaces to empty table cells when
-   empty-cells:show is applied to have compatibility with Internet Explorer
- - Table of Contents generation (XHTML Compiler might be reusable). May also
-   be out-of-band information.
- - Full set of color keywords. Also, a way to add onto them without
-   finalizing the configuration object.
- - Write a var_export and memcached DefinitionCache - Denis
- - Allow restriction of allowed class values
-
-Maintenance related (slightly boring)
- # CHMOD install script for PEAR installs
- ! Factor out command line parser into its own class, and unit test it
- ! Nested configuration namespaces
- - Distinguish between default settings and explicitly set settings, so
-   configurations can be merged
- - Time PHPT tests
-
-ChildDef related (very boring)
- - Abstract ChildDef_BlockQuote to work with all elements that only
-   allow blocks in them, required or optional
- - Implement lenient <ruby> child validation
-
-Wontfix
- - Non-lossy smart alternate character encoding transformations (unless
-   patch provided)
- - Pretty-printing HTML: users can use Tidy on the output on entire page
- - Native content compression, whitespace stripping: use gzip if this is
-   really important
-
-    vim: et sw=4 sts=4

+ 0 - 6
main/inc/lib/htmlpurifier/WHATSNEW

@@ -1,6 +0,0 @@
-HTML Purifier 3.3.0 is fixes a number of obscure bugs reported and fixed
-over a four month period.  It is probably the last release in the 3.x
-series.  Notable new features include support for the overflow CSS
-property; notable bugfixes include fixed YouTube rendering in certain
-versions of Firefox, CSSDefinition Printer, improved early PHP support
-and bugs in iconv.

+ 0 - 1
main/inc/lib/htmlpurifier/benchmarks/.htaccess

@@ -1 +0,0 @@
-Deny from all

+ 0 - 16
main/inc/lib/htmlpurifier/benchmarks/ConfigSchema.php

@@ -1,16 +0,0 @@
-<?php
-
-chdir(dirname(__FILE__));
-
-//require_once '../library/HTMLPurifier.path.php';
-shell_exec('php ../maintenance/generate-schema-cache.php');
-require_once '../library/HTMLPurifier.path.php';
-require_once 'HTMLPurifier.includes.php';
-
-$begin = xdebug_memory_usage();
-
-$schema = HTMLPurifier_ConfigSchema::makeFromSerial();
-
-echo xdebug_memory_usage() - $begin;
-
-// vim: et sw=4 sts=4

+ 0 - 158
main/inc/lib/htmlpurifier/benchmarks/Lexer.php

@@ -1,158 +0,0 @@
-<?php
-
-require_once '../library/HTMLPurifier.auto.php';
-@include_once '../test-settings.php';
-
-// PEAR
-require_once 'Benchmark/Timer.php'; // to do the timing
-require_once 'Text/Password.php'; // for generating random input
-
-$LEXERS = array();
-$RUNS = isset($GLOBALS['HTMLPurifierTest']['Runs'])
-    ? $GLOBALS['HTMLPurifierTest']['Runs'] : 2;
-
-require_once 'HTMLPurifier/Lexer/DirectLex.php';
-$LEXERS['DirectLex'] = new HTMLPurifier_Lexer_DirectLex();
-
-if (version_compare(PHP_VERSION, '5', '>=')) {
-    require_once 'HTMLPurifier/Lexer/DOMLex.php';
-    $LEXERS['DOMLex'] = new HTMLPurifier_Lexer_DOMLex();
-}
-
-// custom class to aid unit testing
-class RowTimer extends Benchmark_Timer
-{
-
-    var $name;
-
-    function RowTimer($name, $auto = false) {
-        $this->name = htmlentities($name);
-        $this->Benchmark_Timer($auto);
-    }
-
-    function getOutput() {
-
-        $total  = $this->TimeElapsed();
-        $result = $this->getProfiling();
-        $dashes = '';
-
-        $out = '<tr>';
-
-        $out .= "<td>{$this->name}</td>";
-
-        $standard = false;
-
-        foreach ($result as $k => $v) {
-            if ($v['name'] == 'Start' || $v['name'] == 'Stop') continue;
-
-            //$perc = (($v['diff'] * 100) / $total);
-            //$tperc = (($v['total'] * 100) / $total);
-
-            //$out .= '<td align="right">' . $v['diff'] . '</td>';
-
-            if ($standard == false) $standard = $v['diff'];
-
-            $perc = $v['diff'] * 100 / $standard;
-            $bad_run = ($v['diff'] < 0);
-
-            $out .= '<td align="right"'.
-                   ($bad_run ? ' style="color:#AAA;"' : '').
-                   '>' . number_format($perc, 2, '.', '') .
-                   '%</td><td>'.number_format($v['diff'],4,'.','').'</td>';
-
-        }
-
-        $out .= '</tr>';
-
-        return $out;
-    }
-}
-
-function print_lexers() {
-    global $LEXERS;
-    $first = true;
-    foreach ($LEXERS as $key => $value) {
-        if (!$first) echo ' / ';
-        echo htmlspecialchars($key);
-        $first = false;
-    }
-}
-
-function do_benchmark($name, $document) {
-    global $LEXERS, $RUNS;
-
-    $config = HTMLPurifier_Config::createDefault();
-    $context = new HTMLPurifier_Context();
-
-    $timer = new RowTimer($name);
-    $timer->start();
-
-    foreach($LEXERS as $key => $lexer) {
-        for ($i=0; $i<$RUNS; $i++) $tokens = $lexer->tokenizeHTML($document, $config, $context);
-        $timer->setMarker($key);
-    }
-
-    $timer->stop();
-    $timer->display();
-}
-
-?>
-<html>
-<head>
-<title>Benchmark: <?php print_lexers(); ?></title>
-</head>
-<body>
-<h1>Benchmark: <?php print_lexers(); ?></h1>
-<table border="1">
-<tr><th>Case</th><?php
-foreach ($LEXERS as $key => $value) {
-    echo '<th colspan="2">' . htmlspecialchars($key) . '</th>';
-}
-?></tr>
-<?php
-
-// ************************************************************************** //
-
-// sample of html pages
-
-$dir = 'samples/Lexer';
-$dh  = opendir($dir);
-while (false !== ($filename = readdir($dh))) {
-
-    if (strpos($filename, '.html') !== strlen($filename) - 5) continue;
-    $document = file_get_contents($dir . '/' . $filename);
-    do_benchmark("File: $filename", $document);
-
-}
-
-// crashers, caused infinite loops before
-
-$snippets = array();
-$snippets[] = '<a href="foo>';
-$snippets[] = '<a "=>';
-
-foreach ($snippets as $snippet) {
-    do_benchmark($snippet, $snippet);
-}
-
-// random input
-
-$random = Text_Password::create(80, 'unpronounceable', 'qwerty <>="\'');
-
-do_benchmark('Random input', $random);
-
-?></table>
-
-<?php
-
-echo '<div>Random input was: ' .
-  '<span colspan="4" style="font-family:monospace;">' .
-  htmlspecialchars($random) . '</span></div>';
-
-?>
-
-
-</body></html>
-<?php
-
-// vim: et sw=4 sts=4

+ 0 - 21
main/inc/lib/htmlpurifier/benchmarks/Trace.php

@@ -1,21 +0,0 @@
-<?php
-
-ini_set('xdebug.trace_format', 1);
-ini_set('xdebug.show_mem_delta', true);
-
-if (file_exists('Trace.xt')) {
-    echo "Previous trace Trace.xt must be removed before this script can be run.";
-    exit;
-}
-
-xdebug_start_trace(dirname(__FILE__) . '/Trace');
-require_once '../library/HTMLPurifier.auto.php';
-
-$purifier = new HTMLPurifier();
-
-$data = $purifier->purify(file_get_contents('samples/Lexer/4.html'));
-xdebug_stop_trace();
-
-echo "Trace finished.";
-
-// vim: et sw=4 sts=4

+ 0 - 55
main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/1.html

@@ -1,55 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<head>
-    <title>Main Page - Huaxia Taiji Club</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <link rel="stylesheet" type="text/css" media="screen, projection" href="/screen.css" />
-    <link rel="stylesheet" type="text/css" media="print" href="/print.css" />
-</head>
-<body>
-
-<div id="translation"><a href="/ch/Main_Page">&#20013;&#25991;</a></div>
-
-<div id="heading"><a href="/en/Main_Page" title="English Main Page">Huaxia Taiji Club</a>
-  <a class="heading_ch" href="/ch/Main_Page" title="&#20013;&#25991;&#20027;&#39029;">&#21326;&#22799;&#22826;&#26497;&#20465;&#20048;&#37096;</a></div>
-<ul id="menu">
-    <li><a href="/en/Main_Page" class="active">Main Page</a></li><li><a href="/en/About">About</a></li><li><a href="/en/News">News</a></li><li><a href="/en/Events">Events</a></li><li><a href="/en/Digest">Digest</a></li><li><a href="/en/Taiji_and_I">Taiji and I</a></li><li><a href="/en/Downloads">Downloads</a></li><li><a href="/en/Registration">Registration</a></li><li><a href="/en/Contact">Contact</a></li>    <li><a href="http://www.taijiclub.org/gallery2/main.php">Gallery</a></li>
-
-    <li><a href="http://www.taijiclub.org/forums/index.php">Forums</a></li>
-
-</ul>
-<div id="content">
-<h1 id="title">Main Page</h1><h2>Taiji (Tai Chi) </h2>
-
-<div id="sidebar">
-<h3>Recent News</h3>
-<ul>
- <li>Zou Xiaojun was elected as the new club vice president </li>
-
- <li>HX Edison Taiji Club <a href="http://www.taijiclub.org/downloads/Taiji_club_regulation_.pdf">by-law</a>  effective 3/28/2006</li>
- <li>A new email account for our club: HXEdisontaijiclub@yahoo.com</li>
-
- <li>Workshop conducted by <a href="http://www.taijiclub.org/ch/Digest/LiDeyin">?????</a> Li Deyin is set on June 4, 2006 at Clarion Hotel in Edison from 9:30am-12pm; <a href="http://www.taijiclub.org/en/Registration">Registration</a></li>
-
-</ul>
-</div>
-
-
-
-<p><i>Taiji</i> is an ancient Chinese tradition of movement systems that is associated with philosophy, physiology, psychology, geometry and dynamics. It is the slowest form of martial arts and is meant to improve the internal spirit.   It is soothing to the soul and extremely invigorating. </p>
-
-<p>The founder of Taiji was Zhang Sanfeng (Chang San-feng), who was a monk of the Wu Dang (Wu Tang) Monastery and lived in the period from 1391 to 1459. His exercises stressed suppleness and elasticity as opposed to the hardness and force of other martial art styles. Several centuries old, Taiji was originally developed as a form of self-defense, emphasizing strength, balance, flexibility and speed. Tai Chi also differs from other martial arts in that it is based on the Taoist religion and aims to avoid aggressive forces. </p>
-
-<p>Modern Taiji includes many forms &mdash; Quan, Sword and Fan. Impacting the mind and body of the practitioners, Taiji is practiced as a meditative exercise made up of a series of forms, or choreographed motions, requiring slow, gentle movement of the arms, legs and torso. Taiji practitioners learn to center their attention on their breathing and body movements so that the exercise strengthens their overall mental and physical awareness. In a sense, Taiji is similar to yoga in that it is also a form of moving meditation, with the goal of achieving stillness through the motion and awareness of breath. To perform Taiji, practitioners have to empty their mind of thoughts and worries in order to achieve harmony. It is a great aid for reducing stress and improving the quality of life. </p>
-
-<p>In China and in communities all over the world, Taiji is practiced by young and old in the early morning hours. It's a great way to bring a new and fresh day!</p>
-
-<p>Check out our <a href="/gallery2/main.php">gallery</a>.</p>
-
-<div style="text-align:center;"><a href="http://www.taijiclub.org/gallery2/v/2006/group1b.jpg.html?g2_imageViewsIndex=1"><img src="/gallery2/d/1836-2/group1b.jpg" /></a></div>
-
-<div style="text-align:center;">Click on photo to see HR version</div></div>
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 19
main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/2.html

@@ -1,19 +0,0 @@
-<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><style><!--
-body,td,a,p,.h{font-family:arial,sans-serif;}
-.h{font-size: 20px;}
-.q{color:#0000cc;}
-//-->
-</style>
-<script>
-<!--
-function sf(){document.f.q.focus();}
-function rwt(el,ct,cd,sg){var e = window.encodeURIComponent ? encodeURIComponent : escape;el.href="/url?sa=t&ct="+e(ct)+"&cd="+e(cd)+"&url="+e(el.href).replace(/\+/g,"%2B")+"&ei=fHNBRJDEG4HSaLONmIoP"+sg;el.onmousedown="";return true;}
-// -->
-</script>
-</head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onLoad=sf() topmargin=3 marginheight=3><center><table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td align=right nowrap><font size=-1><b>edwardzyang@gmail.com</b>&nbsp;|&nbsp;<a href="/url?sa=p&pref=ig&pval=2&q=http://www.google.com/ig%3Fhl%3Den" onmousedown="return rwt(this,'pro','hppphou:def','&sig2=hDbTpsWIp9YG37a23n6krQ')">Personalized Home</a>&nbsp;|&nbsp;<a href="/searchhistory/?hl=en">Search History</a>&nbsp;|&nbsp;<a href="https://www.google.com/accounts/ManageAccount">My Account</a>&nbsp;|&nbsp;<a href="http://www.google.com/accounts/Logout?continue=http://www.google.com/">Sign out</a></font></td></tr><tr height=4><td><img alt="" width=1 height=1></td></tr></table><img src="/intl/en/images/logo.gif" width=276 height=110 alt="Google"><br><br>
-<form action=/search name=f><script><!--
-function qs(el) {if (window.RegExp && window.encodeURIComponent) {var ue=el.href;var qe=encodeURIComponent(document.f.q.value);if(ue.indexOf("q=")!=-1){el.href=ue.replace(new RegExp("q=[^&$]*"),"q="+qe);}else{el.href=ue+"&q="+qe;}}return 1;}
-// -->
-</script><table border=0 cellspacing=0 cellpadding=4><tr><td nowrap><font size=-1><b>Web</b>&nbsp;&nbsp;&nbsp;&nbsp;<a id=1a class=q href="/imghp?hl=en&tab=wi" onClick="return qs(this);">Images</a>&nbsp;&nbsp;&nbsp;&nbsp;<a id=2a class=q href="http://groups.google.com/grphp?hl=en&tab=wg" onClick="return qs(this);">Groups</a>&nbsp;&nbsp;&nbsp;&nbsp;<a id=4a class=q href="http://news.google.com/nwshp?hl=en&tab=wn" onClick="return qs(this);">News</a>&nbsp;&nbsp;&nbsp;&nbsp;<a id=5a class=q href="http://froogle.google.com/frghp?hl=en&tab=wf" onClick="return qs(this);">Froogle</a>&nbsp;&nbsp;&nbsp;&nbsp;<a id=8a class=q href="/lochp?hl=en&tab=wl" onClick="return qs(this);">Local</a>&nbsp;&nbsp;&nbsp;&nbsp;<b><a href="/intl/en/options/" class=q>more&nbsp;&raquo;</a></b></font></td></tr></table><table cellspacing=0 cellpadding=0><tr><td width=25%>&nbsp;</td><td align=center><input type=hidden name=hl value=en><input maxlength=2048 size=55 name=q value="" title="Google Search"><br><input type=submit value="Google Search" name=btnG><input type=submit value="I'm Feeling Lucky" name=btnI></td><td valign=top nowrap width=25%><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><br><font size=-1><a href="/ads/">Advertising&nbsp;Programs</a> - <a href=/services/>Business Solutions</a> - <a href=/about.html>About Google</a></font><p><font size=-2>&copy;2006 Google</font></p></center></body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 130
main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/3.html

@@ -1,130 +0,0 @@
-<html>
-<head>
-<title>Anime Digi-Lib Index</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<div id="tb">
-
-<form name="lycos_search" method="get" target="_new" style="margin: 0px"
-      action="http://r.hotbot.com/r/memberpgs_lycos_searchbox_af/http://www.angelfire.lycos.com/cgi-bin/search/pursuit">
-
-	<table id="tbtable" cellpadding="0" cellspacing="0" border="0" width="100%" style="border: 1px solid black;">
-	  <tr style="background-color: #dcf7ff">
-	    <td colspan="3">
-	      <table cellpadding="0" cellspacing="0" border="0">
-		<tr>
-		  <td>&nbsp;Search:</td>
-
-		  <td><input type="radio" name="cat" value="lycos" checked></td>
-		  <td nowrap="nowrap">The Web</td>
-		  <td><input type="radio" name="cat" value="angelfire"></td>
-		  <td nowrap="nowrap">Angelfire</td>
-		  <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;<img src="http://af.lygo.com/d/toolbar/planeticon.gif"></td><td nowrap="nowrap">&nbsp;<a href="http://r.lycos.com/r/tlbr_planet/http://planet.lycos.com" target="_new">Planet</a></td>
-		</tr>
-	      </table>
-	      <td nowrap="nowrap"><a href="http://lt.angelfire.com/af_toolbar/edit/_h_/www.angelfire.lycos.com/build/index.tmpl" target="_top">
-		    <span id="build">Edit your Site</span></a>&nbsp;</td>
-
-	      <td><img src="http://af.lygo.com/d/toolbar/dir.gif" alt="show site directory" border="0" height="10" hspace="3" width="8"></td>
-	      <td nowrap="nowrap"><a href="http://lt.angelfire.com/af_toolbar/browse/_h_/www.angelfire.lycos.com/directory/index.tmpl" target="_top">Browse Sites</a>&nbsp;</td>
-	      <td><a href="http://lt.angelfire.com/af_toolbar/angelfire/_h_/www.angelfire.lycos.com" target="_top"><img src="http://af.lygo.com/d/toolbar/aflogo_top.gif" alt="hosted by angelfire" border="0" height="26" width="143"></a></td>
-	  </tr>
-	  <tr style="background-color: #dcf7ff">
-	    <td nowrap="nowrap" valign="middle">&nbsp;<input size="30" style="font-size: 10px; background-color: #fff;" type="text" name="query" id="searchbox"></td>
-
-		<td style="background: #fff url(http://af.lygo.com/d/toolbar/bg.gif) repeat-x; text-align: center;" colspan="3" align="center">
-		<a href="http://clk.atdmt.com/VON/go/lycsnvon0710000019von/direct/01/"><img src="/sys/free_logo_xxxx_157x20.gif" height="20" width="157" border="0" alt="Vonage"></a><img src="http://view.atdmt.com/VON/view/lycsnvon0710000019von/direct/01/"></td>
-
-	    <span style="font-size: 11px;">
-		<span style="color:#00f; font-weight:bold;">&#171;</span>
-		<span id="top100">
-		  <a href="javascript:void top100('prev')" target="_top">Previous</a> |
-		  <a href="http://lt.angelfire.com/af_toolbar/top100/_h_/www.angelfire.lycos.com/cgi-bin/top100/pagelist?start=1" target="_top">Top 100</a> |
-		  <a href="javascript:void top100('next')" target="_top">Next</a>
-
-		</span>
-		<span style="color: #00f; font-weight: bold;">&#187;</span>
-	      </span>
-	    </td>
-	    <td valign="top" style="background: #fff url(http://af.lygo.com/d/toolbar/bg.gif) repeat-x;"><a href="http://lt.angelfire.com/af_toolbar/angelfire/_h_/www.angelfire.lycos.com" target="_top"><img src="http://af.lygo.com/d/toolbar/aflogo_bot.gif" alt="hosted by angelfire" border="0" height="22" width="143"></a></td>
-	  </tr>
-	</table>
-      </form>
-     </div>
-
-<table border="0" cellpadding="0" cellspacing="0" width="728"><tr><td>
-  <script type="text/javascript">
-if (objAdMgr.isSlotAvailable("leaderboard")) {
-	objAdMgr.renderSlot("leaderboard")
-}
-</script>
-<noscript>
-<a href="http://network.realmedia.com/RealMedia/ads/click_nx.ads/lycosangelfire/ros/728x90/wp/ss/a/491169@Top1?x"><img border="0" src="http://network.realmedia.com/RealMedia/ads/adstream_nx.ads/lycosangelfire/ros/728x90/wp/ss/a/491169@Top1" alt="leaderboard ad" /></a>
-</noscript>
-
-</td></tr>
-</table>
-<table width="86%" border="0" cellspacing="0" cellpadding="2">
-  <tr>
-    <td height="388" width="19%" bgcolor="#FFCCFF" valign="top">
-      <p>May 1, 2000</p>
-      <p><b>Pop Culture</b> </p>
-      <p>by. H. Finkelstein</p>
-
-    </td>
-    <td height="388" width="52%" valign="top">
-      <p>Welcome to the <b>Anime Digi-Lib</b>, a virtual index to anime on the
-        internet. This site strives to house a comprehensive index to both personal
-        and commercial websites and provides reviews to these sites. We hope to
-        be a gateway for people who've never imagined they'd ever be interested
-        in Japanese Animation. </p>
-      <table width="99%" border="1" cellspacing="0" cellpadding="2" height="320" name="Searchnservices">
-        <tr>
-          <td height="263" valign="top" width="58%">
-            <p>&nbsp; </p>
-            <p>&nbsp;</p>
-
-<FORM ACTION="/cgi-bin/script_library/site_search/search" METHOD="GET">
-
-<table border="0" cellpadding="2" cellspacing="0">
-<tr>
-<td colspan="2">Search term: <INPUT NAME="search_term"><br></td>
-</tr>
-<tr>
-<td colspan="2" align="center">Case-sensitive -
-<INPUT TYPE="checkbox" NAME="case_sensitive">yes<br></td>
-</tr>
-<tr>
-<td align="right"><INPUT TYPE="radio" NAME="search_type" VALUE="exact" CHECKED>exact</td>
-<td><INPUT TYPE="radio" NAME="search_type" VALUE="fuzzy">fuzzy<br></td>
-
-</tr>
-<tr>
-<td colspan="2" align="center"><INPUT TYPE="hidden" NAME="display" VALUE="#FF0000"><INPUT TYPE="submit"></td>
-</tr>
-</table>
-</form>
-
-
-            <td>
-              <table border="0" cellpadding="0" cellspacing="0" width="100%">
-<tr><td><font face="verdana,geneva" color="#000011" size="1">What is better, subtitled or dubbed anime?</font></td></tr>
-<tr><td><input type="radio" name="rd" value="1"><font face="verdana" size="2" color="#000011">Subtitled</font></td></tr>
-
-<tr><td align="middle"><font face="verdana" size="1"><a href="http://pub.alxnet.com/poll?id=2079873&q=view">Current results</a></font></td></tr>
-</table></td></tr>
-          <tr>
-            <td><font face="verdana" size="1"><a href="http://www.alxnet.com/services/poll/">Free
-              Web Polls</a></font></td>
-          </tr>
-</table></form>
-<!-- Alxnet.com -- web poll code ends -->
-    </td>
-  </tr>
-</table>
-</body>
-
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 542
main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/4.html

@@ -1,542 +0,0 @@
-<!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" xml:lang="en" lang="en" dir="ltr">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-		<meta name="keywords" content="Tai Chi Chuan,Yang Pan-hou,Yang Chien-hou,Yang style Tai Chi Chuan,Yang Lu-ch'an,Wu/Hao style T'ai Chi Ch'uan,Wu Ch'uan-yü,Hao Wei-chen,Yang Shou-chung,Wu style T'ai Chi Ch'uan,Wu Chien-ch'üan" />
-<link rel="shortcut icon" href="/favicon.ico" />
-<link rel="copyright" href="http://www.gnu.org/copyleft/fdl.html" />
-		<title>Tai Chi Chuan - Wikipedia, the free encyclopedia</title>
-		<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "/skins-1.5/monobook/main.css?9"; /*]]>*/</style>
-		<link rel="stylesheet" type="text/css" media="print" href="/skins-1.5/common/commonPrint.css" />
-
-		<!--[if lt IE 5.5000]><style type="text/css">@import "/skins-1.5/monobook/IE50Fixes.css";</style><![endif]-->
-		<!--[if IE 5.5000]><style type="text/css">@import "/skins-1.5/monobook/IE55Fixes.css";</style><![endif]-->
-		<!--[if IE 6]><style type="text/css">@import "/skins-1.5/monobook/IE60Fixes.css";</style><![endif]-->
-		<!--[if IE 7]><style type="text/css">@import "/skins-1.5/monobook/IE70Fixes.css?1";</style><![endif]-->
-		<!--[if lt IE 7]><script type="text/javascript" src="/skins-1.5/common/IEFixes.js"></script>
-		<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
-		<script type="text/javascript">var skin = 'monobook';var stylepath = '/skins-1.5';</script>
-		<script type="text/javascript" src="/skins-1.5/common/wikibits.js?1"><!-- wikibits js --></script>
-		<script type="text/javascript" src="/w/index.php?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js"><!-- site js --></script>
-
-		<style type="text/css">/*<![CDATA[*/
-@import "/w/index.php?title=MediaWiki:Common.css&action=raw&ctype=text/css&smaxage=2678400";
-@import "/w/index.php?title=MediaWiki:Monobook.css&action=raw&ctype=text/css&smaxage=2678400";
-@import "/w/index.php?title=-&action=raw&gen=css&maxage=2678400&ts=20060721225848";
-@import "/w/index.php?title=User:Edward_Z._Yang/monobook.css&action=raw&ctype=text/css";
-/*]]>*/</style>
-		<script type="text/javascript" src="/w/index.php?title=User:Edward_Z._Yang/monobook.js&amp;action=raw&amp;ctype=text/javascript&amp;dontcountme=s"></script>
-		<!-- Head Scripts -->
-			</head>
-<body  class="ns-0 ltr">
-	<div id="globalWrapper">
-		<div id="column-content">
-	<div id="content">
-
-		<a name="top" id="top"></a>
-		<div id="siteNotice"><div id="wikimania2006" style="text-align:right; font-size:80%"><a href="http://wm06reg.wikimedia.org/" class="external text" title="http://wm06reg.wikimedia.org/">Registration</a> for <a href="http://wikimania2006.wikimedia.org" class="external text" title="http://wikimania2006.wikimedia.org">Wikimania 2006</a> is open.&nbsp;&nbsp;&nbsp;</div>
-</div>		<h1 class="firstHeading">Tai Chi Chuan</h1>
-		<div id="bodyContent">
-			<h3 id="siteSub">From Wikipedia, the free encyclopedia</h3>
-
-			<div id="contentSub"></div>
-									<div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div>			<!-- start content -->
-			<table border="1" cellpadding="2" cellspacing="0" align="right">
-<tr>
-<th colspan="2" bgcolor="#FFCCCC"><big>???</big></th>
-</tr>
-<tr>
-<td colspan="2">
-
-<div class="center">
-<div class="thumb tnone">
-<div style="width:182px;"><a href="/wiki/Image:Yang_Ch%27eng-fu_circa_1918.jpg" class="internal" title="Yang Chengfu in a posture from the Tai Chi solo form known as Single Whip, circa 1918"><img src="http://upload.wikimedia.org/wikipedia/en/thumb/d/d1/Yang_Ch%27eng-fu_circa_1918.jpg/180px-Yang_Ch%27eng-fu_circa_1918.jpg" alt="Yang Chengfu in a posture from the Tai Chi solo form known as Single Whip, circa 1918" width="180" height="255" longdesc="/wiki/Image:Yang_Ch%27eng-fu_circa_1918.jpg" /></a>
-<div class="thumbcaption">
-<div class="magnify" style="float:right"><a href="/wiki/Image:Yang_Ch%27eng-fu_circa_1918.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>
-<b><a href="/wiki/Yang_Chengfu" title="Yang Chengfu">Yang Chengfu</a> in a posture from the Tai Chi solo form known as <i>Single Whip</i>, circa <a href="/wiki/1918" title="1918">1918</a></b></div>
-</div>
-</div>
-</div>
-</td>
-</tr>
-
-<tr>
-<th colspan="2"><a href="/wiki/Chinese_language" title="Chinese language">Chinese</a> Name</th>
-</tr>
-<tr>
-<td><a href="/wiki/Hanyu_Pinyin" title="Hanyu Pinyin">Hanyu Pinyin</a></td>
-<td>Tàijíquán</td>
-</tr>
-<tr>
-<td><a href="/wiki/Wade-Giles" title="Wade-Giles">Wade-Giles</a></td>
-<td>T'ai<sup>4</sup> Chi<sup>2</sup> Ch'üan<sup>2</sup></td>
-
-</tr>
-<tr>
-<td><a href="/wiki/Simplified_Chinese" title="Simplified Chinese">Simplified Chinese</a></td>
-<td>???</td>
-</tr>
-<tr>
-<td><a href="/wiki/Traditional_Chinese" title="Traditional Chinese">Traditional Chinese</a></td>
-<td><a href="http://en.wiktionary.org/wiki/%E5%A4%AA" class="extiw" title="wiktionary:?">?</a><a href="http://en.wiktionary.org/wiki/%E6%A5%B5" class="extiw" title="wiktionary:?">?</a><a href="http://en.wiktionary.org/wiki/%E6%8B%B3" class="extiw" title="wiktionary:?">?</a></td>
-</tr>
-<tr>
-<td><a href="/wiki/Cantonese_%28linguistics%29" title="Cantonese (linguistics)">Cantonese</a></td>
-
-<td>taai3 gik6 kyun4</td>
-</tr>
-<tr>
-<td><a href="/wiki/Hiragana" title="Hiragana">Japanese Hiragana</a></td>
-<td>???????</td>
-</tr>
-<tr>
-<td><a href="/wiki/Korean_%28language%29" title="Korean (language)">Korean</a></td>
-<td>???</td>
-</tr>
-<tr>
-<td><a href="/wiki/Vietnamese_%28language%29" title="Vietnamese (language)">Vietnamese</a></td>
-
-<td>Thái C?c Quy?n</td>
-</tr>
-</table>
-<p><b>Tai Chi Chuan</b>, <b>T'ai Chi Ch'üan</b> or <b>Taijiquan</b> (<a href="/wiki/Traditional_Chinese_character" title="Traditional Chinese character">Traditional Chinese</a>: ???; <a href="/wiki/Simplified_Chinese_character" title="Simplified Chinese character">Simplified Chinese</a>: ???; <a href="/wiki/Pinyin" title="Pinyin">pinyin</a>: Tàijíquán; literally "supreme ultimate fist"), commonly known as <b>Tai Chi</b>, <b>T'ai Chi</b>, or <b><a href="/wiki/Taiji" title="Taiji">Taiji</a></b>, is an <a href="/wiki/Neijia" title="Neijia">internal</a> <a href="/wiki/Chinese_martial_arts" title="Chinese martial arts">Chinese martial art</a>. There are different styles of T'ai Chi Ch'üan, although most agree they are all based on the system originally taught by the <a href="/wiki/Chen" title="Chen">Chen</a> family to the <a href="/wiki/Yang" title="Yang">Yang</a> family starting in <a href="/wiki/1820" title="1820">1820</a>. It is often promoted and practiced as a <a href="/wiki/Martial_arts_therapy" title="Martial arts therapy">martial arts therapy</a> for the purposes of <a href="/wiki/Health" title="Health">health</a> and <a href="/wiki/Longevity" title="Longevity">longevity</a>, (some <a href="/wiki/Tai_Chi_Chuan#Citations_to_medical_research" title="Tai Chi Chuan">recent medical studies</a> support its effectiveness). T'ai Chi Ch'üan is considered a <i>soft</i> style martial art, an art applied with as complete a relaxation or "softness" in the musculature as possible, to distinguish its theory and application from that of the <i>hard</i> martial art styles which use a degree of tension in the muscles.</p>
-
-<p>Variations of T'ai Chi Ch'üan's basic training forms are well known as the slow motion routines that groups of people practice every morning in parks across China and other parts of the world. Traditional T'ai Chi training is intended to teach awareness of one's own balance and what affects it, awareness of the same in others, an appreciation of the practical value in one's ability to moderate extremes of behavior and attitude at both mental and physical levels, and how this applies to effective self-defense principles.</p>
-<table id="toc" class="toc" summary="Contents">
-<tr>
-<td>
-<div id="toctitle">
-<h2>Contents</h2>
-</div>
-<ul>
-<li class="toclevel-1"><a href="#Overview"><span class="tocnumber">1</span> <span class="toctext">Overview</span></a></li>
-<li class="toclevel-1"><a href="#Training_and_techniques"><span class="tocnumber">2</span> <span class="toctext">Training and techniques</span></a></li>
-
-<li class="toclevel-1"><a href="#Styles_and_history"><span class="tocnumber">3</span> <span class="toctext">Styles and history</span></a>
-<ul>
-<li class="toclevel-2"><a href="#Family_tree"><span class="tocnumber">3.1</span> <span class="toctext">Family tree</span></a></li>
-<li class="toclevel-2"><a href="#Notes_to_Family_tree_table"><span class="tocnumber">3.2</span> <span class="toctext">Notes to Family tree table</span></a></li>
-</ul>
-</li>
-<li class="toclevel-1"><a href="#Modern_T.27ai_Chi"><span class="tocnumber">4</span> <span class="toctext">Modern T'ai Chi</span></a>
-
-<ul>
-<li class="toclevel-2"><a href="#Modern_forms"><span class="tocnumber">4.1</span> <span class="toctext">Modern forms</span></a></li>
-</ul>
-</li>
-<li class="toclevel-1"><a href="#Health_benefits"><span class="tocnumber">5</span> <span class="toctext">Health benefits</span></a>
-<ul>
-<li class="toclevel-2"><a href="#Citations_to_medical_research"><span class="tocnumber">5.1</span> <span class="toctext">Citations to medical research</span></a></li>
-</ul>
-
-</li>
-<li class="toclevel-1"><a href="#See_also"><span class="tocnumber">6</span> <span class="toctext">See also</span></a></li>
-<li class="toclevel-1"><a href="#External_links"><span class="tocnumber">7</span> <span class="toctext">External links</span></a></li>
-</ul>
-</td>
-</tr>
-</table>
-<p><script type="text/javascript">
-//<![CDATA[
- if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); }
-//]]>
-</script></p>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=1" title="Edit section: Overview">edit</a>]</div>
-
-<p><a name="Overview" id="Overview"></a></p>
-<h2>Overview</h2>
-<p>Historically, T'ai Chi Ch'üan has been regarded as a martial art, and its traditional practitioners still teach it as one. Even so, it has developed a worldwide following among many thousands of people with little or no interest in martial training for its aforementioned benefits to health and <a href="/wiki/Preventive_medicine" title="Preventive medicine">health maintenance</a>. Some call it a form of moving <a href="/wiki/Meditation" title="Meditation">meditation</a>, and T'ai Chi theory and practice evolved in agreement with many of the principles of <a href="/wiki/Traditional_Chinese_medicine" title="Traditional Chinese medicine">traditional Chinese medicine</a>. Besides general health benefits and <a href="/wiki/Stress_management" title="Stress management">stress management</a> attributed to beginning and intermediate level T'ai Chi training, many therapeutic interventions along the lines of traditional Chinese medicine are taught to advanced T'ai Chi students.</p>
-<p>T'ai Chi Ch'üan as physical training is characterized by its requirement for the use of leverage through the joints based on coordination in relaxation rather than muscular tension in order to neutralize or initiate physical attacks. The slow, repetitive work involved in that process is said to gently increase and open the internal circulation (<a href="/wiki/Breath" title="Breath">breath</a>, body heat, <a href="/wiki/Blood" title="Blood">blood</a>, <a href="/wiki/Lymph" title="Lymph">lymph</a>, <a href="/wiki/Peristalsis" title="Peristalsis">peristalsis</a>, etc.). Over time, proponents say, this enhancement becomes a lasting effect, a direct reversal of the constricting physical effects of stress on the human body. This reversal allows much more of the students' native energy to be available to them, which they may then apply more effectively to the rest of their lives; families, careers, spiritual or creative pursuits, hobbies, etc.</p>
-
-<p>The study of T'ai Chi Ch'üan involves three primary subjects:</p>
-<ul>
-<li><b>Health</b> - an unhealthy or otherwise uncomfortable person will find it difficult to meditate to a state of calmness or to use T'ai Chi as a martial art. T'ai Chi's health training therefore concentrates on relieving the physical effects of stress on the body and mind.</li>
-<li><b>Meditation</b> - the focus meditation and subsequent calmness cultivated by the meditative aspect of T'ai Chi is seen as necessary to maintain optimum health (in the sense of effectively maintaining stress relief or <a href="/wiki/Homeostasis" title="Homeostasis">homeostasis</a>) and in order to use it as a soft style martial art.</li>
-<li><b>Martial art</b> - the ability to competently use T'ai Chi as a martial art is said to be proof that the health and meditation aspects are working according to the dictates of the theory of T'ai Chi Ch'üan.</li>
-
-</ul>
-<p>In its traditional form (many modern variations exist which ignore at least one of the above requirements) every aspect of its training has to conform with all three of the aforementioned categories.</p>
-<p>The <a href="/wiki/Mandarin_%28linguistics%29" title="Mandarin (linguistics)">Mandarin</a> term "T'ai Chi Ch'üan" translates as "Supreme Ultimate Boxing" or "Boundless Fist". T'ai Chi training involves learning solo routines, known as <i>forms</i>, and two person routines, known as <i><a href="/wiki/Pushing_hands" title="Pushing hands">pushing hands</a></i>, as well as <i><a href="/wiki/Acupressure" title="Acupressure">acupressure</a></i>-related manipulations taught by traditional schools. T'ai Chi Ch'üan is seen by many of its schools as a variety of <a href="/wiki/Taoism" title="Taoism">Taoism</a>, and it does seemingly incorporate many Taoist principles into its practice (see below). It is an art form said to date back many centuries (although not reliably documented under that name before 1850), with precursor disciplines dating back thousands of years. The explanation given by the traditional T'ai Chi family schools for why so many of their previous generations have dedicated their lives to the study and preservation of the art is that the discipline it seems to give its students to dramatically improve the effects of stress in their lives, with a few years of hard work, should hold a useful purpose for people living in a stressful world. They say that once the T'ai Chi principles have been understood and internalized into the bodily framework the practitioner will have an immediately accessible "toolkit" thereby to improve and then maintain their health, to provide a meditative focus, and that can work as an effective and subtle martial art for self-defense.</p>
-<p>Teachers say the study of T'ai Chi Ch'üan is, more than anything else, about challenging one's ability to change oneself appropriately in response to outside forces. These principles are taught using the examples of <a href="/wiki/Physics" title="Physics">physics</a> as experienced by two (or more) bodies in <a href="/wiki/Combat" title="Combat">combat</a>. In order to be able to protect oneself or someone else by using change, it is necessary to understand what the consequences are of changing appropriately, changing inappropriately and not changing at all in response to an attack. Students, by this theory, will appreciate the full benefits of the entire art in the fastest way through physical training of the martial art aspect.</p>
-
-<p><a href="/wiki/Wu_Chien-ch%27uan" title="Wu Chien-ch'uan">Wu Chien-ch'üan</a>, co-founder of the Wu family style, described the name <i>T'ai Chi Ch'üan</i> this way at the beginning of the <a href="/wiki/20th_century" title="20th century">20th century</a>:</p>
-<dl>
-<dd>"Various people have offered different explanations for the name <i>T'ai Chi Ch'uan</i>. Some have said: 'In terms of self-cultivation, one must train from a state of movement towards a state of stillness. <i>T'ai Chi</i> comes about through the balance of <i><a href="/wiki/Yin" title="Yin">yin</a></i> and <i><a href="/wiki/Yang" title="Yang">yang</a></i>. In terms of the art of attack and defense then, in the context of the <a href="/wiki/I_Ching" title="I Ching">changes</a> of full and empty, one is constantly internally latent, not outwardly expressive, as if the <i>yin</i> and <i>yang</i> of <i>T'ai Chi</i> have not yet divided apart.'</dd>
-
-<dd>Others say: 'Every movement of <i>T'ai Chi Ch'uan</i> is based on circles, just like the shape of a <a href="/wiki/Taijitu" title="Taijitu"><i>T'ai Chi</i> symbol</a>. Therefore, it is called <i>T'ai Chi Ch'uan</i>.' Both explanations are quite reasonable, especially the second, which is more complete."</dd>
-</dl>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=2" title="Edit section: Training and techniques">edit</a>]</div>
-<p><a name="Training_and_techniques" id="Training_and_techniques"></a></p>
-
-<h2>Training and techniques</h2>
-<div class="thumb tright">
-<div style="width:182px;"><a href="/wiki/Image:Yin_yang.svg" class="internal" title="The T'ai Chi Symbol or T'ai Chi T'u (Taijitu)"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Yin_yang.svg/180px-Yin_yang.svg.png" alt="The T'ai Chi Symbol or T'ai Chi T'u (Taijitu)" width="180" height="180" longdesc="/wiki/Image:Yin_yang.svg" /></a>
-<div class="thumbcaption">
-<div class="magnify" style="float:right"><a href="/wiki/Image:Yin_yang.svg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>
-<b>The T'ai Chi Symbol or T'ai Chi T'u (Taijitu)</b></div>
-</div>
-</div>
-<p>As the name <i>T'ai Chi Ch'üan</i> is held to be derived from the T'ai Chi symbol, the <i>taijitu</i> or <i>t'ai chi t'u</i> (???, <a href="/wiki/Pinyin" title="Pinyin">pinyin</a> tàijítú), commonly known in the West as the "<a href="/wiki/Yin-yang" title="Yin-yang">yin-yang</a>" diagram, T'ai Chi Ch'üan techniques are said therefore to physically and energetically balance <i>yin</i> (receptive) and <i>yang</i> (active) principles: "From ultimate softness comes ultimate hardness."</p>
-
-<p>The core training involves two primary features: the first being the solo form or <i>ch'üan</i>, a slow sequence of movements which emphasize a straight spine, relaxed breathing and a natural range of motion; the second being different styles of <i>pushing hands</i> or <i>t'ui shou</i> (??) for training "stickiness" and sensitivity in the reflexes through various motions from the forms in concert with a training partner in order to learn leverage, timing, coordination and positioning when interacting with another. Pushing hands is seen as necessary not only for training the self-defense skills of a soft style such as T'ai Chi by demonstrating the forms' movement principles experientially, but also it is said to improve upon the level of conditioning provided by practice of the solo forms by increasing the workload on students while they practice those movement principles.</p>
-<p>The solo form should take the students through a complete, natural, range of motion over their centre of gravity. Accurate, repeated practice of the solo routine is said to retrain posture, encourage circulation throughout the students' bodies, maintain flexibility through their joints and further familiarize students with the martial application sequences implied by the forms. The major traditional styles of T'ai Chi have forms which differ somewhat cosmetically, but there are also many obvious similarities which point to their common origin. The solo forms, empty-hand and <a href="/wiki/Weapon" title="Weapon">weapon</a>, are catalogues of movements that are practised individually in pushing hands and martial application scenarios to prepare students for self-defence training. In most traditional schools different variations of the solo forms can be practiced; fast/slow, small circle/large circle, square/round (which are different expressions of leverage through the joints), low sitting/high sitting (the degree to which weight-bearing knees are kept bent throughout the form), for example.</p>
-<p>In a fight, if one uses hardness to resist violent force then both sides are certain to be injured, at least to some degree. Such injury, according to T'ai Chi theory, is a natural consequence of meeting brute force with brute force. The collision of two like forces, yang with yang, is known as "double-weighted" in T'ai Chi terminology. Instead, students are taught not to fight or resist an incoming force, but to meet it in softness and "stick" to it, following its motion while remaining in physical contact until the incoming force of attack exhausts itself or can be safely redirected, the result of meeting yang with yin. Done correctly, achieving this yin/yang or yang/yin balance in combat (and, by extension, other areas of one's life) is known as being "single-weighted" and is a primary goal of T'ai Chi Ch'üan training. <a href="/wiki/Lao_Tzu" title="Lao Tzu">Lao Tzu</a> provided the <a href="/wiki/Archetype" title="Archetype">archetype</a> for this in the <a href="/wiki/Tao_Te_Ching" title="Tao Te Ching">Tao Te Ching</a> when he wrote, "The soft and the pliable will defeat the hard and strong." This soft "neutralization" of an attack can be accomplished very quickly in an actual fight by an adept practitioner. A T'ai Chi student has to be well conditioned by many years of disciplined training; stable, sensitive and elastic mentally and physically in order to realize this ability, however.</p>
-
-<p>Other training exercises include:</p>
-<ul>
-<li>Weapons training and <a href="/wiki/Fencing" title="Fencing">fencing</a> applications employing the straight <i><a href="/wiki/Sword" title="Sword">sword</a></i> known as the <i>jian</i> or <i>chien</i> or <i>gim</i> (<a href="/wiki/Jian" title="Jian">jiàn</a> ?), a heavier curved <i>sabre</i>, sometimes called a <i>broadsword</i> or <i>tao</i> (<a href="/wiki/Dao_%28saber%29" title="Dao (saber)">dao</a> ?, which is actually considered a big <i><a href="/wiki/Knife" title="Knife">knife</a></i>), folding <i><a href="/wiki/Tessen" title="Tessen">fan</a></i>, <i>staff</i> (?), 7 foot (2 m) <i><a href="/wiki/Qiang_%28spear%29" title="Qiang (spear)">spear</a></i> and 13 foot (4 m) <i><a href="/wiki/Lance" title="Lance">lance</a></i> (both called qiang ?). More exotic weapons still used by some traditional styles are the large <i>Da Dao</i> or <i>Ta Tao</i> (??) sabre, <i><a href="/wiki/Ji_%28halberd%29" title="Ji (halberd)">halberd</a></i> (ji ?), <i>cane</i>, <i>rope-dart</i>, <i><a href="/wiki/Three_sectional_staff" title="Three sectional staff">three sectional staff</a></i>, <i><a href="/wiki/Lasso" title="Lasso">lasso</a></i>, <i><a href="/wiki/Whip" title="Whip">whip</a></i>, <i><a href="/wiki/Chain_whip" title="Chain whip">chain whip</a></i> and <i>steel whip</i>.</li>
-
-<li>Two-person tournament sparring (as part of push hands competitions and/or <i><a href="/wiki/San_shou" title="San shou">san shou</a></i> ??);</li>
-<li>Breathing exercises; <i><a href="/wiki/Nei_kung" title="Nei kung">nei kung</a></i> (?? nèigong) or, more commonly, <i><a href="/wiki/Ch%27i_kung" title="Ch'i kung">ch'i kung</a></i> (?? qìgong) to develop <b><a href="/wiki/Ch%27i" title="Ch'i">ch'i</a></b> (? qì) or "breath energy" in coordination with physical movement and <a href="/wiki/Zhan_zhuang" title="Zhan zhuang">post standing</a> or combinations of the two. These were formerly taught only to disciples as a separate, complementary training system. In the last 50 years they have become more well known to the general public.</li>
-
-</ul>
-<p>T'ai Chi's martial aspect relies on sensitivity to the opponent's movements and centre of gravity dictating appropriate responses. Effectively affecting or "capturing" the opponent's centre of gravity immediately upon contact is trained as the primary goal of the martial T'ai Chi student, and from there all other technique can follow with seeming effortlessness. The alert calmness required to achieve the necessary sensitivity is acquired over thousands of hours of first <i>yin</i> (slow, repetitive, meditative, low impact) and then later adding <i>yang</i> ("realistic," active, fast, high impact) martial training; forms, pushing hands and sparring. T'ai Chi Ch'üan trains in three basic ranges, close, medium and long, and then everything in between. Pushes and open hand strikes are more common than punches, and kicks are usually to the legs and lower torso, never higher than the hip in most styles. The fingers, fists, palms, sides of the hands, wrists, forearms, elbows, shoulders, back, hips, knees and feet are commonly used to strike, with strikes to the eyes, throat, heart, groin and other acupressure points trained by advanced students. There is an extensive repertoire of joint traps, locks and breaks (<a href="/wiki/Chin_na" title="Chin na">chin na</a>), particularly applied to lock up or break an opponent's elbows, wrists, fingers, ankles, back or neck. Most T'ai Chi teachers expect their students to thoroughly learn defensive or neutralizing skills first, and a student will have to demonstrate proficiency with them before offensive skills will be extensively trained. There is also an emphasis in the traditional schools on kind-heartedness. One is expected to show mercy to one's opponents, as instanced by a poem preserved in some of the T'ai Chi families said to be derived from the <a href="/wiki/Shaolin" title="Shaolin">Shaolin</a> temple:</p>
-<dl>
-<dd>"I would rather maim than kill</dd>
-
-<dd>Hurt than maim</dd>
-<dd>Intimidate than hurt</dd>
-<dd>Avoid than intimidate."</dd>
-</dl>
-<div class="thumb tright">
-<div style="width:352px;"><a href="/wiki/Image:Martial_arts_-_Fragrant_Hills.JPG" class="internal" title="An outdoor Chen style class in Beijing"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Martial_arts_-_Fragrant_Hills.JPG/350px-Martial_arts_-_Fragrant_Hills.JPG" alt="An outdoor Chen style class in Beijing" width="350" height="233" longdesc="/wiki/Image:Martial_arts_-_Fragrant_Hills.JPG" /></a>
-<div class="thumbcaption">
-<div class="magnify" style="float:right"><a href="/wiki/Image:Martial_arts_-_Fragrant_Hills.JPG" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>
-An outdoor Chen style class in Beijing</div>
-</div>
-</div>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=3" title="Edit section: Styles and history">edit</a>]</div>
-
-<p><a name="Styles_and_history" id="Styles_and_history"></a></p>
-<h2>Styles and history</h2>
-<p>There are five major styles of T'ai Chi Ch'üan, each named after the Chinese family that teaches (or taught) it:</p>
-<ul>
-<li><b><a href="/wiki/Chen_style_Tai_Chi_Chuan" title="Chen style Tai Chi Chuan">Chen style</a></b> (??) and its close cousin <b><a href="/w/index.php?title=Zhaobao_style_T%27ai_Chi_Ch%27uan&amp;action=edit" class="new" title="Zhaobao style T'ai Chi Ch'uan">Zhao Bao Style</a></b> (?????)</li>
-<li><b><a href="/wiki/Yang_style_T%27ai_Chi_Ch%27uan" title="Yang style T'ai Chi Ch'uan">Yang style</a></b> (??)</li>
-
-<li><b><a href="/wiki/Wu/Hao_style_T%27ai_Chi_Ch%27uan" title="Wu/Hao style T'ai Chi Ch'uan">Wu or Wu/Hao style of Wu Yu-hsiang</a></b> (??)</li>
-<li><b><a href="/wiki/Wu_style_T%27ai_Chi_Ch%27uan" title="Wu style T'ai Chi Ch'uan">Wu style of Wu Ch'uan-yü and Wu Chien-ch'uan</a></b> (??)</li>
-<li><b><a href="/wiki/Sun_style_T%27ai_Chi_Ch%27uan" title="Sun style T'ai Chi Ch'uan">Sun style</a></b> (??)</li>
-</ul>
-<p>The order of seniority is as listed above. The order of popularity is Yang, Wu, Chen, Sun, and Wu/Hao. The first five major family styles share much underlying theory, but differ in their approaches to training.</p>
-<p>In the modern world there are now dozens of new styles, hybrid styles and offshoots of the main styles, but the five family schools are the groups recognised by the international community as being orthodox. For example, there are <i>several</i> groups teaching what they call <a href="/wiki/Wudang_Tai_Chi_Chuan" title="Wudang Tai Chi Chuan">Wu Tang style T'ai Chi Ch'üan (??????)</a>. The best known modern style going by the name <i>Wu Tang</i> has gained some publicity internationally, especially in the <a href="/wiki/United_Kingdom" title="United Kingdom">UK</a> and <a href="/wiki/Europe" title="Europe">Europe</a>, but was originally taught by a senior student of the Wu (?) style.</p>
-
-<p>The designation <i><a href="/wiki/Wudangquan" title="Wudangquan">Wu Tang Ch'üan</a></i> is also used to broadly distinguish <i>internal</i> or <i>nei chia</i> martial arts (said to be a specialty of the <a href="/wiki/Monasteries" title="Monasteries">monasteries</a> at <a href="/wiki/Wudangshan" title="Wudangshan">Wu Tang Shan</a>) from what are known as the <i>external</i> or <i>wei chia</i> styles based on <i><a href="/w/index.php?title=Shaolinquan_kung_fu&amp;action=edit" class="new" title="Shaolinquan kung fu">Shaolinquan kung fu</a></i>, although that distinction is sometimes disputed by individual schools. In this broad sense, among many T'ai Chi schools <i>all</i> styles of T'ai Chi (as well as related arts such as <a href="/wiki/Bagua_zhang" title="Bagua zhang">Pa Kua Chang</a> and <a href="/wiki/Hsing_Yi" title="Hsing Yi">Hsing-i Ch'üan</a>) are therefore considered to be "Wu Tang style" martial arts. The schools that designate themselves "Wu Tang style" relative to the family styles mentioned above mostly claim to teach an "original style" they say was formulated by a Taoist monk called <a href="/wiki/Zhang_Sanfeng" title="Zhang Sanfeng">Zhang Sanfeng</a> and taught by him in the Taoist monasteries at Wu Tang Shan. Some consider that what is practised under that name today may be a modern back-formation based on stories and popular veneration of Zhang Sanfeng (see below) as well as the martial fame of the Wu Tang monastery (there are many other martial art styles historically associated with Wu Tang besides T'ai Chi).</p>
-
-<p>When tracing T'ai Chi Ch'üan's formative influences to <a href="/wiki/Taoist" title="Taoist">Taoist</a> and <a href="/wiki/Buddhist" title="Buddhist">Buddhist</a> monasteries, one has little more to go on than legendary tales from a modern historical perspective, but T'ai Chi Ch'üan's practical connection to and dependence upon the theories of <a href="/wiki/Song_dynasty" title="Song dynasty">Sung dynasty</a> <a href="/wiki/Neo-Confucianism" title="Neo-Confucianism">Neo-Confucianism</a> (a conscious synthesis of Taoist, Buddhist and <a href="/wiki/Confucian" title="Confucian">Confucian</a> traditions, esp. the teachings of <a href="/wiki/Mencius" title="Mencius">Mencius</a>) is readily apparent to its practitioners. The philosophical and political landscape of that time in Chinese history is fairly well documented, even if the origin of the art later to become known as T'ai Chi Ch'üan in it is not. T'ai Chi Ch'üan's theories and practice are therefore believed by some schools to have been formulated by the Taoist monk <a href="/wiki/Zhang_Sanfeng" title="Zhang Sanfeng">Zhang Sanfeng</a> in the 12th century, a time frame fitting well with when the principles of the Neo-Confucian school were making themselves felt in Chinese intellectual life. Therefore the didactic story is told that Zhang Sanfeng as a young man studied <a href="/wiki/Tao_Yin" title="Tao Yin">Tao Yin</a> (??, <a href="/wiki/Pinyin" title="Pinyin">Pinyin</a> daoyin) breathing exercises from his Taoist teachers and martial arts at the Buddhist Shaolin monastery, eventually combining the martial forms and breathing exercises to formulate the soft or internal principles we associate with T'ai Chi Ch'üan and related martial arts. Its subsequent fame attributed to his teaching, Wu Tang monastery was known thereafter as an important martial center for many centuries, its many styles of internal <a href="/wiki/Kung_fu" title="Kung fu">kung fu</a> preserved and refined at various Taoist temples.</p>
-
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=4" title="Edit section: Family tree">edit</a>]</div>
-<p><a name="Family_tree" id="Family_tree"></a></p>
-<h3>Family tree</h3>
-<p>This family tree is not comprehensive.</p>
-<pre>
-<b>LEGENDARY FIGURES</b>
-   |
-<a href="/wiki/Zhang_Sanfeng" title="Zhang Sanfeng">Zhang Sanfeng</a>*
-circa 12th century
-<a href="/wiki/Nei_chia" title="Nei chia">NEI CHIA</a>
-
-   |
-<a href="/w/index.php?title=Wang_Zongyue&amp;action=edit" class="new" title="Wang Zongyue">Wang Zongyue</a>*
-T'AI CHI CH'ÜAN
-   |
-<b>THE 5 MAJOR CLASSICAL FAMILY STYLES</b>
-   |
-Chen Wangting
-1600-1680 9th generation Chen
-<a href="/wiki/Chen_style_Tai_Chi_Chuan" title="Chen style Tai Chi Chuan">CHEN STYLE</a>
-   |
-   +-------------------------------------------------------------------+
-   |                                                                   |
-<a href="/w/index.php?title=Chen_Changxing&amp;action=edit" class="new" title="Chen Changxing">Chen Changxing</a>                                                     <a href="/w/index.php?title=Chen_Youben&amp;action=edit" class="new" title="Chen Youben">Chen Youben</a>
-1771-1853 14th generation Chen                                     circa 1800s 14th generation Chen
-Chen Old Frame                                                     Chen New Frame
-   |                                                                   |
-
-<a href="/wiki/Yang_Lu-ch%27an" title="Yang Lu-ch'an">Yang Lu-ch'an</a>                                                      <a href="/w/index.php?title=Chen_Qingping&amp;action=edit" class="new" title="Chen Qingping">Chen Qingping</a>
-1799-1872                                                          1795-1868
-<a href="/wiki/Yang_style_Tai_Chi_Chuan" title="Yang style Tai Chi Chuan">YANG STYLE</a>                                                         Chen Small Frame, Zhao Bao Frame
-   |                                                                   |
-   +---------------------------------+-----------------------------+   |
-   |                                 |                             |   |
-<a href="/wiki/Yang_Pan-hou" title="Yang Pan-hou">Yang Pan-hou</a>                      <a href="/wiki/Yang_Chien-hou" title="Yang Chien-hou">Yang Chien-hou</a>                   <a href="/w/index.php?title=Wu_Yu-hsiang&amp;action=edit" class="new" title="Wu Yu-hsiang">Wu Yu-hsiang</a>
-1837-1892                         1839-1917                        1812-1880
-Yang Small Frame                     |                             <a href="/wiki/Wu/Hao_style_T%27ai_Chi_Ch%27uan" title="Wu/Hao style T'ai Chi Ch'uan">WU/HAO STYLE</a>
-
-   |                                 +-----------------+                      |
-   |                                 |                 |                      |
-<a href="/wiki/Wu_Ch%27uan-y%C3%BC" title="Wu Ch'uan-yü">Wu Ch'uan-yü</a>                      <a href="/wiki/Yang_Shao-hou" title="Yang Shao-hou">Yang Shao-hou</a>     <a href="/wiki/Yang_Ch%27eng-fu" title="Yang Ch'eng-fu">Yang Ch'eng-fu</a>          <a href="/w/index.php?title=Li_I-y%C3%BC&amp;action=edit" class="new" title="Li I-yü">Li I-yü</a>
-1834-1902                         1862-1930         1883-1936               1832-1892
-   |                              Yang Small Frame  <a href="/wiki/103_form_Yang_family_T%27ai_Chi_Ch%27uan" title="103 form Yang family T'ai Chi Ch'uan">Yang Big Frame</a>            |
-<a href="/wiki/Wu_Chien-ch%27%C3%BCan" title="Wu Chien-ch'üan">Wu Chien-ch'üan</a>                                        |                    <a href="/wiki/Hao_Wei-chen" title="Hao Wei-chen">Hao Wei-chen</a>
-
-1870-1942                                           <a href="/wiki/Yang_Shou-chung" title="Yang Shou-chung">Yang Shou-chung</a>         1849-1920
-<a href="/wiki/Wu_style_T%27ai_Chi_Ch%27uan" title="Wu style T'ai Chi Ch'uan">WU STYLE</a>                                            1910-1985                 |
-<a href="/wiki/108_form_Wu_family_T%27ai_Chi_Ch%27uan" title="108 form Wu family T'ai Chi Ch'uan">108 Form</a>                                                                      |
-   |                                                                        <a href="/wiki/Sun_Lu-t%27ang" title="Sun Lu-t'ang">Sun Lu-t'ang</a>
-<a href="/wiki/Wu_Kung-i" title="Wu Kung-i">Wu Kung-i</a>                                                                   1861-1932
-1900-1970                                                                   <a href="/wiki/Sun_style_T%27ai_Chi_Ch%27uan" title="Sun style T'ai Chi Ch'uan">SUN STYLE</a>
-
-   |                                                                          |
-<a href="/w/index.php?title=Wu_Ta-kuei&amp;action=edit" class="new" title="Wu Ta-kuei">Wu Ta-kuei</a>                                                                  <a href="/w/index.php?title=Sun_Hsing-i&amp;action=edit" class="new" title="Sun Hsing-i">Sun Hsing-i</a>
-1923-1970                                                                   1891-1929
-
-<b>MODERN FORMS</b>
-
-from Yang Ch`eng-fu
-        |
-        |
-        |
-        +--------------+
-        |              |
-  <a href="/wiki/Cheng_Man-ch%27ing" title="Cheng Man-ch'ing">Cheng Man-ch'ing</a>     |
-  1901-1975            |
-  Short (37) Form      |
-                       |
-              Chinese Sports Commission
-              1956
-              Beijing <a href="/wiki/24_Form" title="24 Form">24 Form</a>
-              .
-              .
-              1989
-              <a href="/wiki/42_Form_%28Competition_Form%29_T%27ai_Chi_Ch%27uan" title="42 Form (Competition Form) T'ai Chi Ch'uan">42 Competition Form</a>
-
-              (<a href="/wiki/Wushu" title="Wushu">Wushu</a> competition form combined from Sun, Wu, Chen, and Yang styles)
-</pre>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=5" title="Edit section: Notes to Family tree table">edit</a>]</div>
-<p><a name="Notes_to_Family_tree_table" id="Notes_to_Family_tree_table"></a></p>
-<h3>Notes to Family tree table</h3>
-<p>Names denoted by an asterisk are legendary or semilegendary figures in the lineage, which means their involvement in the lineage, while accepted by most of the major schools, isn't independently verifiable from known historical records.</p>
-<p>The Cheng Man-ch'ing and <a href="/w/index.php?title=Chinese_Sports_Commission&amp;action=edit" class="new" title="Chinese Sports Commission">Chinese Sports Commission</a> short forms are said to be derived from Yang family forms, but neither are recognized as Yang family T'ai Chi Ch'üan by current Yang family teachers. The Chen, Yang and Wu families are now promoting their own shortened demonstration forms for competitive purposes.</p>
-
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=6" title="Edit section: Modern T'ai Chi">edit</a>]</div>
-<p><a name="Modern_T.27ai_Chi" id="Modern_T.27ai_Chi"></a></p>
-<h2>Modern T'ai Chi</h2>
-<div class="thumb tright">
-<div style="width:352px;"><a href="/wiki/Image:Taichi_shanghai_bund_2005.jpg" class="internal" title="Yang style in Shanghai"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/Taichi_shanghai_bund_2005.jpg/350px-Taichi_shanghai_bund_2005.jpg" alt="Yang style in Shanghai" width="350" height="263" longdesc="/wiki/Image:Taichi_shanghai_bund_2005.jpg" /></a>
-<div class="thumbcaption">
-<div class="magnify" style="float:right"><a href="/wiki/Image:Taichi_shanghai_bund_2005.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>
-Yang style in Shanghai</div>
-</div>
-</div>
-<p>T'ai Chi has become very popular in the last twenty years or so, as the <a href="/wiki/Baby_boomers" title="Baby boomers">baby boomers</a> age and T'ai Chi's reputation for ameliorating the effects of aging becomes more well-known. Hospitals, clinics, community and senior centers are all hosting T'ai Chi classes in communities around the world. As a result of this popularity, there has been some divergence between those who say they practice T'ai Chi primarily for fighting, those who practice it for its <a href="/wiki/Aesthetic" title="Aesthetic">aesthetic</a> appeal (as in the shortened, modern, theatrical "Taijiquan" forms of <a href="/wiki/Wushu" title="Wushu">wushu</a>, see below), and those who are more interested in its benefits to physical and mental health. The wushu aspect is primarily for show; the forms taught for those purposes are designed to earn points in competition and are mostly unconcerned with either health maintenance or martial ability. More traditional stylists still see the two aspects of health and martial arts as equally necessary pieces of the puzzle, the <i>yin</i> and <i>yang</i> of T'ai Chi Ch'üan. The T'ai Chi "family" schools therefore still present their teachings in a martial art context even though the majority of their students nowadays profess that they are primarily interested in training for the claimed health benefits.</p>
-
-<p>Along with <a href="/wiki/Yoga" title="Yoga">Yoga</a>, it is one of the fastest growing fitness and health maintenance activities, in terms of numbers of students enrolling in classes. Since there is no universal certification process and most Westerners haven't seen very much T'ai Chi and don't know what to look for, practically anyone can learn or even make up a few moves and call themselves a teacher. This is especially prevalent in the <a href="/wiki/New_Age" title="New Age">New Age</a> community. Relatively few of these teachers even know that there are martial applications to the T'ai Chi forms. Those who do know that it is a martial art usually don't teach martially themselves. If they do teach self-defense, it is often a mixture of motions which the teachers think look like T'ai Chi Ch'üan with some other system. This is especially evident in schools located outside of China. While this phenomenon may have made some external aspects of T'ai Chi available for a wider audience, the traditional T'ai Chi family schools see the martial focus as a fundamental part of their training, both for health <i>and</i> self-defense purposes. They claim that while the students may not need to practice martial applications themselves to derive a benefit from T'ai Chi training, they assert that T'ai Chi teachers at least should know the martial applications to ensure that the movements they teach are done correctly and safely by their students. Also, working on the ability to protect oneself from physical attack (one of the most stressful things that can happen to a person) certainly falls under the category of complete "health maintenance." For these reasons they claim that a school not teaching those aspects somewhere in their syllabus cannot be said to be actually teaching the art itself, and will be much less likely to be able to reproduce the full health benefits that made T'ai Chi's reputation in the first place.</p>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=7" title="Edit section: Modern forms">edit</a>]</div>
-<p><a name="Modern_forms" id="Modern_forms"></a></p>
-<h3>Modern forms</h3>
-
-<div class="thumb tright">
-<div style="width:352px;"><a href="/wiki/Image:Tai_Chi_fans.jpg" class="internal" title="Women practicing non-martial T'ai Chi in Chinatown (New York City, New York, USA)."><img src="http://upload.wikimedia.org/wikipedia/en/thumb/a/ad/Tai_Chi_fans.jpg/350px-Tai_Chi_fans.jpg" alt="Women practicing non-martial T'ai Chi in Chinatown (New York City, New York, USA)." width="350" height="201" longdesc="/wiki/Image:Tai_Chi_fans.jpg" /></a>
-<div class="thumbcaption">
-<div class="magnify" style="float:right"><a href="/wiki/Image:Tai_Chi_fans.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>
-Women practicing non-martial T'ai Chi in <a href="/wiki/Chinatown_%28Manhattan%29" title="Chinatown (Manhattan)">Chinatown</a> (<a href="/wiki/New_York_City" title="New York City">New York City</a>, <a href="/wiki/New_York" title="New York">New York</a>, <a href="/wiki/USA" title="USA">USA</a>).</div>
-</div>
-</div>
-
-<p>In order to standardize T'ai Chi Ch'üan for wushu tournament judging, and because many of the family T'ai Chi Ch'üan teachers had either moved out of China or had been forced to stop teaching after the <a href="/wiki/Chinese_Civil_War" title="Chinese Civil War">Communist regime was established</a> in <a href="/wiki/1949" title="1949">1949</a>, the government sponsored Chinese Sports Committee brought together four of their wushu teachers to truncate the Yang family hand form to <a href="/wiki/24_Form_%28Simplified_Form%29_T%27ai_Chi_Ch%27uan" title="24 Form (Simplified Form) T'ai Chi Ch'uan">24 postures</a> in <a href="/wiki/1956" title="1956">1956</a>. They wanted to somehow retain the look of T'ai Chi Ch'üan but make an easy to remember routine that was less difficult to teach and much less difficult to learn than longer (generally 88 to 108 posture) classical solo hand forms. In <a href="/wiki/1976" title="1976">1976</a>, they developed a slightly longer form also for the purposes of demonstration that still didn't involve the complete memory, balance and coordination requirements of the traditional forms. This was a combination form, the <i>Combined 48 Forms</i> that were created by three wushu coaches headed by Professor Men Hui Feng. The combined forms were created based on simplifying and combining some features of the classical forms from four of the original styles; Ch'en, Yang, Wu, and Sun. Even though shorter modern forms don't have the conditioning benefits of the classical forms, the idea was to take what they felt were distinctive cosmetic features of these styles and to express them in a shorter time for purposes of competition.</p>
-
-<p>As T'ai Chi again became popular on the Mainland, competitive forms were developed to be completed within a 6 minute time limit. In the late <a href="/wiki/1980s" title="1980s">1980s</a>, the Chinese Sports Committee standardized many different competition forms. It had developed sets said to represent the four major styles as well as combined forms. These five sets of forms were created by different teams, and later approved by a committee of wushu coaches in China. All sets of forms thus created were named after their style, e.g., the Ch'en Style National Competition Form is the <i>56 Forms</i>, and so on. The combined forms are <i>The 42 Form</i> or simply the <i>Competition Form</i>, as it is known in China. In the 11th <a href="/wiki/Asian_Games" title="Asian Games">Asian Games</a> of <a href="/wiki/1990" title="1990">1990</a>, wushu was included as an item for competition for the first time with the 42 Form being chosen to represent T'ai Chi. The International Wushu Federation (<a href="/w/index.php?title=IWUF&amp;action=edit" class="new" title="IWUF">IWUF</a>) has applied for wushu to be part of the <a href="/wiki/Olympic_games" title="Olympic games">Olympic games</a>. If accepted, it is likely that T'ai Chi and wushu will be represented as demonstration events in <a href="/wiki/2008" title="2008">2008</a>.</p>
-
-<p>Representatives of the original T'ai Chi families do not teach the forms developed by the Chinese Sports Committee. T'ai Chi Ch'üan has historically been seen by them as a martial art, not a sport, with competitions mostly entered as a hobby or to promote one's school publicly, but with little bearing on measuring actual accomplishment in the art. Their criticisms of modern forms include that the modern, "government" routines have no standardized, internally consistent training requirements. Also, that people studying competition forms rarely train pushing hands or other power generation trainings vital to learning the martial applications of T'ai Chi Ch'üan and thereby lack the <a href="/wiki/Quality_control" title="Quality control">quality control</a> traditional teachers maintain is essential for achieving the full benefits from both the health and the martial aspect of traditional T'ai Chi training.</p>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=8" title="Edit section: Health benefits">edit</a>]</div>
-<p><a name="Health_benefits" id="Health_benefits"></a></p>
-<h2>Health benefits</h2>
-<p>Researchers have found that long-term T'ai Chi practice had favorable effects on the promotion of balance control, flexibility and cardiovascular fitness and reduced the risk of falls in elders. The studies also reported reduced pain, stress and anxiety in healthy subjects. Other studies have indicated improved cardiovascular and respiratory function in healthy subjects as well as those who had undergone coronary artery bypass surgery. Patients also benefited from T'ai Chi who suffered from heart failure, high blood pressure, heart attacks, arthritis and multiple sclerosis.</p>
-<p>T'ai Chi has also been shown to reduce the symptoms of young Attention Deficit and Hyperactivity Disorder (<a href="/wiki/ADHD" title="ADHD">ADHD</a>) sufferers. T'ai Chi's gentle, low impact, movements surprisingly burn more calories than surfing and nearly as many as downhill skiing. T'ai Chi also boosts aspects of the immune system's function very significantly, and has been shown to reduce the incidence of anxiety, depression, and overall mood disturbance. (See research citations listed below.)</p>
-
-<p>A pilot study has found evidence that T'ai Chi and related qigong helps reduce the severity of <a href="/wiki/Diabetes" title="Diabetes">diabetes</a>.<a href="http://www.abc.net.au/pm/content/2005/s1535304.htm" class="external autonumber" title="http://www.abc.net.au/pm/content/2005/s1535304.htm">[1]</a></p>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=9" title="Edit section: Citations to medical research">edit</a>]</div>
-<p><a name="Citations_to_medical_research" id="Citations_to_medical_research"></a></p>
-<h3>Citations to medical research</h3>
-<ul>
-<li>Wolf SL, Sattin RW, Kutner M. Intense T'ai Chi exercise training and fall occurrences in older, transitionally frail adults: a randomized, controlled trial. J Am Geriatr Soc. 2003 Dec; 51(12): 1693-701. <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=14687346" class="external" title="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=14687346">PMID 14687346</a></li>
-<li>Wang C, Collet JP, Lau J. The effect of Tai Chi on health outcomes in patients with chronic conditions: a <a href="/wiki/Systematic_review" title="Systematic review">systematic review</a>. Arch Intern Med. 2004 Mar 8;164(5):493-501. <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=15006825" class="external" title="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=15006825">PMID 15006825</a></li>
-
-<li>Search a listing of articles relating to the FICSIT trials and T'ai Chi <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Select+from+History&amp;db=pubmed&amp;query_key=3" class="external autonumber" title="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Select+from+History&amp;db=pubmed&amp;query_key=3">[2]</a></li>
-<li>Hernandez-Reif, M., Field, T.M., &amp; Thimas, E. (2001). Attention deficit hyperactivity disorder: benefits from Tai Chi. Journal of Bodywork &amp; Movement Therapies, 5(2):120-3, 2001 Apr, 5(23 ref), 120-123</li>
-<li>Calorie Burning Chart <a href="http://www.nutristrategy.com/activitylist3.htm" class="external autonumber" title="http://www.nutristrategy.com/activitylist3.htm">[3]</a></li>
-<li>Tai Chi boosts T-Cell counts in immune system <a href="http://www.acupuncturetoday.com/archives2003/nov/11taichi.html" class="external autonumber" title="http://www.acupuncturetoday.com/archives2003/nov/11taichi.html">[4]</a></li>
-<li>Tai Chi, depression, anxiety, and mood disturbance (American Psychological Association) Journal of Psychosomatic Research, 1989 Vol 33 (2) 197-206</li>
-
-<li>A comprehensive listing of Tai Chi medical research links <a href="http://www.worldtaichiday.org/WTCQDHlthBenft.html" class="external autonumber" title="http://www.worldtaichiday.org/WTCQDHlthBenft.html">[5]</a></li>
-<li>References to medical publications <a href="http://www.worldtaichiday.org/HeadlineNews.html" class="external autonumber" title="http://www.worldtaichiday.org/HeadlineNews.html">[6]</a></li>
-<li><a href="http://www.abc.net.au/pm/content/2005/s1535304.htm" class="external text" title="http://www.abc.net.au/pm/content/2005/s1535304.htm">Tai Chi a promising remedy for diabetes</a>, <i>Australian Broadcasting Corporation</i>, 20 December, 2005 - Pilot study of Qigong and tai chi in diabetes sufferers.</li>
-<li>Health Research Articles on "Tai Chi as Health Therapy" for many issues, i.e. ADHD, Cardiac Health &amp; Rehabilitation, Diabetes, High Blood Pressure, Menopause, Bone Loss, Weight Loss, etc.<a href="http://www.worldtaichiday.org/LIBRARYArticles/LIBRARYTaiChiArticlesMenu.html" class="external autonumber" title="http://www.worldtaichiday.org/LIBRARYArticles/LIBRARYTaiChiArticlesMenu.html">[7]</a></li>
-</ul>
-
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=10" title="Edit section: See also">edit</a>]</div>
-<p><a name="See_also" id="See_also"></a></p>
-<h2>See also</h2>
-<ul>
-<li><a href="/wiki/Jing_%28TCM%29" title="Jing (TCM)">Jing</a></li>
-<li><a href="/wiki/List_of_Tai_Chi_Chuan_forms" title="List of Tai Chi Chuan forms">List of Tai Chi Chuan forms</a></li>
-<li><a href="/wiki/Nei_Jin" title="Nei Jin">nei chin</a></li>
-<li><a href="/wiki/Silk_reeling" title="Silk reeling">Silk reeling</a></li>
-<li><a href="/wiki/World_Tai_Chi_and_Qigong_Day" title="World Tai Chi and Qigong Day">World Tai Chi and Qigong Day</a></li>
-
-</ul>
-<div class="editsection" style="float:right;margin-left:5px;">[<a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit&amp;section=11" title="Edit section: External links">edit</a>]</div>
-<p><a name="External_links" id="External_links"></a></p>
-<h2>External links</h2>
-<ul>
-<li><a href="http://www.chenxiaowang.com/" class="external text" title="http://www.chenxiaowang.com/">A Chen Family Website</a></li>
-<li><a href="http://www.yangfamilytaichi.com/" class="external text" title="http://www.yangfamilytaichi.com/">Yang Family Website</a></li>
-<li><a href="http://www.wustyle.com/" class="external text" title="http://www.wustyle.com/">Wu Chien-ch'üan Family Website</a></li>
-<li><a href="http://www.fushengyuan-taichi.com.au/" class="external text" title="http://www.fushengyuan-taichi.com.au/">Fu Family Website</a></li>
-
-<li><a href="http://www.itcca.org/" class="external text" title="http://www.itcca.org/">Yang family disciple's website (ITCCA)</a></li>
-<li><a href="http://www.dongtaichi.com/" class="external text" title="http://www.dongtaichi.com/">Dong T'ai Chi</a></li>
-<li><a href="http://www.leefamilystyle.com/" class="external text" title="http://www.leefamilystyle.com/">UK website for Li style, popular in Europe</a></li>
-<li><a href="http://www.chen-taiji.com/mambo/" class="external text" title="http://www.chen-taiji.com/mambo/">The World of Taijiquan</a></li>
-<li><a href="http://www.scheele.org/lee/tcclinks.html" class="external text" title="http://www.scheele.org/lee/tcclinks.html">Lee Scheele's Links to T'ai Chi Ch'uan Web Sites</a></li>
-<li><a href="http://news.bbc.co.uk/1/hi/health/3543907.stm" class="external text" title="http://news.bbc.co.uk/1/hi/health/3543907.stm">BBC article</a></li>
-<li><a href="http://www.acupuncturetoday.com/archives2004/jul/07taichi.html" class="external text" title="http://www.acupuncturetoday.com/archives2004/jul/07taichi.html">Tai Chi: Good for the Mind, Good for the Body</a></li>
-<li><a href="http://www.taichiunion.com/" class="external text" title="http://www.taichiunion.com/">Tai Chi Chuan Union for Great Britian: The largest collective of independent Tai Chi Chuan Instructors in the British Isles</a></li>
-</ul>
-
-
-<!-- Saved in parser cache with key enwiki:pcache:idhash:30690-0!0!0!1!!en!2 and timestamp 20060722121412 -->
-<div class="printfooter">
-Retrieved from "<a href="http://en.wikipedia.org/wiki/Tai_Chi_Chuan">http://en.wikipedia.org/wiki/Tai_Chi_Chuan</a>"</div>
-			<div id="catlinks"><p class='catlinks'><a href="/w/index.php?title=Special:Categories&amp;article=Tai_Chi_Chuan" title="Special:Categories">Categories</a>: <span dir='ltr'><a href="/wiki/Category:Chinese_martial_arts" title="Category:Chinese martial arts">Chinese martial arts</a></span> | <span dir='ltr'><a href="/wiki/Category:T%27ai_Chi_Ch%27uan" title="Category:T'ai Chi Ch'uan">T'ai Chi Ch'uan</a></span> | <span dir='ltr'><a href="/wiki/Category:Taoism" title="Category:Taoism">Taoism</a></span> | <span dir='ltr'><a href="/wiki/Category:Meditation" title="Category:Meditation">Meditation</a></span> | <span dir='ltr'><a href="/wiki/Category:Mind-body_interventions" title="Category:Mind-body interventions">Mind-body interventions</a></span> | <span dir='ltr'><a href="/wiki/Category:Traditional_Chinese_medicine" title="Category:Traditional Chinese medicine">Traditional Chinese medicine</a></span></p></div>			<!-- end content -->
-
-			<div class="visualClear"></div>
-		</div>
-	</div>
-		</div>
-		<div id="column-one">
-	<div id="p-cactions" class="portlet">
-		<h5>Views</h5>
-		<ul>
-
-				 <li id="ca-nstab-main" class="selected"><a href="/wiki/Tai_Chi_Chuan">Article</a></li>
-				 <li id="ca-talk"><a href="/wiki/Talk:Tai_Chi_Chuan">Discussion</a></li>
-				 <li id="ca-edit"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=edit">Edit this page</a></li>
-				 <li id="ca-history"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=history">History</a></li>
-				 <li id="ca-protect"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=protect">Protect</a></li>
-				 <li id="ca-delete"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=delete">Delete</a></li>
-
-				 <li id="ca-move"><a href="/w/index.php?title=Special:Movepage&amp;target=Tai_Chi_Chuan">Move</a></li>
-				 <li id="ca-unwatch"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;action=unwatch">Unwatch</a></li>
-		</ul>
-	</div>
-	<div class="portlet" id="p-personal">
-		<h5>Personal tools</h5>
-		<div class="pBody">
-
-			<ul>
-				<li id="pt-userpage"><a href="/wiki/User:Edward_Z._Yang">Edward Z. Yang</a></li>
-				<li id="pt-mytalk"><a href="/wiki/User_talk:Edward_Z._Yang">My talk</a></li>
-				<li id="pt-preferences"><a href="/wiki/Special:Preferences">My preferences</a></li>
-				<li id="pt-watchlist"><a href="/wiki/Special:Watchlist">My watchlist</a></li>
-				<li id="pt-mycontris"><a href="/wiki/Special:Contributions/Edward_Z._Yang">My contributions</a></li>
-
-				<li id="pt-logout"><a href="/w/index.php?title=Special:Userlogout&amp;returnto=Tai_Chi_Chuan">Log out</a></li>
-			</ul>
-		</div>
-	</div>
-	<div class="portlet" id="p-logo">
-		<a style="background-image: url(/images/wiki-en.png);" href="/wiki/Main_Page" title="Main Page"></a>
-	</div>
-	<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
-
-		<div class='portlet' id='p-navigation'>
-		<h5>Navigation</h5>
-		<div class='pBody'>
-			<ul>
-				<li id="n-mainpage"><a href="/wiki/Main_Page">Main Page</a></li>
-				<li id="n-portal"><a href="/wiki/Wikipedia:Community_Portal">Community Portal</a></li>
-				<li id="n-Featured-articles"><a href="/wiki/Wikipedia:Featured_articles">Featured articles</a></li>
-
-				<li id="n-currentevents"><a href="/wiki/Portal:Current_events">Current events</a></li>
-				<li id="n-recentchanges"><a href="/wiki/Special:Recentchanges">Recent changes</a></li>
-				<li id="n-randompage"><a href="/wiki/Special:Random">Random article</a></li>
-				<li id="n-help"><a href="/wiki/Help:Contents">Help</a></li>
-				<li id="n-contact"><a href="/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li>
-				<li id="n-sitesupport"><a href="http://wikimediafoundation.org/wiki/Fundraising#Donation_methods">Donations</a></li>
-
-			</ul>
-		</div>
-	</div>
-		<div id="p-search" class="portlet">
-		<h5><label for="searchInput">Search</label></h5>
-		<div id="searchBody" class="pBody">
-			<form action="/wiki/Special:Search" id="searchform"><div>
-				<input id="searchInput" name="search" type="text" accesskey="f" value="" />
-
-				<input type='submit' name="go" class="searchButton" id="searchGoButton"	value="Go" />&nbsp;
-				<input type='submit' name="fulltext" class="searchButton" value="Search" />
-			</div></form>
-		</div>
-	</div>
-	<div class="portlet" id="p-tb">
-		<h5>Toolbox</h5>
-		<div class="pBody">
-
-			<ul>
-				<li id="t-whatlinkshere"><a href="/w/index.php?title=Special:Whatlinkshere&amp;target=Tai_Chi_Chuan">What links here</a></li>
-				<li id="t-recentchangeslinked"><a href="/w/index.php?title=Special:Recentchangeslinked&amp;target=Tai_Chi_Chuan">Related changes</a></li>
-<li id="t-upload"><a href="/wiki/Special:Upload">Upload file</a></li>
-<li id="t-specialpages"><a href="/wiki/Special:Specialpages">Special pages</a></li>
-				<li id="t-print"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;printable=yes">Printable version</a></li>				<li id="t-permalink"><a href="/w/index.php?title=Tai_Chi_Chuan&amp;oldid=65197836">Permanent link</a></li><li id="t-cite"><a href="/w/index.php?title=Special:Cite&amp;page=Tai_Chi_Chuan&amp;id=65197836">Cite this article</a></li>			</ul>
-
-		</div>
-	</div>
-	<div id="p-lang" class="portlet">
-		<h5>In other languages</h5>
-		<div class="pBody">
-			<ul>
-				<li class="interwiki-br"><a href="http://br.wikipedia.org/wiki/Taichichuan">Brezhoneg</a></li>
-				<li class="interwiki-ca"><a href="http://ca.wikipedia.org/wiki/Tai_txi_txuan">Català</a></li>
-
-				<li class="interwiki-cs"><a href="http://cs.wikipedia.org/wiki/Tchaj-%C5%A5i">Cesky</a></li>
-				<li class="interwiki-da"><a href="http://da.wikipedia.org/wiki/Tai_Chi">Dansk</a></li>
-				<li class="interwiki-de"><a href="http://de.wikipedia.org/wiki/Taijiquan">Deutsch</a></li>
-				<li class="interwiki-et"><a href="http://et.wikipedia.org/wiki/Taijiquan">Eesti</a></li>
-				<li class="interwiki-el"><a href="http://el.wikipedia.org/wiki/%CE%A4%CE%AC%CE%B9_%CE%A4%CE%B6%CE%AF_%CE%A3%CE%BF%CF%85%CE%AC%CE%BD">????????</a></li>
-				<li class="interwiki-es"><a href="http://es.wikipedia.org/wiki/Tai_Chi_Chuan">Español</a></li>
-
-				<li class="interwiki-eo"><a href="http://eo.wikipedia.org/wiki/Taj%C4%9Di%C4%89uano">Esperanto</a></li>
-				<li class="interwiki-fr"><a href="http://fr.wikipedia.org/wiki/Tai-chi-chuan">Français</a></li>
-				<li class="interwiki-it"><a href="http://it.wikipedia.org/wiki/Taijiquan">Italiano</a></li>
-				<li class="interwiki-he"><a href="http://he.wikipedia.org/wiki/%D7%98%D7%90%D7%99_%D7%A6%27%D7%99">?????</a></li>
-				<li class="interwiki-hu"><a href="http://hu.wikipedia.org/wiki/Taijiquan">Magyar</a></li>
-				<li class="interwiki-nl"><a href="http://nl.wikipedia.org/wiki/Tai_Chi">Nederlands</a></li>
-
-				<li class="interwiki-ja"><a href="http://ja.wikipedia.org/wiki/%E5%A4%AA%E6%A5%B5%E6%8B%B3">???</a></li>
-				<li class="interwiki-pl"><a href="http://pl.wikipedia.org/wiki/Taijiquan">Polski</a></li>
-				<li class="interwiki-pt"><a href="http://pt.wikipedia.org/wiki/Tai_Chi_Chuan">Português</a></li>
-				<li class="interwiki-ro"><a href="http://ro.wikipedia.org/wiki/Taijiquan">Româna</a></li>
-				<li class="interwiki-ru"><a href="http://ru.wikipedia.org/wiki/%D0%A2%D0%B0%D0%B9%D1%86%D0%B7%D0%B8%D1%86%D1%8E%D0%B0%D0%BD%D1%8C">???????</a></li>
-				<li class="interwiki-fi"><a href="http://fi.wikipedia.org/wiki/Taijiquan">Suomi</a></li>
-
-				<li class="interwiki-sv"><a href="http://sv.wikipedia.org/wiki/Taijiquan">Svenska</a></li>
-				<li class="interwiki-th"><a href="http://th.wikipedia.org/wiki/%E0%B9%84%E0%B8%97%E0%B9%88%E0%B9%80%E0%B8%81%E0%B9%8A%E0%B8%81">???</a></li>
-				<li class="interwiki-tr"><a href="http://tr.wikipedia.org/wiki/Tai-Chi_Chuan">Türkçe</a></li>
-				<li class="interwiki-zh"><a href="http://zh.wikipedia.org/wiki/%E5%A4%AA%E6%9E%81%E6%8B%B3">??</a></li>
-			</ul>
-		</div>
-	</div>
-
-		</div><!-- end of the left (by default at least) column -->
-			<div class="visualClear"></div>
-			<div id="footer">
-				<div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="/skins-1.5/common/images/poweredby_mediawiki_88x31.png" alt="MediaWiki" /></a></div>
-				<div id="f-copyrightico"><a href="http://wikimediafoundation.org/"><img src="/images/wikimedia-button.png" border="0" alt="Wikimedia Foundation"/></a></div>
-			<ul id="f-list">
-				<li id="lastmod"> This page was last modified 03:15, July 22, 2006.</li>
-				<li id="copyright">All text is available under the terms of the <a class='internal' href="/wiki/Wikipedia:Text_of_the_GNU_Free_Documentation_License" title="Wikipedia:Text of the GNU Free Documentation License">GNU Free Documentation License</a>. (See <b><a class='internal' href="/wiki/Wikipedia:Copyrights" title="Wikipedia:Copyrights">Copyrights</a></b> for details.) <br /> Wikipedia&reg; is a registered trademark of the Wikimedia Foundation, Inc.<br /></li>
-
-				<li id="privacy"><a href="http://wikimediafoundation.org/wiki/Privacy_policy" title="wikimedia:Privacy policy">Privacy policy</a></li>
-				<li id="about"><a href="/wiki/Wikipedia:About" title="Wikipedia:About">About Wikipedia</a></li>
-				<li id="disclaimer"><a href="/wiki/Wikipedia:General_disclaimer" title="Wikipedia:General disclaimer">Disclaimers</a></li>
-			</ul>
-		</div>
-	<script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
-</div>
-
-<!-- Served by srv25 in 0.089 secs. -->
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 7
main/inc/lib/htmlpurifier/benchmarks/samples/Lexer/DISCLAIMER.txt

@@ -1,7 +0,0 @@
-Disclaimer:
-
-The HTML used in these samples are taken from random websites.  I claim
-no copyright over these and assert that I may use them like this under
-fair use.
-
-    vim: et sw=4 sts=4

+ 0 - 218
main/inc/lib/htmlpurifier/docs/dev-advanced-api.html

@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Specification for HTML Purifier's advanced API for defining custom filtering behavior." />
-<link rel="stylesheet" type="text/css" href="style.css" />
-
-<title>Advanced API - HTML Purifier</title>
-
-</head><body>
-
-<h1>Advanced API</h1>
-
-<div id="filing">Filed under Development</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>
-  <strong>Warning:</strong> This document may be out-of-date. When in doubt,
-  consult the source code documentation.
-</p>
-
-<p>HTML Purifier currently natively supports only a subset of HTML's
-allowed elements, attributes, and behavior; specifically, this subset
-is the set of elements that are safe for untrusted users to use.
-However, HTML Purifier is often utilized to ensure standards-compliance
-from input that is trusted (making it a sort of Tidy substitute),
-and often users need to define new elements or attributes. The
-advanced API is oriented specifically for these use-cases.</p>
-
-<p>Our goals are to let the user:</p>
-
-<dl>
-    <dt>Select</dt>
-    <dd><ul>
-        <li>Doctype</li>
-        <!-- <li>Filterset</li> -->
-        <li>Elements / Attributes / Modules</li>
-        <li>Tidy</li>
-    </ul></dd>
-    <dt>Customize</dt>
-    <dd><ul>
-        <li>Attributes</li>
-        <li>Elements</li>
-        <!--<li>Doctypes</li>-->
-    </ul></dd>
-</dl>
-
-<h2>Select</h2>
-
-<p>For basic use, the user will have to specify some basic parameters. This
-is not strictly necessary, as HTML Purifier's default setting will always
-output safe code, but is required for standards-compliant output.</p>
-
-<h3>Selecting a Doctype</h3>
-
-<p>The first thing to select is the <strong>doctype</strong>. This
-is essential for standards-compliant output.</p>
-
-<p class="technical">This identifier is based
-on the name the W3C has given to the document type and <em>not</em>
-the DTD identifier.</p>
-
-<p>This parameter is set via the configuration object:</p>
-
-<pre>$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional');</pre>
-
-<p>Due to historical reasons, the default doctype is XHTML 1.0
-Transitional, however, we really shouldn't be guessing what the user's
-doctype is. Fortunantely, people who can't be bothered to set this won't
-be bothered when their pages stop validating.</p>
-
-<h3>Selecting Elements / Attributes / Modules</h3>
-
-<p>HTML Purifier will, by default, allow as many elements and attributes
-as possible. However, a user may decide to roll their own filterset by
-selecting modules, elements and attributes to allow for their own
-specific use-case. This can be done using %HTML.Allowed:</p>
-
-<pre>$config->set('HTML', 'Allowed', 'a[href|title],em,p,blockquote');</pre>
-
-<p class="technical">The directive %HTML.Allowed is a convenience feature
-that may be fully expressed with the legacy interface.</p>
-
-<p>We currently support another interface from older versions:</p>
-
-<pre>$config->set('HTML', 'AllowedElements', 'a,em,p,blockquote');
-$config->set('HTML', 'AllowedAttributes', 'a.href,a.title');</pre>
-
-<p>A user may also choose to allow modules using a specialized
-directive:</p>
-
-<pre>$config->set('HTML', 'AllowedModules', 'Hypertext,Text,Lists');</pre>
-
-<p>But it is not expected that this feature will be widely used.</p>
-
-<p class="technical">Module selection will work slightly differently
-from the other AllowedElements and AllowedAttributes directives by
-directly modifying the doctype you are operating in, in the spirit of
-XHTML 1.1's modularization. We stop users from shooting themselves in the
-foot by mandating the modules in %HTML.CoreModules be used.</p>
-
-<p class="technical">Modules are distinguished from regular elements by the
-case of their first letter. While XML distinguishes between and allows
-lower and uppercase letters in element names, XHTML uses only lower-case
-element names for sake of consistency.</p>
-
-<h3>Selecting Tidy</h3>
-
-<p>The name of this segment of functionality is inspired off of Dave
-Ragget's program HTML Tidy, which purported to help clean up HTML. In
-HTML Purifier, Tidy functionality involves turning unsupported and
-deprecated elements into standards-compliant ones, maintaining
-backwards compatibility, and enforcing best practices.</p>
-
-<p>This is a complicated feature, and is explained more in depth at
-<a href="enduser-tidy.html">the Tidy documentation page</a>.</p>
-
-<!--
-<h3>Unified selector</h3>
-
-<p>Because selecting each and every one of these configuration options
-is a chore, we may wish to offer a specialized configuration method
-for selecting a filterset. Possibility:</p>
-
-<pre>function selectFilter($doctype, $filterset, $tidy)</pre>
-
-<p>...which is simply a light wrapper over the individual configuration
-calls. A custom config file format or text format could also be adopted.</p>
--->
-
-<h2>Customize</h2>
-
-<p>By reviewing topic posts in the support forum, we determined that
-there were two primarily demanded customization features people wanted:
-to add an attribute to an existing element, and to add an element.
-Thus, we'll want to create convenience functions for these common
-use-cases.</p>
-
-<p>Note that the functions described here are only available if
-a raw copy of <code>HTMLPurifier_HTMLDefinition</code> was retrieved.
-Furthermore, caching may prevent your changes from immediately
-being seen: consult <a href="enduser-customize.html">enduser-customize.html</a> on how
-to work around this.</p>
-
-<h3>Attributes</h3>
-
-<p>An attribute is bound to an element by a name and has a specific
-<code>AttrDef</code> that validates it. The interface is therefore:</p>
-
-<pre>function addAttribute($element, $attribute, $attribute_def);</pre>
-
-<p>Example of the functionality in action:</p>
-
-<pre>$def->addAttribute('a', 'rel', 'Enum#nofollow');</pre>
-
-<p>The <code>$attribute_def</code> value is flexible,
-to make things simpler. It can be a literal object or:</p>
-
-<ul>
-    <!--<li>Class name: We'll instantiate it for you</li>
-    <li>Function name: We'll create an <code>HTMLPurifier_AttrDef_Anonymous</code>
-        class with that function registered as a callback.</li>-->
-    <li>String attribute type: We'll use <code>HTMLPurifier_AttrTypes</code>
-        to resolve it for you. Any data that follows a hash mark (#) will
-        be used to customize the attribute type: in the example above,
-        we specify which values for Enum to allow.</li>
-</ul>
-
-<h3>Elements</h3>
-
-<p>An element requires certain information as specified by
-<code>HTMLPurifier_ElementDef</code>. However, not all of it is necessary,
-the usual things required are:</p>
-
-<ul>
-    <li>Attributes</li>
-    <li>Content model/type</li>
-    <li>Registration in a content set</li>
-</ul>
-
-<p>This suggests an API like this:</p>
-
-<pre>function addElement($element, $type, $contents,
-    $attr_collections = array(); $attributes = array());</pre>
-
-<p>Each parameter explained in depth:</p>
-
-<dl>
-    <dt><code>$element</code></dt>
-    <dd>Element name, ex. 'label'</dd>
-    <dt><code>$type</code></dt>
-    <dd>Content set to register in, ex. 'Inline' or 'Flow'</dd>
-    <dt><code>$contents</code></dt>
-    <dd>Description of allowed children. This is a merged form of
-        <code>HTMLPurifier_ElementDef</code>'s member variables
-        <code>$content_model</code> and <code>$content_model_type</code>,
-        where the form is <q>Type: Model</q>, ex. 'Optional: Inline'.
-        There are also a number of predefined templates one may use.</dd>
-    <dt><code>$attr_collections</code></dt>
-    <dd>Array (or string if only one) of attribute collection(s) to
-        merge into the attributes array.</dd>
-    <dt><code>$attributes</code></dt>
-    <dd>Array of attribute names to attribute definitions, much like
-        the above-described attribute customization.</dd>
-</dl>
-
-<p>A possible usage:</p>
-
-<pre>$def->addElement('font', 'Inline', 'Optional: Inline', 'Common',
-    array('color' => 'Color'));</pre>
-
-<p>See <code>HTMLPurifier/HTMLModule.php</code> for details.</p>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 29
main/inc/lib/htmlpurifier/docs/dev-code-quality.txt

@@ -1,29 +0,0 @@
-
-Code Quality Issues
-
-Okay, face it.  Programmers can get lazy, cut corners, or make mistakes. They
-also can do quick prototypes, and then forget to rewrite them later.  Well,
-while I can't list mistakes in here, I can list prototype-like segments
-of code that should be aggressively refactored.  This does not list
-optimization issues, that needs to be done after intense profiling.
-
-docs/examples/demo.php - ad hoc HTML/PHP soup to the extreme
-
-AttrDef - a lot of duplication, more generic classes need to be created;
-a lot of strtolower() calls, no legit casing
-    Class - doesn't support Unicode characters (fringe); uses regular expressions
-    Lang - code duplication; premature optimization
-    Length - easily mistaken for CSSLength
-    URI - multiple regular expressions; missing validation for parts (?)
-    CSS - parser doesn't accept advanced CSS (fringe)
-    Number - constructor interface inconsistent with Integer
-Strategy
-    FixNesting - cannot bubble nodes out of structures, duplicated checks
-        for special-case parent node
-    RemoveForeignElements - should be run in parallel with MakeWellFormed
-URIScheme - needs to have callable generic checks
-    mailto - doesn't validate emails, doesn't validate querystring
-    news - doesn't validate opaque path
-    nntp - doesn't constrain path
-
-    vim: et sw=4 sts=4

+ 0 - 376
main/inc/lib/htmlpurifier/docs/dev-config-schema.html

@@ -1,376 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <meta name="description" content="Describes config schema framework in HTML Purifier." />
-    <link rel="stylesheet" type="text/css" href="./style.css" />
-    <title>Config Schema - HTML Purifier</title>
-  </head>
-  <body>
-
-    <h1>Config Schema</h1>
-
-    <div id="filing">Filed under Development</div>
-    <div id="index">Return to the <a href="index.html">index</a>.</div>
-    <div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-    <p>
-      HTML Purifier has a fairly complex system for configuration. Users
-      interact with a <code>HTMLPurifier_Config</code> object to
-      set configuration directives. The values they set are validated according
-      to a configuration schema, <code>HTMLPurifier_ConfigSchema</code>.
-    </p>
-
-    <p>
-      The schema is mostly transparent to end-users, but if you're doing development
-      work for HTML Purifier and need to define a new configuration directive,
-      you'll need to interact with it. We'll also talk about how to define
-      userspace configuration directives at the very end.
-    </p>
-
-    <h2>Write a directive file</h2>
-
-    <p>
-      Directive files define configuration directives to be used by
-      HTML Purifier. They are placed in <code>library/HTMLPurifier/ConfigSchema/schema/</code>
-      in the form <code><em>Namespace</em>.<em>Directive</em>.txt</code> (I
-      couldn't think of a more descriptive file extension.)
-      Directive files are actually what we call <code>StringHash</code>es,
-      i.e. associative arrays represented in a string form reminiscent of
-      <a href="http://qa.php.net/write-test.php">PHPT</a> tests. Here's a
-      sample directive file, <code>Test.Sample.txt</code>:
-    </p>
-
-    <pre>Test.Sample
-TYPE: string/null
-DEFAULT: NULL
-ALLOWED: 'foo', 'bar'
-VALUE-ALIASES: 'baz' => 'bar'
-VERSION: 3.1.0
---DESCRIPTION--
-This is a sample configuration directive for the purposes of the
-&lt;code&gt;dev-config-schema.html&lt;code&gt; documentation.
---ALIASES--
-Test.Example</pre>
-
-    <p>
-      Each of these segments has a specific meaning:
-    </p>
-
-    <table class="table">
-      <thead>
-        <tr>
-          <th>Key</th>
-          <th>Example</th>
-          <th>Description</th>
-        </tr>
-      </thead>
-      <tbody>
-        <tr>
-          <td>ID</td>
-          <td>Test.Sample</td>
-          <td>The name of the directive, in the form Namespace.Directive
-          (implicitly the first line)</td>
-        </tr>
-        <tr>
-          <td>TYPE</td>
-          <td>string/null</td>
-          <td>The type of variable this directive accepts. See below for
-          details. You can also add <code>/null</code> to the end of
-          any basic type to allow null values too.</td>
-        </tr>
-        <tr>
-          <td>DEFAULT</td>
-          <td>NULL</td>
-          <td>A parseable PHP expression of the default value.</td>
-        </tr>
-        <tr>
-          <td>DESCRIPTION</td>
-          <td>This is a...</td>
-          <td>An HTML description of what this directive does.</td>
-        </tr>
-        <tr>
-          <td>VERSION</td>
-          <td>3.1.0</td>
-          <td><em>Recommended</em>. The version of HTML Purifier this directive was added.
-          Directives that have been around since 1.0.0 don't have this,
-          but any new ones should.</td>
-        </tr>
-        <tr>
-          <td>ALIASES</td>
-          <td>Test.Example</td>
-          <td><em>Optional</em>. A comma separated list of aliases for this directive.
-          This is most useful for backwards compatibility and should
-          not be used otherwise.</td>
-        </tr>
-        <tr>
-          <td>ALLOWED</td>
-          <td>'foo', 'bar'</td>
-          <td><em>Optional</em>. Set of allowed value for a directive,
-          a comma separated list of parseable PHP expressions. This
-          is only allowed string, istring, text and itext TYPEs.</td>
-        </tr>
-        <tr>
-          <td>VALUE-ALIASES</td>
-          <td>'baz' => 'bar'</td>
-          <td><em>Optional</em>. Mapping of one value to another, and
-          should be a comma separated list of keypair duples. This
-          is only allowed string, istring, text and itext TYPEs.</td>
-        </tr>
-        <tr>
-          <td>DEPRECATED-VERSION</td>
-          <td>3.1.0</td>
-          <td><em>Not shown</em>. Indicates that the directive was
-          deprecated this version.</td>
-        </tr>
-        <tr>
-          <td>DEPRECATED-USE</td>
-          <td>Test.NewDirective</td>
-          <td><em>Not shown</em>. Indicates what new directive should be
-          used instead. Note that the directives will functionally be
-          different, although they should offer the same functionality.
-          If they are identical, use an alias instead.</td>
-        </tr>
-        <tr>
-          <td>EXTERNAL</td>
-          <td>CSSTidy</td>
-          <td><em>Not shown</em>. Indicates if there is an external library
-          the user will need to download and install to use this configuration
-          directive. As of right now, this is merely a Google-able name; future
-          versions may also provide links and instructions.</td>
-        </tr>
-      </tbody>
-    </table>
-
-    <p>
-      Some notes on format and style:
-    </p>
-
-    <ul>
-      <li>
-        Each of these keys can be expressed in the short format
-        (<code>KEY: Value</code>) or the long format
-        (<code>--KEY--</code> with value beneath). You must use the
-        long format if multiple lines are needed, or if a long format
-        has been used already (that's why <code>ALIASES</code> in our
-        example is in the long format); otherwise, it's user preference.
-      </li>
-      <li>
-        The HTML descriptions should be wrapped at about 80 columns; do
-        not rely on editor word-wrapping.
-      </li>
-    </ul>
-
-    <p>
-      Also, as promised, here is the set of possible types:
-    </p>
-
-    <table class="table">
-      <thead>
-        <tr>
-          <th>Type</th>
-          <th>Example</th>
-          <th>Description</th>
-        </tr>
-      </thead>
-      <tbody>
-        <tr>
-          <td>string</td>
-          <td>'Foo'</td>
-          <td><a href="http://docs.php.net/manual/en/language.types.string.php">String</a> without newlines</td>
-        </tr>
-        <tr>
-          <td>istring</td>
-          <td>'foo'</td>
-          <td>Case insensitive ASCII string without newlines</td>
-        </tr>
-        <tr>
-          <td>text</td>
-          <td>"A<em>\n</em>b"</td>
-          <td>String with newlines</td>
-        </tr>
-        <tr>
-          <td>itext</td>
-          <td>"a<em>\n</em>b"</td>
-          <td>Case insensitive ASCII string without newlines</td>
-        </tr>
-        <tr>
-          <td>int</td>
-          <td>23</td>
-          <td>Integer</td>
-        </tr>
-        <tr>
-          <td>float</td>
-          <td>3.0</td>
-          <td>Floating point number</td>
-        </tr>
-        <tr>
-          <td>bool</td>
-          <td>true</td>
-          <td>Boolean</td>
-        </tr>
-        <tr>
-          <td>lookup</td>
-          <td>array('key' => true)</td>
-          <td>Lookup array, used with <code>isset($var[$key])</code></td>
-        </tr>
-        <tr>
-          <td>list</td>
-          <td>array('f', 'b')</td>
-          <td>List array, with ordered numerical indexes</td>
-        </tr>
-        <tr>
-          <td>hash</td>
-          <td>array('key' => 'val')</td>
-          <td>Associative array of keys to values</td>
-        </tr>
-        <tr>
-          <td>mixed</td>
-          <td>new stdclass</td>
-          <td>Any PHP variable is fine</td>
-        </tr>
-      </tbody>
-    </table>
-
-    <p>
-      The examples represent what will be returned out of the configuration
-      object; users have a little bit of leeway when setting configuration
-      values (for example, a lookup value can be specified as a list;
-      HTML Purifier will flip it as necessary.) These types are defined
-      in <a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/VarParser.php">
-      library/HTMLPurifier/VarParser.php</a>.
-    </p>
-
-    <p>
-      For more information on what values are allowed, and how they are parsed,
-      consult <a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php">
-      library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php</a>, as well
-      as <a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/ConfigSchema/Interchange/Directive.php">
-      library/HTMLPurifier/ConfigSchema/Interchange/Directive.php</a> for
-      the semantics of the parsed values.
-    </p>
-
-    <h2>Refreshing the cache</h2>
-
-    <p>
-      You may have noticed that your directive file isn't doing anything
-      yet. That's because it hasn't been added to the runtime
-      <code>HTMLPurifier_ConfigSchema</code> instance. Run
-      <code>maintenance/generate-schema-cache.php</code> to fix this.
-      If there were no errors, you're good to go! Don't forget to add
-      some unit tests for your functionality!
-    </p>
-
-    <p>
-      If you ever make changes to your configuration directives, you
-      will need to run this script again.
-    </p>
-
-    <h2>Errors</h2>
-
-    <p>
-      All directive files go through a rigorous validation process
-      through <a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/ConfigSchema/Validator.php">
-      library/HTMLPurifier/ConfigSchema/Validator.php</a>, as well
-      as some basic checks during building. While
-      listing every error out here is out-of-scope for this document, we
-      can give some general tips for interpreting error messages.
-      There are two types of errors: builder errors and validation errors.
-    </p>
-
-    <h3>Builder errors</h3>
-
-    <blockquote>
-      <p>
-        <strong>Exception:</strong> Expected type string, got
-        integer in DEFAULT in directive hash 'Ns.Dir'
-      </p>
-    </blockquote>
-
-    <p>
-      You can identify a builder error by the keyword "directive hash."
-      These are the easiest to deal with, because they directly correspond
-      with your directive file. Find the offending directive file (which
-      is the directive hash plus the .txt extension), find the
-      offending index ("in DEFAULT" means the DEFAULT key) and fix the error.
-      This particular error would occur if your default value is not the same
-      type as TYPE.
-    </p>
-
-    <h3>Validation errors</h3>
-
-    <blockquote>
-      <p>
-        <strong>Exception:</strong> Alias 3 in valueAliases in directive
-        'Ns.Dir' must be a string
-      </p>
-    </blockquote>
-
-    <p>
-      These are a little trickier, because we're not actually validating
-      your directive file, or even the direct string hash representation.
-      We're validating an Interchange object, and the error messages do
-      not mention any string hash keys.
-    </p>
-
-    <p>
-      Nevertheless, it's not difficult to figure out what went wrong.
-      Read the "context" statements in reverse:
-    </p>
-
-    <dl>
-      <dt>in directive 'Ns.Dir'</dt>
-        <dd>This means we need to look at the directive file <code>Ns.Dir.txt</code></dd>
-      <dt>in valueAliases</dt>
-        <dd>There's no key actually called this, but there's one that's close:
-          VALUE-ALIASES. Indeed, that's where to look.</dd>
-      <dt>Alias 3</dt>
-        <dd>The value alias that is equal to 3 is the culprit.</dd>
-    </dl>
-
-    <p>
-      In this particular case, you're not allowed to alias integers values to
-      strings values.
-    </p>
-
-    <p>
-      The most difficult part is translating the Interchange member variable (valueAliases)
-      into a directive file key (VALUE-ALIASES), but there's a one-to-one
-      correspondence currently. If the two formats diverge, any discrepancies
-      will be described in <a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php">
-      library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php</a>.
-    </p>
-
-    <h2>Internals</h2>
-
-    <p>
-      Much of the configuration schema framework's codebase deals with
-      shuffling data from one format to another, and doing validation on this
-      data.
-      The keystone of all of this is the <code>HTMLPurifier_ConfigSchema_Interchange</code>
-      class, which represents the purest, parsed representation of the schema.
-    </p>
-
-    <p>
-      Hand-writing this data is unwieldy, however, so we write directive files.
-      These directive files are parsed by <code>HTMLPurifier_StringHashParser</code>
-      into <code>HTMLPurifier_StringHash</code>es, which then
-      are run through <code>HTMLPurifier_ConfigSchema_InterchangeBuilder</code>
-      to construct the interchange object.
-    </p>
-
-    <p>
-      From the interchange object, the data can be siphoned into other forms
-      using <code>HTMLPurifier_ConfigSchema_Builder</code> subclasses.
-      For example, <code>HTMLPurifier_ConfigSchema_Builder_ConfigSchema</code>
-      generates a runtime <code>HTMLPurifier_ConfigSchema</code> object,
-      which <code>HTMLPurifier_Config</code> uses to validate its incoming
-      data. There is also an XML serializer, which is used to build documentation.
-    </p>
-
-  </body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 67
main/inc/lib/htmlpurifier/docs/dev-flush.html

@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <meta name="description" content="Discusses when to flush HTML Purifier's various caches." />
-    <link rel="stylesheet" type="text/css" href="./style.css" />
-    <title>Flushing the Purifier - HTML Purifier</title>
-</head>
-<body>
-
-<h1>Flushing the Purifier</h1>
-
-<div id="filing">Filed under Development</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>
-    If you've been poking around the various folders in HTML Purifier,
-    you may have noticed the <code>maintenance</code> directory.  Almost
-    all of these scripts are devoted to flushing out the various caches
-    HTML Purifier uses.  Normal users don't have to worry about this:
-    regular library usage is transparent.  However, when doing development
-    work on HTML Purifier, you may find you have to flush one of the
-    caches.
-</p>
-
-<p>
-    As a general rule of thumb, run <code>flush.php</code> whenever you make
-    any <em>major</em> changes, or when tests start mysteriously failing.
-    In more detail, run this script if:
-</p>
-
-<ul>
-    <li>
-        You added new source files to HTML Purifier's main library.
-        (see <code>generate-includes.php</code>)
-    </li>
-    <li>
-        You modified the configuration schema (see
-        <code>generate-schema-cache.php</code>). This usually means
-        adding or modifying files in <code>HTMLPurifier/ConfigSchema/schema/</code>,
-        although in rare cases modifying <code>HTMLPurifier/ConfigSchema.php</code>
-        will also require this.
-    </li>
-    <li>
-        You modified a Definition, or its subsystems. The most usual candidate
-        is <code>HTMLPurifier/HTMLDefinition.php</code>, which also encompasses
-        the files in <code>HTMLPurifier/HTMLModule/</code> as well as if you've
-        <a href="enduser-customize.html">customizing definitions</a> without
-        the cache disabled. (see <code>flush-generation-cache.php</code>)
-    </li>
-    <li>
-        You modified source files, and have been using the standalone
-        version from the full installation. (see <code>generate-standalone.php</code>)
-    </li>
-</ul>
-
-<p>
-    You can check out the corresponding scripts for more information on what they
-    do.
-</p>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 281
main/inc/lib/htmlpurifier/docs/dev-includes.txt

@@ -1,281 +0,0 @@
-
-INCLUDES, AUTOLOAD, BYTECODE CACHES and OPTIMIZATION
-
-The Problem
------------
-
-HTML Purifier contains a number of extra components that are not used all
-of the time, only if the user explicitly specifies that we should use
-them.
-
-Some of these optional components are optionally included (Filter,
-Language, Lexer, Printer), while others are included all the time
-(Injector, URIFilter, HTMLModule, URIScheme). We will stipulate that these
-are all developer specified: it is conceivable that certain Tokens are not
-used, but this is user-dependent and should not be trusted.
-
-We should come up with a consistent way to handle these things and ensure
-that we get the maximum performance when there is bytecode caches and
-when there are not. Unfortunately, these two goals seem contrary to each
-other.
-
-A peripheral issue is the performance of ConfigSchema, which has been
-shown take a large, constant amount of initialization time, and is
-intricately linked to the issue of includes due to its pervasive use
-in our plugin architecture.
-
-Pros and Cons
--------------
-
-We will assume that user-based extensions will be included by them.
-
-Conditional includes:
-  Pros:
-    - User management is simplified; only a single directive needs to be set
-    - Only necessary code is included
-  Cons:
-    - Doesn't play nicely with opcode caches
-    - Adds complexity to standalone version
-    - Optional configuration directives are not exposed without a little
-      extra coaxing (not implemented yet)
-
-Include it all:
-  Pros:
-    - User management is still simple
-    - Plays nicely with opcode caches and standalone version
-    - All configuration directives are present
-  Cons:
-    - Lots of (how much?) extra code is included
-    - Classes that inherit from external libraries will cause compile
-      errors
-
-Build an include stub (Let's do this!):
-  Pros:
-    - Only necessary code is included
-    - Plays nicely with opcode caches and standalone version
-    - require (without once) can be used, see above
-    - Could further extend as a compilation to one file
-  Cons:
-    - Not implemented yet
-    - Requires user intervention and use of a command line script
-    - Standalone script must be chained to this
-    - More complex and compiled-language-like
-    - Requires a whole new class of system-wide configuration directives,
-      as configuration objects can be reused
-    - Determining what needs to be included can be complex (see above)
-    - No way of autodetecting dynamically instantiated classes
-    - Might be slow
-
-Include stubs
--------------
-
-This solution may be "just right" for users who are heavily oriented
-towards performance. However, there are a number of picky implementation
-details to work out beforehand.
-
-The number one concern is how to make the HTML Purifier files "work
-out of the box", while still being able to easily get them into a form
-that works with this setup. As the codebase stands right now, it would
-be necessary to strip out all of the require_once calls. The only way
-we could get rid of the require_once calls is to use __autoload or
-use the stub for all cases (which might not be a bad idea).
-
-    Aside
-    -----
-    An important thing to remember, however, is that these require_once's
-    are valuable data about what classes a file needs. Unfortunately, there's
-    no distinction between whether or not the file is needed all the time,
-    or whether or not it is one of our "optional" files. Thus, it is
-    effectively useless.
-
-    Deprecated
-    ----------
-    One of the things I'd like to do is have the code search for any classes
-    that are explicitly mentioned in the code. If a class isn't mentioned, I
-    get to assume that it is "optional," i.e. included via introspection.
-    The choice is either to use PHP's tokenizer or use regexps; regexps would
-    be faster but a tokenizer would be more correct. If this ends up being
-    unfeasible, adding dependency comments isn't a bad idea. (This could
-    even be done automatically by search/replacing require_once, although
-    we'd have to manually inspect the results for the optional requires.)
-
-    NOTE: This ends up not being necessary, as we're going to make the user
-    figure out all the extra classes they need, and only include the core
-    which is predetermined.
-
-Using the autoload framework with include stubs works nicely with
-introspective classes: instead of having to have require_once inside
-the function, we can let autoload do the work; we simply need to
-new $class or accept the object straight from the caller. Handling filters
-becomes a simple matter of ticking off configuration directives, and
-if ConfigSchema spits out errors, adding the necessary includes. We could
-also use the autoload framework as a fallback, in case the user forgets
-to make the include, but doesn't really care about performance.
-
-    Insight
-    -------
-    All of this talk is merely a natural extension of what our current
-    standalone functionality does. However, instead of having our code
-    perform the includes, or attempting to inline everything that possibly
-    could be used, we boot the issue to the user, making them include
-    everything or setup the fallback autoload handler.
-
-Configuration Schema
---------------------
-
-A common deficiency for all of the conditional include setups (including
-the dynamically built include PHP stub) is that if one of this
-conditionally included files includes a configuration directive, it
-is not accessible to configdoc. A stopgap solution for this problem is
-to have it piggy-back off of the data in the merge-library.php script
-to figure out what extra files it needs to include, but if the file also
-inherits classes that don't exist, we're in big trouble.
-
-I think it's high time we centralized the configuration documentation.
-However, the type checking has been a great boon for the library, and
-I'd like to keep that. The compromise is to use some other source, and
-then parse it into the ConfigSchema internal format (sans all of those
-nasty documentation strings which we really don't need at runtime) and
-serialize that for future use.
-
-The next question is that of format. XML is very verbose, and the prospect
-of setting defaults in it gives me willies. However, this may be necessary.
-Splitting up the file into manageable chunks may alleviate this trouble,
-and we may be even want to create our own format optimized for specifying
-configuration. It might look like (based off the PHPT format, which is
-nicely compact yet unambiguous and human-readable):
-
-Core.HiddenElements
-TYPE:    lookup
-DEFAULT: array('script', 'style') // auto-converted during processing
---ALIASES--
-Core.InvisibleElements, Core.StupidElements
---DESCRIPTION--
-<p>
-  Blah blah
-</p>
-
-The first line is the directive name, the lines after that prior to the
-first --HEADER-- block are single-line values, and then after that
-the multiline values are there. No value is restricted to a particular
-format: DEFAULT could very well be multiline if that would be easier.
-This would make it insanely easy, also, to add arbitrary extra parameters,
-like:
-
-VERSION:  3.0.0
-ALLOWED:  'none', 'light', 'medium', 'heavy' // this is wrapped in array()
-EXTERNAL: CSSTidy // this would be documented somewhere else with a URL
-
-The final loss would be that you wouldn't know what file the directive
-was used in; with some clever regexps it should be possible to
-figure out where $config->get($ns, $d); occurs. Reflective calls to
-the configuration object is mitigated by the fact that getBatch is
-used, so we can simply talk about that in the namespace definition page.
-This might be slow, but it would only happen when we are creating
-the documentation for consumption, and is sugar.
-
-We can put this in a schema/ directory, outside of HTML Purifier. The serialized
-data gets treated like entities.ser.
-
-The final thing that needs to be handled is user defined configurations.
-They can be added at runtime using ConfigSchema::registerDirectory()
-which globs the directory and grabs all of the directives to be incorporated
-in. Then, the result is saved. We may want to take advantage of the
-DefinitionCache framework, although it is not altogether certain what
-configuration directives would be used to generate our key (meta-directives!)
-
-    Further thoughts
-    ----------------
-    Our master configuration schema will only need to be updated once
-    every new version, so it's easily versionable. User specified
-    schema files are far more volatile, but it's far too expensive
-    to check the filemtimes of all the files, so a DefinitionRev style
-    mechanism works better. However, we can uniquely identify the
-    schema based on the directories they loaded, so there's no need
-    for a DefinitionId until we give them full programmatic control.
-
-    These variables should be directly incorporated into ConfigSchema,
-    and ConfigSchema should handle serialization. Some refactoring will be
-    necessary for the DefinitionCache classes, as they are built with
-    Config in mind. If the user changes something, the cache file gets
-    rebuilt. If the version changes, the cache file gets rebuilt. Since
-    our unit tests flush the caches before we start, and the operation is
-    pretty fast, this will not negatively impact unit testing.
-
-One last thing: certain configuration directives require that files
-get added. They may even be specified dynamically. It is not a good idea
-for the HTMLPurifier_Config object to be used directly for such matters.
-Instead, the userland code should explicitly perform the includes. We may
-put in something like:
-
-REQUIRES: HTMLPurifier_Filter_ExtractStyleBlocks
-
-To indicate that if that class doesn't exist, and the user is attempting
-to use the directive, we should fatally error out. The stub includes the core files,
-and the user includes everything else. Any reflective things like new
-$class would be required to tie in with the configuration.
-
-It would work very well with rarely used configuration options, but it
-wouldn't be so good for "core" parts that can be disabled. In such cases
-the core include file would need to be modified, and the only way
-to properly do this is use the configuration object. Once again, our
-ability to create cache keys saves the day again: we can create arbitrary
-stub files for arbitrary configurations and include those. They could
-even be the single file affairs. The only thing we'd need to include,
-then, would be HTMLPurifier_Config! Then, the configuration object would
-load the library.
-
-    An aside...
-    -----------
-    One questions, however, the wisdom of letting PHP files write other PHP
-    files. It seems like a recipe for disaster, or at least lots of headaches
-    in highly secured setups, where PHP does not have the ability to write
-    to its root. In such cases, we could use sticky bits or tell the user
-    to manually generate the file.
-
-    The other troublesome bit is actually doing the calculations necessary.
-    For certain cases, it's simple (such as URIScheme), but for AttrDef
-    and HTMLModule the dependency trees are very complex in relation to
-    %HTML.Allowed and friends. I think that this idea should be shelved
-    and looked at a later, less insane date.
-
-An interesting dilemma presents itself when a configuration form is offered
-to the user. Normally, the configuration object is not accessible without
-editing PHP code; this facility changes thing. The sensible thing to do
-is stipulate that all classes required by the directives you allow must
-be included.
-
-Unit testing
-------------
-
-Setting up the parsing and translation into our existing format would not
-be difficult to do. It might represent a good time for us to rethink our
-tests for these facilities; as creative as they are, they are often hacky
-and require public visibility for things that ought to be protected.
-This is especially applicable for our DefinitionCache tests.
-
-Migration
----------
-
-Because we are not *adding* anything essentially new, it should be trivial
-to write a script to take our existing data and dump it into the new format.
-Well, not trivial, but fairly easy to accomplish. Primary implementation
-difficulties would probably involve formatting the file nicely.
-
-Backwards-compatibility
------------------------
-
-I expect that the ConfigSchema methods should stick around for a little bit,
-but display E_USER_NOTICE warnings that they are deprecated. This will
-require documentation!
-
-New stuff
----------
-
-VERSION: Version number directive was introduced
-DEPRECATED-VERSION: If the directive was deprecated, when was it deprecated?
-DEPRECATED-USE: If the directive was deprecated, what should the user use now?
-REQUIRES: What classes does this configuration directive require, but are
-    not part of the HTML Purifier core?
-
-    vim: et sw=4 sts=4

+ 0 - 82
main/inc/lib/htmlpurifier/docs/dev-naming.html

@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Defines class naming conventions in HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Naming Conventions - HTML Purifier</title>
-
-</head><body>
-
-<h1>Naming Conventions</h1>
-
-<div id="filing">Filed under Development</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>The classes in this library follow a few naming conventions, which may
-help you find the correct functionality more quickly.  Here they are:</p>
-
-<dl>
-
-<dt>All classes occupy the HTMLPurifier pseudo-namespace.</dt>
-    <dd>This means that all classes are prefixed with HTMLPurifier_.  As such, all
-    names under HTMLPurifier_ are reserved.  I recommend that you use the name
-    HTMLPurifierX_YourName_ClassName, especially if you want to take advantage
-    of HTMLPurifier_ConfigDef.</dd>
-
-<dt>All classes correspond to their path if library/ was in the include path</dt>
-    <dd>HTMLPurifier_AttrDef is located at HTMLPurifier/AttrDef.php; replace
-    underscores with slashes and append .php and you'll have the location of
-    the class.</dd>
-
-<dt>Harness and Test are reserved class names for unit tests</dt>
-    <dd>The suffix <code>Test</code> indicates that the class is a subclass of UnitTestCase
-    (of the Simpletest library) and is testable. "Harness" indicates a subclass
-    of UnitTestCase that is not meant to be run but to be extended into
-    concrete test cases and contains custom test methods (i.e. assert*())</dd>
-
-<dt>Class names do not necessarily represent inheritance hierarchies</dt>
-    <dd>While we try to reflect inheritance in naming to some extent, it is not
-    guaranteed (for instance, none of the classes inherit from HTMLPurifier,
-    the base class).  However, all class files have the require_once
-    declarations to whichever classes they are tightly coupled to.</dd>
-
-<dt>Strategy has a meaning different from the Gang of Four pattern</dt>
-    <dd>In Design Patterns, the Gang of Four describes a Strategy object as
-    encapsulating an algorithm so that they can be switched at run-time.  While
-    our strategies are indeed algorithms, they are not meant to be substituted:
-    all must be present in order for proper functioning.</dd>
-
-<dt>Abbreviations are avoided</dt>
-    <dd>We try to avoid abbreviations as much as possible, but in some cases,
-    abbreviated version is more readable than the full version. Here, we
-    list common abbreviations:
-    <ul>
-        <li>Attr to Attributes (note that it is plural, i.e. <code>$attr = array()</code>)</li>
-        <li>Def to Definition</li>
-        <li><code>$ret</code> is the value to be returned in a function</li>
-    </ul>
-    </dd>
-
-<dt>Ambiguity concerning the definition of Def/Definition</dt>
-    <dd>While a definition normally defines the structure/acceptable values of
-    an entity, most of the definitions in this application also attempt
-    to validate and fix the value.  I am unsure of a better name, as
-    "Validator" would exclude fixing the value, "Fixer" doesn't invoke
-    the proper image of "fixing" something, and "ValidatorFixer" is too long!
-    Some other suggestions were "Handler", "Reference", "Check", "Fix",
-    "Repair" and "Heal".</dd>
-
-<dt>Transform not Transformer</dt>
-    <dd>Transform is both a noun and a verb, and thus we define a "Transform" as
-    something that "transforms," leaving "Transformer" (which sounds like an
-    electrical device/robot toy).</dd>
-
-</dl>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 32
main/inc/lib/htmlpurifier/docs/dev-optimization.html

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Discusses possible methods of optimizing HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Optimization - HTML Purifier</title>
-
-</head><body>
-
-<h1>Optimization</h1>
-
-<div id="filing">Filed under Development</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>Here are some possible optimization techniques we can apply to code sections if
-they turn out to be slow.  Be sure not to prematurely optimize: if you get
-that itch, put it here!</p>
-
-<ul>
-    <li>Make Tokens Flyweights (may prove problematic, probably not worth it)</li>
-    <li>Rewrite regexps into PHP code</li>
-    <li>Batch regexp validation (do as many per function call as possible)</li>
-    <li>Parallelize strategies</li>
-</ul>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 308
main/inc/lib/htmlpurifier/docs/dev-progress.html

@@ -1,308 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Tables detailing HTML element and CSS property implementation coverage in HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Implementation Progress - HTML Purifier</title>
-
-<style type="text/css">
-
-td {padding-right:1em;border-bottom:1px solid #000;padding-left:0.5em;}
-th {text-align:left;padding-top:1.4em;font-size:13pt;
-    border-bottom:2px solid #000;background:#FFF;}
-thead th {text-align:left;padding:0.1em;background-color:#EEE;}
-
-.impl-yes {background:#9D9;}
-.impl-partial {background:#FFA;}
-.impl-no {background:#CCC;}
-
-.danger {color:#600;}
-.css1 {color:#060;}
-.required {font-weight:bold;}
-.feature {color:#999;}
-
-</style>
-
-</head><body>
-
-<h1>Implementation Progress</h1>
-
-<div id="filing">Filed under Development</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>
-  <strong>Warning:</strong> This table is kept for historical purposes and
-  is not being actively updated.
-</p>
-
-<h2>Key</h2>
-
-<table cellspacing="0"><tbody>
-<tr><td class="impl-yes">Implemented</td></tr>
-<tr><td class="impl-partial">Partially implemented</td></tr>
-<tr><td class="impl-no">Not priority to implement</td></tr>
-<tr><td class="danger">Dangerous attribute/property</td></tr>
-<tr><td class="css1">Present in CSS1</td></tr>
-<tr><td class="feature">Feature, requires extra work</td></tr>
-</tbody></table>
-
-<h2>CSS</h2>
-
-<table cellspacing="0">
-
-<thead>
-<tr><th>Name</th><th>Notes</th></tr>
-</thead>
-
-<!--
-<tr><td>-</td><td>-</td></tr>
--->
-
-<tbody>
-<tr><th colspan="2">Standard</th></tr>
-<tr class="css1 impl-yes"><td>background-color</td><td>COMPOSITE(&lt;color&gt;, transparent)</td></tr>
-<tr class="css1 impl-yes"><td>background</td><td>SHORTHAND, currently alias for background-color</td></tr>
-<tr class="css1 impl-yes"><td>border</td><td>SHORTHAND, MULTIPLE</td></tr>
-<tr class="css1 impl-yes"><td>border-color</td><td>MULTIPLE</td></tr>
-<tr class="css1 impl-yes"><td>border-style</td><td>MULTIPLE</td></tr>
-<tr class="css1 impl-yes"><td>border-width</td><td>MULTIPLE</td></tr>
-<tr class="css1 impl-yes"><td>border-*</td><td>SHORTHAND</td></tr>
-<tr class="impl-yes"><td>border-*-color</td><td>COMPOSITE(&lt;color&gt;, transparent)</td></tr>
-<tr class="impl-yes"><td>border-*-style</td><td>ENUM(none, hidden, dotted, dashed,
-    solid, double, groove, ridge, inset, outset)</td></tr>
-<tr class="css1 impl-yes"><td>border-*-width</td><td>COMPOSITE(&lt;length&gt;, thin, medium, thick)</td></tr>
-<tr class="css1 impl-yes"><td>clear</td><td>ENUM(none, left, right, both)</td></tr>
-<tr class="css1 impl-yes"><td>color</td><td>&lt;color&gt;</td></tr>
-<tr class="css1 impl-yes"><td>float</td><td>ENUM(left, right, none), May require layout
-    precautions with clear</td></tr>
-<tr class="css1 impl-yes"><td>font</td><td>SHORTHAND</td></tr>
-<tr class="css1 impl-yes"><td>font-family</td><td>CSS validator may complain if fallback font
-    family not specified</td></tr>
-<tr class="css1 impl-yes"><td>font-size</td><td>COMPOSITE(&lt;absolute-size&gt;,
-    &lt;relative-size&gt;, &lt;length&gt;, &lt;percentage&gt;)</td></tr>
-<tr class="css1 impl-yes"><td>font-style</td><td>ENUM(normal, italic, oblique)</td></tr>
-<tr class="css1 impl-yes"><td>font-variant</td><td>ENUM(normal, small-caps)</td></tr>
-<tr class="css1 impl-yes"><td>font-weight</td><td>ENUM(normal, bold, bolder, lighter,
-    100, 200, 300, 400, 500, 600, 700, 800, 900), maybe special code for
-    in-between integers</td></tr>
-<tr class="css1 impl-yes"><td>letter-spacing</td><td>COMPOSITE(&lt;length&gt;, normal)</td></tr>
-<tr class="css1 impl-yes"><td>line-height</td><td>COMPOSITE(&lt;number&gt;,
-    &lt;length&gt;, &lt;percentage&gt;, normal)</td></tr>
-<tr class="css1 impl-yes"><td>list-style-position</td><td>ENUM(inside, outside),
-    Strange behavior in browsers</td></tr>
-<tr class="css1 impl-yes"><td>list-style-type</td><td>ENUM(...),
-    Well-supported values are: disc, circle, square,
-    decimal, lower-roman, upper-roman, lower-alpha and upper-alpha. See also
-    CSS 3. Mostly IE lack of support.</td></tr>
-<tr class="css1 impl-yes"><td>list-style</td><td>SHORTHAND</td></tr>
-<tr class="css1 impl-yes"><td>margin</td><td>MULTIPLE</td></tr>
-<tr class="css1 impl-yes"><td>margin-*</td><td>COMPOSITE(&lt;length&gt;,
-    &lt;percentage&gt;, auto)</td></tr>
-<tr class="css1 impl-yes"><td>padding</td><td>MULTIPLE</td></tr>
-<tr class="css1 impl-yes"><td>padding-*</td><td>COMPOSITE(&lt;length&gt;(positive),
-    &lt;percentage&gt;(positive))</td></tr>
-<tr class="css1 impl-yes"><td>text-align</td><td>ENUM(left, right,
-    center, justify)</td></tr>
-<tr class="css1 impl-yes"><td>text-decoration</td><td>No blink (argh my eyes), not
-    enum, can be combined (composite sorta): underline, overline,
-    line-through</td></tr>
-<tr class="css1 impl-yes"><td>text-indent</td><td>COMPOSITE(&lt;length&gt;,
-    &lt;percentage&gt;)</td></tr>
-<tr class="css1 impl-yes"><td>text-transform</td><td>ENUM(capitalize, uppercase,
-    lowercase, none)</td></tr>
-<tr class="css1 impl-yes"><td>width</td><td>COMPOSITE(&lt;length&gt;,
-    &lt;percentage&gt;, auto), Interesting</td></tr>
-<tr class="css1 impl-yes"><td>word-spacing</td><td>COMPOSITE(&lt;length&gt;, auto),
-    IE 5 no support</td></tr>
-</tbody>
-
-<tbody>
-<tr><th colspan="2">Table</th></tr>
-<tr class="impl-yes"><td>border-collapse</td><td>ENUM(collapse, seperate)</td></tr>
-<tr class="impl-yes"><td>border-space</td><td>MULTIPLE</td></tr>
-<tr class="impl-yes"><td>caption-side</td><td>ENUM(top, bottom)</td></tr>
-<tr class="feature"><td>empty-cells</td><td>ENUM(show, hide), No IE support makes this useless,
-    possible fix with &amp;nbsp;? Unknown release milestone.</td></tr>
-<tr class="impl-yes"><td>table-layout</td><td>ENUM(auto, fixed)</td></tr>
-<tr class="impl-yes css1"><td>vertical-align</td><td>COMPOSITE(ENUM(baseline, sub,
-    super, top, text-top, middle, bottom, text-bottom), &lt;percentage&gt;,
-    &lt;length&gt;) Also applies to others with explicit height</td></tr>
-</tbody>
-
-<tbody>
-<tr><th colspan="2">Absolute positioning, unknown release milestone</th></tr>
-<tr class="danger impl-no"><td>bottom</td><td rowspan="4">Dangerous, must be non-negative to even be considered,
-    but it's still possible to arbitrarily position by running over.</td></tr>
-<tr class="danger impl-no"><td>left</td></tr>
-<tr class="danger impl-no"><td>right</td></tr>
-<tr class="danger impl-no"><td>top</td></tr>
-<tr class="impl-no"><td>clip</td><td>-</td></tr>
-<tr class="danger impl-no"><td>position</td><td>ENUM(static, relative, absolute, fixed)
-    relative not absolute?</td></tr>
-<tr class="danger impl-no"><td>z-index</td><td>Dangerous</td></tr>
-</tbody>
-
-<tbody>
-<tr><th colspan="2">Unknown</th></tr>
-<tr class="danger css1 impl-yes"><td>background-image</td><td>Dangerous</td></tr>
-<tr class="css1 impl-yes"><td>background-attachment</td><td>ENUM(scroll, fixed),
-    Depends on background-image</td></tr>
-<tr class="css1 impl-yes"><td>background-position</td><td>Depends on background-image</td></tr>
-<tr class="danger impl-no"><td>cursor</td><td>Dangerous but fluffy</td></tr>
-<tr class="danger impl-yes"><td>display</td><td>ENUM(...), Dangerous but interesting;
-    will not implement list-item, run-in (Opera only) or table (no IE);
-    inline-block has incomplete IE6 support and requires -moz-inline-box
-    for Mozilla. Unknown target milestone.</td></tr>
-<tr class="css1 impl-yes"><td>height</td><td>Interesting, why use it? Unknown target milestone.</td></tr>
-<tr class="danger css1 impl-yes"><td>list-style-image</td><td>Dangerous?</td></tr>
-<tr class="impl-no"><td>max-height</td><td rowspan="4">No IE 5/6</td></tr>
-<tr class="impl-no"><td>min-height</td></tr>
-<tr class="impl-no"><td>max-width</td></tr>
-<tr class="impl-no"><td>min-width</td></tr>
-<tr class="impl-no"><td>orphans</td><td>No IE support</td></tr>
-<tr class="impl-no"><td>widows</td><td>No IE support</td></tr>
-<tr><td>overflow</td><td>ENUM, IE 5/6 almost (remove visible if set). Unknown target milestone.</td></tr>
-<tr><td>page-break-after</td><td>ENUM(auto, always, avoid, left, right),
-    IE 5.5/6 and Opera. Unknown target milestone.</td></tr>
-<tr><td>page-break-before</td><td>ENUM(auto, always, avoid, left, right),
-    Mostly supported. Unknown target milestone.</td></tr>
-<tr><td>page-break-inside</td><td>ENUM(avoid, auto), Opera only. Unknown target milestone.</td></tr>
-<tr class="impl-no"><td>quotes</td><td>May be dropped from CSS2, fairly useless for inline context</td></tr>
-<tr class="danger impl-yes"><td>visibility</td><td>ENUM(visible, hidden, collapse),
-    Dangerous</td></tr>
-<tr class="css1 feature impl-partial"><td>white-space</td><td>ENUM(normal, pre, nowrap, pre-wrap,
-    pre-line), Spotty implementation:
-    pre (no IE 5/6), <em>nowrap</em> (no IE 5, supported),
-    pre-wrap (only Opera), pre-line (no support). Fixable? Unknown target milestone.</td></tr>
-</tbody>
-
-<tbody class="impl-no">
-<tr><th colspan="2">Aural</th></tr>
-<tr><td>azimuth</td><td>-</td></tr>
-<tr><td>cue</td><td>-</td></tr>
-<tr><td>cue-after</td><td>-</td></tr>
-<tr><td>cue-before</td><td>-</td></tr>
-<tr><td>elevation</td><td>-</td></tr>
-<tr><td>pause-after</td><td>-</td></tr>
-<tr><td>pause-before</td><td>-</td></tr>
-<tr><td>pause</td><td>-</td></tr>
-<tr><td>pitch-range</td><td>-</td></tr>
-<tr><td>pitch</td><td>-</td></tr>
-<tr><td>play-during</td><td>-</td></tr>
-<tr><td>richness</td><td>-</td></tr>
-<tr><td>speak-header</td><td>Table related</td></tr>
-<tr><td>speak-numeral</td><td>-</td></tr>
-<tr><td>speak-punctuation</td><td>-</td></tr>
-<tr><td>speak</td><td>-</td></tr>
-<tr><td>speech-rate</td><td>-</td></tr>
-<tr><td>stress</td><td>-</td></tr>
-<tr><td>voice-family</td><td>-</td></tr>
-<tr><td>volume</td><td>-</td></tr>
-</tbody>
-
-<tbody class="impl-no">
-<tr><th colspan="2">Will not implement</th></tr>
-<tr><td>content</td><td>Not applicable for inline styles</td></tr>
-<tr><td>counter-increment</td><td>Needs content, Opera only</td></tr>
-<tr><td>counter-reset</td><td>Needs content, Opera only</td></tr>
-<tr><td>direction</td><td>No support</td></tr>
-<tr><td>outline-color</td><td rowspan="4">IE Mac and Opera on outside,
-Mozilla on inside and needs -moz-outline, no IE support.</td></tr>
-    <tr><td>outline-style</td></tr>
-    <tr><td>outline-width</td></tr>
-    <tr><td>outline</td></tr>
-<tr><td>unicode-bidi</td><td>No support</td></tr>
-</tbody>
-
-</table>
-
-<h2>Interesting Attributes</h2>
-
-<table cellspacing="0">
-
-<thead>
-<tr><th>Attribute</th><th>Tags</th><th>Notes</th></tr>
-</thead>
-
-<!--
-<tr><th></th></tr>
-<tbody>
-<tr><td>-</td><td>-</td><td>-</td></tr>
-</tbody>
--->
-
-<tbody>
-<tr><th colspan="3">CSS</th></tr>
-<tr class="impl-yes"><td>style</td><td>All</td><td>Parser is reasonably functional. Status here doesn't count individual properties.</td></tr>
-</tbody>
-
-<tbody>
-<tr><th colspan="3">Questionable</th></tr>
-<tr class="impl-no"><td>accesskey</td><td>A</td><td>May interfere with main interface</td></tr>
-<tr class="impl-no"><td>tabindex</td><td>A</td><td>May interfere with main interface</td></tr>
-<tr class="impl-yes"><td>target</td><td>A</td><td>Config enabled, only useful for frame layouts, disallowed in strict</td></tr>
-</tbody>
-
-<tbody>
-<tr><th colspan="3">Miscellaneous</th></tr>
-<tr><td>datetime</td><td>DEL, INS</td><td>No visible effect, ISO format</td></tr>
-<tr class="impl-yes"><td>rel</td><td>A</td><td>Largely user-defined: nofollow, tag (see microformats)</td></tr>
-<tr class="impl-yes"><td>rev</td><td>A</td><td>Largely user-defined: vote-*</td></tr>
-<tr class="feature"><td>axis</td><td>TD, TH</td><td>W3C only: No browser implementation</td></tr>
-<tr class="feature"><td>char</td><td>COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR</td><td>W3C only: No browser implementation</td></tr>
-<tr class="feature"><td>headers</td><td>TD, TH</td><td>W3C only: No browser implementation</td></tr>
-<tr class="feature"><td>scope</td><td>TD, TH</td><td>W3C only: No browser implementation</td></tr>
-</tbody>
-
-<tbody class="impl-yes">
-<tr><th colspan="3">URI</th></tr>
-<tr><td rowspan="2">cite</td><td>BLOCKQUOTE, Q</td><td>For attribution</td></tr>
-    <tr><td>DEL, INS</td><td>Link to explanation why it changed</td></tr>
-<tr><td>href</td><td>A</td><td>-</td></tr>
-<tr><td>longdesc</td><td>IMG</td><td>-</td></tr>
-<tr class="required"><td>src</td><td>IMG</td><td>Required</td></tr>
-</tbody>
-
-<tbody>
-<tr><th colspan="3">Transform</th></tr>
-<tr class="impl-yes"><td rowspan="5">align</td><td>CAPTION</td><td>'caption-side' for top/bottom, 'text-align' for left/right</td></tr>
-    <tr class="impl-yes"><td>IMG</td><td rowspan="3">See specimens/html-align-to-css.html</td></tr>
-    <tr class="impl-yes"><td>TABLE</td></tr>
-    <tr class="impl-yes"><td>HR</td></tr>
-    <tr class="impl-yes"><td>H1, H2, H3, H4, H5, H6, P</td><td>Equivalent style 'text-align'</td></tr>
-<tr class="required impl-yes"><td>alt</td><td>IMG</td><td>Required, insert image filename if src is present or default invalid image text</td></tr>
-<tr class="impl-yes"><td rowspan="3">bgcolor</td><td>TABLE</td><td>Superset style 'background-color'</td></tr>
-    <tr class="impl-yes"><td>TR</td><td>Superset style 'background-color'</td></tr>
-    <tr class="impl-yes"><td>TD, TH</td><td>Superset style 'background-color'</td></tr>
-<tr class="impl-yes"><td>border</td><td>IMG</td><td>Equivalent style <code>border:[number]px solid</code></td></tr>
-<tr class="impl-yes"><td>clear</td><td>BR</td><td>Near-equiv style 'clear', transform 'all' into 'both'</td></tr>
-<tr class="impl-no"><td>compact</td><td>DL, OL, UL</td><td>Boolean, needs custom CSS class; rarely used anyway</td></tr>
-<tr class="required impl-yes"><td>dir</td><td>BDO</td><td>Required, insert ltr (or configuration value) if none</td></tr>
-<tr class="impl-yes"><td>height</td><td>TD, TH</td><td>Near-equiv style 'height', needs px suffix if original was in pixels</td></tr>
-<tr class="impl-yes"><td>hspace</td><td>IMG</td><td>Near-equiv styles 'margin-top' and 'margin-bottom', needs px suffix</td></tr>
-<tr class="impl-yes"><td>lang</td><td>*</td><td>Copy value to xml:lang</td></tr>
-<tr class="impl-yes"><td rowspan="2">name</td><td>IMG</td><td>Turn into ID</td></tr>
-    <tr class="impl-yes"><td>A</td><td>Turn into ID</td></tr>
-<tr class="impl-yes"><td>noshade</td><td>HR</td><td>Boolean, style 'border-style:solid;'</td></tr>
-<tr class="impl-yes"><td>nowrap</td><td>TD, TH</td><td>Boolean, style 'white-space:nowrap;' (not compat with IE5)</td></tr>
-<tr class="impl-yes"><td>size</td><td>HR</td><td>Near-equiv 'height', needs px suffix if original was pixels</td></tr>
-<tr class="required impl-yes"><td>src</td><td>IMG</td><td>Required, insert blank or default img if not set</td></tr>
-<tr class="impl-yes"><td>start</td><td>OL</td><td>Poorly supported 'counter-reset', allowed in loose, dropped in strict</td></tr>
-<tr class="impl-yes"><td rowspan="3">type</td><td>LI</td><td rowspan="3">Equivalent style 'list-style-type', different allowed values though. (needs testing)</td></tr>
-    <tr class="impl-yes"><td>OL</td></tr>
-    <tr class="impl-yes"><td>UL</td></tr>
-<tr class="impl-yes"><td>value</td><td>LI</td><td>Poorly supported 'counter-reset', allowed in loose, dropped in strict</td></tr>
-<tr class="impl-yes"><td>vspace</td><td>IMG</td><td>Near-equiv styles 'margin-left' and 'margin-right', needs px suffix, see hspace</td></tr>
-<tr class="impl-yes"><td rowspan="2">width</td><td>HR</td><td rowspan="2">Near-equiv style 'width', needs px suffix if original was pixels</td></tr>
-    <tr class="impl-yes"><td>TD, TH</td></tr>
-</tbody>
-
-</table>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 1201
main/inc/lib/htmlpurifier/docs/dtd/xhtml1-transitional.dtd

@@ -1,1201 +0,0 @@
-<!--
-   Extensible HTML version 1.0 Transitional DTD
-
-   This is the same as HTML 4 Transitional except for
-   changes due to the differences between XML and SGML.
-
-   Namespace = http://www.w3.org/1999/xhtml
-
-   For further information, see: http://www.w3.org/TR/xhtml1
-
-   Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
-   All Rights Reserved. 
-
-   This DTD module is identified by the PUBLIC and SYSTEM identifiers:
-
-   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-   SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-
-   $Revision: 1.2 $
-   $Date: 2002/08/01 18:37:55 $
-
--->
-
-<!--================ Character mnemonic entities =========================-->
-
-<!ENTITY % HTMLlat1 PUBLIC
-   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
-   "xhtml-lat1.ent">
-%HTMLlat1;
-
-<!ENTITY % HTMLsymbol PUBLIC
-   "-//W3C//ENTITIES Symbols for XHTML//EN"
-   "xhtml-symbol.ent">
-%HTMLsymbol;
-
-<!ENTITY % HTMLspecial PUBLIC
-   "-//W3C//ENTITIES Special for XHTML//EN"
-   "xhtml-special.ent">
-%HTMLspecial;
-
-<!--================== Imported Names ====================================-->
-
-<!ENTITY % ContentType "CDATA">
-    <!-- media type, as per [RFC2045] -->
-
-<!ENTITY % ContentTypes "CDATA">
-    <!-- comma-separated list of media types, as per [RFC2045] -->
-
-<!ENTITY % Charset "CDATA">
-    <!-- a character encoding, as per [RFC2045] -->
-
-<!ENTITY % Charsets "CDATA">
-    <!-- a space separated list of character encodings, as per [RFC2045] -->
-
-<!ENTITY % LanguageCode "NMTOKEN">
-    <!-- a language code, as per [RFC3066] -->
-
-<!ENTITY % Character "CDATA">
-    <!-- a single character, as per section 2.2 of [XML] -->
-
-<!ENTITY % Number "CDATA">
-    <!-- one or more digits -->
-
-<!ENTITY % LinkTypes "CDATA">
-    <!-- space-separated list of link types -->
-
-<!ENTITY % MediaDesc "CDATA">
-    <!-- single or comma-separated list of media descriptors -->
-
-<!ENTITY % URI "CDATA">
-    <!-- a Uniform Resource Identifier, see [RFC2396] -->
-
-<!ENTITY % UriList "CDATA">
-    <!-- a space separated list of Uniform Resource Identifiers -->
-
-<!ENTITY % Datetime "CDATA">
-    <!-- date and time information. ISO date format -->
-
-<!ENTITY % Script "CDATA">
-    <!-- script expression -->
-
-<!ENTITY % StyleSheet "CDATA">
-    <!-- style sheet data -->
-
-<!ENTITY % Text "CDATA">
-    <!-- used for titles etc. -->
-
-<!ENTITY % FrameTarget "NMTOKEN">
-    <!-- render in this frame -->
-
-<!ENTITY % Length "CDATA">
-    <!-- nn for pixels or nn% for percentage length -->
-
-<!ENTITY % MultiLength "CDATA">
-    <!-- pixel, percentage, or relative -->
-
-<!ENTITY % Pixels "CDATA">
-    <!-- integer representing length in pixels -->
-
-<!-- these are used for image maps -->
-
-<!ENTITY % Shape "(rect|circle|poly|default)">
-
-<!ENTITY % Coords "CDATA">
-    <!-- comma separated list of lengths -->
-
-<!-- used for object, applet, img, input and iframe -->
-<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
-
-<!-- a color using sRGB: #RRGGBB as Hex values -->
-<!ENTITY % Color "CDATA">
-
-<!-- There are also 16 widely known color names with their sRGB values:
-
-    Black  = #000000    Green  = #008000
-    Silver = #C0C0C0    Lime   = #00FF00
-    Gray   = #808080    Olive  = #808000
-    White  = #FFFFFF    Yellow = #FFFF00
-    Maroon = #800000    Navy   = #000080
-    Red    = #FF0000    Blue   = #0000FF
-    Purple = #800080    Teal   = #008080
-    Fuchsia= #FF00FF    Aqua   = #00FFFF
--->
-
-<!--=================== Generic Attributes ===============================-->
-
-<!-- core attributes common to most elements
-  id       document-wide unique id
-  class    space separated list of classes
-  style    associated style info
-  title    advisory title/amplification
--->
-<!ENTITY % coreattrs
- "id          ID             #IMPLIED
-  class       CDATA          #IMPLIED
-  style       %StyleSheet;   #IMPLIED
-  title       %Text;         #IMPLIED"
-  >
-
-<!-- internationalization attributes
-  lang        language code (backwards compatible)
-  xml:lang    language code (as per XML 1.0 spec)
-  dir         direction for weak/neutral text
--->
-<!ENTITY % i18n
- "lang        %LanguageCode; #IMPLIED
-  xml:lang    %LanguageCode; #IMPLIED
-  dir         (ltr|rtl)      #IMPLIED"
-  >
-
-<!-- attributes for common UI events
-  onclick     a pointer button was clicked
-  ondblclick  a pointer button was double clicked
-  onmousedown a pointer button was pressed down
-  onmouseup   a pointer button was released
-  onmousemove a pointer was moved onto the element
-  onmouseout  a pointer was moved away from the element
-  onkeypress  a key was pressed and released
-  onkeydown   a key was pressed down
-  onkeyup     a key was released
--->
-<!ENTITY % events
- "onclick     %Script;       #IMPLIED
-  ondblclick  %Script;       #IMPLIED
-  onmousedown %Script;       #IMPLIED
-  onmouseup   %Script;       #IMPLIED
-  onmouseover %Script;       #IMPLIED
-  onmousemove %Script;       #IMPLIED
-  onmouseout  %Script;       #IMPLIED
-  onkeypress  %Script;       #IMPLIED
-  onkeydown   %Script;       #IMPLIED
-  onkeyup     %Script;       #IMPLIED"
-  >
-
-<!-- attributes for elements that can get the focus
-  accesskey   accessibility key character
-  tabindex    position in tabbing order
-  onfocus     the element got the focus
-  onblur      the element lost the focus
--->
-<!ENTITY % focus
- "accesskey   %Character;    #IMPLIED
-  tabindex    %Number;       #IMPLIED
-  onfocus     %Script;       #IMPLIED
-  onblur      %Script;       #IMPLIED"
-  >
-
-<!ENTITY % attrs "%coreattrs; %i18n; %events;">
-
-<!-- text alignment for p, div, h1-h6. The default is
-     align="left" for ltr headings, "right" for rtl -->
-
-<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
-
-<!--=================== Text Elements ====================================-->
-
-<!ENTITY % special.extra
-   "object | applet | img | map | iframe">
-	
-<!ENTITY % special.basic
-	"br | span | bdo">
-
-<!ENTITY % special
-   "%special.basic; | %special.extra;">
-
-<!ENTITY % fontstyle.extra "big | small | font | basefont">
-
-<!ENTITY % fontstyle.basic "tt | i | b | u
-                      | s | strike ">
-
-<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
-
-<!ENTITY % phrase.extra "sub | sup">
-<!ENTITY % phrase.basic "em | strong | dfn | code | q |
-                   samp | kbd | var | cite | abbr | acronym">
-
-<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
-
-<!ENTITY % inline.forms "input | select | textarea | label | button">
-
-<!-- these can occur at block or inline level -->
-<!ENTITY % misc.inline "ins | del | script">
-
-<!-- these can only occur at block level -->
-<!ENTITY % misc "noscript | %misc.inline;">
-
-<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
-
-<!-- %Inline; covers inline or "text-level" elements -->
-<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
-
-<!--================== Block level elements ==============================-->
-
-<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
-<!ENTITY % lists "ul | ol | dl | menu | dir">
-<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
-
-<!ENTITY % block
-    "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
-
-<!-- %Flow; mixes block and inline and is used for list items etc. -->
-<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
-
-<!--================== Content models for exclusions =====================-->
-
-<!-- a elements use %Inline; excluding a -->
-
-<!ENTITY % a.content
-   "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
-
-<!-- pre uses %Inline excluding img, object, applet, big, small,
-     font, or basefont -->
-
-<!ENTITY % pre.content
-   "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
-	   %inline.forms; | %misc.inline;)*">
-
-<!-- form uses %Flow; excluding form -->
-
-<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
-
-<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
-
-<!ENTITY % button.content
-   "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
-      table | br | span | bdo | object | applet | img | map |
-      %fontstyle; | %phrase; | %misc;)*">
-
-<!--================ Document Structure ==================================-->
-
-<!-- the namespace URI designates the document profile -->
-
-<!ELEMENT html (head, body)>
-<!ATTLIST html
-  %i18n;
-  id          ID             #IMPLIED
-  xmlns       %URI;          #FIXED 'http://www.w3.org/1999/xhtml'
-  >
-
-<!--================ Document Head =======================================-->
-
-<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
-
-<!-- content model is %head.misc; combined with a single
-     title and an optional base element in any order -->
-
-<!ELEMENT head (%head.misc;,
-     ((title, %head.misc;, (base, %head.misc;)?) |
-      (base, %head.misc;, (title, %head.misc;))))>
-
-<!ATTLIST head
-  %i18n;
-  id          ID             #IMPLIED
-  profile     %URI;          #IMPLIED
-  >
-
-<!-- The title element is not considered part of the flow of text.
-       It should be displayed, for example as the page header or
-       window title. Exactly one title is required per document.
-    -->
-<!ELEMENT title (#PCDATA)>
-<!ATTLIST title 
-  %i18n;
-  id          ID             #IMPLIED
-  >
-
-<!-- document base URI -->
-
-<!ELEMENT base EMPTY>
-<!ATTLIST base
-  id          ID             #IMPLIED
-  href        %URI;          #IMPLIED
-  target      %FrameTarget;  #IMPLIED
-  >
-
-<!-- generic metainformation -->
-<!ELEMENT meta EMPTY>
-<!ATTLIST meta
-  %i18n;
-  id          ID             #IMPLIED
-  http-equiv  CDATA          #IMPLIED
-  name        CDATA          #IMPLIED
-  content     CDATA          #REQUIRED
-  scheme      CDATA          #IMPLIED
-  >
-
-<!--
-  Relationship values can be used in principle:
-
-   a) for document specific toolbars/menus when used
-      with the link element in document head e.g.
-        start, contents, previous, next, index, end, help
-   b) to link to a separate style sheet (rel="stylesheet")
-   c) to make a link to a script (rel="script")
-   d) by stylesheets to control how collections of
-      html nodes are rendered into printed documents
-   e) to make a link to a printable version of this document
-      e.g. a PostScript or PDF version (rel="alternate" media="print")
--->
-
-<!ELEMENT link EMPTY>
-<!ATTLIST link
-  %attrs;
-  charset     %Charset;      #IMPLIED
-  href        %URI;          #IMPLIED
-  hreflang    %LanguageCode; #IMPLIED
-  type        %ContentType;  #IMPLIED
-  rel         %LinkTypes;    #IMPLIED
-  rev         %LinkTypes;    #IMPLIED
-  media       %MediaDesc;    #IMPLIED
-  target      %FrameTarget;  #IMPLIED
-  >
-
-<!-- style info, which may include CDATA sections -->
-<!ELEMENT style (#PCDATA)>
-<!ATTLIST style
-  %i18n;
-  id          ID             #IMPLIED
-  type        %ContentType;  #REQUIRED
-  media       %MediaDesc;    #IMPLIED
-  title       %Text;         #IMPLIED
-  xml:space   (preserve)     #FIXED 'preserve'
-  >
-
-<!-- script statements, which may include CDATA sections -->
-<!ELEMENT script (#PCDATA)>
-<!ATTLIST script
-  id          ID             #IMPLIED
-  charset     %Charset;      #IMPLIED
-  type        %ContentType;  #REQUIRED
-  language    CDATA          #IMPLIED
-  src         %URI;          #IMPLIED
-  defer       (defer)        #IMPLIED
-  xml:space   (preserve)     #FIXED 'preserve'
-  >
-
-<!-- alternate content container for non script-based rendering -->
-
-<!ELEMENT noscript %Flow;>
-<!ATTLIST noscript
-  %attrs;
-  >
-
-<!--======================= Frames =======================================-->
-
-<!-- inline subwindow -->
-
-<!ELEMENT iframe %Flow;>
-<!ATTLIST iframe
-  %coreattrs;
-  longdesc    %URI;          #IMPLIED
-  name        NMTOKEN        #IMPLIED
-  src         %URI;          #IMPLIED
-  frameborder (1|0)          "1"
-  marginwidth %Pixels;       #IMPLIED
-  marginheight %Pixels;      #IMPLIED
-  scrolling   (yes|no|auto)  "auto"
-  align       %ImgAlign;     #IMPLIED
-  height      %Length;       #IMPLIED
-  width       %Length;       #IMPLIED
-  >
-
-<!-- alternate content container for non frame-based rendering -->
-
-<!ELEMENT noframes %Flow;>
-<!ATTLIST noframes
-  %attrs;
-  >
-
-<!--=================== Document Body ====================================-->
-
-<!ELEMENT body %Flow;>
-<!ATTLIST body
-  %attrs;
-  onload      %Script;       #IMPLIED
-  onunload    %Script;       #IMPLIED
-  background  %URI;          #IMPLIED
-  bgcolor     %Color;        #IMPLIED
-  text        %Color;        #IMPLIED
-  link        %Color;        #IMPLIED
-  vlink       %Color;        #IMPLIED
-  alink       %Color;        #IMPLIED
-  >
-
-<!ELEMENT div %Flow;>  <!-- generic language/style container -->
-<!ATTLIST div
-  %attrs;
-  %TextAlign;
-  >
-
-<!--=================== Paragraphs =======================================-->
-
-<!ELEMENT p %Inline;>
-<!ATTLIST p
-  %attrs;
-  %TextAlign;
-  >
-
-<!--=================== Headings =========================================-->
-
-<!--
-  There are six levels of headings from h1 (the most important)
-  to h6 (the least important).
--->
-
-<!ELEMENT h1  %Inline;>
-<!ATTLIST h1
-  %attrs;
-  %TextAlign;
-  >
-
-<!ELEMENT h2 %Inline;>
-<!ATTLIST h2
-  %attrs;
-  %TextAlign;
-  >
-
-<!ELEMENT h3 %Inline;>
-<!ATTLIST h3
-  %attrs;
-  %TextAlign;
-  >
-
-<!ELEMENT h4 %Inline;>
-<!ATTLIST h4
-  %attrs;
-  %TextAlign;
-  >
-
-<!ELEMENT h5 %Inline;>
-<!ATTLIST h5
-  %attrs;
-  %TextAlign;
-  >
-
-<!ELEMENT h6 %Inline;>
-<!ATTLIST h6
-  %attrs;
-  %TextAlign;
-  >
-
-<!--=================== Lists ============================================-->
-
-<!-- Unordered list bullet styles -->
-
-<!ENTITY % ULStyle "(disc|square|circle)">
-
-<!-- Unordered list -->
-
-<!ELEMENT ul (li)+>
-<!ATTLIST ul
-  %attrs;
-  type        %ULStyle;     #IMPLIED
-  compact     (compact)     #IMPLIED
-  >
-
-<!-- Ordered list numbering style
-
-    1   arabic numbers      1, 2, 3, ...
-    a   lower alpha         a, b, c, ...
-    A   upper alpha         A, B, C, ...
-    i   lower roman         i, ii, iii, ...
-    I   upper roman         I, II, III, ...
-
-    The style is applied to the sequence number which by default
-    is reset to 1 for the first list item in an ordered list.
--->
-<!ENTITY % OLStyle "CDATA">
-
-<!-- Ordered (numbered) list -->
-
-<!ELEMENT ol (li)+>
-<!ATTLIST ol
-  %attrs;
-  type        %OLStyle;      #IMPLIED
-  compact     (compact)      #IMPLIED
-  start       %Number;       #IMPLIED
-  >
-
-<!-- single column list (DEPRECATED) --> 
-<!ELEMENT menu (li)+>
-<!ATTLIST menu
-  %attrs;
-  compact     (compact)     #IMPLIED
-  >
-
-<!-- multiple column list (DEPRECATED) --> 
-<!ELEMENT dir (li)+>
-<!ATTLIST dir
-  %attrs;
-  compact     (compact)     #IMPLIED
-  >
-
-<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
-<!ENTITY % LIStyle "CDATA">
-
-<!-- list item -->
-
-<!ELEMENT li %Flow;>
-<!ATTLIST li
-  %attrs;
-  type        %LIStyle;      #IMPLIED
-  value       %Number;       #IMPLIED
-  >
-
-<!-- definition lists - dt for term, dd for its definition -->
-
-<!ELEMENT dl (dt|dd)+>
-<!ATTLIST dl
-  %attrs;
-  compact     (compact)      #IMPLIED
-  >
-
-<!ELEMENT dt %Inline;>
-<!ATTLIST dt
-  %attrs;
-  >
-
-<!ELEMENT dd %Flow;>
-<!ATTLIST dd
-  %attrs;
-  >
-
-<!--=================== Address ==========================================-->
-
-<!-- information on author -->
-
-<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
-<!ATTLIST address
-  %attrs;
-  >
-
-<!--=================== Horizontal Rule ==================================-->
-
-<!ELEMENT hr EMPTY>
-<!ATTLIST hr
-  %attrs;
-  align       (left|center|right) #IMPLIED
-  noshade     (noshade)      #IMPLIED
-  size        %Pixels;       #IMPLIED
-  width       %Length;       #IMPLIED
-  >
-
-<!--=================== Preformatted Text ================================-->
-
-<!-- content is %Inline; excluding 
-        "img|object|applet|big|small|sub|sup|font|basefont" -->
-
-<!ELEMENT pre %pre.content;>
-<!ATTLIST pre
-  %attrs;
-  width       %Number;      #IMPLIED
-  xml:space   (preserve)    #FIXED 'preserve'
-  >
-
-<!--=================== Block-like Quotes ================================-->
-
-<!ELEMENT blockquote %Flow;>
-<!ATTLIST blockquote
-  %attrs;
-  cite        %URI;          #IMPLIED
-  >
-
-<!--=================== Text alignment ===================================-->
-
-<!-- center content -->
-<!ELEMENT center %Flow;>
-<!ATTLIST center
-  %attrs;
-  >
-
-<!--=================== Inserted/Deleted Text ============================-->
-
-<!--
-  ins/del are allowed in block and inline content, but its
-  inappropriate to include block content within an ins element
-  occurring in inline content.
--->
-<!ELEMENT ins %Flow;>
-<!ATTLIST ins
-  %attrs;
-  cite        %URI;          #IMPLIED
-  datetime    %Datetime;     #IMPLIED
-  >
-
-<!ELEMENT del %Flow;>
-<!ATTLIST del
-  %attrs;
-  cite        %URI;          #IMPLIED
-  datetime    %Datetime;     #IMPLIED
-  >
-
-<!--================== The Anchor Element ================================-->
-
-<!-- content is %Inline; except that anchors shouldn't be nested -->
-
-<!ELEMENT a %a.content;>
-<!ATTLIST a
-  %attrs;
-  %focus;
-  charset     %Charset;      #IMPLIED
-  type        %ContentType;  #IMPLIED
-  name        NMTOKEN        #IMPLIED
-  href        %URI;          #IMPLIED
-  hreflang    %LanguageCode; #IMPLIED
-  rel         %LinkTypes;    #IMPLIED
-  rev         %LinkTypes;    #IMPLIED
-  shape       %Shape;        "rect"
-  coords      %Coords;       #IMPLIED
-  target      %FrameTarget;  #IMPLIED
-  >
-
-<!--===================== Inline Elements ================================-->
-
-<!ELEMENT span %Inline;> <!-- generic language/style container -->
-<!ATTLIST span
-  %attrs;
-  >
-
-<!ELEMENT bdo %Inline;>  <!-- I18N BiDi over-ride -->
-<!ATTLIST bdo
-  %coreattrs;
-  %events;
-  lang        %LanguageCode; #IMPLIED
-  xml:lang    %LanguageCode; #IMPLIED
-  dir         (ltr|rtl)      #REQUIRED
-  >
-
-<!ELEMENT br EMPTY>   <!-- forced line break -->
-<!ATTLIST br
-  %coreattrs;
-  clear       (left|all|right|none) "none"
-  >
-
-<!ELEMENT em %Inline;>   <!-- emphasis -->
-<!ATTLIST em %attrs;>
-
-<!ELEMENT strong %Inline;>   <!-- strong emphasis -->
-<!ATTLIST strong %attrs;>
-
-<!ELEMENT dfn %Inline;>   <!-- definitional -->
-<!ATTLIST dfn %attrs;>
-
-<!ELEMENT code %Inline;>   <!-- program code -->
-<!ATTLIST code %attrs;>
-
-<!ELEMENT samp %Inline;>   <!-- sample -->
-<!ATTLIST samp %attrs;>
-
-<!ELEMENT kbd %Inline;>  <!-- something user would type -->
-<!ATTLIST kbd %attrs;>
-
-<!ELEMENT var %Inline;>   <!-- variable -->
-<!ATTLIST var %attrs;>
-
-<!ELEMENT cite %Inline;>   <!-- citation -->
-<!ATTLIST cite %attrs;>
-
-<!ELEMENT abbr %Inline;>   <!-- abbreviation -->
-<!ATTLIST abbr %attrs;>
-
-<!ELEMENT acronym %Inline;>   <!-- acronym -->
-<!ATTLIST acronym %attrs;>
-
-<!ELEMENT q %Inline;>   <!-- inlined quote -->
-<!ATTLIST q
-  %attrs;
-  cite        %URI;          #IMPLIED
-  >
-
-<!ELEMENT sub %Inline;> <!-- subscript -->
-<!ATTLIST sub %attrs;>
-
-<!ELEMENT sup %Inline;> <!-- superscript -->
-<!ATTLIST sup %attrs;>
-
-<!ELEMENT tt %Inline;>   <!-- fixed pitch font -->
-<!ATTLIST tt %attrs;>
-
-<!ELEMENT i %Inline;>   <!-- italic font -->
-<!ATTLIST i %attrs;>
-
-<!ELEMENT b %Inline;>   <!-- bold font -->
-<!ATTLIST b %attrs;>
-
-<!ELEMENT big %Inline;>   <!-- bigger font -->
-<!ATTLIST big %attrs;>
-
-<!ELEMENT small %Inline;>   <!-- smaller font -->
-<!ATTLIST small %attrs;>
-
-<!ELEMENT u %Inline;>   <!-- underline -->
-<!ATTLIST u %attrs;>
-
-<!ELEMENT s %Inline;>   <!-- strike-through -->
-<!ATTLIST s %attrs;>
-
-<!ELEMENT strike %Inline;>   <!-- strike-through -->
-<!ATTLIST strike %attrs;>
-
-<!ELEMENT basefont EMPTY>  <!-- base font size -->
-<!ATTLIST basefont
-  id          ID             #IMPLIED
-  size        CDATA          #REQUIRED
-  color       %Color;        #IMPLIED
-  face        CDATA          #IMPLIED
-  >
-
-<!ELEMENT font %Inline;> <!-- local change to font -->
-<!ATTLIST font
-  %coreattrs;
-  %i18n;
-  size        CDATA          #IMPLIED
-  color       %Color;        #IMPLIED
-  face        CDATA          #IMPLIED
-  >
-
-<!--==================== Object ======================================-->
-<!--
-  object is used to embed objects as part of HTML pages.
-  param elements should precede other content. Parameters
-  can also be expressed as attribute/value pairs on the
-  object element itself when brevity is desired.
--->
-
-<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
-<!ATTLIST object
-  %attrs;
-  declare     (declare)      #IMPLIED
-  classid     %URI;          #IMPLIED
-  codebase    %URI;          #IMPLIED
-  data        %URI;          #IMPLIED
-  type        %ContentType;  #IMPLIED
-  codetype    %ContentType;  #IMPLIED
-  archive     %UriList;      #IMPLIED
-  standby     %Text;         #IMPLIED
-  height      %Length;       #IMPLIED
-  width       %Length;       #IMPLIED
-  usemap      %URI;          #IMPLIED
-  name        NMTOKEN        #IMPLIED
-  tabindex    %Number;       #IMPLIED
-  align       %ImgAlign;     #IMPLIED
-  border      %Pixels;       #IMPLIED
-  hspace      %Pixels;       #IMPLIED
-  vspace      %Pixels;       #IMPLIED
-  >
-
-<!--
-  param is used to supply a named property value.
-  In XML it would seem natural to follow RDF and support an
-  abbreviated syntax where the param elements are replaced
-  by attribute value pairs on the object start tag.
--->
-<!ELEMENT param EMPTY>
-<!ATTLIST param
-  id          ID             #IMPLIED
-  name        CDATA          #REQUIRED
-  value       CDATA          #IMPLIED
-  valuetype   (data|ref|object) "data"
-  type        %ContentType;  #IMPLIED
-  >
-
-<!--=================== Java applet ==================================-->
-<!--
-  One of code or object attributes must be present.
-  Place param elements before other content.
--->
-<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
-<!ATTLIST applet
-  %coreattrs;
-  codebase    %URI;          #IMPLIED
-  archive     CDATA          #IMPLIED
-  code        CDATA          #IMPLIED
-  object      CDATA          #IMPLIED
-  alt         %Text;         #IMPLIED
-  name        NMTOKEN        #IMPLIED
-  width       %Length;       #REQUIRED
-  height      %Length;       #REQUIRED
-  align       %ImgAlign;     #IMPLIED
-  hspace      %Pixels;       #IMPLIED
-  vspace      %Pixels;       #IMPLIED
-  >
-
-<!--=================== Images ===========================================-->
-
-<!--
-   To avoid accessibility problems for people who aren't
-   able to see the image, you should provide a text
-   description using the alt and longdesc attributes.
-   In addition, avoid the use of server-side image maps.
--->
-
-<!ELEMENT img EMPTY>
-<!ATTLIST img
-  %attrs;
-  src         %URI;          #REQUIRED
-  alt         %Text;         #REQUIRED
-  name        NMTOKEN        #IMPLIED
-  longdesc    %URI;          #IMPLIED
-  height      %Length;       #IMPLIED
-  width       %Length;       #IMPLIED
-  usemap      %URI;          #IMPLIED
-  ismap       (ismap)        #IMPLIED
-  align       %ImgAlign;     #IMPLIED
-  border      %Length;       #IMPLIED
-  hspace      %Pixels;       #IMPLIED
-  vspace      %Pixels;       #IMPLIED
-  >
-
-<!-- usemap points to a map element which may be in this document
-  or an external document, although the latter is not widely supported -->
-
-<!--================== Client-side image maps ============================-->
-
-<!-- These can be placed in the same document or grouped in a
-     separate document although this isn't yet widely supported -->
-
-<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
-<!ATTLIST map
-  %i18n;
-  %events;
-  id          ID             #REQUIRED
-  class       CDATA          #IMPLIED
-  style       %StyleSheet;   #IMPLIED
-  title       %Text;         #IMPLIED
-  name        CDATA          #IMPLIED
-  >
-
-<!ELEMENT area EMPTY>
-<!ATTLIST area
-  %attrs;
-  %focus;
-  shape       %Shape;        "rect"
-  coords      %Coords;       #IMPLIED
-  href        %URI;          #IMPLIED
-  nohref      (nohref)       #IMPLIED
-  alt         %Text;         #REQUIRED
-  target      %FrameTarget;  #IMPLIED
-  >
-
-<!--================ Forms ===============================================-->
-
-<!ELEMENT form %form.content;>   <!-- forms shouldn't be nested -->
-
-<!ATTLIST form
-  %attrs;
-  action      %URI;          #REQUIRED
-  method      (get|post)     "get"
-  name        NMTOKEN        #IMPLIED
-  enctype     %ContentType;  "application/x-www-form-urlencoded"
-  onsubmit    %Script;       #IMPLIED
-  onreset     %Script;       #IMPLIED
-  accept      %ContentTypes; #IMPLIED
-  accept-charset %Charsets;  #IMPLIED
-  target      %FrameTarget;  #IMPLIED
-  >
-
-<!--
-  Each label must not contain more than ONE field
-  Label elements shouldn't be nested.
--->
-<!ELEMENT label %Inline;>
-<!ATTLIST label
-  %attrs;
-  for         IDREF          #IMPLIED
-  accesskey   %Character;    #IMPLIED
-  onfocus     %Script;       #IMPLIED
-  onblur      %Script;       #IMPLIED
-  >
-
-<!ENTITY % InputType
-  "(text | password | checkbox |
-    radio | submit | reset |
-    file | hidden | image | button)"
-   >
-
-<!-- the name attribute is required for all but submit & reset -->
-
-<!ELEMENT input EMPTY>     <!-- form control -->
-<!ATTLIST input
-  %attrs;
-  %focus;
-  type        %InputType;    "text"
-  name        CDATA          #IMPLIED
-  value       CDATA          #IMPLIED
-  checked     (checked)      #IMPLIED
-  disabled    (disabled)     #IMPLIED
-  readonly    (readonly)     #IMPLIED
-  size        CDATA          #IMPLIED
-  maxlength   %Number;       #IMPLIED
-  src         %URI;          #IMPLIED
-  alt         CDATA          #IMPLIED
-  usemap      %URI;          #IMPLIED
-  onselect    %Script;       #IMPLIED
-  onchange    %Script;       #IMPLIED
-  accept      %ContentTypes; #IMPLIED
-  align       %ImgAlign;     #IMPLIED
-  >
-
-<!ELEMENT select (optgroup|option)+>  <!-- option selector -->
-<!ATTLIST select
-  %attrs;
-  name        CDATA          #IMPLIED
-  size        %Number;       #IMPLIED
-  multiple    (multiple)     #IMPLIED
-  disabled    (disabled)     #IMPLIED
-  tabindex    %Number;       #IMPLIED
-  onfocus     %Script;       #IMPLIED
-  onblur      %Script;       #IMPLIED
-  onchange    %Script;       #IMPLIED
-  >
-
-<!ELEMENT optgroup (option)+>   <!-- option group -->
-<!ATTLIST optgroup
-  %attrs;
-  disabled    (disabled)     #IMPLIED
-  label       %Text;         #REQUIRED
-  >
-
-<!ELEMENT option (#PCDATA)>     <!-- selectable choice -->
-<!ATTLIST option
-  %attrs;
-  selected    (selected)     #IMPLIED
-  disabled    (disabled)     #IMPLIED
-  label       %Text;         #IMPLIED
-  value       CDATA          #IMPLIED
-  >
-
-<!ELEMENT textarea (#PCDATA)>     <!-- multi-line text field -->
-<!ATTLIST textarea
-  %attrs;
-  %focus;
-  name        CDATA          #IMPLIED
-  rows        %Number;       #REQUIRED
-  cols        %Number;       #REQUIRED
-  disabled    (disabled)     #IMPLIED
-  readonly    (readonly)     #IMPLIED
-  onselect    %Script;       #IMPLIED
-  onchange    %Script;       #IMPLIED
-  >
-
-<!--
-  The fieldset element is used to group form fields.
-  Only one legend element should occur in the content
-  and if present should only be preceded by whitespace.
--->
-<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
-<!ATTLIST fieldset
-  %attrs;
-  >
-
-<!ENTITY % LAlign "(top|bottom|left|right)">
-
-<!ELEMENT legend %Inline;>     <!-- fieldset label -->
-<!ATTLIST legend
-  %attrs;
-  accesskey   %Character;    #IMPLIED
-  align       %LAlign;       #IMPLIED
-  >
-
-<!--
- Content is %Flow; excluding a, form, form controls, iframe
---> 
-<!ELEMENT button %button.content;>  <!-- push button -->
-<!ATTLIST button
-  %attrs;
-  %focus;
-  name        CDATA          #IMPLIED
-  value       CDATA          #IMPLIED
-  type        (button|submit|reset) "submit"
-  disabled    (disabled)     #IMPLIED
-  >
-
-<!-- single-line text input control (DEPRECATED) -->
-<!ELEMENT isindex EMPTY>
-<!ATTLIST isindex
-  %coreattrs;
-  %i18n;
-  prompt      %Text;         #IMPLIED
-  >
-
-<!--======================= Tables =======================================-->
-
-<!-- Derived from IETF HTML table standard, see [RFC1942] -->
-
-<!--
- The border attribute sets the thickness of the frame around the
- table. The default units are screen pixels.
-
- The frame attribute specifies which parts of the frame around
- the table should be rendered. The values are not the same as
- CALS to avoid a name clash with the valign attribute.
--->
-<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
-
-<!--
- The rules attribute defines which rules to draw between cells:
-
- If rules is absent then assume:
-     "none" if border is absent or border="0" otherwise "all"
--->
-
-<!ENTITY % TRules "(none | groups | rows | cols | all)">
-  
-<!-- horizontal placement of table relative to document -->
-<!ENTITY % TAlign "(left|center|right)">
-
-<!-- horizontal alignment attributes for cell contents
-
-  char        alignment char, e.g. char=':'
-  charoff     offset for alignment char
--->
-<!ENTITY % cellhalign
-  "align      (left|center|right|justify|char) #IMPLIED
-   char       %Character;    #IMPLIED
-   charoff    %Length;       #IMPLIED"
-  >
-
-<!-- vertical alignment attributes for cell contents -->
-<!ENTITY % cellvalign
-  "valign     (top|middle|bottom|baseline) #IMPLIED"
-  >
-
-<!ELEMENT table
-     (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
-<!ELEMENT caption  %Inline;>
-<!ELEMENT thead    (tr)+>
-<!ELEMENT tfoot    (tr)+>
-<!ELEMENT tbody    (tr)+>
-<!ELEMENT colgroup (col)*>
-<!ELEMENT col      EMPTY>
-<!ELEMENT tr       (th|td)+>
-<!ELEMENT th       %Flow;>
-<!ELEMENT td       %Flow;>
-
-<!ATTLIST table
-  %attrs;
-  summary     %Text;         #IMPLIED
-  width       %Length;       #IMPLIED
-  border      %Pixels;       #IMPLIED
-  frame       %TFrame;       #IMPLIED
-  rules       %TRules;       #IMPLIED
-  cellspacing %Length;       #IMPLIED
-  cellpadding %Length;       #IMPLIED
-  align       %TAlign;       #IMPLIED
-  bgcolor     %Color;        #IMPLIED
-  >
-
-<!ENTITY % CAlign "(top|bottom|left|right)">
-
-<!ATTLIST caption
-  %attrs;
-  align       %CAlign;       #IMPLIED
-  >
-
-<!--
-colgroup groups a set of col elements. It allows you to group
-several semantically related columns together.
--->
-<!ATTLIST colgroup
-  %attrs;
-  span        %Number;       "1"
-  width       %MultiLength;  #IMPLIED
-  %cellhalign;
-  %cellvalign;
-  >
-
-<!--
- col elements define the alignment properties for cells in
- one or more columns.
-
- The width attribute specifies the width of the columns, e.g.
-
-     width=64        width in screen pixels
-     width=0.5*      relative width of 0.5
-
- The span attribute causes the attributes of one
- col element to apply to more than one column.
--->
-<!ATTLIST col
-  %attrs;
-  span        %Number;       "1"
-  width       %MultiLength;  #IMPLIED
-  %cellhalign;
-  %cellvalign;
-  >
-
-<!--
-    Use thead to duplicate headers when breaking table
-    across page boundaries, or for static headers when
-    tbody sections are rendered in scrolling panel.
-
-    Use tfoot to duplicate footers when breaking table
-    across page boundaries, or for static footers when
-    tbody sections are rendered in scrolling panel.
-
-    Use multiple tbody sections when rules are needed
-    between groups of table rows.
--->
-<!ATTLIST thead
-  %attrs;
-  %cellhalign;
-  %cellvalign;
-  >
-
-<!ATTLIST tfoot
-  %attrs;
-  %cellhalign;
-  %cellvalign;
-  >
-
-<!ATTLIST tbody
-  %attrs;
-  %cellhalign;
-  %cellvalign;
-  >
-
-<!ATTLIST tr
-  %attrs;
-  %cellhalign;
-  %cellvalign;
-  bgcolor     %Color;        #IMPLIED
-  >
-
-<!-- Scope is simpler than headers attribute for common tables -->
-<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
-
-<!-- th is for headers, td for data and for cells acting as both -->
-
-<!ATTLIST th
-  %attrs;
-  abbr        %Text;         #IMPLIED
-  axis        CDATA          #IMPLIED
-  headers     IDREFS         #IMPLIED
-  scope       %Scope;        #IMPLIED
-  rowspan     %Number;       "1"
-  colspan     %Number;       "1"
-  %cellhalign;
-  %cellvalign;
-  nowrap      (nowrap)       #IMPLIED
-  bgcolor     %Color;        #IMPLIED
-  width       %Length;       #IMPLIED
-  height      %Length;       #IMPLIED
-  >
-
-<!ATTLIST td
-  %attrs;
-  abbr        %Text;         #IMPLIED
-  axis        CDATA          #IMPLIED
-  headers     IDREFS         #IMPLIED
-  scope       %Scope;        #IMPLIED
-  rowspan     %Number;       "1"
-  colspan     %Number;       "1"
-  %cellhalign;
-  %cellvalign;
-  nowrap      (nowrap)       #IMPLIED
-  bgcolor     %Color;        #IMPLIED
-  width       %Length;       #IMPLIED
-  height      %Length;       #IMPLIED
-  >
-

+ 0 - 798
main/inc/lib/htmlpurifier/docs/enduser-customize.html

@@ -1,798 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Tutorial for customizing HTML Purifier's tag and attribute sets." />
-<link rel="stylesheet" type="text/css" href="style.css" />
-
-<title>Customize - HTML Purifier</title>
-
-</head><body>
-
-<h1 class="subtitled">Customize!</h1>
-<div class="subtitle">HTML Purifier is a Swiss-Army Knife</div>
-
-<div id="filing">Filed under End-User</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>
-  You may have heard of the <a href="dev-advanced-api.html">Advanced API</a>.
-  If you're interested in reading dry prose and boring functional
-  specifications, feel free to click that link to get a no-nonsense overview
-  on the Advanced API. For the rest of us, there's this tutorial. By the time
-  you're finished reading this, you should have a pretty good idea on
-  how to implement custom tags and attributes that HTML Purifier may not have.
-</p>
-
-<h2>Is it necessary?</h2>
-
-<p>
-  Before we even write any code, it is paramount to consider whether or
-  not the code we're writing is necessary or not. HTML Purifier, by default,
-  contains a large set of elements and attributes: large enough so that
-  <em>any</em> element or attribute in XHTML 1.0 or 1.1 (and its HTML variants)
-  that can be safely used by the general public is implemented.
-</p>
-
-<p>
-  So what needs to be implemented? (Feel free to skip this section if
-  you know what you want).
-</p>
-
-<h3>XHTML 1.0</h3>
-
-<p>
-  All of the modules listed below are based off of the
-  <a href="http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/abstract_modules.html#sec_5.2.">modularization of
-  XHTML</a>, which, while technically for XHTML 1.1, is quite a useful
-  resource.
-</p>
-
-<ul>
-  <li>Structure</li>
-  <li>Frames</li>
-  <li>Applets (deprecated)</li>
-  <li>Forms</li>
-  <li>Image maps</li>
-  <li>Objects</li>
-  <li>Frames</li>
-  <li>Events</li>
-  <li>Meta-information</li>
-  <li>Style sheets</li>
-  <li>Link (not hypertext)</li>
-  <li>Base</li>
-  <li>Name</li>
-</ul>
-
-<p>
-  If you don't recognize it, you probably don't need it. But the curious
-  can look all of these modules up in the above-mentioned document.  Note
-  that inline scripting comes packaged with HTML Purifier (more on this
-  later).
-</p>
-
-<h3>XHTML 1.1</h3>
-
-<p>
-  As of HTMLPurifier 2.1.0, we have implemented the
-  <a href="http://www.w3.org/TR/2001/REC-ruby-20010531/">Ruby module</a>,
-  which defines a set of tags
-  for publishing short annotations for text, used mostly in Japanese
-  and Chinese school texts, but applicable for positioning any text (not
-  limited to translations) above or below other corresponding text.
-</p>
-
-<h3>XHTML 2.0</h3>
-
-<p>
-  <a href="http://www.w3.org/TR/xhtml2/">XHTML 2.0</a> is still a
-  working draft, so any elements introduced in the
-  specification have not been implemented and will not be implemented
-  until we get a recommendation or proposal.  Because XHTML 2.0 is
-  an entirely new markup language, implementing rules for it will be
-  no easy task.
-</p>
-
-<h3>HTML 5</h3>
-
-<p>
-  <a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML 5</a>
-  is a fork of HTML 4.01 by WHATWG, who believed that XHTML 2.0 was headed
-  in the wrong direction.  It too is a working draft, and may change
-  drastically before publication, but it should be noted that the
-  <code>canvas</code> tag has been implemented by many browser vendors.
-</p>
-
-<h3>Proprietary</h3>
-
-<p>
-  There are a number of proprietary tags still in the wild. Many of them
-  have been documented in <a href="ref-proprietary-tags.txt">ref-proprietary-tags.txt</a>,
-  but there is currently no implementation for any of them.
-</p>
-
-<h3>Extensions</h3>
-
-<p>
-  There are also a number of other XML languages out there that can
-  be embedded in HTML documents: two of the most popular are MathML and
-  SVG, and I frequently get requests to implement these.  But they are
-  expansive, comprehensive specifications, and it would take far too long
-  to implement them <em>correctly</em> (most systems I've seen go as far
-  as whitelisting tags and no further; come on, what about nesting!)
-</p>
-
-<p>
-  Word of warning: HTML Purifier is currently <em>not</em> namespace
-  aware.
-</p>
-
-<h2>Giving back</h2>
-
-<p>
-  As you may imagine from the details above (don't be abashed if you didn't
-  read it all: a glance over would have done), there's quite a bit that
-  HTML Purifier doesn't implement.  Recent architectural changes have
-  allowed HTML Purifier to implement elements and attributes that are not
-  safe!  Don't worry, they won't be activated unless you set %HTML.Trusted
-  to true, but they certainly help out users who need to put, say, forms
-  on their page and don't want to go through the trouble of reading this
-  and implementing it themself.
-</p>
-
-<p>
-  So any of the above that you implement for your own application could
-  help out some other poor sap on the other side of the globe.  Help us
-  out, and send back code so that it can be hammered into a module and
-  released with the core.  Any code would be greatly appreciated!
-</p>
-
-<h2>And now...</h2>
-
-<p>
-  Enough philosophical talk, time for some code:
-</p>
-
-<pre>$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'DefinitionID', 'enduser-customize.html tutorial');
-$config->set('HTML', 'DefinitionRev', 1);
-$def = $config->getHTMLDefinition(true);</pre>
-
-<p>
-  Assuming that HTML Purifier has already been properly loaded (hint:
-  include <code>HTMLPurifier.auto.php</code>), this code will set up
-  the environment that you need to start customizing the HTML definition.
-  What's going on?
-</p>
-
-<ul>
-  <li>
-    The first three lines are regular configuration code:
-    <ul>
-      <li>
-        %HTML.DefinitionID is set to a unique identifier for your
-        custom HTML definition.  This prevents it from clobbering
-        other custom definitions on the same installation.
-      </li>
-      <li>
-        %HTML.DefinitionRev is a revision integer of your HTML
-        definition.  Because HTML definitions are cached, you'll need
-        to increment this whenever you make a change in order to flush
-        the cache.
-      </li>
-    </ul>
-  </li>
-  <li>
-    The fourth line retrieves a raw <code>HTMLPurifier_HTMLDefinition</code>
-    object that we will be tweaking. If the parameter was removed, we
-    would be retrieving a fully formed definition object, which is somewhat
-    useless for customization purposes.
-  </li>
-</ul>
-
-<h3>Broken backwards-compatibility</h3>
-
-<p>
-  Those of you who have already been twiddling around with the raw
-  HTML definition object, you'll be noticing that you're getting an error
-  when you attempt to retrieve the raw definition object without specifying
-  a DefinitionID.  It is vital to caching (see below) that you make a unique
-  name for your customized definition, so make up something right now and
-  things will operate again.
-</p>
-
-<h2>Turn off caching</h2>
-
-<p>
-  To make development easier, we're going to temporarily turn off
-  definition caching:
-</p>
-
-<pre>$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'DefinitionID', 'enduser-customize.html tutorial');
-$config->set('HTML', 'DefinitionRev', 1);
-<strong>$config->set('Cache', 'DefinitionImpl', null); // remove this later!</strong>
-$def = $config->getHTMLDefinition(true);</pre>
-
-<p>
-  A few things should be mentioned about the caching mechanism before
-  we move on.  For performance reasons, HTML Purifier caches generated
-  <code>HTMLPurifier_Definition</code> objects in serialized files
-  stored (by default) in <code>library/HTMLPurifier/DefinitionCache/Serializer</code>.
-  A lot of processing is done in order to create these objects, so it
-  makes little sense to repeat the same processing over and over again
-  whenever HTML Purifier is called.
-</p>
-
-<p>
-  In order to identify a cache entry, HTML Purifier uses three variables:
-  the library's version number, the value of %HTML.DefinitionRev and
-  a serial of relevant configuration.  Whenever any of these changes,
-  a new HTML definition is generated.  Notice that there is no way
-  for the definition object to track changes to customizations: here, it
-  is up to you to supply appropriate information to DefinitionID and
-  DefinitionRev.
-</p>
-
-<h2 id="addAttribute">Add an attribute</h2>
-
-<p>
-  For this example, we're going to implement the <code>target</code> attribute found
-  on <code>a</code> elements.  To implement an attribute, we have to
-  ask a few questions:
-</p>
-
-<ol>
-  <li>What element is it found on?</li>
-  <li>What is its name?</li>
-  <li>Is it required or optional?</li>
-  <li>What are valid values for it?</li>
-</ol>
-
-<p>
-  The first three are easy: the element is <code>a</code>, the attribute
-  is <code>target</code>, and it is not a required attribute. (If it
-  was required, we'd need to append an asterisk to the attribute name,
-  you'll see an example of this in the addElement() example).
-</p>
-
-<p>
-  The last question is a little trickier.
-  Lets allow the special values: _blank, _self, _target and _top.
-  The form of this is called an <strong>enumeration</strong>, a list of
-  valid values, although only one can be used at a time.  To translate
-  this into code form, we write:
-</p>
-
-<pre>$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'DefinitionID', 'enduser-customize.html tutorial');
-$config->set('HTML', 'DefinitionRev', 1);
-$config->set('Cache', 'DefinitionImpl', null); // remove this later!
-$def = $config->getHTMLDefinition(true);
-<strong>$def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');</strong></pre>
-
-<p>
-  The <code>Enum#_blank,_self,_target,_top</code> does all the magic.
-  The string is split into two parts, separated by a hash mark (#):
-</p>
-
-<ol>
-  <li>The first part is the name of what we call an <code>AttrDef</code></li>
-  <li>The second part is the parameter of the above-mentioned <code>AttrDef</code></li>
-</ol>
-
-<p>
-  If that sounds vague and generic, it's because it is!  HTML Purifier defines
-  an assortment of different attribute types one can use, and each of these
-  has their own specialized parameter format.  Here are some of the more useful
-  ones:
-</p>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Type</th>
-      <th>Format</th>
-      <th>Description</th>
-    </tr>
-  </thead>
-  <tbody>
-    <tr>
-      <th>Enum</th>
-      <td><em>[s:]</em>value1,value2,...</td>
-      <td>
-        Attribute with a number of valid values, one of which may be used. When
-        s: is present, the enumeration is case sensitive.
-      </td>
-    </tr>
-    <tr>
-      <th>Bool</th>
-      <td>attribute_name</td>
-      <td>
-        Boolean attribute, with only one valid value: the name
-        of the attribute.
-      </td>
-    </tr>
-    <tr>
-      <th>CDATA</th>
-      <td></td>
-      <td>
-        Attribute of arbitrary text. Can also be referred to as <strong>Text</strong>
-        (the specification makes a semantic distinction between the two).
-      </td>
-    </tr>
-    <tr>
-      <th>ID</th>
-      <td></td>
-      <td>
-        Attribute that specifies a unique ID
-      </td>
-    </tr>
-    <tr>
-      <th>Pixels</th>
-      <td></td>
-      <td>
-        Attribute that specifies an integer pixel length
-      </td>
-    </tr>
-    <tr>
-      <th>Length</th>
-      <td></td>
-      <td>
-        Attribute that specifies a pixel or percentage length
-      </td>
-    </tr>
-    <tr>
-      <th>NMTOKENS</th>
-      <td></td>
-      <td>
-        Attribute that specifies a number of name tokens, example: the
-        <code>class</code> attribute
-      </td>
-    </tr>
-    <tr>
-      <th>URI</th>
-      <td></td>
-      <td>
-        Attribute that specifies a URI, example: the <code>href</code>
-        attribute
-      </td>
-    </tr>
-    <tr>
-      <th>Number</th>
-      <td></td>
-      <td>
-        Attribute that specifies an positive integer number
-      </td>
-    </tr>
-  </tbody>
-</table>
-
-<p>
-  For a complete list, consult
-  <a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/AttrTypes.php"><code>library/HTMLPurifier/AttrTypes.php</code></a>;
-  more information on attributes that accept parameters can be found on their
-  respective includes in
-  <a href="http://repo.or.cz/w/htmlpurifier.git?a=tree;hb=HEAD;f=library/HTMLPurifier/AttrDef"><code>library/HTMLPurifier/AttrDef</code></a>.
-</p>
-
-<p>
-  Sometimes, the restrictive list in AttrTypes just doesn't cut it. Don't
-  sweat: you can also use a fully instantiated object as the value. The
-  equivalent, verbose form of the above example is:
-</p>
-
-<pre>$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'DefinitionID', 'enduser-customize.html tutorial');
-$config->set('HTML', 'DefinitionRev', 1);
-$config->set('Cache', 'DefinitionImpl', null); // remove this later!
-$def = $config->getHTMLDefinition(true);
-<strong>$def->addAttribute('a', 'target', new HTMLPurifier_AttrDef_Enum(
-  array('_blank','_self','_target','_top')
-));</strong></pre>
-
-<p>
-  Trust me, you'll learn to love the shorthand.
-</p>
-
-<h2>Add an element</h2>
-
-<p>
-  Adding attributes is really small-fry stuff, though, and it was possible
-  to add them (albeit a bit more wordy) prior to 2.0. The real gem of
-  the Advanced API is adding elements. There are five questions to
-  ask when adding a new element:
-</p>
-
-<ol>
-  <li>What is the element's name?</li>
-  <li>What content set does this element belong to?</li>
-  <li>What are the allowed children of this element?</li>
-  <li>What attributes does the element allow that are general?</li>
-  <li>What attributes does the element allow that are specific to this element?</li>
-</ol>
-
-<p>
-  It's a mouthful, and you'll be slightly lost if your not familiar with
-  the HTML specification, so let's explain them step by step.
-</p>
-
-<h3>Content set</h3>
-
-<p>
-  The HTML specification defines two major content sets: Inline
-  and Block.  Each of these
-  content sets contain a list of elements: Inline contains things like
-  <code>span</code> and <code>b</code> while Block contains things like
-  <code>div</code> and <code>blockquote</code>.
-</p>
-
-<p>
-  These content sets amount to a macro mechanism for HTML definition. Most
-  elements in HTML are organized into one of these two sets, and most
-  elements in HTML allow elements from one of these sets.  If we had
-  to write each element verbatim into each other element's allowed
-  children, we would have ridiculously large lists; instead we use
-  content sets to compactify the declaration.
-</p>
-
-<p>
-  Practically speaking, there are several useful values you can use here:
-</p>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Content set</th>
-      <th>Description</th>
-    </tr>
-  </thead>
-  <tbody>
-    <tr>
-      <th>Inline</th>
-      <td>Character level elements, text</td>
-    </tr>
-    <tr>
-      <th>Block</th>
-      <td>Block-like elements, like paragraphs and lists</td>
-    </tr>
-    <tr>
-      <th><em>false</em></th>
-      <td>
-        Any element that doesn't fit into the mold, for example <code>li</code>
-        or <code>tr</code>
-      </td>
-    </tr>
-  </tbody>
-</table>
-
-<p>
-  By specifying a valid value here, all other elements that use that
-  content set will also allow your element, without you having to do
-  anything. If you specify <em>false</em>, you'll have to register
-  your element manually.
-</p>
-
-<h3>Allowed children</h3>
-
-<p>
-  Allowed children defines the elements that this element can contain.
-  The allowed values may range from none to a complex regexp depending on
-  your element.
-</p>
-
-<p>
-  If you've ever taken a look at the HTML DTD's before, you may have
-  noticed declarations like this:
-</p>
-
-<pre>&lt;!ELEMENT LI - O (%flow;)*             -- list item --&gt;</pre>
-
-<p>
-  The <code>(%flow;)*</code> indicates the allowed children of the
-  <code>li</code> tag: <code>li</code> allows any number of flow
-  elements as its children. (The <code>- O</code> allows the closing tag to be
-  omitted, though in XML this is not allowed.) In HTML Purifier,
-  we'd write it like <code>Flow</code> (here's where the content sets
-  we were discussing earlier come into play). There are three shorthand
-  content models you can specify:
-</p>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Content model</th>
-      <th>Description</th>
-    </tr>
-  </thead>
-  <tbody>
-    <tr>
-      <th>Empty</th>
-      <td>No children allowed, like <code>br</code> or <code>hr</code></td>
-    </tr>
-    <tr>
-      <th>Inline</th>
-      <td>Any number of inline elements and text, like <code>span</code></td>
-    </tr>
-    <tr>
-      <th>Flow</th>
-      <td>Any number of inline elements, block elements and text, like <code>div</code></td>
-    </tr>
-  </tbody>
-</table>
-
-<p>
-  This covers 90% of all the cases out there, but what about elements that
-  break the mold like <code>ul</code>? This guy requires at least one
-  child, and the only valid children for it are <code>li</code>. The
-  content model is: <code>Required: li</code>. There are two parts: the
-  first type determines what <code>ChildDef</code> will be used to validate
-  content models. The most common values are:
-</p>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Type</th>
-      <th>Description</th>
-    </tr>
-  </thead>
-  <tbody>
-    <tr>
-      <th>Required</th>
-      <td>Children must be one or more of the valid elements</td>
-    </tr>
-    <tr>
-      <th>Optional</th>
-      <td>Children can be any number of the valid elements</td>
-    </tr>
-    <tr>
-      <th>Custom</th>
-      <td>Children must follow the DTD-style regex</td>
-    </tr>
-  </tbody>
-</table>
-
-<p>
-  You can also implement your own <code>ChildDef</code>: this was done
-  for a few special cases in HTML Purifier such as <code>Chameleon</code>
-  (for <code>ins</code> and <code>del</code>), <code>StrictBlockquote</code>
-  and <code>Table</code>.
-</p>
-
-<p>
-  The second part specifies either valid elements or a regular expression.
-  Valid elements are separated with horizontal bars (|), i.e.
-  "<code>a | b | c</code>".  Use #PCDATA to represent plain text.
-  Regular expressions are based off of DTD's style:
-</p>
-
-<ul>
-  <li>Parentheses () are used for grouping</li>
-  <li>Commas (,) separate elements that should come one after another</li>
-  <li>Horizontal bars (|) indicate one or the other elements should be used</li>
-  <li>Plus signs (+) are used for a one or more match</li>
-  <li>Asterisks (*) are used for a zero or more match</li>
-  <li>Question marks (?) are used for a zero or one match</li>
-</ul>
-
-<p>
-  For example, "<code>a, b?, (c | d), e+, f*</code>" means "In this order,
-  one <code>a</code> element, at most one <code>b</code> element,
-  one <code>c</code> or <code>d</code> element (but not both), one or more
-  <code>e</code> elements, and any number of <code>f</code> elements."
-  Regex veterans should be able to jump right in, and those not so savvy
-  can always copy-paste W3C's content model definitions into HTML Purifier
-  and hope for the best.
-</p>
-
-<p>
-  A word of warning: while the regex format is extremely flexible on
-  the developer's side, it is
-  quite unforgiving on the user's side.  If the user input does not <em>exactly</em>
-  match the specification, the entire contents of the element will
-  be nuked.  This is why there is are specific content model types like
-  Optional and Required: while they could be implemented as <code>Custom:
-  (valid | elements)*</code>, the custom classes contain special recovery
-  measures that make sure as much of the user's original content gets
-  through. HTML Purifier's core, as a rule, does not use Custom.
-</p>
-
-<p>
-  One final note: you can also use Content Sets inside your valid elements
-  lists or regular expressions. In fact, the three shorthand content models
-  mentioned above are just that: abbreviations:
-</p>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Content model</th>
-      <th>Implementation</th>
-    </tr>
-  </thead>
-  <tbody>
-    <tr>
-      <th>Inline</th>
-      <td>Optional: Inline | #PCDATA</td>
-    </tr>
-    <tr>
-      <th>Flow</th>
-      <td>Optional: Flow | #PCDATA</td>
-    </tr>
-  </tbody>
-</table>
-
-<p>
-  When the definition is compiled, Inline will be replaced with a
-  horizontal-bar separated list of inline elements. Also, notice that
-  it does not contain text: you have to specify that yourself.
-</p>
-
-<h3>Common attributes</h3>
-
-<p>
-  Congratulations: you have just gotten over the proverbial hump (Allowed
-  children). Common attributes is much simpler, and boils down to
-  one question: does your element have the <code>id</code>, <code>style</code>,
-  <code>class</code>, <code>title</code> and <code>lang</code> attributes?
-  If so, you'll want to specify the <code>Common</code> attribute collection,
-  which contains these five attributes that are found on almost every
-  HTML element in the specification.
-</p>
-
-<p>
-  There are a few more collections, but they're really edge cases:
-</p>
-
-<table class="table">
-  <thead>
-    <tr>
-      <th>Collection</th>
-      <th>Attributes</th>
-    </tr>
-  </thead>
-  <tbody>
-    <tr>
-      <th>I18N</th>
-      <td><code>lang</code>, possibly <code>xml:lang</code></td>
-    </tr>
-    <tr>
-      <th>Core</th>
-      <td><code>style</code>, <code>class</code>, <code>id</code> and <code>title</code></td>
-    </tr>
-  </tbody>
-</table>
-
-<p>
-  Common is a combination of the above-mentioned collections.
-</p>
-
-<p class="aside">
-  Readers familiar with the modularization may have noticed that the Core
-  attribute collection differs from that specified by the <a
-  href="http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_commonatts">abstract
-  modules of the XHTML Modularization 1.1</a>. We believe this section
-  to be in error, as <code>br</code> permits the use of the <code>style</code>
-  attribute even though it uses the <code>Core</code> collection, and
-  the DTD and XML Schemas supplied by W3C support our interpretation.
-</p>
-
-<h3>Attributes</h3>
-
-<p>
-  If you didn't read the <a href="#addAttribute">earlier section on
-  adding attributes</a>, read it now.  The last parameter is simply
-  an array of attribute names to attribute implementations, in the exact
-  same format as <code>addAttribute()</code>.
-</p>
-
-<h3>Putting it all together</h3>
-
-<p>
-  We're going to implement <code>form</code>. Before we embark, lets
-  grab a reference implementation from over at the
-  <a href="http://www.w3.org/TR/html4/sgml/loosedtd.html">transitional DTD</a>:
-</p>
-
-<pre>&lt;!ELEMENT FORM - - (%flow;)* -(FORM)   -- interactive form --&gt;
-&lt;!ATTLIST FORM
-  %attrs;                              -- %coreattrs, %i18n, %events --
-  action      %URI;          #REQUIRED -- server-side form handler --
-  method      (GET|POST)     GET       -- HTTP method used to submit the form--
-  enctype     %ContentType;  &quot;application/x-www-form-urlencoded&quot;
-  accept      %ContentTypes; #IMPLIED  -- list of MIME types for file upload --
-  name        CDATA          #IMPLIED  -- name of form for scripting --
-  onsubmit    %Script;       #IMPLIED  -- the form was submitted --
-  onreset     %Script;       #IMPLIED  -- the form was reset --
-  target      %FrameTarget;  #IMPLIED  -- render in this frame --
-  accept-charset %Charsets;  #IMPLIED  -- list of supported charsets --
-  &gt;</pre>
-
-<p>
-  Juicy! With just this, we can answer four of our five questions:
-</p>
-
-<ol>
-  <li>What is the element's name? <strong>form</strong></li>
-  <li>What content set does this element belong to? <strong>Block</strong>
-    (this needs a little sleuthing, I find the easiest way is to search
-    the DTD for <code>FORM</code> and determine which set it is in.)</li>
-  <li>What are the allowed children of this element? <strong>One
-    or more flow elements, but no nested <code>form</code>s</strong></li>
-  <li>What attributes does the element allow that are general? <strong>Common</strong></li>
-  <li>What attributes does the element allow that are specific to this element? <strong>A whole bunch, see ATTLIST;
-    we're going to the vital ones: <code>action</code>, <code>method</code> and <code>name</code></strong></li>
-</ol>
-
-<p>
-  Time for some code:
-</p>
-
-<pre>$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'DefinitionID', 'enduser-customize.html tutorial');
-$config->set('HTML', 'DefinitionRev', 1);
-$config->set('Cache', 'DefinitionImpl', null); // remove this later!
-$def = $config->getHTMLDefinition(true);
-$def->addAttribute('a', 'target', new HTMLPurifier_AttrDef_Enum(
-  array('_blank','_self','_target','_top')
-));
-<strong>$form = $def->addElement(
-  'form',   // name
-  'Block',  // content set
-  'Flow', // allowed children
-  'Common', // attribute collection
-  array( // attributes
-    'action*' => 'URI',
-    'method' => 'Enum#get|post',
-    'name' => 'ID'
-  )
-);
-$form->excludes = array('form' => true);</strong></pre>
-
-<p>
-  Each of the parameters corresponds to one of the questions we asked.
-  Notice that we added an asterisk to the end of the <code>action</code>
-  attribute to indicate that it is required. If someone specifies a
-  <code>form</code> without that attribute, the tag will be axed.
-  Also, the extra line at the end is a special extra declaration that
-  prevents forms from being nested within each other.
-</p>
-
-<p>
-  And that's all there is to it! Implementing the rest of the form
-  module is left as an exercise to the user; to see more examples
-  check the <a href="http://repo.or.cz/w/htmlpurifier.git?a=tree;hb=HEAD;f=library/HTMLPurifier/HTMLModule"><code>library/HTMLPurifier/HTMLModule/</code></a> directory
-  in your local HTML Purifier installation.
-</p>
-
-<h2>And beyond...</h2>
-
-<p>
-  Perceptive users may have realized that, to a certain extent, we
-  have simply re-implemented the facilities of XML Schema or the
-  Document Type Definition.  What you are seeing here, however, is
-  not just an XML Schema or Document Type Definition: it is a fully
-  expressive method of specifying the definition of HTML that is
-  a portable superset of the capabilities of the two above-mentioned schema
-  languages.  What makes HTMLDefinition so powerful is the fact that
-  if we don't have an implementation for a content model or an attribute
-  definition, you can supply it yourself by writing a PHP class.
-</p>
-
-<p>
-  There are many facets of HTMLDefinition beyond the Advanced API I have
-  walked you through today.  To find out more about these, you can
-  check out these source files:
-</p>
-
-<ul>
-  <li><a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/HTMLModule.php"><code>library/HTMLPurifier/HTMLModule.php</code></a></li>
-  <li><a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/ElementDef.php"><code>library/HTMLPurifier/ElementDef.php</code></a></li>
-</ul>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 147
main/inc/lib/htmlpurifier/docs/enduser-id.html

@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Explains various methods for allowing IDs in documents safely in HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>IDs - HTML Purifier</title>
-
-</head><body>
-
-<h1 class="subtitled">IDs</h1>
-<div class="subtitle">What they are, why you should(n't) wear them, and how to deal with it</div>
-
-<div id="filing">Filed under End-User</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>Prior to HTML Purifier 1.2.0, this library blithely accepted user input that
-looked like this:</p>
-
-<pre>&lt;a id=&quot;fragment&quot;&gt;Anchor&lt;/a&gt;</pre>
-
-<p>...presenting an attractive vector for those that would destroy standards
-compliance: simply set the ID to one that is already used elsewhere in the
-document and voila: validation breaks.  There was a half-hearted attempt to
-prevent this by allowing users to blacklist IDs, but I suspect that no one
-really bothered, and thus, with the release of 1.2.0, IDs are now <em>removed</em>
-by default.</p>
-
-<p>IDs, however, are quite useful functionality to have, so if users start
-complaining about broken anchors you'll probably want to turn them back on
-with %HTML.EnableAttrID. But before you go mucking around with the config
-object, it's probably worth to take some precautions to keep your page
-validating. Why?</p>
-
-<ol>
-   <li>Standards-compliant pages are good</li>
-   <li>Duplicated IDs interfere with anchors.  If there are two id="foobar"s in a
-   document, which spot does a browser presented with the fragment #foobar go
-   to? Most browsers opt for the first appearing ID, making it impossible
-   to references the second section. Similarly, duplicated IDs can hijack
-   client-side scripting that relies on the IDs of elements.</li>
-</ol>
-
-<p>You have (currently) four ways of dealing with the problem.</p>
-
-
-
-<h2 class="subtitled">Blacklisting IDs</h2>
-<div class="subsubtitle">Good for pages with single content source and stable templates</div>
-
-<p>Keeping in terms with the
-<acronym title="Keep It Simple, Stupid">KISS</acronym> principle, let us
-deal with the most obvious solution: preventing users from using any IDs that
-appear elsewhere on the document.  The method is simple:</p>
-
-<pre>$config->set('HTML', 'EnableAttrID', true);
-$config->set('Attr', 'IDBlacklist' array(
-    'list', 'of', 'attribute', 'values', 'that', 'are', 'forbidden'
-));</pre>
-
-<p>That being said, there are some notable drawbacks.  First of all, you have to
-know precisely which IDs are being used by the HTML surrounding the user code.
-This is easier said than done: quite often the page designer and the system
-coder work separately, so the designer has to constantly be talking with the
-coder whenever he decides to add a new anchor.  Miss one and you open yourself
-to possible standards-compliance issues.</p>
-
-<p>Furthermore, this position becomes untenable when a single web page must hold
-multiple portions of user-submitted content.  Since there's obviously no way
-to find out before-hand what IDs users will use, the blacklist is helpless.
-And since HTML Purifier validates each segment separately, perhaps doing
-so at different times, it would be extremely difficult to dynamically update
-the blacklist in between runs.</p>
-
-<p>Finally, simply destroying the ID is extremely un-userfriendly behavior: after
-all, they might have simply specified a duplicate ID by accident.</p>
-
-<p>Thus, we get to our second method.</p>
-
-
-
-<h2 class="subtitled">Namespacing IDs</h2>
-<div class="subsubtitle">Lazy developer's way, but needs user education</div>
-
-<p>This method, too, is quite simple: add a prefix to all user IDs. With this
-code:</p>
-
-<pre>$config->set('HTML', 'EnableAttrID', true);
-$config->set('Attr', 'IDPrefix', 'user_');</pre>
-
-<p>...this:</p>
-
-<pre>&lt;a id=&quot;foobar&quot;&gt;Anchor!&lt;/a&gt;</pre>
-
-<p>...turns into:</p>
-
-<pre>&lt;a id=&quot;user_foobar&quot;&gt;Anchor!&lt;/a&gt;</pre>
-
-<p>As long as you don't have any IDs that start with user_, collisions are
-guaranteed not to happen.  The drawback is obvious: if a user submits
-id=&quot;foobar&quot;, they probably expect to be able to reference their page with
-#foobar. You'll have to tell them, &quot;No, that doesn't work, you have to add
-user_ to the beginning.&quot;</p>
-
-<p>And yes, things get hairier.  Even with a nice prefix, we still have done
-nothing about multiple HTML Purifier outputs on one page.  Thus, we have
-a second configuration value to piggy-back off of: %Attr.IDPrefixLocal:</p>
-
-<pre>$config->set('Attr', 'IDPrefixLocal', 'comment' . $id . '_');</pre>
-
-<p>This new attributes does nothing but append on to regular IDPrefix, but is
-special in that it is volatile: it's value is determined at run-time and
-cannot possibly be cordoned into, say, a .ini config file.  As for what to
-put into the directive, is up to you, but I would recommend the ID number
-the text has been assigned in the database.  Whatever you pick, however, it
-has to be unique and stable for the text you are validating.  Note, however,
-that we require that %Attr.IDPrefix be set before you use this directive.</p>
-
-<p>And also remember: the user has to know what this prefix is too!</p>
-
-
-
-<h2>Abstinence</h2>
-
-<p>You may not want to bother. That's okay too, just don't enable IDs.</p>
-
-<p>Personally, I would take this road whenever user-submitted content would be
-possibly be shown together on one page.  Why a blog comment would need to use
-anchors is beyond me.</p>
-
-
-
-<h2>Denial</h2>
-
-<p>To revert back to pre-1.2.0 behavior, simply:</p>
-
-<pre>$config->set('HTML', 'EnableAttrID', true);</pre>
-
-<p>Don't come crying to me when your page mysteriously stops validating, though.</p>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 59
main/inc/lib/htmlpurifier/docs/enduser-overview.txt

@@ -1,59 +0,0 @@
-
-HTML Purifier
-  by Edward Z. Yang
-
-There are a number of ad hoc HTML filtering solutions out there on the web
-(some examples including HTML_Safe, kses and SafeHtmlChecker.class.php) that
-claim to filter HTML properly, preventing malicious JavaScript and layout
-breaking HTML from getting through the parser.  None of them, however,
-demonstrates a thorough knowledge of neither the DTD that defines the HTML
-nor the caveats of HTML that cannot be expressed by a DTD.  Configurable
-filters (such as kses or PHP's built-in striptags() function) have trouble
-validating the contents of attributes and can be subject to security attacks
-due to poor configuration.  Other filters take the naive approach of
-blacklisting known threats and tags, failing to account for the introduction
-of new technologies, new tags, new attributes or quirky browser behavior.
-
-However, HTML Purifier takes a different approach, one that doesn't use
-specification-ignorant regexes or narrow blacklists.  HTML Purifier will
-decompose the whole document into tokens, and rigorously process the tokens by:
-removing non-whitelisted elements, transforming bad practice tags like <font>
-into <span>, properly checking the nesting of tags and their children and
-validating all attributes according to their RFCs.
-
-To my knowledge, there is nothing like this on the web yet.  Not even MediaWiki,
-which allows an amazingly diverse mix of HTML and wikitext in its documents,
-gets all the nesting quirks right.  Existing solutions hope that no JavaScript
-will slip through, but either do not attempt to ensure that the resulting
-output is valid XHTML or send the HTML through a draconic XML parser (and yet
-still get the nesting wrong: SafeHtmlChecker.class.php does not prevent <a>
-tags from being nested within each other).
-
-This document no longer is a detailed description of how HTMLPurifier works,
-as those descriptions have been moved to the appropriate code.  The first
-draft was drawn up after two rough code sketches and the implementation of a
-forgiving lexer.  You may also be interested in the unit tests located in the
-tests/ folder, which provide a living document on how exactly the filter deals
-with malformed input.
-
-In summary (see corresponding classes for more details):
-
-1. Parse document into an array of tag and text tokens (Lexer)
-2. Remove all elements not on whitelist and transform certain other elements
-   into acceptable forms (i.e. <font>)
-3. Make document well formed while helpfully taking into account certain quirks,
-   such as the fact that <p> tags traditionally are closed by other block-level
-   elements.
-4. Run through all nodes and check children for proper order (especially
-   important for tables).
-5. Validate attributes according to more restrictive definitions based on the
-   RFCs.
-6. Translate back into a string. (Generator)
-
-HTML Purifier is best suited for documents that require a rich array of
-HTML tags.  Things like blog comments are, in all likelihood, most appropriately
-written in an extremely restrictive set of markup that doesn't require
-all this functionality (or not written in HTML at all), although this may
-be changing in the future with the addition of levels of filtering.
-
-    vim: et sw=4 sts=4

+ 0 - 18
main/inc/lib/htmlpurifier/docs/enduser-security.txt

@@ -1,18 +0,0 @@
-
-Security
-
-Like anything that claims to afford security, HTML_Purifier can be circumvented
-through negligence of people. This class will do its job: no more, no less,
-and it's up to you to provide it the proper information and proper context
-to be effective. Things to remember:
-
-1. Character Encoding: see enduser-utf8.html for more info.
-
-2. IDs: see enduser-id.html for more info
-
-3. URIs: see enduser-uri-filter.html
-
-4. CSS: document pending
-Explain which CSS styles we blocked and why.
-
-    vim: et sw=4 sts=4

+ 0 - 119
main/inc/lib/htmlpurifier/docs/enduser-slow.html

@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Explains how to speed up HTML Purifier through caching or inbound filtering." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Speeding up HTML Purifier - HTML Purifier</title>
-
-</head><body>
-
-<h1 class="subtitled">Speeding up HTML Purifier</h1>
-<div class="subtitle">...also known as the HELP ME LIBRARY IS TOO SLOW MY PAGE TAKE TOO LONG page</div>
-
-<div id="filing">Filed under End-User</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>HTML Purifier is a very powerful library. But with power comes great
-responsibility, in the form of longer execution times.  Remember, this
-library isn't lightly grazing over submitted HTML: it's deconstructing
-the whole thing, rigorously checking the parts, and then putting it back
-together. </p>
-
-<p>So, if it so turns out that HTML Purifier is kinda too slow for outbound
-filtering, you've got a few options: </p>
-
-<h2>Inbound filtering</h2>
-
-<p>Perform filtering of HTML when it's submitted by the user. Since the
-user is already submitting something, an extra half a second tacked on
-to the load time probably isn't going to be that huge of a problem.
-Then, displaying the content is a simple a manner of outputting it
-directly from your database/filesystem. The trouble with this method is
-that your user loses the original text, and when doing edits, will be
-handling the filtered text.  While this may be a good thing, especially
-if you're using a WYSIWYG editor, it can also result in data-loss if a
-user makes a typo. </p>
-
-<p>Example (non-functional):</p>
-
-<pre>&lt;?php
-    /**
-     * FORM SUBMISSION PAGE
-     * display_error($message) : displays nice error page with message
-     * display_success() : displays a nice success page
-     * display_form() : displays the HTML submission form
-     * database_insert($html) : inserts data into database as new row
-     */
-    if (!empty($_POST)) {
-        require_once '/path/to/library/HTMLPurifier.auto.php';
-        require_once 'HTMLPurifier.func.php';
-        $dirty_html = isset($_POST['html']) ? $_POST['html'] : false;
-        if (!$dirty_html) {
-            display_error('You must write some HTML!');
-        }
-        $html = HTMLPurifier($dirty_html);
-        database_insert($html);
-        display_success();
-        // notice that $dirty_html is *not* saved
-    } else {
-        display_form();
-    }
-?&gt;</pre>
-
-<h2>Caching the filtered output</h2>
-
-<p>Accept the submitted text and put it unaltered into the database, but
-then also generate a filtered version and stash that in the database.
-Serve the filtered version to readers, and the unaltered version to
-editors.  If need be, you can invalidate the cache and have the cached
-filtered version be regenerated on the first page view.  Pros? Full data
-retention. Cons? It's more complicated, and opens other editors up to
-XSS if they are using a WYSIWYG editor (to fix that, they'd have to be
-able to get their hands on the *really* original text served in
-plaintext mode). </p>
-
-<p>Example (non-functional):</p>
-
-<pre>&lt;?php
-    /**
-     * VIEW PAGE
-     * display_error($message) : displays nice error page with message
-     * cache_get($id) : retrieves HTML from fast cache (db or file)
-     * cache_insert($id, $html) : inserts good HTML into cache system
-     * database_get($id) : retrieves raw HTML from database
-     */
-    $id = isset($_GET['id']) ? (int) $_GET['id'] : false;
-    if (!$id) {
-        display_error('Must specify ID.');
-        exit;
-    }
-    $html = cache_get($id); // filesystem or database
-    if ($html === false) {
-        // cache didn't have the HTML, generate it
-        $raw_html = database_get($id);
-        require_once '/path/to/library/HTMLPurifier.auto.php';
-        require_once 'HTMLPurifier.func.php';
-        $html = HTMLPurifier($raw_html);
-        cache_insert($id, $html);
-    }
-    echo $html;
-?&gt;</pre>
-
-<h2>Summary</h2>
-
-<p>In short, inbound filtering is the simple option and caching is the
-robust option (albeit with bigger storage requirements). </p>
-
-<p>There is a third option, independent of the two we've discussed: profile
-and optimize HTMLPurifier yourself. Be sure to report back your results
-if you decide to do that! Especially if you port HTML Purifier to C++.
-<tt>;-)</tt></p>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 230
main/inc/lib/htmlpurifier/docs/enduser-tidy.html

@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Tutorial for tweaking HTML Purifier's Tidy-like behavior." />
-<link rel="stylesheet" type="text/css" href="style.css" />
-
-<title>Tidy - HTML Purifier</title>
-
-</head><body>
-
-<h1>Tidy</h1>
-
-<div id="filing">Filed under Development</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>You've probably heard of HTML Tidy, Dave Raggett's little piece
-of software that cleans up poorly written HTML.  Let me say it straight
-out:</p>
-
-<p class="emphasis">This ain't HTML Tidy!</p>
-
-<p>Rather, Tidy stands for a cool set of Tidy-inspired features in HTML Purifier
-that allows users to submit deprecated elements and attributes and get
-valid strict markup back. For example:</p>
-
-<pre>&lt;center&gt;Centered&lt;/center&gt;</pre>
-
-<p>...becomes:</p>
-
-<pre>&lt;div style=&quot;text-align:center;&quot;&gt;Centered&lt;/div&gt;</pre>
-
-<p>...when this particular fix is run on the HTML. This tutorial will give
-you the lowdown of what exactly HTML Purifier will do when Tidy
-is on, and how to fine-tune this behavior. Once again, <strong>you do
-not need Tidy installed on your PHP to use these features!</strong></p>
-
-<h2>What does it do?</h2>
-
-<p>Tidy will do several things to your HTML:</p>
-
-<ul>
-    <li>Convert deprecated elements and attributes to standards-compliant
-        alternatives</li>
-    <li>Enforce XHTML compatibility guidelines and other best practices</li>
-    <li>Preserve data that would normally be removed as per W3C</li>
-</ul>
-
-<h2>What are levels?</h2>
-
-<p>Levels describe how aggressive the Tidy module should be when
-cleaning up HTML. There are four levels to pick: none, light, medium
-and heavy. Each of these levels has a well-defined set of behavior
-associated with it, although it may change depending on your doctype.</p>
-
-<dl>
-    <dt>light</dt>
-    <dd>This is the <strong>lenient</strong> level. If a tag or attribute
-        is about to be removed because it isn't supported by the
-        doctype, Tidy will step in and change into an alternative that
-        is supported.</dd>
-    <dt>medium</dt>
-    <dd>This is the <strong>correctional</strong> level. At this level,
-        all the functions of light are performed, as well as some extra,
-        non-essential best practices enforcement. Changes made on this
-        level are very benign and are unlikely to cause problems.</dd>
-    <dt>heavy</dt>
-    <dd>This is the <strong>aggressive</strong> level. If a tag or
-        attribute is deprecated, it will be converted into a non-deprecated
-        version, no ifs ands or buts.</dd>
-</dl>
-
-<p>By default, Tidy operates on the <strong>medium</strong> level. You can
-change the level of cleaning by setting the %HTML.TidyLevel configuration
-directive:</p>
-
-<pre>$config->set('HTML', 'TidyLevel', 'heavy'); // burn baby burn!</pre>
-
-<h2>Is the light level really light?</h2>
-
-<p>It depends on what doctype you're using. If your documents are HTML
-4.01 <em>Transitional</em>, HTML Purifier will be lazy
-and won't clean up your <code>center</code>
-or <code>font</code> tags. But if you're using HTML 4.01 <em>Strict</em>,
-HTML Purifier has no choice: it has to convert them, or they will
-be nuked out of existence. So while light on Transitional will result
-in little to no changes, light on Strict will still result in quite
-a lot of fixes.</p>
-
-<p>This is different behavior from 1.6 or before, where deprecated
-tags in transitional documents would
-always be cleaned up regardless. This is also better behavior.</p>
-
-<h2>My pages look different!</h2>
-
-<p>HTML Purifier is tasked with converting deprecated tags and
-attributes to standards-compliant alternatives, which usually
-need copious amounts of CSS. It's also not foolproof: sometimes
-things do get lost in the translation. This is why when HTML Purifier
-can get away with not doing cleaning, it won't; this is why
-the default value is <strong>medium</strong> and not heavy.</p>
-
-<p>Fortunately, only a few attributes have problems with the switch
-over. They are described below:</p>
-
-<table class="table">
-    <thead><tr>
-        <th>Element@Attr</th>
-        <th>Changes</th>
-    </tr></thead>
-    <tbody>
-        <tr>
-            <td>caption@align</td>
-            <td>Firefox supports stuffing the caption on the
-                left and right side of the table, a feature that
-                Internet Explorer, understandably, does not have.
-                When align equals right or left, the text will simply
-                be aligned on the left or right side.</td>
-        </tr>
-        <tr>
-            <td>img@align</td>
-            <td>The implementation for align bottom is good, but not
-            perfect. There are a few pixel differences.</td>
-        </tr>
-        <tr>
-            <td>br@clear</td>
-            <td>Clear both gets a little wonky in Internet Explorer. Haven't
-                really been able to figure out why.</td>
-        </tr>
-        <tr>
-            <td>hr@noshade</td>
-            <td>All browsers implement this slightly differently: we've
-                chosen to make noshade horizontal rules gray.</td>
-        </tr>
-    </tbody>
-</table>
-
-<p>There are a few more minor, although irritating, bugs.
-Some older browsers support deprecated attributes,
-but not CSS. Transformed elements and attributes will look unstyled
-to said browsers. Also, CSS precedence is slightly different for
-inline styles versus presentational markup. In increasing precedence:</p>
-
-<ol>
-    <li>Presentational attributes</li>
-    <li>External style sheets</li>
-    <li>Inline styling</li>
-</ol>
-
-<p>This means that styling that may have been masked by external CSS
-declarations will start showing up (a good thing, perhaps). Finally,
-if you've turned off the style attribute, almost all of
-these transformations will not work. Sorry mates.</p>
-
-<p>You can review the rendering before and after of these transformations
-by consulting the <a
-href="http://htmlpurifier.org/live/smoketests/attrTransform.php">attrTransform.php
-smoketest</a>.</p>
-
-<h2>I like the general idea, but the specifics bug me!</h2>
-
-<p>So you want HTML Purifier to clean up your HTML, but you're not
-so happy about the br@clear implementation. That's perfectly fine!
-HTML Purifier will make accomodations:</p>
-
-<pre>$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional');
-$config->set('HTML', 'TidyLevel', 'heavy'); // all changes, minus...
-<strong>$config->set('HTML', 'TidyRemove', 'br@clear');</strong></pre>
-
-<p>That third line does the magic, removing the br@clear fix
-from the module, ensuring that <code>&lt;br clear="both" /&gt;</code>
-will pass through unharmed. The reverse is possible too:</p>
-
-<pre>$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional');
-$config->set('HTML', 'TidyLevel', 'none'); // no changes, plus...
-<strong>$config->set('HTML', 'TidyAdd', 'p@align');</strong></pre>
-
-<p>In this case, all transformations are shut off, except for the p@align
-one, which you found handy.</p>
-
-<p>To find out what the names of fixes you want to turn on or off are,
-you'll have to consult the source code, specifically the files in
-<code>HTMLPurifier/HTMLModule/Tidy/</code>. There is, however, a
-general syntax:</p>
-
-<table class="table">
-    <thead>
-        <tr>
-            <th>Name</th>
-            <th>Example</th>
-            <th>Interpretation</th>
-        </tr>
-    </thead>
-    <tbody>
-        <tr>
-            <td>element</td>
-            <td>font</td>
-            <td>Tag transform for <em>element</em></td>
-        </tr>
-        <tr>
-            <td>element@attr</td>
-            <td>br@clear</td>
-            <td>Attribute transform for <em>attr</em> on <em>element</em></td>
-        </tr>
-        <tr>
-            <td>@attr</td>
-            <td>@lang</td>
-            <td>Global attribute transform for <em>attr</em></td>
-        </tr>
-        <tr>
-            <td>e#content_model_type</td>
-            <td>blockquote#content_model_type</td>
-            <td>Change of child processing implementation for <em>e</em></td>
-        </tr>
-    </tbody>
-</table>
-
-<h2>So... what's the lowdown?</h2>
-
-<p>The lowdown is, quite frankly, HTML Purifier's default settings are
-probably good enough. The next step is to bump the level up to heavy,
-and if that still doesn't satisfy your appetite, do some fine-tuning.
-Other than that, don't worry about it: this all works silently and
-effectively in the background.</p>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 216
main/inc/lib/htmlpurifier/docs/enduser-uri-filter.html

@@ -1,216 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Tutorial for creating custom URI filters." />
-<link rel="stylesheet" type="text/css" href="style.css" />
-
-<title>URI Filters - HTML Purifier</title>
-
-</head><body>
-
-<h1>URI Filters</h1>
-
-<div id="filing">Filed under End-User</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>
-  This is a quick and dirty document to get you on your way to writing
-  custom URI filters for your own URL filtering needs.  Why would you
-  want to write a URI filter?  If you need URIs your users put into
-  HTML to magically change into a different URI, this is
-  exactly what you need!
-</p>
-
-<h2>Creating the class</h2>
-
-<p>
-  Any URI filter you make will be a subclass of <code>HTMLPurifier_URIFilter</code>.
-  The scaffolding is thus:
-</p>
-
-<pre>class HTMLPurifier_URIFilter_<strong>NameOfFilter</strong> extends HTMLPurifier_URIFilter
-{
-    public $name = '<strong>NameOfFilter</strong>';
-    public function prepare($config) {}
-    public function filter(&$uri, $config, $context) {}
-}</pre>
-
-<p>
-  Fill in the variable <code>$name</code> with the name of your filter, and
-  take a look at the two methods. <code>prepare()</code> is an initialization
-  method that is called only once, before any filtering has been done of the
-  HTML. Use it to perform any costly setup work that only needs to be done
-  once. <code>filter()</code> is the guts and innards of our filter:
-  it takes the URI and does whatever needs to be done to it.
-</p>
-
-<p>
-  If you've worked with HTML Purifier, you'll recognize the <code>$config</code>
-  and <code>$context</code> parameters.  On the other hand, <code>$uri</code>
-  is something unique to this section of the application: it's a
-  <code>HTMLPurifier_URI</code> object. The interface is thus:
-</p>
-
-<pre>class HTMLPurifier_URI
-{
-    public $scheme, $userinfo, $host, $port, $path, $query, $fragment;
-    public function HTMLPurifier_URI($scheme, $userinfo, $host, $port, $path, $query, $fragment);
-    public function toString();
-    public function copy();
-    public function getSchemeObj($config, $context);
-    public function validate($config, $context);
-}</pre>
-
-<p>
-  The first three methods are fairly self-explanatory: you have a constructor,
-  a serializer, and a cloner.  Generally, you won't be using them when
-  you are manipulating the URI objects themselves.
-  <code>getSchemeObj()</code> is a special purpose method that returns
-  a <code>HTMLPurifier_URIScheme</code> object corresponding to the specific
-  URI at hand. <code>validate()</code> performs general-purpose validation
-  on the internal components of a URI. Once again, you don't need to
-  worry about these: they've already been handled for you.
-</p>
-
-<h2>URI format</h2>
-
-<p>
-  As a URIFilter, we're interested in the member variables of the URI object.
-</p>
-
-<table class="quick"><tbody>
-  <tr><th>Scheme</th>   <td>The protocol for identifying (and possibly locating) a resource (http, ftp, https)</td></tr>
-  <tr><th>Userinfo</th> <td>User information such as a username (bob)</td></tr>
-  <tr><th>Host</th>     <td>Domain name or IP address of the server (example.com, 127.0.0.1)</td></tr>
-  <tr><th>Port</th>     <td>Network port number for the server (80, 12345)</td></tr>
-  <tr><th>Path</th>     <td>Data that identifies the resource, possibly hierarchical (/path/to, ed@example.com)</td></tr>
-  <tr><th>Query</th>    <td>String of information to be interpreted by the resource (?q=search-term)</td></tr>
-  <tr><th>Fragment</th> <td>Additional information for the resource after retrieval (#bookmark)</td></tr>
-</tbody></table>
-
-<p>
-  Because the URI is presented to us in this form, and not
-  <code>http://bob@example.com:8080/foo.php?q=string#hash</code>, it saves us
-  a lot of trouble in having to parse the URI every time we want to filter
-  it. For the record, the above URI has the following components:
-</p>
-
-<table class="quick"><tbody>
-  <tr><th>Scheme</th>   <td>http</td></tr>
-  <tr><th>Userinfo</th> <td>bob</td></tr>
-  <tr><th>Host</th>     <td>example.com</td></tr>
-  <tr><th>Port</th>     <td>8080</td></tr>
-  <tr><th>Path</th>     <td>/foo.php</td></tr>
-  <tr><th>Query</th>    <td>q=string</td></tr>
-  <tr><th>Fragment</th> <td>hash</td></tr>
-</tbody></table>
-
-<p>
-  Note that there is no question mark or octothorpe in the query or
-  fragment: these get removed during parsing.
-</p>
-
-<p>
-  With this information, you can get straight to implementing your
-  <code>filter()</code> method. But one more thing...
-</p>
-
-<h2>Return value: Boolean, not URI</h2>
-
-<p>
-  You may have noticed that the URI is being passed in by reference.
-  This means that whatever changes you make to it, those changes will
-  be reflected in the URI object the callee had.  <strong>Do not
-  return the URI object: it is unnecessary and will cause bugs.</strong>
-  Instead, return a boolean value, true if the filtering was successful,
-  or false if the URI is beyond repair and needs to be axed.
-</p>
-
-<p>
-  Let's suppose I wanted to write a filter that converted links with a
-  custom <code>image</code> scheme to its corresponding real path on
-  our website:
-</p>
-
-<pre>class HTMLPurifier_URIFilter_TransformImageScheme extends HTMLPurifier_URIFilter
-{
-    public $name = 'TransformImageScheme';
-    public function filter(&$uri, $config, $context) {
-        if ($uri->scheme !== 'image') return true;
-        $img_name = $uri->path;
-        // Overwrite the previous URI object
-        $uri = new HTMLPurifier_URI('http', null, null, null, '/img/' . $img_name . '.png', null, null);
-        return true;
-    }
-}</pre>
-
-<p>
-  Notice I did not <code>return $uri;</code>. This filter would turn
-  <code>image:Foo</code> into <code>/img/Foo.png</code>.
-</p>
-
-<h2>Activating your filter</h2>
-
-<p>
-  Having a filter is all well and good, but you need to tell HTML Purifier
-  to use it. Fortunately, this part's simple:
-</p>
-
-<pre>$uri = $config->getDefinition('URI');
-$uri->addFilter(new HTMLPurifier_URIFilter_<strong>NameOfFilter</strong>());</pre>
-
-<p>
-  If you want to be really fancy, you can define a configuration directive
-  for your filter and have HTML Purifier automatically manage whether or
-  not your filter gets loaded or not (this is how internal filters manage
-  things):
-</p>
-
-<pre>HTMLPurifier_ConfigSchema::define(
-    'URI', '<strong>NameOfFilter</strong>', false, 'bool',
-    '<strong>What your filter does.</strong>'
-);
-$uri = $config->getDefinition('URI', true);
-$uri->registerFilter(new HTMLPurifier_URIFilter_<strong>NameOfFilter</strong>());
-</pre>
-
-<p>
-  Now, your filter will only be called when %URI.<strong>NameOfFilter</strong>
-  is set to true.
-</p>
-
-<h2>Post-filter</h2>
-
-<p>
-    Remember our TransformImageScheme filter? That filter acted before we had
-    performed scheme validation; otherwise, the URI would have been filtered
-    out when it was discovered that there was no image scheme. Well, a post-filter
-    is run after scheme specific validation, so it's ideal for bulk
-    post-processing of URIs, including munging. To specify a URI as a post-filter,
-    set the <code>$post</code> member variable to TRUE.
-</p>
-
-<pre>class HTMLPurifier_URIFilter_MyPostFilter extends HTMLPurifier_URIFilter
-{
-    public $name = 'MyPostFilter';
-    public $post = true;
-    // ... extra code here
-}
-</pre>
-
-<h2>Examples</h2>
-
-<p>
-  Check the
-  <a href="http://repo.or.cz/w/htmlpurifier.git?a=tree;hb=HEAD;f=library/HTMLPurifier/URIFilter">URIFilter</a>
-  directory for more implementation examples, and see <a href="proposal-new-directives.txt">the
-  new directives proposal document</a> for ideas on what could be implemented
-  as a filter.
-</p>
-
-</body></html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 1059
main/inc/lib/htmlpurifier/docs/enduser-utf8.html

@@ -1,1059 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Describes the rationale for using UTF-8, the ramifications otherwise, and how to make the switch." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-<style type="text/css">
-    .minor td {font-style:italic;}
-</style>
-
-<title>UTF-8: The Secret of Character Encoding - HTML Purifier</title>
-
-<!-- Note to users: this document, though professing to be UTF-8, attempts
-to use only ASCII characters, because most webservers are configured
-to send HTML as ISO-8859-1. So I will, many times, go against my
-own advice for sake of portability.  -->
-
-</head><body>
-
-<h1>UTF-8: The Secret of Character Encoding</h1>
-
-<div id="filing">Filed under End-User</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>Character encoding and character sets are not that
-difficult to understand, but so many people blithely stumble
-through the worlds of programming without knowing what to actually
-do about it, or say &quot;Ah, it's a job for those <em>internationalization</em>
-experts.&quot; No, it is not! This document will walk you through
-determining the encoding of your system and how you should handle
-this information. It will stay away from excessive discussion on
-the internals of character encoding.</p>
-
-<p>This document is not designed to be read in its entirety: it will
-slowly introduce concepts that build on each other: you need not get to
-the bottom to have learned something new. However, I strongly
-recommend you read all the way to <strong>Why UTF-8?</strong>, because at least
-at that point you'd have made a conscious decision not to migrate,
-which can be a rewarding (but difficult) task.</p>
-
-<blockquote class="aside">
-<div class="label">Asides</div>
-    <p>Text in this formatting is an <strong>aside</strong>,
-    interesting tidbits for the curious but not strictly necessary material to
-    do the tutorial. If you read this text, you'll come out
-    with a greater understanding of the underlying issues.</p>
-</blockquote>
-
-<h2>Table of Contents</h2>
-
-<ol id="toc">
-    <li><a href="#findcharset">Finding the real encoding</a></li>
-    <li><a href="#findmetacharset">Finding the embedded encoding</a></li>
-    <li><a href="#fixcharset">Fixing the encoding</a><ol>
-        <li><a href="#fixcharset-none">No embedded encoding</a></li>
-        <li><a href="#fixcharset-diff">Embedded encoding disagrees</a></li>
-        <li><a href="#fixcharset-server">Changing the server encoding</a><ol>
-            <li><a href="#fixcharset-server-php">PHP header() function</a></li>
-            <li><a href="#fixcharset-server-phpini">PHP ini directive</a></li>
-            <li><a href="#fixcharset-server-nophp">Non-PHP</a></li>
-            <li><a href="#fixcharset-server-htaccess">.htaccess</a></li>
-            <li><a href="#fixcharset-server-ext">File extensions</a></li>
-        </ol></li>
-        <li><a href="#fixcharset-xml">XML</a></li>
-        <li><a href="#fixcharset-internals">Inside the process</a></li>
-    </ol></li>
-    <li><a href="#whyutf8">Why UTF-8?</a><ol>
-        <li><a href="#whyutf8-i18n">Internationalization</a></li>
-        <li><a href="#whyutf8-user">User-friendly</a></li>
-        <li><a href="#whyutf8-forms">Forms</a><ol>
-            <li><a href="#whyutf8-forms-urlencoded">application/x-www-form-urlencoded</a></li>
-            <li><a href="#whyutf8-forms-multipart">multipart/form-data</a></li>
-        </ol></li>
-        <li><a href="#whyutf8-support">Well supported</a></li>
-        <li><a href="#whyutf8-htmlpurifier">HTML Purifiers</a></li>
-    </ol></li>
-    <li><a href="#migrate">Migrate to UTF-8</a><ol>
-        <li><a href="#migrate-db">Configuring your database</a><ol>
-            <li><a href="#migrate-db-legit">Legit method</a></li>
-            <li><a href="#migrate-db-binary">Binary</a></li>
-        </ol></li>
-        <li><a href="#migrate-editor">Text editor</a></li>
-        <li><a href="#migrate-bom">Byte Order Mark (headers already sent!)</a></li>
-        <li><a href="#migrate-fonts">Fonts</a><ol>
-            <li><a href="#migrate-fonts-obscure">Obscure scripts</a></li>
-            <li><a href="#migrate-fonts-occasional">Occasional use</a></li>
-        </ol></li>
-        <li><a href="#migrate-variablewidth">Dealing with variable width in functions</a></li>
-    </ol></li>
-    <li><a href="#externallinks">Further Reading</a></li>
-</ol>
-
-<h2 id="findcharset">Finding the real encoding</h2>
-
-<p>In the beginning, there was ASCII, and things were simple. But they
-weren't good, for no one could write in Cyrillic or Thai. So there
-exploded a proliferation of character encodings to remedy the problem
-by extending the characters ASCII could express. This ridiculously
-simplified version of the history of character encodings shows us that
-there are now many character encodings floating around.</p>
-
-<blockquote class="aside">
-    <p>A <strong>character encoding</strong> tells the computer how to
-    interpret raw zeroes and ones into real characters. It
-    usually does this by pairing numbers with characters.</p>
-    <p>There are many different types of character encodings floating
-    around, but the ones we deal most frequently with are ASCII,
-    8-bit encodings, and Unicode-based encodings.</p>
-    <ul>
-        <li><strong>ASCII</strong> is a 7-bit encoding based on the
-            English alphabet.</li>
-        <li><strong>8-bit encodings</strong> are extensions to ASCII
-            that add a potpourri of useful, non-standard characters
-            like &eacute; and &aelig;. They can only add 127 characters,
-            so usually only support one script at a time. When you
-            see a page on the web, chances are it's encoded in one
-            of these encodings.</li>
-        <li><strong>Unicode-based encodings</strong> implement the
-            Unicode standard and include UTF-8, UTF-16 and UTF-32/UCS-4.
-            They go beyond 8-bits and support almost
-            every language in the world. UTF-8 is gaining traction
-            as the dominant international encoding of the web.</li>
-    </ul>
-</blockquote>
-
-<p>The first step of our journey is to find out what the encoding of
-your website is. The most reliable way is to ask your
-browser:</p>
-
-<dl>
-    <dt>Mozilla Firefox</dt>
-    <dd>Tools &gt; Page Info: Encoding</dd>
-    <dt>Internet Explorer</dt>
-    <dd>View &gt; Encoding: bulleted item is unofficial name</dd>
-</dl>
-
-<p>Internet Explorer won't give you the MIME (i.e. useful/real) name of the
-character encoding, so you'll have to look it up using their description.
-Some common ones:</p>
-
-<table class="table">
-    <thead><tr>
-        <th>IE's Description</th>
-        <th>Mime Name</th>
-    </tr></thead>
-    <tbody>
-        <tr><th colspan="2">Windows</th></tr>
-        <tr><td>Arabic (Windows)</td><td>Windows-1256</td></tr>
-        <tr><td>Baltic (Windows)</td><td>Windows-1257</td></tr>
-        <tr><td>Central European (Windows)</td><td>Windows-1250</td></tr>
-        <tr><td>Cyrillic (Windows)</td><td>Windows-1251</td></tr>
-        <tr><td>Greek (Windows)</td><td>Windows-1253</td></tr>
-        <tr><td>Hebrew (Windows)</td><td>Windows-1255</td></tr>
-        <tr><td>Thai (Windows)</td><td>TIS-620</td></tr>
-        <tr><td>Turkish (Windows)</td><td>Windows-1254</td></tr>
-        <tr><td>Vietnamese (Windows)</td><td>Windows-1258</td></tr>
-        <tr><td>Western European (Windows)</td><td>Windows-1252</td></tr>
-    </tbody>
-    <tbody>
-        <tr><th colspan="2">ISO</th></tr>
-        <tr><td>Arabic (ISO)</td><td>ISO-8859-6</td></tr>
-        <tr><td>Baltic (ISO)</td><td>ISO-8859-4</td></tr>
-        <tr><td>Central European (ISO)</td><td>ISO-8859-2</td></tr>
-        <tr><td>Cyrillic (ISO)</td><td>ISO-8859-5</td></tr>
-        <tr class="minor"><td>Estonian (ISO)</td><td>ISO-8859-13</td></tr>
-        <tr class="minor"><td>Greek (ISO)</td><td>ISO-8859-7</td></tr>
-        <tr><td>Hebrew (ISO-Logical)</td><td>ISO-8859-8-l</td></tr>
-        <tr><td>Hebrew (ISO-Visual)</td><td>ISO-8859-8</td></tr>
-        <tr class="minor"><td>Latin 9 (ISO)</td><td>ISO-8859-15</td></tr>
-        <tr class="minor"><td>Turkish (ISO)</td><td>ISO-8859-9</td></tr>
-        <tr><td>Western European (ISO)</td><td>ISO-8859-1</td></tr>
-    </tbody>
-    <tbody>
-        <tr><th colspan="2">Other</th></tr>
-        <tr><td>Chinese Simplified (GB18030)</td><td>GB18030</td></tr>
-        <tr><td>Chinese Simplified (GB2312)</td><td>GB2312</td></tr>
-        <tr><td>Chinese Simplified (HZ)</td><td>HZ</td></tr>
-        <tr><td>Chinese Traditional (Big5)</td><td>Big5</td></tr>
-        <tr><td>Japanese (Shift-JIS)</td><td>Shift_JIS</td></tr>
-        <tr><td>Japanese (EUC)</td><td>EUC-JP</td></tr>
-        <tr><td>Korean</td><td>EUC-KR</td></tr>
-        <tr><td>Unicode (UTF-8)</td><td>UTF-8</td></tr>
-    </tbody>
-</table>
-
-<p>Internet Explorer does not recognize some of the more obscure
-character encodings, and having to lookup the real names with a table
-is a pain, so I recommend using Mozilla Firefox to find out your
-character encoding.</p>
-
-<h2 id="findmetacharset">Finding the embedded encoding</h2>
-
-<p>At this point, you may be asking, &quot;Didn't we already find out our
-encoding?&quot; Well, as it turns out, there are multiple places where
-a web developer can specify a character encoding, and one such place
-is in a <code>META</code> tag:</p>
-
-<pre>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;</pre>
-
-<p>You'll find this in the <code>HEAD</code> section of an HTML document.
-The text to the right of <code>charset=</code> is the &quot;claimed&quot;
-encoding: the HTML claims to be this encoding, but whether or not this
-is actually the case depends on other factors. For now, take note
-if your <code>META</code> tag claims that either:</p>
-
-<ol>
-    <li>The character encoding is the same as the one reported by the
-        browser,</li>
-    <li>The character encoding is different from the browser's, or</li>
-    <li>There is no <code>META</code> tag at all! (horror, horror!)</li>
-</ol>
-
-<h2 id="fixcharset">Fixing the encoding</h2>
-
-<p class="aside">The advice given here is for pages being served as
-vanilla <code>text/html</code>.  Different practices must be used
-for <code>application/xml</code> or <code>application/xml+xhtml</code>, see
-<a href="http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020430/">W3C's
-document on XHTML media types</a> for more information.</p>
-
-<p>If your <code>META</code> encoding and your real encoding match,
-savvy! You can skip this section. If they don't...</p>
-
-<h3 id="fixcharset-none">No embedded encoding</h3>
-
-<p>If this is the case, you'll want to add in the appropriate
-<code>META</code> tag to your website. It's as simple as copy-pasting
-the code snippet above and replacing UTF-8 with whatever is the mime name
-of your real encoding.</p>
-
-<blockquote class="aside">
-    <p>For all those skeptics out there, there is a very good reason
-    why the character encoding should be explicitly stated. When the
-    browser isn't told what the character encoding of a text is, it
-    has to guess: and sometimes the guess is wrong. Hackers can manipulate
-    this guess in order to slip XSS past filters and then fool the
-    browser into executing it as active code. A great example of this
-    is the <a href="http://shiflett.org/archive/177">Google UTF-7
-    exploit</a>.</p>
-    <p>You might be able to get away with not specifying a character
-    encoding with the <code>META</code> tag as long as your webserver
-    sends the right Content-Type header, but why risk it? Besides, if
-    the user downloads the HTML file, there is no longer any webserver
-    to define the character encoding.</p>
-</blockquote>
-
-<h3 id="fixcharset-diff">Embedded encoding disagrees</h3>
-
-<p>This is an extremely common mistake: another source is telling
-the browser what the
-character encoding is and is overriding the embedded encoding. This
-source usually is the Content-Type HTTP header that the webserver (i.e.
-Apache) sends. A usual Content-Type header sent with a page might
-look like this:</p>
-
-<pre>Content-Type: text/html; charset=ISO-8859-1</pre>
-
-<p>Notice how there is a charset parameter: this is the webserver's
-way of telling a browser what the character encoding is, much like
-the <code>META</code> tags we touched upon previously.</p>
-
-<blockquote class="aside"><p>In fact, the <code>META</code> tag is
-designed as a substitute for the HTTP header for contexts where
-sending headers is impossible (such as locally stored files without
-a webserver). Thus the name <code>http-equiv</code> (HTTP equivalent).
-</p></blockquote>
-
-<p>There are two ways to go about fixing this: changing the <code>META</code>
-tag to match the HTTP header, or changing the HTTP header to match
-the <code>META</code> tag. How do we know which to do? It depends
-on the website's content: after all, headers and tags are only ways of
-describing the actual characters on the web page.</p>
-
-<p>If your website:</p>
-
-<dl>
-    <dt>...only uses ASCII characters,</dt>
-    <dd>Either way is fine, but I recommend switching both to
-        UTF-8 (more on this later).</dd>
-    <dt>...uses special characters, and they display
-        properly,</dt>
-    <dd>Change the embedded encoding to the server encoding.</dd>
-    <dt>...uses special characters, but users often complain that
-        they come out garbled,</dt>
-    <dd>Change the server encoding to the embedded encoding.</dd>
-</dl>
-
-<p>Changing a META tag is easy: just swap out the old encoding
-for the new. Changing the server (HTTP header) encoding, however,
-is slightly more difficult.</p>
-
-<h3 id="fixcharset-server">Changing the server encoding</h3>
-
-<h4 id="fixcharset-server-php">PHP header() function</h4>
-
-<p>The simplest way to handle this problem is to send the encoding
-yourself, via your programming language. Since you're using HTML
-Purifier, I'll assume PHP, although it's not too difficult to do
-similar things in
-<a href="http://www.w3.org/International/O-HTTP-charset#scripting">other
-languages</a>. The appropriate code is:</p>
-
-<pre><a href="http://php.net/function.header">header</a>('Content-Type:text/html; charset=UTF-8');</pre>
-
-<p>...replacing UTF-8 with whatever your embedded encoding is.
-This code must come before any output, so be careful about
-stray whitespace in your application (i.e., any whitespace before
-output excluding whitespace within &lt;?php ?&gt; tags).</p>
-
-<h4 id="fixcharset-server-phpini">PHP ini directive</h4>
-
-<p>PHP also has a neat little ini directive that can save you a
-header call: <code><a href="http://php.net/ini.core#ini.default-charset">default_charset</a></code>. Using this code:</p>
-
-<pre><a href="http://php.net/function.ini_set">ini_set</a>('default_charset', 'UTF-8');</pre>
-
-<p>...will also do the trick. If PHP is running as an Apache module (and
-not as FastCGI, consult
-<a href="http://php.net/phpinfo">phpinfo</a>() for details), you can even use htaccess to apply this property
-across many PHP files:</p>
-
-<pre><a href="http://php.net/configuration.changes#configuration.changes.apache">php_value</a> default_charset &quot;UTF-8&quot;</pre>
-
-<blockquote class="aside"><p>As with all INI directives, this can
-also go in your php.ini file. Some hosting providers allow you to customize
-your own php.ini file, ask your support for details. Use:</p>
-<pre>default_charset = &quot;utf-8&quot;</pre></blockquote>
-
-<h4 id="fixcharset-server-nophp">Non-PHP</h4>
-
-<p>You may, for whatever reason, need to set the character encoding
-on non-PHP files, usually plain ol' HTML files. Doing this
-is more of a hit-or-miss process: depending on the software being
-used as a webserver and the configuration of that software, certain
-techniques may work, or may not work.</p>
-
-<h4 id="fixcharset-server-htaccess">.htaccess</h4>
-
-<p>On Apache, you can use an .htaccess file to change the character
-encoding. I'll defer to
-<a href="http://www.w3.org/International/questions/qa-htaccess-charset">W3C</a>
-for the in-depth explanation, but it boils down to creating a file
-named .htaccess with the contents:</p>
-
-<pre><a href="http://httpd.apache.org/docs/1.3/mod/mod_mime.html#addcharset">AddCharset</a> UTF-8 .html</pre>
-
-<p>Where UTF-8 is replaced with the character encoding you want to
-use and .html is a file extension that this will be applied to. This
-character encoding will then be set for any file directly in
-or in the subdirectories of directory you place this file in.</p>
-
-<p>If you're feeling particularly courageous, you can use:</p>
-
-<pre><a href="http://httpd.apache.org/docs/1.3/mod/core.html#adddefaultcharset">AddDefaultCharset</a> UTF-8</pre>
-
-<p>...which changes the character set Apache adds to any document that
-doesn't have any Content-Type parameters. This directive, which the
-default configuration file sets to iso-8859-1 for security
-reasons, is probably why your headers mismatch
-with the <code>META</code> tag. If you would prefer Apache not to be
-butting in on your character encodings, you can tell it not
-to send anything at all:</p>
-
-<pre><a href="http://httpd.apache.org/docs/1.3/mod/core.html#adddefaultcharset">AddDefaultCharset</a> Off</pre>
-
-<p>...making your internal charset declaration (usually the <code>META</code> tags)
-the sole source of character encoding
-information. In these cases, it is <em>especially</em> important to make
-sure you have valid <code>META</code> tags on your pages and all the
-text before them is ASCII.</p>
-
-<blockquote class="aside"><p>These directives can also be
-placed in httpd.conf file for Apache, but
-in most shared hosting situations you won't be able to edit this file.
-</p></blockquote>
-
-<h4 id="fixcharset-server-ext">File extensions</h4>
-
-<p>If you're not allowed to use .htaccess files, you can often
-piggy-back off of Apache's default AddCharset declarations to get
-your files in the proper extension. Here are Apache's default
-character set declarations:</p>
-
-<table class="table">
-    <thead><tr>
-        <th>Charset</th>
-        <th>File extension(s)</th>
-    </tr></thead>
-    <tbody>
-        <tr><td>ISO-8859-1</td><td>.iso8859-1 .latin1</td></tr>
-        <tr><td>ISO-8859-2</td><td>.iso8859-2 .latin2 .cen</td></tr>
-        <tr><td>ISO-8859-3</td><td>.iso8859-3 .latin3</td></tr>
-        <tr><td>ISO-8859-4</td><td>.iso8859-4 .latin4</td></tr>
-        <tr><td>ISO-8859-5</td><td>.iso8859-5 .latin5 .cyr .iso-ru</td></tr>
-        <tr><td>ISO-8859-6</td><td>.iso8859-6 .latin6 .arb</td></tr>
-        <tr><td>ISO-8859-7</td><td>.iso8859-7 .latin7 .grk</td></tr>
-        <tr><td>ISO-8859-8</td><td>.iso8859-8 .latin8 .heb</td></tr>
-        <tr><td>ISO-8859-9</td><td>.iso8859-9 .latin9 .trk</td></tr>
-        <tr><td>ISO-2022-JP</td><td>.iso2022-jp .jis</td></tr>
-        <tr><td>ISO-2022-KR</td><td>.iso2022-kr .kis</td></tr>
-        <tr><td>ISO-2022-CN</td><td>.iso2022-cn .cis</td></tr>
-        <tr><td>Big5</td><td>.Big5 .big5 .b5</td></tr>
-        <tr><td>WINDOWS-1251</td><td>.cp-1251 .win-1251</td></tr>
-        <tr><td>CP866</td><td>.cp866</td></tr>
-        <tr><td>KOI8-r</td><td>.koi8-r .koi8-ru</td></tr>
-        <tr><td>KOI8-ru</td><td>.koi8-uk .ua</td></tr>
-        <tr><td>ISO-10646-UCS-2</td><td>.ucs2</td></tr>
-        <tr><td>ISO-10646-UCS-4</td><td>.ucs4</td></tr>
-        <tr><td>UTF-8</td><td>.utf8</td></tr>
-        <tr><td>GB2312</td><td>.gb2312 .gb </td></tr>
-        <tr><td>utf-7</td><td>.utf7</td></tr>
-        <tr><td>EUC-TW</td><td>.euc-tw</td></tr>
-        <tr><td>EUC-JP</td><td>.euc-jp</td></tr>
-        <tr><td>EUC-KR</td><td>.euc-kr</td></tr>
-        <tr><td>shift_jis</td><td>.sjis</td></tr>
-    </tbody>
-</table>
-
-<p>So, for example, a file named <code>page.utf8.html</code> or
-<code>page.html.utf8</code> will probably be sent with the UTF-8 charset
-attached, the difference being that if there is an
-<code>AddCharset charset .html</code> declaration, it will override
-the .utf8 extension in <code>page.utf8.html</code> (precedence moves
-from right to left). By default, Apache has no such declaration.</p>
-
-<h4 id="fixcharset-server-iis">Microsoft IIS</h4>
-
-<p>If anyone can contribute information on how to configure Microsoft
-IIS to change character encodings, I'd be grateful.</p>
-
-<h3 id="fixcharset-xml">XML</h3>
-
-<p><code>META</code> tags are the most common source of embedded
-encodings, but they can also come from somewhere else: XML
-Declarations. They look like:</p>
-
-<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</pre>
-
-<p>...and are most often found in XML documents (including XHTML).</p>
-
-<p>For XHTML, this XML Declaration theoretically
-overrides the <code>META</code> tag. In reality, this happens only when the
-XHTML is actually served as legit XML and not HTML, which is almost always
-never due to Internet Explorer's lack of support for
-<code>application/xhtml+xml</code> (even though doing so is often
-argued to be <a href="http://www.hixie.ch/advocacy/xhtml">good
-practice</a> and is required by the XHTML 1.1 specification).</p>
-
-<p>For XML, however, this XML Declaration is extremely important.
-Since most webservers are not configured to send charsets for .xml files,
-this is the only thing a parser has to go on. Furthermore, the default
-for XML files is UTF-8, which often butts heads with more common
-ISO-8859-1 encoding (you see this in garbled RSS feeds).</p>
-
-<p>In short, if you use XHTML and have gone through the
-trouble of adding the XML Declaration, make sure it jives
-with your <code>META</code> tags (which should only be present
-if served in text/html) and HTTP headers.</p>
-
-<h3 id="fixcharset-internals">Inside the process</h3>
-
-<p>This section is not required reading,
-but may answer some of your questions on what's going on in all
-this character encoding hocus pocus. If you're interested in
-moving on to the next phase, skip this section.</p>
-
-<p>A logical question that follows all of our wheeling and dealing
-with multiple sources of character encodings is &quot;Why are there
-so many options?&quot; To answer this question, we have to turn
-back our definition of character encodings: they allow a program
-to interpret bytes into human-readable characters.</p>
-
-<p>Thus, a chicken-egg problem: a character encoding
-is necessary to interpret the
-text of a document. A <code>META</code> tag is in the text of a document.
-The <code>META</code> tag gives the character encoding. How can we
-determine the contents of a <code>META</code> tag, inside the text,
-if we don't know it's character encoding? And how do we figure out
-the character encoding, if we don't know the contents of the
-<code>META</code> tag?</p>
-
-<p>Fortunately for us, the characters we need to write the
-<code>META</code> are in ASCII, which is pretty much universal
-over every character encoding that is in common use today. So,
-all the web-browser has to do is parse all the way down until
-it gets to the Content-Type tag, extract the character encoding
-tag, then re-parse the document according to this new information.</p>
-
-<p>Obviously this is complicated, so browsers prefer the simpler
-and more efficient solution: get the character encoding from a
-somewhere other than the document itself, i.e. the HTTP headers,
-much to the chagrin of HTML authors who can't set these headers.</p>
-
-<h2 id="whyutf8">Why UTF-8?</h2>
-
-<p>So, you've gone through all the trouble of ensuring that your
-server and embedded characters all line up properly and are
-present.  Good job: at
-this point, you could quit and rest easy knowing that your pages
-are not vulnerable to character encoding style XSS attacks.
-However, just as having a character encoding is better than
-having no character encoding at all, having UTF-8 as your
-character encoding is better than having some other random
-character encoding, and the next step is to convert to UTF-8.
-But why?</p>
-
-<h3 id="whyutf8-i18n">Internationalization</h3>
-
-<p>Many software projects, at one point or another, suddenly realize
-that they should be supporting more than one language. Even regular
-usage in one language sometimes requires the occasional special character
-that, without surprise, is not available in your character set. Sometimes
-developers get around this by adding support for multiple encodings: when
-using Chinese, use Big5, when using Japanese, use Shift-JIS, when
-using Greek, etc. Other times, they use character references with great
-zeal.</p>
-
-<p>UTF-8, however, obviates the need for any of these complicated
-measures. After getting the system to use UTF-8 and adjusting for
-sources that are outside the hand of the browser (more on this later),
-UTF-8 just works. You can use it for any language, even many languages
-at once, you don't have to worry about managing multiple encodings,
-you don't have to use those user-unfriendly entities.</p>
-
-<h3 id="whyutf8-user">User-friendly</h3>
-
-<p>Websites encoded in Latin-1 (ISO-8859-1) which occasionally need
-a special character outside of their scope often will use a character
-entity reference to achieve the desired effect. For instance, &theta; can be
-written <code>&amp;theta;</code>, regardless of the character encoding's
-support of Greek letters.</p>
-
-<p>This works nicely for limited use of special characters, but
-say you wanted this sentence of Chinese text: &#28608;&#20809;,
-&#36889;&#20841;&#20491;&#23383;&#26159;&#29978;&#40636;&#24847;&#24605;.
-The ampersand encoded version would look like this:</p>
-
-<pre>&amp;#28608;&amp;#20809;, &amp;#36889;&amp;#20841;&amp;#20491;&amp;#23383;&amp;#26159;&amp;#29978;&amp;#40636;&amp;#24847;&amp;#24605;</pre>
-
-<p>Extremely inconvenient for those of us who actually know what
-character entities are, totally unintelligible to poor users who don't!
-Even the slightly more user-friendly, &quot;intelligible&quot; character
-entities like <code>&amp;theta;</code> will leave users who are
-uninterested in learning HTML scratching their heads. On the other
-hand, if they see &theta; in an edit box, they'll know that it's a
-special character, and treat it accordingly, even if they don't know
-how to write that character themselves.</p>
-
-<blockquote class="aside"><p>Wikipedia is a great case study for
-an application that originally used ISO-8859-1 but switched to UTF-8
-when it became far to cumbersome to support foreign languages. Bots
-will now actually go through articles and convert character entities
-to their corresponding real characters for the sake of user-friendliness
-and searchability. See
-<a href="http://meta.wikimedia.org/wiki/Help:Special_characters">Meta's
-page on special characters</a> for more details.
-</p></blockquote>
-
-<h3 id="whyutf8-forms">Forms</h3>
-
-<p>While we're on the tack of users, how do non-UTF-8 web forms deal
-with characters that our outside of their character set? Rather than
-discuss what UTF-8 does right, we're going to show what could go wrong
-if you didn't use UTF-8 and people tried to use characters outside
-of your character encoding.</p>
-
-<p>The troubles are large, extensive, and extremely difficult to fix (or,
-at least, difficult enough that if you had the time and resources to invest
-in doing the fix, you would be probably better off migrating to UTF-8).
-There are two types of form submission: <code>application/x-www-form-urlencoded</code>
-which is used for GET and by default for POST, and <code>multipart/form-data</code>
-which may be used by POST, and is required when you want to upload
-files.</p>
-
-<p>The following is a summarization of notes from
-<a href="http://web.archive.org/web/20060427015200/ppewww.ph.gla.ac.uk/~flavell/charset/form-i18n.html">
-<code>FORM</code> submission and i18n</a>. That document contains lots
-of useful information, but is written in a rambly manner, so
-here I try to get right to the point. (Note: the original has
-disappeared off the web, so I am linking to the Web Archive copy.)</p>
-
-<h4 id="whyutf8-forms-urlencoded"><code>application/x-www-form-urlencoded</code></h4>
-
-<p>This is the Content-Type that GET requests must use, and POST requests
-use by default. It involves the ubiquitous percent encoding format that
-looks something like: <code>%C3%86</code>. There is no official way of
-determining the character encoding of such a request, since the percent
-encoding operates on a byte level, so it is usually assumed that it
-is the same as the encoding the page containing the form was submitted
-in. (<a href="http://tools.ietf.org/html/rfc3986#section-2.5">RFC 3986</a>
-recommends that textual identifiers be translated to UTF-8; however, browser
-compliance is spotty.) You'll run into very few problems
-if you only use characters in the character encoding you chose.</p>
-
-<p>However, once you start adding characters outside of your encoding
-(and this is a lot more common than you may think: take curly
-&quot;smart&quot; quotes from Microsoft as an example),
-a whole manner of strange things start to happen. Depending on the
-browser you're using, they might:</p>
-
-<ul>
-    <li>Replace the unsupported characters with useless question marks,</li>
-    <li>Attempt to fix the characters (example: smart quotes to regular quotes),</li>
-    <li>Replace the character with a character entity reference, or</li>
-    <li>Send it anyway as a different character encoding mixed in
-        with the original encoding (usually Windows-1252 rather than
-        iso-8859-1 or UTF-8 interspersed in 8-bit)</li>
-</ul>
-
-<p>To properly guard against these behaviors, you'd have to sniff out
-the browser agent, compile a database of different behaviors, and
-take appropriate conversion action against the string (disregarding
-a spate of extremely mysterious, random and devastating bugs Internet
-Explorer manifests every once in a while). Or you could
-use UTF-8 and rest easy knowing that none of this could possibly happen
-since UTF-8 supports every character.</p>
-
-<h4 id="whyutf8-forms-multipart"><code>multipart/form-data</code></h4>
-
-<p>Multipart form submission takes away a lot of the ambiguity
-that percent-encoding had: the server now can explicitly ask for
-certain encodings, and the client can explicitly tell the server
-during the form submission what encoding the fields are in.</p>
-
-<p>There are two ways you go with this functionality: leave it
-unset and have the browser send in the same encoding as the page,
-or set it to UTF-8 and then do another conversion server-side.
-Each method has deficiencies, especially the former.</p>
-
-<p>If you tell the browser to send the form in the same encoding as
-the page, you still have the trouble of what to do with characters
-that are outside of the character encoding's range. The behavior, once
-again, varies: Firefox 2.0 converts them to character entity references
-while Internet Explorer 7.0 mangles them beyond intelligibility. For
-serious internationalization purposes, this is not an option.</p>
-
-<p>The other possibility is to set Accept-Encoding to UTF-8, which
-begs the question: Why aren't you using UTF-8 for everything then?
-This route is more palatable, but there's a notable caveat: your data
-will come in as UTF-8, so you will have to explicitly convert it into
-your favored local character encoding.</p>
-
-<p>I object to this approach on idealogical grounds: you're
-digging yourself deeper into
-the hole when you could have been converting to UTF-8
-instead. And, of course, you can't use this method for GET requests.</p>
-
-<h3 id="whyutf8-support">Well supported</h3>
-
-<p>Almost every modern browser in the wild today has full UTF-8 and Unicode
-support: the number of troublesome cases can be counted with the
-fingers of one hand, and these browsers usually have trouble with
-other character encodings too. Problems users usually encounter stem
-from the lack of appropriate fonts to display the characters (once
-again, this applies to all character encodings and HTML entities) or
-Internet Explorer's lack of intelligent font picking (which can be
-worked around).</p>
-
-<p>We will go into more detail about how to deal with edge cases in
-the browser world in the Migration section, but rest assured that
-converting to UTF-8, if done correctly, will not result in users
-hounding you about broken pages.</p>
-
-<h3 id="whyutf8-htmlpurifier">HTML Purifier</h3>
-
-<p>And finally, we get to HTML Purifier.  HTML Purifier is built to
-deal with UTF-8: any indications otherwise are the result of an
-encoder that converts text from your preferred encoding to UTF-8, and
-back again.  HTML Purifier never touches anything else, and leaves
-it up to the module iconv to do the dirty work.</p>
-
-<p>This approach, however, is not perfect. iconv is blithely unaware
-of HTML character entities. HTML Purifier, in order to
-protect against sophisticated escaping schemes, normalizes all character
-and numeric entity references before processing the text. This leads to
-one important ramification:</p>
-
-<p><strong>Any character that is not supported by the target character
-set, regardless of whether or not it is in the form of a character
-entity reference or a raw character, will be silently ignored.</strong></p>
-
-<p>Example of this principle at work: say you have <code>&amp;theta;</code>
-in your HTML, but the output is in Latin-1 (which, understandably,
-does not understand Greek), the following process will occur (assuming you've
-set the encoding correctly using %Core.Encoding):</p>
-
-<ul>
-    <li>The <code>Encoder</code> will transform the text from ISO 8859-1 to UTF-8
-        (note that theta is preserved here since it doesn't actually use
-        any non-ASCII characters): <code>&amp;theta;</code></li>
-    <li>The <code>EntityParser</code> will transform all named and numeric
-        character entities to their corresponding raw UTF-8 equivalents:
-        <code>&theta;</code></li>
-    <li>HTML Purifier processes the code: <code>&theta;</code></li>
-    <li>The <code>Encoder</code> now transforms the text back from UTF-8
-        to ISO 8859-1. Since Greek is not supported by ISO 8859-1, it
-        will be either ignored or replaced with a question mark:
-        <code>?</code></li>
-</ul>
-
-<p>This behaviour is quite unsatisfactory. It is a deal-breaker for
-international applications, and it can be mildly annoying for the provincial
-soul who occasionally needs a special character. Since 1.4.0, HTML
-Purifier has provided a slightly more palatable workaround using
-%Core.EscapeNonASCIICharacters. The process now looks like:</p>
-
-<ul>
-    <li>The <code>Encoder</code> transforms encoding to UTF-8: <code>&amp;theta;</code></li>
-    <li>The <code>EntityParser</code> transforms entities: <code>&theta;</code></li>
-    <li>HTML Purifier processes the code: <code>&theta;</code></li>
-    <li>The <code>Encoder</code> replaces all non-ASCII characters
-        with numeric entity reference: <code>&amp;#952;</code></li>
-    <li>For good measure, <code>Encoder</code> transforms encoding back to
-        original (which is strictly unnecessary for 99% of encodings
-        out there): <code>&amp;#952;</code> (remember, it's all ASCII!)</li>
-</ul>
-
-<p>...which means that this is only good for an occasional foray into
-the land of Unicode characters, and is totally unacceptable for Chinese
-or Japanese texts. The even bigger kicker is that, supposing the
-input encoding was actually ISO-8859-7, which <em>does</em> support
-theta, the character would get converted into a character entity reference
-anyway! (The Encoder does not discriminate).</p>
-
-<p>The current functionality is about where HTML Purifier will be for
-the rest of eternity. HTML Purifier could attempt to preserve the original
-form of the character references so that they could be substituted back in, only the
-DOM extension kills them off irreversibly. HTML Purifier could also attempt
-to be smart and only convert non-ASCII characters that weren't supported
-by the target encoding, but that would require reimplementing iconv
-with HTML awareness, something I will not do.</p>
-
-<p>So there: either it's UTF-8 or crippled international support. Your pick! (and I'm
-not being sarcastic here: some people could care less about other languages).</p>
-
-<h2 id="migrate">Migrate to UTF-8</h2>
-
-<p>So, you've decided to bite the bullet, and want to migrate to UTF-8.
-Note that this is not for the faint-hearted, and you should expect
-the process to take longer than you think it will take.</p>
-
-<p>The general idea is that you convert all existing text to UTF-8,
-and then you set all the headers and META tags we discussed earlier
-to UTF-8. There are many ways going about doing this: you could
-write a conversion script that runs through the database and re-encodes
-everything as UTF-8 or you could do the conversion on the fly when someone
-reads the page. The details depend on your system, but I will cover
-some of the more subtle points of migration that may trip you up.</p>
-
-<h3 id="migrate-db">Configuring your database</h3>
-
-<p>Most modern databases, the most prominent open-source ones being MySQL
-4.1+ and PostgreSQL, support character encodings. If you're switching
-to UTF-8, logically speaking, you'd want to make sure your database
-knows about the change too. There are some caveats though:</p>
-
-<h4 id="migrate-db-legit">Legit method</h4>
-
-<p>Standardization in terms of SQL syntax for specifying character
-encodings is notoriously spotty. Refer to your respective database's
-documentation on how to do this properly.</p>
-
-<p>For <a href="http://dev.mysql.com/doc/refman/5.0/en/charset-conversion.html">MySQL</a>, <code>ALTER</code> will magically perform the
-character encoding conversion for you. However, you have
-to make sure that the text inside the column is what is says it is:
-if you had put Shift-JIS in an ISO 8859-1 column, MySQL will irreversibly mangle
-the text when you try to convert it to UTF-8. You'll have to convert
-it to a binary field, convert it to a Shift-JIS field (the real encoding),
-and then finally to UTF-8. Many a website had pages irreversibly mangled
-because they didn't realize that they'd been deluding themselves about
-the character encoding all along; don't become the next victim.</p>
-
-<p>For <a href="http://www.postgresql.org/docs/8.2/static/multibyte.html">PostgreSQL</a>, there appears to be no direct way to change the
-encoding of a database (as of 8.2). You will have to dump the data, and then reimport
-it into a new table. Make sure that your client encoding is set properly:
-this is how PostgreSQL knows to perform an encoding conversion.</p>
-
-<p>Many times, you will be also asked about the &quot;collation&quot; of
-the new column. Collation is how a DBMS sorts text, like ordering
-B, C and A into A, B and C (the problem gets surprisingly complicated
-when you get to languages like Thai and Japanese). If in doubt,
-going with the default setting is usually a safe bet.</p>
-
-<p>Once the conversion is all said and done, you still have to remember
-to set the client encoding (your encoding) properly on each database
-connection using <code>SET NAMES</code> (which is standard SQL and is
-usually supported).</p>
-
-<h4 id="migrate-db-binary">Binary</h4>
-
-<p>Due to the aforementioned compatibility issues, a more interoperable
-way of storing UTF-8 text is to stuff it in a binary datatype.
-<code>CHAR</code> becomes <code>BINARY</code>, <code>VARCHAR</code> becomes
-<code>VARBINARY</code> and <code>TEXT</code> becomes <code>BLOB</code>.
-Doing so can save you some huge headaches:</p>
-
-<ul>
-    <li>The syntax for binary data types is very portable,</li>
-    <li>MySQL 4.0 has <em>no</em> support for character encodings, so
-        if you want to support it you <em>have</em> to use binary,</li>
-    <li>MySQL, as of 5.1, has no support for four byte UTF-8 characters,
-        which represent characters beyond the basic multilingual
-        plane, and</li>
-    <li>You will never have to worry about your DBMS being too smart
-        and attempting to convert your text when you don't want it to.</li>
-</ul>
-
-<p>MediaWiki, a very prominent international application, uses binary fields
-for storing their data because of point three.</p>
-
-<p>There are drawbacks, of course:</p>
-
-<ul>
-    <li>Database tools like PHPMyAdmin won't be able to offer you inline
-        text editing, since it is declared as binary,</li>
-    <li>It's not semantically correct: it's really text not binary
-        (lying to the database),</li>
-    <li>Unless you use the not-very-portable wizardry mentioned above,
-        you have to change the encoding yourself (usually, you'd do
-        it on the fly), and</li>
-    <li>You will not have collation.</li>
-</ul>
-
-<p>Choose based on your circumstances.</p>
-
-<h3 id="migrate-editor">Text editor</h3>
-
-<p>For more flat-file oriented systems, you will often be tasked with
-converting reams of existing text and HTML files into UTF-8, as well as
-making sure that all new files uploaded are properly encoded. Once again,
-I can only point vaguely in the right direction for converting your
-existing files: make sure you backup, make sure you use
-<a href="http://php.net/ref.iconv">iconv</a>(), and
-make sure you know what the original character encoding of the files
-is (or are, depending on the tidiness of your system).</p>
-
-<p>However, I can proffer more specific advice on the subject of
-text editors. Many text editors have notoriously spotty Unicode support.
-To find out how your editor is doing, you can check out <a
-href="http://www.alanwood.net/unicode/utilities_editors.html">this list</a>
-or <a href="http://en.wikipedia.org/wiki/Comparison_of_text_editors#Encoding_support">Wikipedia's list.</a>
-I personally use Notepad++, which works like a charm when it comes to UTF-8.
-Usually, you will have to <strong>explicitly</strong> tell the editor through some dialogue
-(usually Save as or Format) what encoding you want it to use. An editor
-will often offer &quot;Unicode&quot; as a method of saving, which is
-ambiguous. Make sure you know whether or not they really mean UTF-8
-or UTF-16 (which is another flavor of Unicode).</p>
-
-<p>The two things to look out for are whether or not the editor
-supports <strong>font mixing</strong> (multiple
-fonts in one document) and whether or not it adds a <strong>BOM</strong>.
-Font mixing is important because fonts rarely have support for every
-language known to mankind: in order to be flexible, an editor must
-be able to take a little from here and a little from there, otherwise
-all your Chinese characters will come as nice boxes. We'll discuss
-BOM below.</p>
-
-<h3 id="migrate-bom">Byte Order Mark (headers already sent!)</h3>
-
-<p>The BOM, or <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark">Byte
-Order Mark</a>, is a magical, invisible character placed at
-the beginning of UTF-8 files to tell people what the encoding is and
-what the endianness of the text is. It is also unnecessary.</p>
-
-<p>Because it's invisible, it often
-catches people by surprise when it starts doing things it shouldn't
-be doing. For example, this PHP file:</p>
-
-<pre><strong>BOM</strong>&lt;?php
-header('Location: index.php');
-?&gt;</pre>
-
-<p>...will fail with the all too familiar <strong>Headers already sent</strong>
-PHP error. And because the BOM is invisible, this culprit will go unnoticed.
-My suggestion is to only use ASCII in PHP pages, but if you must, make
-sure the page is saved WITHOUT the BOM.</p>
-
-<blockquote class="aside">
-    <p>The headers the error is referring to are <strong>HTTP headers</strong>,
-       which are sent to the browser before any HTML to tell it various
-       information. The moment any regular text (and yes, a BOM counts as
-       ordinary text) is output, the headers must be sent, and you are
-       not allowed to send anymore. Thus, the error.</p>
-</blockquote>
-
-<p>If you are reading in text files to insert into the middle of another
-page, it is strongly advised (but not strictly necessary) that you replace out the UTF-8 byte
-sequence for BOM <code>&quot;\xEF\xBB\xBF&quot;</code> before inserting it in,
-via:</p>
-
-<pre>$text = str_replace(&quot;\xEF\xBB\xBF&quot;, '', $text);</pre>
-
-<h3 id="migrate-fonts">Fonts</h3>
-
-<p>Generally speaking, people who are having trouble with fonts fall
-into two categories:</p>
-
-<ul>
-<li>Those who want to
-use an extremely obscure language for which there is very little
-support even among native speakers of the language, and</li>
-<li>Those where the primary language of the text is
-well-supported but there are occasional characters
-that aren't supported.</li>
-</ul>
-
-<p>Yes, there's always a chance where an English user happens across
-a Sinhalese website and doesn't have the right font. But an English user
-who happens not to have the right fonts probably has no business reading Sinhalese
-anyway. So we'll deal with the other two edge cases.</p>
-
-<h4 id="migrate-fonts-obscure">Obscure scripts</h4>
-
-<p>If you run a Bengali website, you may get comments from users who
-would like to read your website but get heaps of question marks or
-other meaningless characters. Fixing this problem requires the
-installation of a font or language pack which is often highly
-dependent on what the language is. <a href="http://bn.wikipedia.org/wiki/%E0%A6%89%E0%A6%87%E0%A6%95%E0%A6%BF%E0%A6%AA%E0%A7%87%E0%A6%A1%E0%A6%BF%E0%A6%AF%E0%A6%BC%E0%A6%BE:Bangla_script_display_and_input_help">Here is an example</a>
-of such a help file for the Bengali language; I am sure there are
-others out there too. You just have to point users to the appropriate
-help file.</p>
-
-<h4 id="migrate-fonts-occasional">Occasional use</h4>
-
-<p>A prime example of when you'll see some very obscure Unicode
-characters embedded in what otherwise would be very bland ASCII are
-letters of the
-<a href="http://en.wikipedia.org/wiki/International_Phonetic_Alphabet">International
-Phonetic Alphabet (IPA)</a>, use to designate pronunciations in a very standard
-manner (you probably see them all the time in your dictionary). Your
-average font probably won't have support for all of the IPA characters
-like &#664; (bilabial click) or &#658; (voiced postalveolar fricative).
-So what's a poor browser to do? Font mix! Smart browsers like Mozilla Firefox
-and Internet Explorer 7 will borrow glyphs from other fonts in order
-to make sure that all the characters display properly.</p>
-
-<p>But what happens when the browser isn't smart and happens to be the
-most widely used browser in the entire world? Microsoft IE 6
-is not smart enough to borrow from other fonts when a character isn't
-present, so more often than not you'll be slapped with a nice big &#65533;.
-To get things to work, MSIE 6 needs a little nudge. You could configure it
-to use a different font to render the text, but you can achieve the same
-effect by selectively changing the font for blocks of special characters
-to known good Unicode fonts.</p>
-
-<p>Fortunately, the folks over at Wikipedia have already done all the
-heavy lifting for you. Get the CSS from the horses mouth here:
-<a href="http://en.wikipedia.org/wiki/MediaWiki:Common.css">Common.css</a>,
-and search for &quot;.IPA&quot; There are also a smattering of
-other classes you can use for other purposes, check out
-<a href="http://meta.wikimedia.org/wiki/Help:Special_characters#Displaying_Special_Characters">this page</a>
-for more details. For you lazy ones, this should work:</p>
-
-<pre>.Unicode {
-        font-family: Code2000, &quot;TITUS Cyberbit Basic&quot;, &quot;Doulos SIL&quot;,
-            &quot;Chrysanthi Unicode&quot;, &quot;Bitstream Cyberbit&quot;,
-            &quot;Bitstream CyberBase&quot;, Thryomanes, Gentium, GentiumAlt,
-            &quot;Lucida Grande&quot;, &quot;Arial Unicode MS&quot;, &quot;Microsoft Sans Serif&quot;,
-            &quot;Lucida Sans Unicode&quot;;
-        font-family /**/:inherit; /* resets fonts for everyone but IE6 */
-}</pre>
-
-<p>The standard usage goes along the lines of <code>&lt;span class=&quot;Unicode&quot;&gt;Crazy
-Unicode stuff here&lt;/span&gt;</code>. Characters in the
-<a href="http://en.wikipedia.org/wiki/Windows_Glyph_List_4">Windows Glyph List</a>
-usually don't need to be fixed, but for anything else you probably
-want to play it safe. Unless, of course, you don't care about IE6
-users.</p>
-
-<h3 id="migrate-variablewidth">Dealing with variable width in functions</h3>
-
-<p>When people claim that PHP6 will solve all our Unicode problems, they're
-misinformed. It will not fix any of the aforementioned troubles. It will,
-however, fix the problem we are about to discuss: processing UTF-8 text
-in PHP.</p>
-
-<p>PHP (as of PHP5) is blithely unaware of the existence of UTF-8 (with a few
-notable exceptions). Sometimes, this will cause problems, other times,
-this won't. So far, we've avoided discussing the architecture of
-UTF-8, so, we must first ask, what is UTF-8? Yes, it supports Unicode,
-and yes, it is variable width. Other traits:</p>
-
-<ul>
-    <li>Every character's byte sequence is unique and will never be found
-        inside the byte sequence of another character,</li>
-    <li>UTF-8 may use up to four bytes to encode a character,</li>
-    <li>UTF-8 text must be checked for well-formedness,</li>
-    <li>Pure ASCII is also valid UTF-8, and</li>
-    <li>Binary sorting will sort UTF-8 in the same order as Unicode.</li>
-</ul>
-
-<p>Each of these traits affect different domains of text processing
-in different ways. It is beyond the scope of this document to explain
-what precisely these implications are. PHPWact provides
-a very good <a href="http://www.phpwact.org/php/i18n/utf-8">reference document</a>
-on what to expect from each function, although coverage is spotty in
-some areas. Their more general notes on
-<a href="http://www.phpwact.org/php/i18n/charsets">character sets</a>
-are also worth looking at for information on UTF-8. Some rules of thumb
-when dealing with Unicode text:</p>
-
-<ul>
-    <li>Do not EVER use functions that:<ul>
-        <li>...convert case (strtolower, strtoupper, ucfirst, ucwords)</li>
-        <li>...claim to be case-insensitive (str_ireplace, stristr, strcasecmp)</li>
-    </ul></li>
-    <li>Think twice before using functions that:<ul>
-        <li>...count characters (strlen will return bytes, not characters;
-            str_split and word_wrap may corrupt)</li>
-        <li>...convert characters to entity references (UTF-8 doesn't need entities)</li>
-        <li>...do very complex string processing (*printf)</li>
-    </ul></li>
-</ul>
-
-<p>Note: this list applies to UTF-8 encoded text only: if you have
-a string that you are 100% sure is ASCII, be my guest and use
-<code>strtolower</code> (HTML Purifier uses this function.)</p>
-
-<p>Regardless, always think in bytes, not characters. If you use strpos()
-to find the position of a character, it will be in bytes, but this
-usually won't matter since substr() also operates with byte indices!</p>
-
-<p>You'll also need to make sure your UTF-8 is well-formed and will
-probably need replacements for some of these functions. I recommend
-using Harry Fuecks' <a href="http://phputf8.sourceforge.net/">PHP
-UTF-8</a> library, rather than use mb_string directly. HTML Purifier
-also defines a few useful UTF-8 compatible functions: check out
-<code>Encoder.php</code> in the <code>/library/HTMLPurifier/</code>
-directory.</p>
-
-<h2 id="externallinks">Further Reading</h2>
-
-<p>Well, that's it. Hopefully this document has served as a very
-practical springboard into knowledge of how UTF-8 works.  You may have
-decided that you don't want to migrate yet: that's fine, just know
-what will happen to your output and what bug reports you may receive.</p>
-
-<p>Many other developers have already discussed the subject of Unicode,
-UTF-8 and internationalization, and I would like to defer to them for
-a more in-depth look into character sets and encodings.</p>
-
-<ul>
-    <li><a href="http://www.joelonsoftware.com/articles/Unicode.html">
-        The Absolute Minimum Every Software Developer Absolutely,
-        Positively Must Know About Unicode and Character Sets
-        (No Excuses!)</a> by Joel Spolsky, provides a <em>very</em>
-        good high-level look at Unicode and character sets in general.</li>
-    <li><a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8 on Wikipedia</a>,
-        provides a lot of useful details into the innards of UTF-8, although
-        it may be a little off-putting to people who don't know much
-        about Unicode to begin with.</li>
-</ul>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 152
main/inc/lib/htmlpurifier/docs/enduser-youtube.html

@@ -1,152 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Explains how to safely allow the embedding of flash from trusted sites in HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Embedding YouTube Videos - HTML Purifier</title>
-
-</head><body>
-
-<h1 class="subtitled">Embedding YouTube Videos</h1>
-<div class="subtitle">...as well as other dangerous active content</div>
-
-<div id="filing">Filed under End-User</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>Clients like their YouTube videos. It gives them a warm fuzzy feeling when
-they see a neat little embedded video player on their websites that can play
-the latest clips from their documentary &quot;Fido and the Bones of Spring&quot;.
-All joking aside, the ability to embed YouTube videos or other active
-content in their pages is something that a lot of people like.</p>
-
-<p>This is a <em>bad</em> idea. The moment you embed anything untrusted,
-you will definitely be slammed by a manner of nasties that can be
-embedded in things from your run of the mill Flash movie to
-<a href="http://blog.spywareguide.com/2006/12/myspace_phish_attack_leads_use.html">Quicktime movies</a>.
-Even <code>img</code> tags, which HTML Purifier allows by default, can be
-dangerous. Be distrustful of anything that tells a browser to load content
-from another website automatically.</p>
-
-<p>Luckily for us, however, whitelisting saves the day. Sure, letting users
-include any old random flash file could be dangerous, but if it's
-from a specific website, it probably is okay. If no amount of pleading will
-convince the people upstairs that they should just settle with just linking
-to their movies, you may find this technique very useful.</p>
-
-<h2>Looking in</h2>
-
-<p>Below is custom code that allows users to embed
-YouTube videos. This is not favoritism: this trick can easily be adapted for
-other forms of embeddable content.</p>
-
-<p>Usually, websites like YouTube give us boilerplate code that you can insert
-into your documents. YouTube's code goes like this:</p>
-
-<pre>
-&lt;object width=&quot;425&quot; height=&quot;350&quot;&gt;
-  &lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/AyPzM5WK8ys&quot; /&gt;
-  &lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;
-  &lt;embed src=&quot;http://www.youtube.com/v/AyPzM5WK8ys&quot;
-         type=&quot;application/x-shockwave-flash&quot;
-         wmode=&quot;transparent&quot; width=&quot;425&quot; height=&quot;350&quot; /&gt;
-&lt;/object&gt;
-</pre>
-
-<p>There are two things to note about this code:</p>
-
-<ol>
-    <li><code>&lt;embed&gt;</code> is not recognized by W3C, so if you want
-        standards-compliant code, you'll have to get rid of it.</li>
-    <li>The code is exactly the same for all instances, except for the
-        identifier <tt>AyPzM5WK8ys</tt> which tells us which movie file
-        to retrieve.</li>
-</ol>
-
-<p>What point 2 means is that if we have code like <code>&lt;span
-class=&quot;embed-youtube&quot;&gt;AyPzM5WK8ys&lt;/span&gt;</code> your
-application can reconstruct the full object from this small snippet that
-passes through HTML Purifier <em>unharmed</em>.
-<a href="http://repo.or.cz/w/htmlpurifier.git?a=blob;hb=HEAD;f=library/HTMLPurifier/Filter/YouTube.php">Show me the code!</a></p>
-
-<p>And the corresponding usage:</p>
-
-<pre>&lt;?php
-    $config->set('Filter', 'YouTube', true);
-?&gt;</pre>
-
-<p>There is a bit going in the two code snippets, so let's explain.</p>
-
-<ol>
-    <li>This is a Filter object, which intercepts the HTML that is
-        coming into and out of the purifier. You can add as many
-        filter objects as you like. <code>preFilter()</code>
-        processes the code before it gets purified, and <code>postFilter()</code>
-        processes the code afterwards. So, we'll use <code>preFilter()</code> to
-        replace the object tag with a <code>span</code>, and <code>postFilter()</code>
-        to restore it.</li>
-    <li>The first preg_replace call replaces any YouTube code users may have
-        embedded into the benign span tag. Span is used because it is inline,
-        and objects are inline too. We are very careful to be extremely
-        restrictive on what goes inside the span tag, as if an errant code
-        gets in there it could get messy.</li>
-    <li>The HTML is then purified as usual.</li>
-    <li>Then, another preg_replace replaces the span tag with a fully fledged
-        object. Note that the embed is removed, and, in its place, a data
-        attribute was added to the object. This makes the tag standards
-        compliant! It also breaks Internet Explorer, so we add in a bit of
-        conditional comments with the old embed code to make it work again.
-        It's all quite convoluted but works.</li>
-</ol>
-
-<h2>Warning</h2>
-
-<p>There are a number of possible problems with the code above, depending
-on how you look at it.</p>
-
-<h3>Cannot change width and height</h3>
-
-<p>The width and height of the final YouTube movie cannot be adjusted. This
-is because I am lazy. If you really insist on letting users change the size
-of the movie, what you need to do is package up the attributes inside the
-span tag (along with the movie ID). It gets complicated though: a malicious
-user can specify an outrageously large height and width and attempt to crash
-the user's operating system/browser. You need to either cap it by limiting
-the amount of digits allowed in the regex or using a callback to check the
-number.</p>
-
-<h3>Trusts media's host's security</h3>
-
-<p>By allowing this code onto our website, we are trusting that YouTube has
-tech-savvy enough people not to allow their users to inject malicious
-code into the Flash files.  An exploit on YouTube means an exploit on your
-site.  Even though YouTube is run by the reputable Google, it
-<a href="http://ha.ckers.org/blog/20061213/google-xss-vuln/">doesn't</a>
-mean they are
-<a href="http://ha.ckers.org/blog/20061208/xss-in-googles-orkut/">invulnerable.</a>
-You're putting a certain measure of the job on an external provider (just as
-you have by entrusting your user input to HTML Purifier), and
-it is important that you are cognizant of the risk.</p>
-
-<h3>Poorly written adaptations compromise security</h3>
-
-<p>This should go without saying, but if you're going to adapt this code
-for Google Video or the like, make sure you do it <em>right</em>. It's
-extremely easy to allow a character too many in <code>postFilter()</code> and
-suddenly you're introducing XSS into HTML Purifier's XSS free output. HTML
-Purifier may be well written, but it cannot guard against vulnerabilities
-introduced after it has finished.</p>
-
-<h2>Help out!</h2>
-
-<p>If you write a filter for your favorite video destination (or anything
-like that, for that matter), send it over and it might get included
-with the core!</p>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 196
main/inc/lib/htmlpurifier/docs/entities/xhtml-lat1.ent

@@ -1,196 +0,0 @@
-<!-- Portions (C) International Organization for Standardization 1986
-     Permission to copy in any form is granted for use with
-     conforming SGML systems and applications as defined in
-     ISO 8879, provided this notice is included in all copies.
--->
-<!-- Character entity set. Typical invocation:
-    <!ENTITY % HTMLlat1 PUBLIC
-       "-//W3C//ENTITIES Latin 1 for XHTML//EN"
-       "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
-    %HTMLlat1;
--->
-
-<!ENTITY nbsp   "&#160;"> <!-- no-break space = non-breaking space,
-                                  U+00A0 ISOnum -->
-<!ENTITY iexcl  "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
-<!ENTITY cent   "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
-<!ENTITY pound  "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
-<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
-<!ENTITY yen    "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
-<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
-                                  U+00A6 ISOnum -->
-<!ENTITY sect   "&#167;"> <!-- section sign, U+00A7 ISOnum -->
-<!ENTITY uml    "&#168;"> <!-- diaeresis = spacing diaeresis,
-                                  U+00A8 ISOdia -->
-<!ENTITY copy   "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
-<!ENTITY ordf   "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
-<!ENTITY laquo  "&#171;"> <!-- left-pointing double angle quotation mark
-                                  = left pointing guillemet, U+00AB ISOnum -->
-<!ENTITY not    "&#172;"> <!-- not sign = angled dash,
-                                  U+00AC ISOnum -->
-<!ENTITY shy    "&#173;"> <!-- soft hyphen = discretionary hyphen,
-                                  U+00AD ISOnum -->
-<!ENTITY reg    "&#174;"> <!-- registered sign = registered trade mark sign,
-                                  U+00AE ISOnum -->
-<!ENTITY macr   "&#175;"> <!-- macron = spacing macron = overline
-                                  = APL overbar, U+00AF ISOdia -->
-<!ENTITY deg    "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
-<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
-                                  U+00B1 ISOnum -->
-<!ENTITY sup2   "&#178;"> <!-- superscript two = superscript digit two
-                                  = squared, U+00B2 ISOnum -->
-<!ENTITY sup3   "&#179;"> <!-- superscript three = superscript digit three
-                                  = cubed, U+00B3 ISOnum -->
-<!ENTITY acute  "&#180;"> <!-- acute accent = spacing acute,
-                                  U+00B4 ISOdia -->
-<!ENTITY micro  "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
-<!ENTITY para   "&#182;"> <!-- pilcrow sign = paragraph sign,
-                                  U+00B6 ISOnum -->
-<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
-                                  = Greek middle dot, U+00B7 ISOnum -->
-<!ENTITY cedil  "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
-<!ENTITY sup1   "&#185;"> <!-- superscript one = superscript digit one,
-                                  U+00B9 ISOnum -->
-<!ENTITY ordm   "&#186;"> <!-- masculine ordinal indicator,
-                                  U+00BA ISOnum -->
-<!ENTITY raquo  "&#187;"> <!-- right-pointing double angle quotation mark
-                                  = right pointing guillemet, U+00BB ISOnum -->
-<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
-                                  = fraction one quarter, U+00BC ISOnum -->
-<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
-                                  = fraction one half, U+00BD ISOnum -->
-<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
-                                  = fraction three quarters, U+00BE ISOnum -->
-<!ENTITY iquest "&#191;"> <!-- inverted question mark
-                                  = turned question mark, U+00BF ISOnum -->
-<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
-                                  = latin capital letter A grave,
-                                  U+00C0 ISOlat1 -->
-<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
-                                  U+00C1 ISOlat1 -->
-<!ENTITY Acirc  "&#194;"> <!-- latin capital letter A with circumflex,
-                                  U+00C2 ISOlat1 -->
-<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
-                                  U+00C3 ISOlat1 -->
-<!ENTITY Auml   "&#196;"> <!-- latin capital letter A with diaeresis,
-                                  U+00C4 ISOlat1 -->
-<!ENTITY Aring  "&#197;"> <!-- latin capital letter A with ring above
-                                  = latin capital letter A ring,
-                                  U+00C5 ISOlat1 -->
-<!ENTITY AElig  "&#198;"> <!-- latin capital letter AE
-                                  = latin capital ligature AE,
-                                  U+00C6 ISOlat1 -->
-<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
-                                  U+00C7 ISOlat1 -->
-<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
-                                  U+00C8 ISOlat1 -->
-<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
-                                  U+00C9 ISOlat1 -->
-<!ENTITY Ecirc  "&#202;"> <!-- latin capital letter E with circumflex,
-                                  U+00CA ISOlat1 -->
-<!ENTITY Euml   "&#203;"> <!-- latin capital letter E with diaeresis,
-                                  U+00CB ISOlat1 -->
-<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
-                                  U+00CC ISOlat1 -->
-<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
-                                  U+00CD ISOlat1 -->
-<!ENTITY Icirc  "&#206;"> <!-- latin capital letter I with circumflex,
-                                  U+00CE ISOlat1 -->
-<!ENTITY Iuml   "&#207;"> <!-- latin capital letter I with diaeresis,
-                                  U+00CF ISOlat1 -->
-<!ENTITY ETH    "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
-<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
-                                  U+00D1 ISOlat1 -->
-<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
-                                  U+00D2 ISOlat1 -->
-<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
-                                  U+00D3 ISOlat1 -->
-<!ENTITY Ocirc  "&#212;"> <!-- latin capital letter O with circumflex,
-                                  U+00D4 ISOlat1 -->
-<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
-                                  U+00D5 ISOlat1 -->
-<!ENTITY Ouml   "&#214;"> <!-- latin capital letter O with diaeresis,
-                                  U+00D6 ISOlat1 -->
-<!ENTITY times  "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
-<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
-                                  = latin capital letter O slash,
-                                  U+00D8 ISOlat1 -->
-<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
-                                  U+00D9 ISOlat1 -->
-<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
-                                  U+00DA ISOlat1 -->
-<!ENTITY Ucirc  "&#219;"> <!-- latin capital letter U with circumflex,
-                                  U+00DB ISOlat1 -->
-<!ENTITY Uuml   "&#220;"> <!-- latin capital letter U with diaeresis,
-                                  U+00DC ISOlat1 -->
-<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
-                                  U+00DD ISOlat1 -->
-<!ENTITY THORN  "&#222;"> <!-- latin capital letter THORN,
-                                  U+00DE ISOlat1 -->
-<!ENTITY szlig  "&#223;"> <!-- latin small letter sharp s = ess-zed,
-                                  U+00DF ISOlat1 -->
-<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
-                                  = latin small letter a grave,
-                                  U+00E0 ISOlat1 -->
-<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
-                                  U+00E1 ISOlat1 -->
-<!ENTITY acirc  "&#226;"> <!-- latin small letter a with circumflex,
-                                  U+00E2 ISOlat1 -->
-<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
-                                  U+00E3 ISOlat1 -->
-<!ENTITY auml   "&#228;"> <!-- latin small letter a with diaeresis,
-                                  U+00E4 ISOlat1 -->
-<!ENTITY aring  "&#229;"> <!-- latin small letter a with ring above
-                                  = latin small letter a ring,
-                                  U+00E5 ISOlat1 -->
-<!ENTITY aelig  "&#230;"> <!-- latin small letter ae
-                                  = latin small ligature ae, U+00E6 ISOlat1 -->
-<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
-                                  U+00E7 ISOlat1 -->
-<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
-                                  U+00E8 ISOlat1 -->
-<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
-                                  U+00E9 ISOlat1 -->
-<!ENTITY ecirc  "&#234;"> <!-- latin small letter e with circumflex,
-                                  U+00EA ISOlat1 -->
-<!ENTITY euml   "&#235;"> <!-- latin small letter e with diaeresis,
-                                  U+00EB ISOlat1 -->
-<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
-                                  U+00EC ISOlat1 -->
-<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
-                                  U+00ED ISOlat1 -->
-<!ENTITY icirc  "&#238;"> <!-- latin small letter i with circumflex,
-                                  U+00EE ISOlat1 -->
-<!ENTITY iuml   "&#239;"> <!-- latin small letter i with diaeresis,
-                                  U+00EF ISOlat1 -->
-<!ENTITY eth    "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
-<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
-                                  U+00F1 ISOlat1 -->
-<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
-                                  U+00F2 ISOlat1 -->
-<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
-                                  U+00F3 ISOlat1 -->
-<!ENTITY ocirc  "&#244;"> <!-- latin small letter o with circumflex,
-                                  U+00F4 ISOlat1 -->
-<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
-                                  U+00F5 ISOlat1 -->
-<!ENTITY ouml   "&#246;"> <!-- latin small letter o with diaeresis,
-                                  U+00F6 ISOlat1 -->
-<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
-<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
-                                  = latin small letter o slash,
-                                  U+00F8 ISOlat1 -->
-<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
-                                  U+00F9 ISOlat1 -->
-<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
-                                  U+00FA ISOlat1 -->
-<!ENTITY ucirc  "&#251;"> <!-- latin small letter u with circumflex,
-                                  U+00FB ISOlat1 -->
-<!ENTITY uuml   "&#252;"> <!-- latin small letter u with diaeresis,
-                                  U+00FC ISOlat1 -->
-<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
-                                  U+00FD ISOlat1 -->
-<!ENTITY thorn  "&#254;"> <!-- latin small letter thorn,
-                                  U+00FE ISOlat1 -->
-<!ENTITY yuml   "&#255;"> <!-- latin small letter y with diaeresis,
-                                  U+00FF ISOlat1 -->

+ 0 - 80
main/inc/lib/htmlpurifier/docs/entities/xhtml-special.ent

@@ -1,80 +0,0 @@
-<!-- Special characters for XHTML -->
-
-<!-- Character entity set. Typical invocation:
-     <!ENTITY % HTMLspecial PUBLIC
-        "-//W3C//ENTITIES Special for XHTML//EN"
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
-     %HTMLspecial;
--->
-
-<!-- Portions (C) International Organization for Standardization 1986:
-     Permission to copy in any form is granted for use with
-     conforming SGML systems and applications as defined in
-     ISO 8879, provided this notice is included in all copies.
--->
-
-<!-- Relevant ISO entity set is given unless names are newly introduced.
-     New names (i.e., not in ISO 8879 list) do not clash with any
-     existing ISO 8879 entity names. ISO 10646 character numbers
-     are given for each character, in hex. values are decimal
-     conversions of the ISO 10646 values and refer to the document
-     character set. Names are Unicode names. 
--->
-
-<!-- C0 Controls and Basic Latin -->
-<!ENTITY quot    "&#34;"> <!--  quotation mark, U+0022 ISOnum -->
-<!ENTITY amp     "&#38;#38;"> <!--  ampersand, U+0026 ISOnum -->
-<!ENTITY lt      "&#38;#60;"> <!--  less-than sign, U+003C ISOnum -->
-<!ENTITY gt      "&#62;"> <!--  greater-than sign, U+003E ISOnum -->
-<!ENTITY apos	 "&#39;"> <!--  apostrophe = APL quote, U+0027 ISOnum -->
-
-<!-- Latin Extended-A -->
-<!ENTITY OElig   "&#338;"> <!--  latin capital ligature OE,
-                                    U+0152 ISOlat2 -->
-<!ENTITY oelig   "&#339;"> <!--  latin small ligature oe, U+0153 ISOlat2 -->
-<!-- ligature is a misnomer, this is a separate character in some languages -->
-<!ENTITY Scaron  "&#352;"> <!--  latin capital letter S with caron,
-                                    U+0160 ISOlat2 -->
-<!ENTITY scaron  "&#353;"> <!--  latin small letter s with caron,
-                                    U+0161 ISOlat2 -->
-<!ENTITY Yuml    "&#376;"> <!--  latin capital letter Y with diaeresis,
-                                    U+0178 ISOlat2 -->
-
-<!-- Spacing Modifier Letters -->
-<!ENTITY circ    "&#710;"> <!--  modifier letter circumflex accent,
-                                    U+02C6 ISOpub -->
-<!ENTITY tilde   "&#732;"> <!--  small tilde, U+02DC ISOdia -->
-
-<!-- General Punctuation -->
-<!ENTITY ensp    "&#8194;"> <!-- en space, U+2002 ISOpub -->
-<!ENTITY emsp    "&#8195;"> <!-- em space, U+2003 ISOpub -->
-<!ENTITY thinsp  "&#8201;"> <!-- thin space, U+2009 ISOpub -->
-<!ENTITY zwnj    "&#8204;"> <!-- zero width non-joiner,
-                                    U+200C NEW RFC 2070 -->
-<!ENTITY zwj     "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
-<!ENTITY lrm     "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
-<!ENTITY rlm     "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
-<!ENTITY ndash   "&#8211;"> <!-- en dash, U+2013 ISOpub -->
-<!ENTITY mdash   "&#8212;"> <!-- em dash, U+2014 ISOpub -->
-<!ENTITY lsquo   "&#8216;"> <!-- left single quotation mark,
-                                    U+2018 ISOnum -->
-<!ENTITY rsquo   "&#8217;"> <!-- right single quotation mark,
-                                    U+2019 ISOnum -->
-<!ENTITY sbquo   "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
-<!ENTITY ldquo   "&#8220;"> <!-- left double quotation mark,
-                                    U+201C ISOnum -->
-<!ENTITY rdquo   "&#8221;"> <!-- right double quotation mark,
-                                    U+201D ISOnum -->
-<!ENTITY bdquo   "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
-<!ENTITY dagger  "&#8224;"> <!-- dagger, U+2020 ISOpub -->
-<!ENTITY Dagger  "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
-<!ENTITY permil  "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
-<!ENTITY lsaquo  "&#8249;"> <!-- single left-pointing angle quotation mark,
-                                    U+2039 ISO proposed -->
-<!-- lsaquo is proposed but not yet ISO standardized -->
-<!ENTITY rsaquo  "&#8250;"> <!-- single right-pointing angle quotation mark,
-                                    U+203A ISO proposed -->
-<!-- rsaquo is proposed but not yet ISO standardized -->
-
-<!-- Currency Symbols -->
-<!ENTITY euro   "&#8364;"> <!--  euro sign, U+20AC NEW -->

+ 0 - 237
main/inc/lib/htmlpurifier/docs/entities/xhtml-symbol.ent

@@ -1,237 +0,0 @@
-<!-- Mathematical, Greek and Symbolic characters for XHTML -->
-
-<!-- Character entity set. Typical invocation:
-     <!ENTITY % HTMLsymbol PUBLIC
-        "-//W3C//ENTITIES Symbols for XHTML//EN"
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
-     %HTMLsymbol;
--->
-
-<!-- Portions (C) International Organization for Standardization 1986:
-     Permission to copy in any form is granted for use with
-     conforming SGML systems and applications as defined in
-     ISO 8879, provided this notice is included in all copies.
--->
-
-<!-- Relevant ISO entity set is given unless names are newly introduced.
-     New names (i.e., not in ISO 8879 list) do not clash with any
-     existing ISO 8879 entity names. ISO 10646 character numbers
-     are given for each character, in hex. values are decimal
-     conversions of the ISO 10646 values and refer to the document
-     character set. Names are Unicode names. 
--->
-
-<!-- Latin Extended-B -->
-<!ENTITY fnof     "&#402;"> <!-- latin small letter f with hook = function
-                                    = florin, U+0192 ISOtech -->
-
-<!-- Greek -->
-<!ENTITY Alpha    "&#913;"> <!-- greek capital letter alpha, U+0391 -->
-<!ENTITY Beta     "&#914;"> <!-- greek capital letter beta, U+0392 -->
-<!ENTITY Gamma    "&#915;"> <!-- greek capital letter gamma,
-                                    U+0393 ISOgrk3 -->
-<!ENTITY Delta    "&#916;"> <!-- greek capital letter delta,
-                                    U+0394 ISOgrk3 -->
-<!ENTITY Epsilon  "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
-<!ENTITY Zeta     "&#918;"> <!-- greek capital letter zeta, U+0396 -->
-<!ENTITY Eta      "&#919;"> <!-- greek capital letter eta, U+0397 -->
-<!ENTITY Theta    "&#920;"> <!-- greek capital letter theta,
-                                    U+0398 ISOgrk3 -->
-<!ENTITY Iota     "&#921;"> <!-- greek capital letter iota, U+0399 -->
-<!ENTITY Kappa    "&#922;"> <!-- greek capital letter kappa, U+039A -->
-<!ENTITY Lambda   "&#923;"> <!-- greek capital letter lamda,
-                                    U+039B ISOgrk3 -->
-<!ENTITY Mu       "&#924;"> <!-- greek capital letter mu, U+039C -->
-<!ENTITY Nu       "&#925;"> <!-- greek capital letter nu, U+039D -->
-<!ENTITY Xi       "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
-<!ENTITY Omicron  "&#927;"> <!-- greek capital letter omicron, U+039F -->
-<!ENTITY Pi       "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
-<!ENTITY Rho      "&#929;"> <!-- greek capital letter rho, U+03A1 -->
-<!-- there is no Sigmaf, and no U+03A2 character either -->
-<!ENTITY Sigma    "&#931;"> <!-- greek capital letter sigma,
-                                    U+03A3 ISOgrk3 -->
-<!ENTITY Tau      "&#932;"> <!-- greek capital letter tau, U+03A4 -->
-<!ENTITY Upsilon  "&#933;"> <!-- greek capital letter upsilon,
-                                    U+03A5 ISOgrk3 -->
-<!ENTITY Phi      "&#934;"> <!-- greek capital letter phi,
-                                    U+03A6 ISOgrk3 -->
-<!ENTITY Chi      "&#935;"> <!-- greek capital letter chi, U+03A7 -->
-<!ENTITY Psi      "&#936;"> <!-- greek capital letter psi,
-                                    U+03A8 ISOgrk3 -->
-<!ENTITY Omega    "&#937;"> <!-- greek capital letter omega,
-                                    U+03A9 ISOgrk3 -->
-
-<!ENTITY alpha    "&#945;"> <!-- greek small letter alpha,
-                                    U+03B1 ISOgrk3 -->
-<!ENTITY beta     "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
-<!ENTITY gamma    "&#947;"> <!-- greek small letter gamma,
-                                    U+03B3 ISOgrk3 -->
-<!ENTITY delta    "&#948;"> <!-- greek small letter delta,
-                                    U+03B4 ISOgrk3 -->
-<!ENTITY epsilon  "&#949;"> <!-- greek small letter epsilon,
-                                    U+03B5 ISOgrk3 -->
-<!ENTITY zeta     "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
-<!ENTITY eta      "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
-<!ENTITY theta    "&#952;"> <!-- greek small letter theta,
-                                    U+03B8 ISOgrk3 -->
-<!ENTITY iota     "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
-<!ENTITY kappa    "&#954;"> <!-- greek small letter kappa,
-                                    U+03BA ISOgrk3 -->
-<!ENTITY lambda   "&#955;"> <!-- greek small letter lamda,
-                                    U+03BB ISOgrk3 -->
-<!ENTITY mu       "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
-<!ENTITY nu       "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
-<!ENTITY xi       "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
-<!ENTITY omicron  "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
-<!ENTITY pi       "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
-<!ENTITY rho      "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
-<!ENTITY sigmaf   "&#962;"> <!-- greek small letter final sigma,
-                                    U+03C2 ISOgrk3 -->
-<!ENTITY sigma    "&#963;"> <!-- greek small letter sigma,
-                                    U+03C3 ISOgrk3 -->
-<!ENTITY tau      "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
-<!ENTITY upsilon  "&#965;"> <!-- greek small letter upsilon,
-                                    U+03C5 ISOgrk3 -->
-<!ENTITY phi      "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
-<!ENTITY chi      "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
-<!ENTITY psi      "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
-<!ENTITY omega    "&#969;"> <!-- greek small letter omega,
-                                    U+03C9 ISOgrk3 -->
-<!ENTITY thetasym "&#977;"> <!-- greek theta symbol,
-                                    U+03D1 NEW -->
-<!ENTITY upsih    "&#978;"> <!-- greek upsilon with hook symbol,
-                                    U+03D2 NEW -->
-<!ENTITY piv      "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
-
-<!-- General Punctuation -->
-<!ENTITY bull     "&#8226;"> <!-- bullet = black small circle,
-                                     U+2022 ISOpub  -->
-<!-- bullet is NOT the same as bullet operator, U+2219 -->
-<!ENTITY hellip   "&#8230;"> <!-- horizontal ellipsis = three dot leader,
-                                     U+2026 ISOpub  -->
-<!ENTITY prime    "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
-<!ENTITY Prime    "&#8243;"> <!-- double prime = seconds = inches,
-                                     U+2033 ISOtech -->
-<!ENTITY oline    "&#8254;"> <!-- overline = spacing overscore,
-                                     U+203E NEW -->
-<!ENTITY frasl    "&#8260;"> <!-- fraction slash, U+2044 NEW -->
-
-<!-- Letterlike Symbols -->
-<!ENTITY weierp   "&#8472;"> <!-- script capital P = power set
-                                     = Weierstrass p, U+2118 ISOamso -->
-<!ENTITY image    "&#8465;"> <!-- black-letter capital I = imaginary part,
-                                     U+2111 ISOamso -->
-<!ENTITY real     "&#8476;"> <!-- black-letter capital R = real part symbol,
-                                     U+211C ISOamso -->
-<!ENTITY trade    "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
-<!ENTITY alefsym  "&#8501;"> <!-- alef symbol = first transfinite cardinal,
-                                     U+2135 NEW -->
-<!-- alef symbol is NOT the same as hebrew letter alef,
-     U+05D0 although the same glyph could be used to depict both characters -->
-
-<!-- Arrows -->
-<!ENTITY larr     "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
-<!ENTITY uarr     "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
-<!ENTITY rarr     "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
-<!ENTITY darr     "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
-<!ENTITY harr     "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
-<!ENTITY crarr    "&#8629;"> <!-- downwards arrow with corner leftwards
-                                     = carriage return, U+21B5 NEW -->
-<!ENTITY lArr     "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
-<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
-    but also does not have any other character for that function. So lArr can
-    be used for 'is implied by' as ISOtech suggests -->
-<!ENTITY uArr     "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
-<!ENTITY rArr     "&#8658;"> <!-- rightwards double arrow,
-                                     U+21D2 ISOtech -->
-<!-- Unicode does not say this is the 'implies' character but does not have 
-     another character with this function so rArr can be used for 'implies'
-     as ISOtech suggests -->
-<!ENTITY dArr     "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
-<!ENTITY hArr     "&#8660;"> <!-- left right double arrow,
-                                     U+21D4 ISOamsa -->
-
-<!-- Mathematical Operators -->
-<!ENTITY forall   "&#8704;"> <!-- for all, U+2200 ISOtech -->
-<!ENTITY part     "&#8706;"> <!-- partial differential, U+2202 ISOtech  -->
-<!ENTITY exist    "&#8707;"> <!-- there exists, U+2203 ISOtech -->
-<!ENTITY empty    "&#8709;"> <!-- empty set = null set, U+2205 ISOamso -->
-<!ENTITY nabla    "&#8711;"> <!-- nabla = backward difference,
-                                     U+2207 ISOtech -->
-<!ENTITY isin     "&#8712;"> <!-- element of, U+2208 ISOtech -->
-<!ENTITY notin    "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
-<!ENTITY ni       "&#8715;"> <!-- contains as member, U+220B ISOtech -->
-<!ENTITY prod     "&#8719;"> <!-- n-ary product = product sign,
-                                     U+220F ISOamsb -->
-<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
-     the same glyph might be used for both -->
-<!ENTITY sum      "&#8721;"> <!-- n-ary summation, U+2211 ISOamsb -->
-<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
-     though the same glyph might be used for both -->
-<!ENTITY minus    "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
-<!ENTITY lowast   "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
-<!ENTITY radic    "&#8730;"> <!-- square root = radical sign,
-                                     U+221A ISOtech -->
-<!ENTITY prop     "&#8733;"> <!-- proportional to, U+221D ISOtech -->
-<!ENTITY infin    "&#8734;"> <!-- infinity, U+221E ISOtech -->
-<!ENTITY ang      "&#8736;"> <!-- angle, U+2220 ISOamso -->
-<!ENTITY and      "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
-<!ENTITY or       "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
-<!ENTITY cap      "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
-<!ENTITY cup      "&#8746;"> <!-- union = cup, U+222A ISOtech -->
-<!ENTITY int      "&#8747;"> <!-- integral, U+222B ISOtech -->
-<!ENTITY there4   "&#8756;"> <!-- therefore, U+2234 ISOtech -->
-<!ENTITY sim      "&#8764;"> <!-- tilde operator = varies with = similar to,
-                                     U+223C ISOtech -->
-<!-- tilde operator is NOT the same character as the tilde, U+007E,
-     although the same glyph might be used to represent both  -->
-<!ENTITY cong     "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
-<!ENTITY asymp    "&#8776;"> <!-- almost equal to = asymptotic to,
-                                     U+2248 ISOamsr -->
-<!ENTITY ne       "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
-<!ENTITY equiv    "&#8801;"> <!-- identical to, U+2261 ISOtech -->
-<!ENTITY le       "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
-<!ENTITY ge       "&#8805;"> <!-- greater-than or equal to,
-                                     U+2265 ISOtech -->
-<!ENTITY sub      "&#8834;"> <!-- subset of, U+2282 ISOtech -->
-<!ENTITY sup      "&#8835;"> <!-- superset of, U+2283 ISOtech -->
-<!ENTITY nsub     "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
-<!ENTITY sube     "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
-<!ENTITY supe     "&#8839;"> <!-- superset of or equal to,
-                                     U+2287 ISOtech -->
-<!ENTITY oplus    "&#8853;"> <!-- circled plus = direct sum,
-                                     U+2295 ISOamsb -->
-<!ENTITY otimes   "&#8855;"> <!-- circled times = vector product,
-                                     U+2297 ISOamsb -->
-<!ENTITY perp     "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
-                                     U+22A5 ISOtech -->
-<!ENTITY sdot     "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
-<!-- dot operator is NOT the same character as U+00B7 middle dot -->
-
-<!-- Miscellaneous Technical -->
-<!ENTITY lceil    "&#8968;"> <!-- left ceiling = APL upstile,
-                                     U+2308 ISOamsc  -->
-<!ENTITY rceil    "&#8969;"> <!-- right ceiling, U+2309 ISOamsc  -->
-<!ENTITY lfloor   "&#8970;"> <!-- left floor = APL downstile,
-                                     U+230A ISOamsc  -->
-<!ENTITY rfloor   "&#8971;"> <!-- right floor, U+230B ISOamsc  -->
-<!ENTITY lang     "&#9001;"> <!-- left-pointing angle bracket = bra,
-                                     U+2329 ISOtech -->
-<!-- lang is NOT the same character as U+003C 'less than sign' 
-     or U+2039 'single left-pointing angle quotation mark' -->
-<!ENTITY rang     "&#9002;"> <!-- right-pointing angle bracket = ket,
-                                     U+232A ISOtech -->
-<!-- rang is NOT the same character as U+003E 'greater than sign' 
-     or U+203A 'single right-pointing angle quotation mark' -->
-
-<!-- Geometric Shapes -->
-<!ENTITY loz      "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
-
-<!-- Miscellaneous Symbols -->
-<!ENTITY spades   "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
-<!-- black here seems to mean filled as opposed to hollow -->
-<!ENTITY clubs    "&#9827;"> <!-- black club suit = shamrock,
-                                     U+2663 ISOpub -->
-<!ENTITY hearts   "&#9829;"> <!-- black heart suit = valentine,
-                                     U+2665 ISOpub -->
-<!ENTITY diams    "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->

+ 0 - 23
main/inc/lib/htmlpurifier/docs/examples/basic.php

@@ -1,23 +0,0 @@
-<?php
-
-// This file demonstrates basic usage of HTMLPurifier.
-
-// replace this with the path to the HTML Purifier library
-require_once '../../library/HTMLPurifier.auto.php';
-
-$config = HTMLPurifier_Config::createDefault();
-
-// configuration goes here:
-$config->set('Core', 'Encoding', 'UTF-8'); // replace with your encoding
-$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional'); // replace with your doctype
-
-$purifier = new HTMLPurifier($config);
-
-// untrusted input HTML
-$html = '<b>Simple and short';
-
-$pure_html = $purifier->purify($html);
-
-echo '<pre>' . htmlspecialchars($pure_html) . '</pre>';
-
-// vim: et sw=4 sts=4

+ 0 - 8
main/inc/lib/htmlpurifier/docs/fixquotes.htc

@@ -1,8 +0,0 @@
-<public:attach event="oncontentready" onevent="init();" />
-<script>
-function init() {
-  element.innerHTML = '&#8220;'+element.innerHTML+'&#8221;';
-}
-</script>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 181
main/inc/lib/htmlpurifier/docs/index.html

@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Index to all HTML Purifier documentation." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Documentation - HTML Purifier</title>
-
-</head>
-<body>
-
-<h1>Documentation</h1>
-
-<p><strong><a href="http://htmlpurifier.org/">HTML Purifier</a></strong> has documentation for all types of people.
-Here is an index of all of them.</p>
-
-<h2>End-user</h2>
-<p>End-user documentation that contains articles, tutorials and useful
-information for casual developers using HTML Purifier.</p>
-
-<dl>
-
-<dt><a href="enduser-id.html">IDs</a></dt>
-<dd>Explains various methods for allowing IDs in documents safely.</dd>
-
-<dt><a href="enduser-youtube.html">Embedding YouTube videos</a></dt>
-<dd>Explains how to safely allow the embedding of flash from trusted sites.</dd>
-
-<dt><a href="enduser-slow.html">Speeding up HTML Purifier</a></dt>
-<dd>Explains how to speed up HTML Purifier through caching or inbound filtering.</dd>
-
-<dt><a href="enduser-utf8.html">UTF-8: The Secret of Character Encoding</a></dt>
-<dd>Describes the rationale for using UTF-8, the ramifications otherwise, and how to make the switch.</dd>
-
-<dt><a href="enduser-tidy.html">Tidy</a></dt>
-<dd>Tutorial for tweaking HTML Purifier's Tidy-like behavior.</dd>
-
-<dt><a href="enduser-customize.html">Customize</a></dt>
-<dd>Tutorial for customizing HTML Purifier's tag and attribute sets.</dd>
-
-<dt><a href="enduser-uri-filter.html">URI Filters</a></dt>
-<dd>Tutorial for creating custom URI filters.</dd>
-
-</dl>
-
-<h2>Development</h2>
-<p>Developer documentation detailing code issues, roadmaps and project
-conventions.</p>
-
-<dl>
-
-<dt><a href="dev-progress.html">Implementation Progress</a></dt>
-<dd>Tables detailing HTML element and CSS property implementation coverage.</dd>
-
-<dt><a href="dev-naming.html">Naming Conventions</a></dt>
-<dd>Defines class naming conventions.</dd>
-
-<dt><a href="dev-optimization.html">Optimization</a></dt>
-<dd>Discusses possible methods of optimizing HTML Purifier.</dd>
-
-<dt><a href="dev-flush.html">Flushing the Purifier</a></dt>
-<dd>Discusses when to flush HTML Purifier's various caches.</dd>
-
-<dt><a href="dev-advanced-api.html">Advanced API</a></dt>
-<dd>Specification for HTML Purifier's advanced API for defining
-custom filtering behavior.</dd>
-
-<dt><a href="dev-config-schema.html">Config Schema</a></dt>
-<dd>Describes config schema framework in HTML Purifier.</dd>
-
-</dl>
-
-<h2>Proposals</h2>
-<p>Proposed features, as well as the associated rambling to get a clear
-objective in place before attempted implementation.</p>
-
-<dl>
-<dt><a href="proposal-colors.html">Colors</a></dt>
-<dd>Proposal to allow for color constraints.</dd>
-</dl>
-
-<h2>Reference</h2>
-<p>Miscellaneous essays, research pieces and other reference type material
-that may not directly discuss HTML Purifier.</p>
-
-<dl>
-<dt><a href="ref-devnetwork.html">DevNetwork Credits</a></dt>
-<dd>Credits and links to DevNetwork forum topics.</dd>
-</dl>
-
-<h2>Internal memos</h2>
-
-<p>Plaintext documents that are more for use by active developers of
-the code. They may be upgraded to HTML files or stay as TXT scratchpads.</p>
-
-<table class="table">
-
-<thead><tr>
-    <th style="width:10%">Type</th>
-    <th style="width:20%">Name</th>
-    <th>Description</th>
-</tr></thead>
-
-<tbody>
-
-<tr>
-    <td>End-user</td>
-    <td><a href="enduser-overview.txt">Overview</a></td>
-    <td>High level overview of the general control flow (mostly obsolete).</td>
-</tr>
-
-<tr>
-    <td>End-user</td>
-    <td><a href="enduser-security.txt">Security</a></td>
-    <td>Common security issues that may still arise (half-baked).</td>
-</tr>
-
-<tr>
-    <td>Development</td>
-    <td><a href="dev-code-quality.txt">Code Quality Issues</a></td>
-    <td>Enumerates code quality issues and places that need to be refactored.</td>
-</tr>
-
-<tr>
-    <td>Proposal</td>
-    <td><a href="proposal-filter-levels.txt">Filter levels</a></td>
-    <td>Outlines details of projected configurable level of filtering.</td>
-</tr>
-
-<tr>
-    <td>Proposal</td>
-    <td><a href="proposal-language.txt">Language</a></td>
-    <td>Specification of I18N for error messages derived from MediaWiki (half-baked).</td>
-</tr>
-
-<tr>
-    <td>Proposal</td>
-    <td><a href="proposal-new-directives.txt">New directives</a></td>
-    <td>Assorted configuration options that could be implemented.</td>
-</tr>
-
-<tr>
-    <td>Proposal</td>
-    <td><a href="proposal-css-extraction.txt">CSS extraction</a></td>
-    <td>Taking the inline CSS out of documents and into <code>style</code>.</td>
-</tr>
-
-<tr>
-    <td>Reference</td>
-    <td><a href="ref-content-models.txt">Handling Content Model Changes</a></td>
-    <td>Discusses how to tidy up content model changes using custom ChildDef classes.</td>
-</tr>
-
-<tr>
-    <td>Reference</td>
-    <td><a href="ref-proprietary-tags.txt">Proprietary tags</a></td>
-    <td>List of vendor-specific tags we may want to transform to W3C compliant markup.</td>
-</tr>
-
-<tr>
-    <td>Reference</td>
-    <td><a href="ref-html-modularization.txt">Modularization of HTMLDefinition</a></td>
-    <td>Provides a high-level overview of the concepts behind HTMLModules.</td>
-</tr>
-
-<tr>
-    <td>Reference</td>
-    <td><a href="ref-whatwg.txt">WHATWG</a></td>
-    <td>How WHATWG plays into what we need to do.</td>
-</tr>
-
-</tbody>
-
-</table>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 48
main/inc/lib/htmlpurifier/docs/proposal-colors.html

@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Proposal to allow for color constraints in HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>Proposal: Colors - HTML Purifier</title>
-
-</head><body>
-
-<h1 class="subtitled">Colors</h1>
-<div class="subtitle">Hammering some sense into those color-blind newbies</div>
-
-<div id="filing">Filed under Proposals</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>Your website probably has a color-scheme.
-<span style="color:#090; background:#FFF;">Green on white</span>,
-<span style="color:#A0F; background:#FF0;">purple on yellow</span>,
-whatever. When you give users the ability to style their content, you may
-want them to keep in line with your styling. If you're website is all
-about light colors, you don't want a user to come in and vandalize your
-page with a deep maroon.</p>
-
-<p>This is an extremely silly feature proposal, but I'm writing it down anyway.</p>
-
-<p>What if the user could constrain the colors specified in inline styles? You
-are only allowed to use these shades of dark green for text and these shades
-of light yellow for the background. At the very least, you could ensure
-that we did not have pale yellow on white text.</p>
-
-<h2>Implementation issues</h2>
-
-<ol>
-<li>Requires the color attribute definition to know, currently, what the text
-and background colors are. This becomes difficult when classes are thrown
-into the mix.</li>
-<li>The user still has to define the permissible colors, how does one do
-something like that?</li>
-</ol>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 23
main/inc/lib/htmlpurifier/docs/proposal-config.txt

@@ -1,23 +0,0 @@
-
-Configuration
-
-Configuration is documented on a per-use case: if a class uses a certain
-value from the configuration object, it has to define its name and what the
-value is used for.  This means decentralized configuration declarations that
-are nevertheless error checking and a centralized configuration object.
-
-Directives are divided into namespaces, indicating the major portion of
-functionality they cover (although there may be overlaps).  Please consult
-the documentation in ConfigDef for more information on these namespaces.
-
-Since configuration is dependant on context, internal classes require a
-configuration object to be passed as a parameter.  (They also require a
-Context object). A majority of classes do not need the config object,
-but for those who do, it is a lifesaver.
-
-Definition objects are complex datatypes influenced by their respective
-directive namespaces (HTMLDefinition with HTML and CSSDefinition with CSS).
-If any of these directives is updated, HTML Purifier forces the definition
-to be regenerated.
-
-    vim: et sw=4 sts=4

+ 0 - 34
main/inc/lib/htmlpurifier/docs/proposal-css-extraction.txt

@@ -1,34 +0,0 @@
-
-Extracting inline CSS from HTML Purifier
-    voodoofied: Assigning semantics to elements
-
-Sander Tekelenburg brought to my attention the poor programming style of
-inline CSS in HTML documents.  In an ideal world, we wouldn't be using inline
-CSS at all: everything would be assigned using semantic class attributes
-from an external stylesheet.
-
-With ExtractStyleBlocks and CSSTidy, this is now possible (when allowed, users
-can specify a style element which gets extracted from the user-submitted HTML, which
-the application can place in the head of the HTML document).  But there still
-is the issue of inline CSS that refuses to go away.
-
-The basic idea behind this feature is assign every element a unique identifier,
-and then move all of the CSS data to a style-sheet. This HTML:
-
-<div style="text-align:center">Big <span style="color:red;">things</span>!</div>
-
-into
-
-<div id="hp-12345">Big <span id="hp-12346">things</span>!</div>
-
-and a stylesheet that is:
-
-#hp-12345 {text-align:center;}
-#hp-12346 {color:red;}
-
-Beyond that, HTML Purifier can magically merge common CSS values together,
-and a whole manner of other heuristic things.  HTML Purifier should also
-make it easy for an admin to re-style the HTML semantically. Speed is not
-an issue. Also, better WYSIWYG editors are needed.
-
-    vim: et sw=4 sts=4

+ 0 - 211
main/inc/lib/htmlpurifier/docs/proposal-errors.txt

@@ -1,211 +0,0 @@
-Considerations for ErrorCollection
-
-Presently, HTML Purifier takes a code-execution centric approach to handling
-errors. Errors are organized and grouped according to which segment of the
-code triggers them, not necessarily the portion of the input document that
-triggered the error. This means that errors are pseudo-sorted by category,
-rather than location in the document.
-
-One easy way to "fix" this problem would be to re-sort according to line number.
-However, the "category" style information we derive from naively following
-program execution is still useful. After all, each of the strategies which
-can report errors still process the document mostly linearly. Furthermore,
-not only do they process linearly, but the way they pass off operations to
-sub-systems mirrors that of the document. For example, AttrValidator will
-linearly proceed through elements, and on each element will use AttrDef to
-validate those contents. From there, the attribute might have more
-sub-components, which have execution passed off accordingly.
-
-In fact, each strategy handles a very specific class of "error."
-
-RemoveForeignElements   - element tokens
-MakeWellFormed          - element token ordering
-FixNesting              - element token ordering
-ValidateAttributes      - attributes of elements
-
-The crucial point is that while we care about the hierarchy governing these
-different errors, we *don't* care about any other information about what actually
-happens to the elements. This brings up another point: if HTML Purifier fixes
-something, this is not really a notice/warning/error; it's really a suggestion
-of a way to fix the aforementioned defects.
-
-In short, the refactoring to take this into account kinda sucks.
-
-Errors should not be recorded in order that they are reported. Instead, they
-should be bound to the line (and preferably element) in which they were found.
-This means we need some way to uniquely identify every element in the document,
-which doesn't presently exist. An easy way of adding this would be to track
-line columns. An important ramification of this is that we *must* use the
-DirectLex implementation.
-
-    1. Implement column numbers for DirectLex [DONE!]
-    2. Disable error collection when not using DirectLex [DONE!]
-
-Next, we need to re-orient all of the error declarations to place CurrentToken
-at utmost important. Since this is passed via Context, it's not always clear
-if that's available. ErrorCollector should complain HARD if it isn't available.
-There are some locations when we don't have a token available. These include:
-
-    * Lexing - this can actually have a row and column, but NOT correspond to
-      a token
-    * End of document errors - bump this to the end
-
-Actually, we *don't* have to complain if CurrentToken isn't available; we just
-set it as a document-wide error. And actually, nothing needs to be done here.
-
-Something interesting to consider is whether or not we care about the locations
-of attributes and CSS properties, i.e. the sub-objects that compose these things.
-In terms of consistency, at the very least attributes should have column/line
-numbers attached to them. However, this may be overkill, as attributes are
-uniquely identifiable. You could go even further, with CSS, but they are also
-uniquely identifiable.
-
-Bottom-line is, however, this information must be available, in form of the
-CurrentAttribute and CurrentCssProperty (theoretical) context variables, and
-it must be used to organize the errors that the sub-processes may throw.
-There is also a hierarchy of sorts that may make merging this into one context
-variable more sense, if it hadn't been for HTML's reasonably rigid structure.
-A CSS property will never contain an HTML attribute. So we won't ever get
-recursive relations, and having multiple depths won't ever make sense. Leave
-this be.
-
-We already have this information, and consequently, using start and end is
-*unnecessary*, so long as the context variables are set appropriately. We don't
-care if an error was thrown by an attribute transform or an attribute definition;
-to the end user these are the same (for a developer, they are different, but
-they're better off with a stack trace (which we should add support for) in such
-cases).
-
-    3. Remove start()/end() code. Don't get rid of recursion, though [DONE]
-    4. Setup ErrorCollector to use context information to setup hierarchies.
-       This may require a different internal format. Use objects if it gets
-       complex. [DONE]
-
-       ASIDE
-            More on this topic: since we are now binding errors to lines
-            and columns, a particular error can have three relationships to that
-            specific location:
-
-            1. The token at that location directly
-                RemoveForeignElements
-                AttrValidator (transforms)
-                MakeWellFormed
-            2. A "component" of that token (i.e. attribute)
-                AttrValidator (removals)
-            3. A modification to that node (i.e. contents from start to end
-               token) as a whole
-                FixNesting
-
-            This needs to be marked accordingly. In the presentation, it might
-            make sense keep (3) separate, have (2) a sublist of (1). (1) can
-            be a closing tag, in which case (3) makes no sense at all, OR it
-            should be related with its opening tag (this may not necessarily
-            be possible before MakeWellFormed is run).
-
-            So, the line and column counts as our identifier, so:
-
-            $errors[$line][$col] = ...
-
-            Then, we need to identify case 1, 2 or 3. They are identified as
-            such:
-
-            1. Need some sort of semaphore in RemoveForeignElements, etc.
-            2. If CurrentAttr/CurrentCssProperty is non-null
-            3. Default (FixNesting, MakeWellFormed)
-
-            One consideration about (1) is that it usually is actually a
-            (3) modification, but we have no way of knowing about that because
-            of various optimizations. However, they can probably be treated
-            the same. The other difficulty is that (3) is never a line and
-            column; rather, it is a range (i.e. a duple) and telling the user
-            the very start of the range may confuse them. For example,
-
-            <b>Foo<div>bar</div></b>
-            ^     ^
-
-            The node being operated on is <b>, so the error would be assigned
-            to the first caret, with a "node reorganized" error. Then, the
-            ChildDef would have submitted its own suggestions and errors with
-            regard to what's going in the internals.  So I suppose this is
-            ok. :-)
-
-            Now, the structure of the earlier mentioned ... would be something
-            like this:
-
-            object {
-                type = (token|attr|property),
-                value, // appropriate for type
-                errors => array(),
-                sub-errors = [recursive],
-            }
-
-            This helps us keep things agnostic. It is also sufficiently complex
-            enough to warrant an object.
-
-So, more wanking about the object format is in order. The way HTML Purifier is
-currently setup, the only possible hierarchy is:
-
-    token -> attr -> css property
-
-These relations do not exist all of the time; a comment or end token would not
-ever have any attributes, and non-style attributes would never have CSS properties
-associated with them.
-
-I believe that it is worth supporting multiple paths. At some point, we might
-have a hierarchy like:
-
-    * -> syntax
-      -> token -> attr -> css property
-                       -> url
-               -> css stylesheet <style>
-
-et cetera. Now, one of the practical implications of this is that every "node"
-on our tree is well-defined, so in theory it should be possible to either 1.
-create a separate class for each error struct, or 2. embed this information
-directly into HTML Purifier's token stream.  Embedding the information in the
-token stream is not a terribly good idea, since tokens can be removed, etc.
-So that leaves us with 1... and if we use a generic interface we can cut down
-on a lot of code we might need. So let's leave it like this.
-
-~~~~
-
-Then we setup suggestions.
-
-    5. Setup a separate error class which tells the user any modifications
-       HTML Purifier made.
-
-Some information about this:
-
-Our current paradigm is to tell the user what HTML Purifier did to the HTML.
-This is the most natural mode of operation, since that's what HTML Purifier
-is all about; it was not meant to be a validator.
-
-However, most other people have experience dealing with a validator. In cases
-where HTML Purifier unambiguously does the right thing, simply giving the user
-the correct version isn't a bad idea, but problems arise when:
-
-- The user has such bad HTML we do something odd, when we should have just
-  flagged the HTML as an error. Such examples are when we do things like
-  remove text from directly inside a <table> tag. It was probably meant to
-  be in a <td> tag or be outside the table, but we're not smart enough to
-  realize this so we just remove it. In such a case, we should tell the user
-  that there was foreign data in the table, but then we shouldn't "demand"
-  the user remove the data; it's more of a "here's a possible way of
-  rectifying the problem"
-
-- Giving line context for input is hard enough, but feasible; giving output
-  line context will be extremely difficult due to shifting lines; we'd probably
-  have to track what the tokens are and then find the appropriate out context
-  and it's not guaranteed to work etc etc etc.
-
-````````````
-
-Don't forget to spruce up output.
-
-    6. Output needs to automatically give line and column numbers, basically
-       "at line" on steroids. Look at W3C's output; it's ok. [PARTIALLY DONE]
-
-       - We need a standard CSS to apply (check demo.css for some starting
-         styling; some buttons would also be hip)
-
-    vim: et sw=4 sts=4

+ 0 - 137
main/inc/lib/htmlpurifier/docs/proposal-filter-levels.txt

@@ -1,137 +0,0 @@
-
-Filter Levels
-    When one size *does not* fit all
-
-It makes little sense to constrain users to one set of HTML elements and
-attributes and tell them that they are not allowed to mold this in
-any fashion.  Many users demand to be able to custom-select which elements
-and attributes they want.  This is fine: because HTML Purifier keeps close
-track of what elements are safe to use, there is no way for them to
-accidently allow an XSS-able tag.
-
-However, combing through the HTML spec to make your own whitelist can
-be a daunting task.  HTML Purifier ought to offer pre-canned filter levels
-that amateur users can select based on what they think is their use-case.
-
-Here are some fuzzy levels you could set:
-
-1. Comments - Wordpress recommends a, abbr, acronym, b, blockquote, cite,
-    code, em, i, strike, strong; however, you could get away with only a, em and
-    p; also having blockquote and pre tags would be helpful.
-2. BBCode - Emulate the usual tagset for forums: b, i, img, a, blockquote,
-    pre, div, span and h[2-6] (the last three are for specially formatted
-    posts, div and span require associated classes or inline styling enabled
-    to be useful)
-3. Pages - As permissive as possible without allowing XSS.  No protection
-    against bad design sense, unfortunantely.  Suitable for wiki and page
-    environments. (probably what we have now)
-4. Lint - Accept everything in the spec, a Tidy wannabe. (This probably won't
-    get implemented as it would require routines for things like <object>
-    and friends to be implemented, which is a lot of work for not a lot of
-    benefit)
-
-One final note: when you start axing tags that are more commonly used, you
-run the risk of accidentally destroying user data, especially if the data
-is incoming from a WYSIWYG editor that hasn't been synced accordingly. This may
-make forbidden element to text transformations desirable (for example, images).
-
-
-
-== Element Risk Analysis ==
-
-Although none of the currently supported elements presents a security
-threat per-say, some can cause problems for page layouts or be
-extremely complicated.
-
-Legend:
-    [danger level] - regular tags / uncommon tags ~ deprecated tags
-    [danger level]* - rare tags
-
-1 - blockquote, code, em, i, p, tt / strong, sub, sup
-1* - abbr, acronym, bdo, cite, dfn, kbd, q, samp
-2 - b, br, del, div, pre, span / ins, s, strike ~ u
-3 - h2, h3, h4, h5, h6 ~ center
-4 - h1, big ~ font
-5 - a
-7 - area, map
-
-These are special use tags, they should be enabled on a blanket basis.
-
-Lists - dd, dl, dt, li, ol, ul ~ menu, dir
-Tables - caption, table, td, th, tr / col, colgroup, tbody, tfoot, thead
-
-Forms - fieldset, form, input, lable, legend, optgroup, option, select, textarea
-XSS - noscript, object, script ~ applet
-Meta - base, basefont, body, head, html, link, meta, style, title
-Frames - frame, frameset, iframe
-
-And tag specific notes:
-
-a   - general problems involving linkspam
-b   - too much bold is bad, typographically speaking bold is discouraged
-br  - often misused
-center - CSS, usually no legit use
-del - only useful in editing context
-div - little meaning in certain contexts i.e. blog comment
-h1  - usually no legit use, as header is already set by application
-h*  - not needed in blog comments
-hr  - usually not necessary in blog comments
-img - could be extremely undesirable if linking to external pics (CSRF, goatse)
-pre - could use formatting, only useful in code contexts
-q   - very little support
-s   - transform into span with styling or del?
-small - technically presentational
-span - depends on attribute allowances
-sub, sup - specialized
-u   - little legit use, prefer class with text-decoration
-
-Based on the riskiness of the items, we may want to offer %HTML.DisableImages
-attribute and put URI filtering higher up on the priority list.
-
-
-== Attribute Risk Analysis ==
-
-We actually have a suprisingly small assortment of allowed attributes (the
-rest are deprecated in strict, and thus we opted not to allow them, even
-though our output is XHTML Transitional by default.)
-
-Required URI - img.alt, img.src, a.href
-Medium risk - *.class, *.dir
-High risk - img.height, img.width, *.id, *.style
-
-Table - colgroup/col.span, td/th.rowspan, td/th.colspan
-Uncommon - *.title, *.lang, *.xml:lang
-Rare - td/th.abbr, table.summary, {table}.charoff
-Rare URI - del.cite, ins.cite, blockquote.cite, q.cite, img.longdesc
-Presentational - {table}.align, {table}.valign, table.frame, table.rules,
-    table.border
-Partially presentational - table.cellpadding, table.cellspacing,
-    table.width, col.width, colgroup.width
-
-
-== CSS Risk Analysis ==
-
-Currently, there is no support for fine-grained "allowed CSS" specification,
-mainly because I'm lazy, partially because no one has asked for it. However,
-this will be added eventually.
-
-There are certain CSS elements that are extremely useful inline, but then
-as you get to more presentation oriented styling it may not always be
-appropriate to inline them.
-
-Useful - clear, float, border-collapse, caption-side
-
-These CSS properties can break layouts if used improperly. We have excluded
-any CSS properties that are not currently implemented (such as position).
-
-Dangerous, can go outside container - float
-Easy to abuse - font-size, font-family (font), width
-Colored - background-color (background), border-color (border), color
-    (see proposal-colors.html)
-Dramatic - border, list-style-position (list-style), margin, padding,
-    text-align, text-indent, text-transform, vertical-align, line-height
-
-Dramatic elements substantially change the look of text in ways that should
-probably have been reserved to other areas.
-
-    vim: et sw=4 sts=4

+ 0 - 64
main/inc/lib/htmlpurifier/docs/proposal-language.txt

@@ -1,64 +0,0 @@
-We are going to model our I18N/L10N off of MediaWiki's system.  Their's is
-obviously quite complicated, so we're going to simplify it a bit for our needs.
-
-== Caching ==
-
-MediaWiki has lots of caching mechanisms built in, which make the code somewhat
-more difficult to understand.  Before doing any loading, MediaWiki will check
-the following places to see if we can be lazy:
-
-1. $mLocalisationCache[$code] -  just a variable where it may have been stashed
-2. serialized/$code.ser -  compiled serialized language file
-3. Memcached version of file (with expiration checking)
-
-Expiration checking consists of by ensuring all dependencies have filemtime
-that match the ones bundled with the cached copy. Similar checking could be
-implemented for serialized versions, as it seems that they are not updated
-until manually recompiled.
-
-== Behavior ==
-
-Things that are localizable:
-
--  Weekdays (and abbrev)
--  Months (and abbrev)
--  Bookstores
--  Skin names
--  Date preferences / Custom date format
--  Default date format
--  Default user option overrides
--+ Language names
--  Timezones
--+ Character encoding conversion via iconv
--  UpperLowerCase first (needs casemaps for some)
--  UpperLowerCase
--  Uppercase words
--  Uppercase word breaks
--  Case folding
--  Strip punctuation for MySQL search
--  Get first character
--+ Alternate encoding
--+ Recoding for edit (and then recode input)
--+ RTL
--+ Direction mark character depending on RTL
--? Arrow depending on RTL
--  Languages where italics cannot be used
--+ Number formatting (commafy, transform digits, transform separators)
--  Truncate (multibyte)
--  Grammar conversions for inflected languages
--  Plural transformations
--  Formatting expiry times
--  Segmenting for diffs (Chinese)
--  Convert to variants of language
--  Language specific user preference options
--  Link trails [[foo]]bar
--+ Language code (RFC 3066)
-
-Neat functionality:
-
--  I18N sprintfDate
--  Roman numeral formatting
-
-Items marked with a + likely need to be addressed by HTML Purifier
-
-    vim: et sw=4 sts=4

+ 0 - 44
main/inc/lib/htmlpurifier/docs/proposal-new-directives.txt

@@ -1,44 +0,0 @@
-
-Configuration Ideas
-
-Here are some theoretical configuration ideas that we could implement some
-time.  Note the naming convention: %Namespace.Directive. If you want one
-implemented, give us a ring, and we'll move it up the priority chain.
-
-%Attr.RewriteFragments - if there's %Attr.IDPrefix we may want to transparently
-    rewrite the URLs we parse too.  However, we can only do it when it's a pure
-    anchor link, so it's not foolproof
-
-%Attr.ClassBlacklist,
-%Attr.ClassWhitelist,
-%Attr.ClassPolicy - determines what classes are allowed. When
-    %Attr.ClassPolicy is set to Blacklist, only allow those not in
-    %Attr.ClassBlacklist. When it's Whitelist, only allow those in
-    %Attr.ClassWhitelist.
-
-%Attr.MaxWidth,
-%Attr.MaxHeight - caps for width and height related checks.
-    (the hack in Pixels for an image crashing attack could be replaced by this)
-
-%URI.AddRelNofollow - will add rel="nofollow" to all links, preventing the
-    spread of ill-gotten pagerank
-
-%URI.HostBlacklistRegex - regexes that if matching the host are disallowed
-%URI.HostWhitelist - domain names that are excluded from the host blacklist
-%URI.HostPolicy - determines whether or not its reject all and then whitelist
-    or allow all in then do specific blacklists with whitelist intervening.
-    'DenyAll' or 'AllowAll' (default)
-
-%URI.DisableIPHosts - URIs that have IP addresses for hosts are disallowed.
-    Be sure to also grab unusual encodings (dword, hex and octal), which may
-    be currently be caught by regular DNS
-%URI.DisableIDN - Disallow raw internationalized domain names. Punycode
-    will still be permitted.
-
-%URI.ConvertUnusualIPHosts - transform dword/hex/octal IP addresses to the
-    regular form
-%URI.ConvertAbsoluteDNS - Remove extra dots after host names that trigger
-    absolute DNS.  While this is actually the preferred method according to
-    the RFC, most people opt to use a relative domain name relative to . (root).
-
-    vim: et sw=4 sts=4

+ 0 - 50
main/inc/lib/htmlpurifier/docs/ref-content-models.txt

@@ -1,50 +0,0 @@
-
-Handling Content Model Changes
-
-
-1. Context
-
-The distinction between Transitional and Strict document types is somewhat
-of an anomaly in the lineage of XHTML document types (following 1.0, no
-doctypes do not have flavors: instead, modularization is used to let
-document authors vary their elements).  This transition is usually quite
-straight-forward, as W3C usually deprecates attributes or elements, which
-are quite easily handled using tag and attribute transforms.
-
-However, for two elements, <blockquote>, <body> and <address>, W3C elected
-to also change the content model.  <blockquote> and <body> originally
-accepted both inline and block elements, but in the strict doctype they
-only allow block elements.  With <address>, the situation is inverted:
-<p> tags were now forbidden from appearing within this tag.
-
-
-2. Current situation
-
-Currently, HTML Purifier treats <blockquote> specially during Tidy mode
-using a custom ChildDef class StrictBlockquote.  StrictBlockquote
-operates similarly to Required, except that when it encounters an inline
-element, it will wrap it in a block tag (as specified by
-%HTML.BlockWrapper, the default is <p>).  The naming suggests it can
-only be used for <blockquote>s, although it may be possible to
-genericize it to work on other cases of this nature (this would be of
-little practical application, as no other element in XHTML 1.1 or earlier
-has a block-only content model).
-
-Tidy currently contains no custom, lenient implementation for <address>.
-If one were to be written, it would likely operate on the principle that,
-when a <p> tag were to be encountered, it would be replaced with a
-leading and trailing <br /> tag (the contents of <p>, being inline, are
-not an issue).  There is no prior work with this sort of operation.
-
-
-3. Outside applicability
-
-There are a number of other elements that contain restrictive content
-models, such as <ul> or <span> (the latter is restrictive in that it
-does not allow block elements).  In the former case, an errant node
-is eliminated completely, in the latter case, the text of the node
-would is preserved (as the parent node does allow PCDATA).  Custom
-content model implementations probably are not the best way of handling
-these cases, instead, node bubbling should be implemented instead.
-
-    vim: et sw=4 sts=4

+ 0 - 30
main/inc/lib/htmlpurifier/docs/ref-css-length.txt

@@ -1,30 +0,0 @@
-
-CSS Length Reference
-  To bound, or not to bound, that is the question
-
-It's quite a reasonable request, really, and it's already been implemented
-for HTML.  That is, length bounding.  It makes little sense to let users
-define text blocks that have a font-size of 63,360 inches (that's a mile,
-by the way) or a width of forty-fold the parent container.
-
-But it's a little more complicated then that. There are multiple units
-one can use, and we have to a little unit conversion to get things working.
-Here's what we have:
-
-Absolute:
-    1 in ~= 2.54 cm
-    1 cm = 10 mm
-    1 pt = 1/72 in
-    1 pc = 12 pt
-
-Relative:
-    1 em ~= 10.0667 px
-    1 ex ~= 0.5 em, though Mozilla Firefox says 1 ex = 6px
-    1 px ~= 1 pt
-
-Watch out: font-sizes can also be nested to get successively larger
-(although I do not relish having to keep track of context font-sizes,
-this may be necessary, especially for some of the more advanced features
-for preventing things like white on white).
-
-    vim: et sw=4 sts=4

+ 0 - 46
main/inc/lib/htmlpurifier/docs/ref-devnetwork.html

@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<meta name="description" content="Credits and links to DevNetwork forum topics on HTML Purifier." />
-<link rel="stylesheet" type="text/css" href="./style.css" />
-
-<title>DevNetwork Credits - HTML Purifier</title>
-
-</head>
-<body>
-
-<h1>DevNetwork Credits</h1>
-
-<div id="filing">Filed under Reference</div>
-<div id="index">Return to the <a href="index.html">index</a>.</div>
-<div id="home"><a href="http://htmlpurifier.org/">HTML Purifier</a> End-User Documentation</div>
-
-<p>Many thanks to the DevNetwork community for answering questions,
-theorizing about design, and offering encouragement during
-the development of this library in these forum threads:</p>
-
-<ul>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=52905">HTMLPurifier PHP Library hompeage</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53056">How much of CSS to implement?</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53083">Parsing URL only according to URI : Security Risk?</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53096">Gimme a name : URI and friends</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53415">How to document configuration directives</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53479">IPv6</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53539">http and ftp versus news and mailto</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53579">HTMLPurifier - Take your best shot</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53664">Need help optimizing a block of code</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=53861">Non-SGML characters</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=54283">Wordpress makes me cry</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=54478">Parameter Object vs. Parameter Array vs. Parameter Functions</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=54521">Convert encoding where output cannot represent characters</a></li>
-    <li><a href="http://forums.devnetwork.net/viewtopic.php?t=56411">Reporting errors in a document without line numbers</a></li>
-</ul>
-
-<p>...as well as any I may have forgotten.</p>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 166
main/inc/lib/htmlpurifier/docs/ref-html-modularization.txt

@@ -1,166 +0,0 @@
-
-The Modularization of HTMLDefinition in HTML Purifier
-
-WARNING: This document was drafted before the implementation of this
-    system, and some implementation details may have evolved over time.
-
-HTML Purifier uses the modularization of XHTML
-<http://www.w3.org/TR/xhtml-modularization/> to organize the internals
-of HTMLDefinition into a more manageable and extensible fashion. Rather
-than have one super-object, HTMLDefinition is split into HTMLModules,
-each of which are responsible for defining elements, their attributes,
-and other properties (for a more indepth coverage, see
-/library/HTMLPurifier/HTMLModule.php's docblock comments). These modules
-are managed by HTMLModuleManager.
-
-Modules that we don't support but could support are:
-
-    * 5.6. Table Modules
-          o 5.6.1. Basic Tables Module [?]
-    * 5.8. Client-side Image Map Module [?]
-    * 5.9. Server-side Image Map Module [?]
-    * 5.12. Target Module [?]
-    * 5.21. Name Identification Module [deprecated]
-
-These modules would be implemented as "unsafe":
-
-    * 5.2. Core Modules
-          o 5.2.1. Structure Module
-    * 5.3. Applet Module
-    * 5.5. Forms Modules
-          o 5.5.1. Basic Forms Module
-          o 5.5.2. Forms Module
-    * 5.10. Object Module
-    * 5.11. Frames Module
-    * 5.13. Iframe Module
-    * 5.14. Intrinsic Events Module
-    * 5.15. Metainformation Module
-    * 5.16. Scripting Module
-    * 5.17. Style Sheet Module
-    * 5.19. Link Module
-    * 5.20. Base Module
-
-We will not be using W3C's XML Schemas or DTDs directly due to the lack
-of robust tools for handling them (the main problem is that all the
-current parsers are usually PHP 5 only and solely-validating, not
-correcting).
-
-This system may be generalized and ported over for CSS.
-
-== General Use-Case ==
-
-The outwards API of HTMLDefinition has been largely preserved, not
-only for backwards-compatibility but also by design. Instead,
-HTMLDefinition can be retrieved "raw", in which it loads a structure
-that closely resembles the modules of XHTML 1.1. This structure is very
-dynamic, making it easy to make cascading changes to global content
-sets or remove elements in bulk.
-
-However, once HTML Purifier needs the actual definition, it retrieves
-a finalized version of HTMLDefinition. The finalized definition involves
-processing the modules into a form that it is optimized for multiple
-calls. This final version is immutable and, even if editable, would
-be extremely hard to change.
-
-So, some code taking advantage of the XHTML modularization may look
-like this:
-
-<?php
-    $config = HTMLPurifier_Config::createDefault();
-    $def =& $config->getHTMLDefinition(true); // reference to raw
-    $def->addElement('marquee', 'Block', 'Flow', 'Common');
-    $purifier = new HTMLPurifier($config);
-    $purifier->purify($html); // now the definition is finalized
-?>
-
-== Inclusions ==
-
-One of the nice features of HTMLDefinition is that piggy-backing off
-of global attribute and content sets is extremely easy to do.
-
-=== Attributes ===
-
-HTMLModule->elements[$element]->attr stores attribute information for the
-specific attributes of $element. This is quite close to the final
-API that HTML Purifier interfaces with, but there's an important
-extra feature: attr may also contain a array with a member index zero.
-
-<?php
-    HTMLModule->elements[$element]->attr[0] = array('AttrSet');
-?>
-
-Rather than map the attribute key 0 to an array (which should be
-an AttrDef), it defines a number of attribute collections that should
-be merged into this elements attribute array.
-
-Furthermore, the value of an attribute key, attribute value pair need
-not be a fully fledged AttrDef object. They can also be a string, which
-signifies a AttrDef that is looked up from a centralized registry
-AttrTypes. This allows more concise attribute definitions that look
-more like W3C's declarations, as well as offering a centralized point
-for modifying the behavior of one attribute type. And, of course, the
-old method of manually instantiating an AttrDef still works.
-
-=== Attribute Collections ===
-
-Attribute collections are stored and processed in the AttrCollections
-object, which is responsible for performing the inclusions signified
-by the 0 index. These attribute collections, too, are mutable, by
-using HTMLModule->attr_collections. You may add new attributes
-to a collection or define an entirely new collection for your module's
-use. Inclusions can also be cumulative.
-
-Attribute collections allow us to get rid of so called "global attributes"
-(which actually aren't so global).
-
-=== Content Models and ChildDef ===
-
-An implementation of the above-mentioned attributes and attribute
-collections was applied to the ChildDef system. HTML Purifier uses
-a proprietary system called ChildDef for performance and flexibility
-reasons, but this does not line up very well with W3C's notion of
-regexps for defining the allowed children of an element.
-
-HTMLPurifier->elements[$element]->content_model and
-HTMLPurifier->elements[$element]->content_model_type store information
-about the final ChildDef that will be stored in
-HTMLPurifier->elements[$element]->child (we use a different variable
-because the two forms are sufficiently different).
-
-$content_model is an abstract, string representation of the internal
-state of ChildDef, while $content_model_type is a string identifier
-of which ChildDef subclass to instantiate. $content_model is processed
-by substituting all content set identifiers (capitalized element names)
-with their contents. It is then parsed and passed into the appropriate
-ChildDef class, as defined by the ContentSets->getChildDef() or the
-custom fallback HTMLModule->getChildDef() for custom child definitions
-not in the core.
-
-You'll need to use these facilities if you plan on referencing a content
-set like "Inline" or "Block", and using them is recommended even if you're
-not due to their conciseness.
-
-A few notes on $content_model: it's structure can be as complicated
-as you want, but the pipe symbol (|) is reserved for defining possible
-choices, due to the content sets implementation. For example, a content
-model that looks like:
-
-"Inline -> Block -> a"
-
-...when the Inline content set is defined as "span | b" and the Block
-content set is defined as "div | blockquote", will expand into:
-
-"span | b -> div | blockquote -> a"
-
-The custom HTMLModule->getChildDef() function will need to be able to
-then feed this information to ChildDef in a usable manner.
-
-=== Content Sets ===
-
-Content sets can be altered using HTMLModule->content_sets, an associative
-array of content set names to content set contents. If the content set
-already exists, your values are appended on to it (great for, say,
-registering the font tag as an inline element), otherwise it is
-created. They are substituted into content_model.
-
-    vim: et sw=4 sts=4

+ 0 - 26
main/inc/lib/htmlpurifier/docs/ref-proprietary-tags.txt

@@ -1,26 +0,0 @@
-
-Proprietary Tags
-    <nobr> and friends
-
-Here are some proprietary tags that W3C does not define but occasionally show
-up in the wild.  We have only included tags that would make sense in an
-HTML Purifier context.
-
-<align>, block element that aligns (extremely rare)
-<blackface>, inline that double-bolds text (extremely rare)
-<comment>, hidden comment for IE and WebTV
-<multicol cols=number gutter=pixels width=pixels>, multiple columns
-<nobr>, no linebreaks
-<spacer align=* type="vertical|horizontal|block">, whitespace in doc,
-    use width/height for block and size for vertical/horizontal (attributes)
-    (extremely rare)
-<wbr>, potential word break point: allows linebreaks. Only works in <nobr>
-
-<listing>, monospace pre-variant (extremely rare)
-<plaintext>, escapes all tags to the end of document
-<xmp>, monospace, replace with pre
-
-These should be put into their own Tidy module, not loaded by default(?). These
-all qualify as "lenient" transforms.
-
-    vim: et sw=4 sts=4

+ 0 - 26
main/inc/lib/htmlpurifier/docs/ref-whatwg.txt

@@ -1,26 +0,0 @@
-
-Web Hypertext Application Technology Working Group
-    WHATWG
-
-== HTML 5 ==
-
-URL: http://www.whatwg.org/specs/web-apps/current-work/
-
-HTML 5 defines a kaboodle of new elements and attributes, as well as
-some well-defined, "quirks mode" HTML parsing.  Although WHATWG professes
-to be targeted towards web applications, many of their semantic additions
-would be quite useful in regular documents. Eventually, HTML
-Purifier will need to audit their lists and figure out what changes need
-to be made.  This process is complicated by the fact that the WHATWG
-doesn't buy into W3C's modularization of XHTML 1.1: we may need
-to remodularize HTML 5 (probably done by section name). No sense in
-committing ourselves till the spec stabilizes, though.
-
-More immediately speaking though, however, is the well-defined parsing
-behavior that HTML 5 adds. While I have little interest in writing
-another DirectLex parser, other parsers like ph5p
-<http://jero.net/lab/ph5p/> can be adapted to DOMLex to support much more
-flexible HTML parsing (a cool feature I've seen is how they resolve
-<b>bold<i>both</b>italic</i>).
-
-    vim: et sw=4 sts=4

+ 0 - 76
main/inc/lib/htmlpurifier/docs/style.css

@@ -1,76 +0,0 @@
-html {font-size:1em; font-family:serif; }
-body {margin-left:4em; margin-right:4em; }
-
-dt {font-weight:bold; }
-pre {margin-left:2em; }
-pre, code, tt {font-family:monospace; font-size:1em; }
-
-h1 {text-align:center; font-family:Garamond, serif;
-  font-variant:small-caps;}
-h2 {border-bottom:1px solid #CCC; font-family:sans-serif; font-weight:normal;
-    font-size:1.3em;}
-h3 {font-family:sans-serif; font-size:1.1em; font-weight:bold; }
-h4 {font-family:sans-serif; font-size:0.9em; font-weight:bold; }
-
-/* For witty quips */
-.subtitled {margin-bottom:0em;}
-.subtitle , .subsubtitle {font-size:.8em; margin-bottom:1em;
-    font-style:italic; margin-top:-.2em;text-align:center;}
-.subsubtitle {text-align:left;margin-left:2em;}
-
-/* Used for special "See also" links. */
-.reference {font-style:italic;margin-left:2em;}
-
-/* Marks off asides, discussions on why something is the way it is */
-.aside {margin-left:2em; font-family:sans-serif; font-size:0.9em; }
-blockquote .label {font-weight:bold; font-size:1em; margin:0 0 .1em;
-    border-bottom:1px solid #CCC;}
-.emphasis {font-weight:bold; text-align:center; font-size:1.3em;}
-
-/* A regular table */
-.table {border-collapse:collapse; border-bottom:2px solid #888; margin-left:2em; }
-.table thead th {margin:0; background:#888; color:#FFF; }
-.table thead th:first-child {-moz-border-radius-topleft:1em;}
-.table tbody td {border-bottom:1px solid #CCC; padding-right:0.6em;padding-left:0.6em;}
-
-/* A quick table*/
-table.quick tbody th {text-align:right; padding-right:1em;}
-
-/* Category of the file */
-#filing {font-weight:bold; font-size:smaller; }
-
-/* Contains, without exception, Return to index. */
-#index {font-size:smaller; }
-
-#home {font-size:smaller;}
-
-/* Contains, without exception, $Id$, for SVN version info. */
-#version {text-align:right; font-style:italic; margin:2em 0;}
-
-#toc ol ol {list-style-type:lower-roman;}
-#toc ol {list-style-type:decimal;}
-#toc {list-style-type:upper-alpha;}
-
-q {
-  behavior: url(fixquotes.htc); /* IE fix */
-  quotes: '\201C' '\201D' '\2018' '\2019';
-}
-q:before {
-  content: open-quote;
-}
-q:after {
-  content: close-quote;
-}
-
-/* Marks off implementation details interesting only to the person writing
-   the class described in the spec. */
-.technical {margin-left:2em; }
-.technical:before {content:"Technical note: "; font-weight:bold; color:#061; }
-
-/* Marks off sections that are lacking. */
-.fixme {margin-left:2em; }
-.fixme:before {content:"Fix me: "; font-weight:bold; color:#C00; }
-
-#applicability {margin: 1em 5%; font-style:italic;}
-
-/* vim: et sw=4 sts=4 */

+ 0 - 1
main/inc/lib/htmlpurifier/maintenance/.htaccess

@@ -1 +0,0 @@
-Deny from all

+ 0 - 102
main/inc/lib/htmlpurifier/maintenance/PH5P.patch

@@ -1,102 +0,0 @@
---- C:\Users\Edward\Webs\htmlpurifier\maintenance\PH5P.php	2008-07-07 09:12:12.000000000 -0400
-+++ C:\Users\Edward\Webs\htmlpurifier\maintenance/PH5P.new.php	2008-12-06 02:29:34.988800000 -0500
-@@ -65,7 +65,7 @@
- 
-     public function __construct($data) {
-         $data = str_replace("\r\n", "\n", $data);
--        $date = str_replace("\r", null, $data);
-+        $data = str_replace("\r", null, $data);
- 
-         $this->data = $data;
-         $this->char = -1;
-@@ -211,7 +211,10 @@
-         // If nothing is returned, emit a U+0026 AMPERSAND character token.
-         // Otherwise, emit the character token that was returned.
-         $char = (!$entity) ? '&' : $entity;
--        $this->emitToken($char);
-+        $this->emitToken(array(
-+            'type' => self::CHARACTR,
-+            'data' => $char
-+        ));
- 
-         // Finally, switch to the data state.
-         $this->state = 'data';
-@@ -708,7 +711,7 @@
-         } elseif($char === '&') {
-             /* U+0026 AMPERSAND (&)
-             Switch to the entity in attribute value state. */
--            $this->entityInAttributeValueState('non');
-+            $this->entityInAttributeValueState();
- 
-         } elseif($char === '>') {
-             /* U+003E GREATER-THAN SIGN (>)
-@@ -738,7 +741,8 @@
-             ? '&'
-             : $entity;
- 
--        $this->emitToken($char);
-+        $last = count($this->token['attr']) - 1;
-+        $this->token['attr'][$last]['value'] .= $char;
-     }
- 
-     private function bogusCommentState() {
-@@ -1066,6 +1070,11 @@
-                     $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;
-                     }
-@@ -2084,7 +2093,7 @@
-                     /* Reconstruct the active formatting elements, if any. */
-                     $this->reconstructActiveFormattingElements();
- 
--                    $this->insertElement($token);
-+                    $this->insertElement($token, true, true);
-                 break;
-             }
-             break;
-@@ -3465,7 +3474,18 @@
-         }
-     }
- 
--    private function insertElement($token, $append = true) {
-+    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) {
-@@ -3659,7 +3679,7 @@
-         }
-     }
- 
--    private function generateImpliedEndTags(array $exclude = array()) {
-+    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
-@@ -3673,7 +3693,8 @@
-         }
-     }
- 
--    private function getElementCategory($name) {
-+    private function getElementCategory($node) {
-+        $name = $node->tagName;
-         if(in_array($name, $this->special))
-             return self::SPECIAL;
- 

+ 0 - 3824
main/inc/lib/htmlpurifier/maintenance/PH5P.php

@@ -1,3824 +0,0 @@
-<?php
-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) {
-        $data = str_replace("\r\n", "\n", $data);
-        $date = str_replace("\r", null, $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($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('non');
-
-        } 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;
-
-        $this->emitToken($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 bellow.
-            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)) {
-                        $entity = $id;
-                        break;
-                    }
-                }
-
-                $cond = isset($entity);
-                // The rest of the parsing happens bellow.
-            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('&'.$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);
-                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) {
-        $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(array $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($name) {
-        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;
-    }
-}
-?>

+ 0 - 129
main/inc/lib/htmlpurifier/maintenance/add-vimline.php

@@ -1,129 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Adds vimline to files
- */
-
-chdir(dirname(__FILE__) . '/..');
-$FS = new FSTools();
-
-$vimline = 'vim: et sw=4 sts=4';
-
-$files = $FS->globr('.', '*');
-foreach ($files as $file) {
-    if (
-        !is_file($file) ||
-        prefix_is('./docs/doxygen', $file) ||
-        prefix_is('./library/standalone', $file) ||
-        postfix_is('.ser', $file) ||
-        postfix_is('.tgz', $file) ||
-        postfix_is('.patch', $file) ||
-        postfix_is('.dtd', $file) ||
-        postfix_is('.ent', $file) ||
-        postfix_is('.png', $file) ||
-        postfix_is('.ico', $file) ||
-        // wontfix
-        postfix_is('.vtest', $file) ||
-        postfix_is('.svg', $file) ||
-        postfix_is('.phpt', $file) ||
-        postfix_is('VERSION', $file) ||
-        postfix_is('WHATSNEW', $file) ||
-        postfix_is('FOCUS', $file) ||
-        postfix_is('configdoc/usage.xml', $file) ||
-        postfix_is('library/HTMLPurifier.includes.php', $file) ||
-        postfix_is('library/HTMLPurifier.safe-includes.php', $file) ||
-        // phpt files
-        postfix_is('.diff', $file) ||
-        postfix_is('.exp', $file) ||
-        postfix_is('.log', $file) ||
-        postfix_is('.out', $file) ||
-
-        $file == './library/HTMLPurifier/Lexer/PH5P.php' ||
-        $file == './maintenance/PH5P.php'
-    ) continue;
-    $ext = strrchr($file, '.');
-    if (
-        postfix_is('README', $file) ||
-        postfix_is('LICENSE', $file) ||
-        postfix_is('CREDITS', $file) ||
-        postfix_is('INSTALL', $file) ||
-        postfix_is('NEWS', $file) ||
-        postfix_is('TODO', $file) ||
-        postfix_is('WYSIWYG', $file) ||
-        postfix_is('Changelog', $file)
-    ) $ext = '.txt';
-    if (postfix_is('Doxyfile', $file)) $ext = 'Doxyfile';
-    if (postfix_is('.php.in', $file)) $ext = '.php';
-    $no_nl = false;
-    switch ($ext) {
-        case '.php':
-        case '.inc':
-        case '.js':
-            $line = '// %s';
-            break;
-        case '.html':
-        case '.xsl':
-        case '.xml':
-        case '.htc':
-            $line = '<!-- %s -->';
-            break;
-        case '.htmlt':
-            $no_nl = true;
-            $line = '--# %s';
-            break;
-        case '.ini':
-            $line = '; %s';
-            break;
-        case '.css':
-            $line = '/* %s */';
-            break;
-        case '.bat':
-            $line = 'rem %s';
-            break;
-        case '.txt':
-        case '.utf8':
-            if (
-                prefix_is('./library/HTMLPurifier/ConfigSchema', $file) ||
-                prefix_is('./smoketests/test-schema', $file) ||
-                prefix_is('./tests/HTMLPurifier/StringHashParser', $file)
-            ) {
-                $no_nl = true;
-                $line = '--# %s';
-            } else {
-                $line = '    %s';
-            }
-            break;
-        case 'Doxyfile':
-            $line = '# %s';
-            break;
-        default:
-            throw new Exception('Unknown file: ' . $file);
-    }
-
-    echo "$file\n";
-    $contents = file_get_contents($file);
-
-    $regex = '~' . str_replace('%s', 'vim: .+', preg_quote($line, '~')) .  '~m';
-    $contents = preg_replace($regex, '', $contents);
-
-    $contents = rtrim($contents);
-
-    if (strpos($contents, "\r\n") !== false) $nl = "\r\n";
-    elseif (strpos($contents, "\n") !== false) $nl = "\n";
-    elseif (strpos($contents, "\r") !== false) $nl = "\r";
-    else $nl = PHP_EOL;
-
-    if (!$no_nl) $contents .= $nl;
-    $contents .= $nl . str_replace('%s', $vimline, $line) . $nl;
-
-    file_put_contents($file, $contents);
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 22
main/inc/lib/htmlpurifier/maintenance/common.php

@@ -1,22 +0,0 @@
-<?php
-
-function assertCli() {
-    if (php_sapi_name() != 'cli' && !getenv('PHP_IS_CLI')) {
-        echo 'Script cannot be called from web-browser (if you are indeed calling via cli,
-set environment variable PHP_IS_CLI to work around this).';
-        exit(1);
-    }
-}
-
-function prefix_is($comp, $subject) {
-    return strncmp($comp, $subject, strlen($comp)) === 0;
-}
-
-function postfix_is($comp, $subject) {
-    return strlen($subject) < $comp ? false : substr($subject, -strlen($comp)) === $comp;
-}
-
-// Load useful stuff like FSTools
-require_once '../extras/HTMLPurifierExtras.auto.php';
-
-// vim: et sw=4 sts=4

+ 0 - 161
main/inc/lib/htmlpurifier/maintenance/config-scanner.php

@@ -1,161 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-require_once '../library/HTMLPurifier.auto.php';
-assertCli();
-
-if (version_compare(PHP_VERSION, '5.2.2', '<')) {
-    echo "This script requires PHP 5.2.2 or later, for tokenizer line numbers.";
-    exit(1);
-}
-
-/**
- * @file
- * Scans HTML Purifier source code for $config tokens and records the
- * directive being used; configdoc can use this info later.
- *
- * Currently, this just dumps all the info onto the console. Eventually, it
- * will create an XML file that our XSLT transform can use.
- */
-
-$FS = new FSTools();
-chdir(dirname(__FILE__) . '/../library/');
-$raw_files = $FS->globr('.', '*.php');
-$files = array();
-foreach ($raw_files as $file) {
-    $file = substr($file, 2); // rm leading './'
-    if (strncmp('standalone/', $file, 11) === 0) continue; // rm generated files
-    if (substr_count($file, '.') > 1) continue; // rm meta files
-    $files[] = $file;
-}
-
-/**
- * Moves the $i cursor to the next non-whitespace token
- */
-function consumeWhitespace($tokens, &$i) {
-    do {$i++;} while (is_array($tokens[$i]) && $tokens[$i][0] === T_WHITESPACE);
-}
-
-/**
- * Tests whether or not a token is a particular type. There are three run-cases:
- *      - ($token, $expect_token): tests if the token is $expect_token type;
- *      - ($token, $expect_value): tests if the token is the string $expect_value;
- *      - ($token, $expect_token, $expect_value): tests if token is $expect_token type, and
- *        its string representation is $expect_value
- */
-function testToken($token, $value_or_token, $value = null) {
-    if (is_null($value)) {
-        if (is_int($value_or_token)) return is_array($token) && $token[0] === $value_or_token;
-        else return $token === $value_or_token;
-    } else {
-        return is_array($token) && $token[0] === $value_or_token && $token[1] === $value;
-    }
-}
-
-$counter = 0;
-$full_counter = 0;
-$tracker = array();
-
-foreach ($files as $file) {
-    $tokens = token_get_all(file_get_contents($file));
-    $file = str_replace('\\', '/', $file);
-    for ($i = 0, $c = count($tokens); $i < $c; $i++) {
-        $ok = false;
-        // Match $config
-        if (!$ok && testToken($tokens[$i], T_VARIABLE, '$config')) $ok = true;
-        // Match $this->config
-        while (!$ok && testToken($tokens[$i], T_VARIABLE, '$this')) {
-            consumeWhitespace($tokens, $i);
-            if (!testToken($tokens[$i], T_OBJECT_OPERATOR)) break;
-            consumeWhitespace($tokens, $i);
-            if (testToken($tokens[$i], T_STRING, 'config')) $ok = true;
-            break;
-        }
-        if (!$ok) continue;
-
-        $ok = false;
-        for($i++; $i < $c; $i++) {
-            if ($tokens[$i] === ',' || $tokens[$i] === ')' || $tokens[$i] === ';') {
-                break;
-            }
-            if (is_string($tokens[$i])) continue;
-            if ($tokens[$i][0] === T_OBJECT_OPERATOR) {
-                $ok = true;
-                break;
-            }
-        }
-        if (!$ok) continue;
-
-        $line = $tokens[$i][2];
-
-        consumeWhitespace($tokens, $i);
-        if (!testToken($tokens[$i], T_STRING, 'get')) continue;
-
-        consumeWhitespace($tokens, $i);
-        if (!testToken($tokens[$i], '(')) continue;
-
-        $full_counter++;
-
-        $matched = false;
-        do {
-
-            // What we currently don't match are batch retrievals, and
-            // wildcard retrievals. This data might be useful in the future,
-            // which is why we have a do {} while loop that doesn't actually
-            // do anything.
-
-            consumeWhitespace($tokens, $i);
-            if (!testToken($tokens[$i], T_CONSTANT_ENCAPSED_STRING)) continue;
-            $namespace = substr($tokens[$i][1], 1, -1);
-
-            consumeWhitespace($tokens, $i);
-            if (!testToken($tokens[$i], ',')) continue;
-
-            consumeWhitespace($tokens, $i);
-            if (!testToken($tokens[$i], T_CONSTANT_ENCAPSED_STRING)) continue;
-            $directive = substr($tokens[$i][1], 1, -1);
-
-            $counter++;
-            $matched = true;
-
-            $id = "$namespace.$directive";
-            if (!isset($tracker[$id])) $tracker[$id] = array();
-            if (!isset($tracker[$id][$file])) $tracker[$id][$file] = array();
-            $tracker[$id][$file][] = $line;
-
-        } while (0);
-
-        //echo "$file:$line uses $namespace.$directive\n";
-    }
-}
-
-echo "\n$counter/$full_counter instances of \$config or \$this->config found in source code.\n";
-
-echo "Generating XML... ";
-
-$xw = new XMLWriter();
-$xw->openURI('../configdoc/usage.xml');
-$xw->setIndent(true);
-$xw->startDocument('1.0', 'UTF-8');
-$xw->startElement('usage');
-foreach ($tracker as $id => $files) {
-    $xw->startElement('directive');
-    $xw->writeAttribute('id', $id);
-    foreach ($files as $file => $lines) {
-        $xw->startElement('file');
-        $xw->writeAttribute('name', $file);
-        foreach ($lines as $line) {
-            $xw->writeElement('line', $line);
-        }
-        $xw->endElement();
-    }
-    $xw->endElement();
-}
-$xw->endElement();
-$xw->flush();
-
-echo "done!\n";
-
-// vim: et sw=4 sts=4

+ 0 - 42
main/inc/lib/htmlpurifier/maintenance/flush-definition-cache.php

@@ -1,42 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Flushes the definition serial cache. This file should be
- * called if changes to any subclasses of HTMLPurifier_Definition
- * or related classes (such as HTMLPurifier_HTMLModule) are made. This
- * may also be necessary if you've modified a customized version.
- *
- * @param Accepts one argument, cache type to flush; otherwise flushes all
- *      the caches.
- */
-
-echo "Flushing cache... \n";
-
-require_once(dirname(__FILE__) . '/../library/HTMLPurifier.auto.php');
-
-$config = HTMLPurifier_Config::createDefault();
-
-$names = array('HTML', 'CSS', 'URI', 'Test');
-if (isset($argv[1])) {
-    if (in_array($argv[1], $names)) {
-        $names = array($argv[1]);
-    } else {
-        throw new Exception("Cache parameter {$argv[1]} is not a valid cache");
-    }
-}
-
-foreach ($names as $name) {
-    echo " - Flushing $name\n";
-    $cache = new HTMLPurifier_DefinitionCache_Serializer($name);
-    $cache->flush($config);
-}
-
-echo "Cache flushed successfully.\n";
-
-// vim: et sw=4 sts=4

+ 0 - 30
main/inc/lib/htmlpurifier/maintenance/flush.php

@@ -1,30 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Runs all generation/flush cache scripts to ensure that somewhat volatile
- * generated files are up-to-date.
- */
-
-function e($cmd) {
-    echo "\$ $cmd\n";
-    passthru($cmd, $status);
-    echo "\n";
-    if ($status) exit($status);
-}
-
-$php = $_SERVER['argv'][1];
-if (!$php) $php = 'php';
-
-e($php . ' generate-includes.php');
-e($php . ' generate-schema-cache.php');
-e($php . ' flush-definition-cache.php');
-e($php . ' generate-standalone.php');
-e($php . ' config-scanner.php');
-
-// vim: et sw=4 sts=4

+ 0 - 74
main/inc/lib/htmlpurifier/maintenance/generate-entity-file.php

@@ -1,74 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Parses *.ent files into an entity lookup table, and then serializes and
- * writes the whole kaboodle to a file. The resulting file is cached so
- * that this script does not need to be run. This script should rarely,
- * if ever, be run, since HTML's entities are fairly immutable.
- */
-
-// here's where the entity files are located, assuming working directory
-// is the same as the location of this PHP file. Needs trailing slash.
-$entity_dir = '../docs/entities/';
-
-// defines the output file for the serialized content.
-$output_file = '../library/HTMLPurifier/EntityLookup/entities.ser';
-
-// courtesy of a PHP manual comment
-function unichr($dec) {
-    if ($dec < 128) {
-        $utf  = chr($dec);
-    } else if ($dec < 2048) {
-        $utf  = chr(192 + (($dec - ($dec % 64)) / 64));
-        $utf .= chr(128 + ($dec % 64));
-    } else {
-        $utf  = chr(224 + (($dec - ($dec % 4096)) / 4096));
-        $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64));
-        $utf .= chr(128 + ($dec % 64));
-    }
-    return $utf;
-}
-
-if ( !is_dir($entity_dir) ) exit("Fatal Error: Can't find entity directory.\n");
-if ( file_exists($output_file) ) exit("Fatal Error: entity-lookup.txt already exists.\n");
-
-$dh = @opendir($entity_dir);
-if ( !$dh ) exit("Fatal Error: Cannot read entity directory.\n");
-
-$entity_files = array();
-while (($file = readdir($dh)) !== false) {
-    if (@$file[0] === '.') continue;
-    if (substr(strrchr($file, "."), 1) !== 'ent') continue;
-    $entity_files[] = $file;
-}
-closedir($dh);
-
-if ( !$entity_files ) exit("Fatal Error: No entity files to parse.\n");
-
-$entity_table = array();
-$regexp = '/<!ENTITY\s+([A-Za-z]+)\s+"&#(?:38;#)?([0-9]+);">/';
-
-foreach ( $entity_files as $file ) {
-    $contents = file_get_contents($entity_dir . $file);
-    $matches = array();
-    preg_match_all($regexp, $contents, $matches, PREG_SET_ORDER);
-    foreach ($matches as $match) {
-        $entity_table[$match[1]] = unichr($match[2]);
-    }
-}
-
-$output = serialize($entity_table);
-
-$fh = fopen($output_file, 'w');
-fwrite($fh, $output);
-fclose($fh);
-
-echo "Completed successfully.";
-
-// vim: et sw=4 sts=4

+ 0 - 189
main/inc/lib/htmlpurifier/maintenance/generate-includes.php

@@ -1,189 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-require_once '../tests/path2class.func.php';
-require_once '../library/HTMLPurifier/Bootstrap.php';
-assertCli();
-
-/**
- * @file
- * Generates an include stub for users who do not want to use the autoloader.
- * When new files are added to HTML Purifier's main codebase, this file should
- * be called.
- */
-
-chdir(dirname(__FILE__) . '/../library/');
-$FS = new FSTools();
-
-$exclude_dirs = array(
-    'HTMLPurifier/Language/',
-    'HTMLPurifier/ConfigSchema/',
-    'HTMLPurifier/Filter/',
-    'HTMLPurifier/Printer/',
-    /* These should be excluded, but need to have ConfigSchema support first
-
-    */
-);
-$exclude_files = array(
-    'HTMLPurifier/Lexer/PEARSax3.php',
-    'HTMLPurifier/Lexer/PH5P.php',
-    'HTMLPurifier/Printer.php',
-);
-
-// Determine what files need to be included:
-echo 'Scanning for files... ';
-$raw_files = $FS->globr('.', '*.php');
-if (!$raw_files) throw new Exception('Did not find any PHP source files');
-$files = array();
-foreach ($raw_files as $file) {
-    $file = substr($file, 2); // rm leading './'
-    if (strncmp('standalone/', $file, 11) === 0) continue; // rm generated files
-    if (substr_count($file, '.') > 1) continue; // rm meta files
-    $ok = true;
-    foreach ($exclude_dirs as $dir) {
-        if (strncmp($dir, $file, strlen($dir)) === 0) {
-            $ok = false;
-            break;
-        }
-    }
-    if (!$ok) continue; // rm excluded directories
-    if (in_array($file, $exclude_files)) continue; // rm excluded files
-    $files[] = $file;
-}
-echo "done!\n";
-
-// Reorder list so that dependencies are included first:
-
-/**
- * Returns a lookup array of dependencies for a file.
- *
- * @note This function expects that format $name extends $parent on one line
- *
- * @param $file
- *      File to check dependencies of.
- * @return
- *      Lookup array of files the file is dependent on, sorted accordingly.
- */
-function get_dependency_lookup($file) {
-    static $cache = array();
-    if (isset($cache[$file])) return $cache[$file];
-    if (!file_exists($file)) {
-        echo "File doesn't exist: $file\n";
-        return array();
-    }
-    $fh = fopen($file, 'r');
-    $deps = array();
-    while (!feof($fh)) {
-        $line = fgets($fh);
-        if (strncmp('class', $line, 5) === 0) {
-            // The implementation here is fragile and will break if we attempt
-            // to use interfaces. Beware!
-            list(, $parent) = explode(' extends ', trim($line, ' {'."\n\r"), 2);
-            if (empty($parent)) break;
-            $dep_file = HTMLPurifier_Bootstrap::getPath($parent);
-            if (!$dep_file) break;
-            $deps[$dep_file] = true;
-            break;
-        }
-    }
-    fclose($fh);
-    foreach (array_keys($deps) as $file) {
-        // Extra dependencies must come *before* base dependencies
-        $deps = get_dependency_lookup($file) + $deps;
-    }
-    $cache[$file] = $deps;
-    return $deps;
-}
-
-/**
- * Sorts files based on dependencies. This function is lazy and will not
- * group files with dependencies together; it will merely ensure that a file
- * is never included before its dependencies are.
- *
- * @param $files
- *      Files array to sort.
- * @return
- *      Sorted array ($files is not modified by reference!)
- */
-function dep_sort($files) {
-    $ret = array();
-    $cache = array();
-    foreach ($files as $file) {
-        if (isset($cache[$file])) continue;
-        $deps = get_dependency_lookup($file);
-        foreach (array_keys($deps) as $dep) {
-            if (!isset($cache[$dep])) {
-                $ret[] = $dep;
-                $cache[$dep] = true;
-            }
-        }
-        $cache[$file] = true;
-        $ret[] = $file;
-    }
-    return $ret;
-}
-
-$files = dep_sort($files);
-
-// Build the actual include stub:
-
-$version = trim(file_get_contents('../VERSION'));
-
-// stub
-$php = "<?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 $version
- *
- * @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.
- */
-
-";
-
-foreach ($files as $file) {
-    $php .= "require '$file';" . PHP_EOL;
-}
-
-echo "Writing HTMLPurifier.includes.php... ";
-file_put_contents('HTMLPurifier.includes.php', $php);
-echo "done!\n";
-
-$php = "<?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__);
-
-";
-
-foreach ($files as $file) {
-    $php .= "require_once \$__dir . '/$file';" . PHP_EOL;
-}
-
-echo "Writing HTMLPurifier.safe-includes.php... ";
-file_put_contents('HTMLPurifier.safe-includes.php', $php);
-echo "done!\n";
-
-// vim: et sw=4 sts=4

+ 0 - 22
main/inc/lib/htmlpurifier/maintenance/generate-ph5p-patch.php

@@ -1,22 +0,0 @@
-<?php
-
-/**
- * @file
- * This file compares our version of PH5P with Jero's original version, and
- * generates a patch of the differences. This script should be run whenever
- * library/HTMLPurifier/Lexer/PH5P.php is modified.
- */
-
-$orig = realpath(dirname(__FILE__) . '/PH5P.php');
-$new  = realpath(dirname(__FILE__) . '/../library/HTMLPurifier/Lexer/PH5P.php');
-$newt = dirname(__FILE__) . '/PH5P.new.php'; // temporary file
-
-// minor text-processing of new file to get into same format as original
-$new_src = file_get_contents($new);
-$new_src = '<?php' . PHP_EOL . substr($new_src, strpos($new_src, 'class HTML5 {'));
-
-file_put_contents($newt, $new_src);
-shell_exec("diff -u \"$orig\" \"$newt\" > PH5P.patch");
-unlink($newt);
-
-// vim: et sw=4 sts=4

+ 0 - 31
main/inc/lib/htmlpurifier/maintenance/generate-schema-cache.php

@@ -1,31 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-require_once '../library/HTMLPurifier.auto.php';
-assertCli();
-
-/**
- * @file
- * Generates a schema cache file, saving it to
- * library/HTMLPurifier/ConfigSchema/schema.ser.
- *
- * This should be run when new configuration options are added to
- * HTML Purifier. A cached version is available via SVN so this does not
- * normally have to be regenerated.
- */
-
-$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
-
-$interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder::buildFromDirectory();
-$interchange->validate();
-
-$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
-$schema = $schema_builder->build($interchange);
-
-echo "Saving schema... ";
-file_put_contents($target, serialize($schema));
-echo "done!\n";
-
-// vim: et sw=4 sts=4

+ 0 - 152
main/inc/lib/htmlpurifier/maintenance/generate-standalone.php

@@ -1,152 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Compiles all of HTML Purifier's library files into one big file
- * named HTMLPurifier.standalone.php. This is usually called during the
- * release process.
- */
-
-/**
- * Global hash that tracks already loaded includes
- */
-$GLOBALS['loaded'] = array();
-
-/**
- * Custom FSTools for this script that overloads some behavior
- * @warning The overloading of copy() is not necessarily global for
- *          this script. Watch out!
- */
-class MergeLibraryFSTools extends FSTools
-{
-    function copyable($entry) {
-        // Skip hidden files
-        if ($entry[0] == '.') {
-            return false;
-        }
-        return true;
-    }
-    function copy($source, $dest) {
-        copy_and_remove_includes($source, $dest);
-    }
-}
-$FS = new MergeLibraryFSTools();
-
-/**
- * Replaces the includes inside PHP source code with the corresponding
- * source.
- * @param string $text PHP source code to replace includes from
- */
-function replace_includes($text) {
-    // also remove vim modelines
-    return preg_replace_callback(
-        "/require(?:_once)? ['\"]([^'\"]+)['\"];/",
-        'replace_includes_callback',
-        $text
-    );
-}
-
-/**
- * Removes leading PHP tags from included files. Assumes that there is
- * no trailing tag. Also removes vim modelines.
- * @note This is safe for files that have internal <?php
- * @param string $text Text to have leading PHP tag from
- */
-function remove_php_tags($text) {
-    $text = preg_replace('#// vim:.+#', '', $text);
-    return substr($text, 5);
-}
-
-/**
- * Copies the contents of a directory to the standalone directory
- * @param string $dir Directory to copy
- */
-function make_dir_standalone($dir) {
-    global $FS;
-    return $FS->copyr($dir, 'standalone/' . $dir);
-}
-
-/**
- * Copies the contents of a file to the standalone directory
- * @param string $file File to copy
- */
-function make_file_standalone($file) {
-    global $FS;
-    $FS->mkdirr('standalone/' . dirname($file));
-    copy_and_remove_includes($file, 'standalone/' . $file);
-    return true;
-}
-
-/**
- * Copies a file to another location recursively, if it is a PHP file
- * remove includes
- * @param string $file Original file
- * @param string $sfile New location of file
- */
-function copy_and_remove_includes($file, $sfile) {
-    $contents = file_get_contents($file);
-    if (strrchr($file, '.') === '.php') $contents = replace_includes($contents);
-    return file_put_contents($sfile, $contents);
-}
-
-/**
- * @param $matches preg_replace_callback matches array, where index 1
- *        is the filename to include
- */
-function replace_includes_callback($matches) {
-    $file = $matches[1];
-    $preserve = array(
-      // PEAR (external)
-      'XML/HTMLSax3.php' => 1
-    );
-    if (isset($preserve[$file])) {
-        return $matches[0];
-    }
-    if (isset($GLOBALS['loaded'][$file])) return '';
-    $GLOBALS['loaded'][$file] = true;
-    return replace_includes(remove_php_tags(file_get_contents($file)));
-}
-
-echo 'Generating includes file... ';
-shell_exec('php generate-includes.php');
-echo "done!\n";
-
-chdir(dirname(__FILE__) . '/../library/');
-
-echo 'Creating full file...';
-$contents = replace_includes(file_get_contents('HTMLPurifier.includes.php'));
-$contents = str_replace(
-    // Note that bootstrap is now inside the standalone file
-    "define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..'));",
-    "define('HTMLPURIFIER_PREFIX', dirname(__FILE__) . '/standalone');
-    set_include_path(HTMLPURIFIER_PREFIX . PATH_SEPARATOR . get_include_path());",
-    $contents
-);
-file_put_contents('HTMLPurifier.standalone.php', $contents);
-echo ' done!' . PHP_EOL;
-
-echo 'Creating standalone directory...';
-$FS->rmdirr('standalone'); // ensure a clean copy
-
-// data files
-$FS->mkdirr('standalone/HTMLPurifier/DefinitionCache/Serializer');
-make_file_standalone('HTMLPurifier/EntityLookup/entities.ser');
-make_file_standalone('HTMLPurifier/ConfigSchema/schema.ser');
-
-// non-standard inclusion setup
-make_dir_standalone('HTMLPurifier/ConfigSchema');
-make_dir_standalone('HTMLPurifier/Language');
-make_dir_standalone('HTMLPurifier/Filter');
-make_dir_standalone('HTMLPurifier/Printer');
-make_file_standalone('HTMLPurifier/Printer.php');
-make_file_standalone('HTMLPurifier/Lexer/PH5P.php');
-make_file_standalone('HTMLPurifier/Lexer/PEARSax3.php');
-
-echo ' done!' . PHP_EOL;
-
-// vim: et sw=4 sts=4

+ 0 - 11
main/inc/lib/htmlpurifier/maintenance/merge-library.php

@@ -1,11 +0,0 @@
-#!/usr/bin/php
-<?php
-
-/**
- * @file
- * Deprecated in favor of generate-standalone.php.
- */
-
-require dirname(__FILE__) . '/generate-standalone.php';
-
-// vim: et sw=4 sts=4

+ 0 - 70
main/inc/lib/htmlpurifier/maintenance/old-extract-schema.php

@@ -1,70 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-echo "Please do not run this script. It is here for historical purposes only.";
-exit;
-
-/**
- * @file
- * Extracts all definitions inside a configuration schema
- * (HTMLPurifier_ConfigSchema) and exports them as plain text files.
- *
- * @todo Extract version numbers.
- */
-
-define('HTMLPURIFIER_SCHEMA_STRICT', true); // description data needs to be collected
-require_once dirname(__FILE__) . '/../library/HTMLPurifier.auto.php';
-
-// We need includes to ensure all HTMLPurifier_ConfigSchema calls are
-// performed.
-require_once 'HTMLPurifier.includes.php';
-
-// Also, these extra files will be necessary.
-require_once 'HTMLPurifier/Filter/ExtractStyleBlocks.php';
-
-/**
- * Takes a hash and saves its contents to library/HTMLPurifier/ConfigSchema/
- */
-function saveHash($hash) {
-    if ($hash === false) return;
-    $dir = realpath(dirname(__FILE__) . '/../library/HTMLPurifier/ConfigSchema');
-    $name = $hash['ID'] . '.txt';
-    $file = $dir . '/' . $name;
-    if (file_exists($file)) {
-        trigger_error("File already exists; skipped $name");
-        return;
-    }
-    $file = new FSTools_File($file);
-    $file->open('w');
-    $multiline = false;
-    foreach ($hash as $key => $value) {
-        $multiline = $multiline || (strpos($value, "\n") !== false);
-        if ($multiline) {
-            $file->put("--$key--" . PHP_EOL);
-            $file->put(str_replace("\n", PHP_EOL, $value) . PHP_EOL);
-        } else {
-            if ($key == 'ID') {
-                $file->put("$value" . PHP_EOL);
-            } else {
-                $file->put("$key: $value" . PHP_EOL);
-            }
-        }
-    }
-    $file->close();
-}
-
-$schema  = HTMLPurifier_ConfigSchema::instance();
-$adapter = new HTMLPurifier_ConfigSchema_StringHashReverseAdapter($schema);
-
-foreach ($schema->info as $ns => $ns_array) {
-    saveHash($adapter->get($ns));
-    foreach ($ns_array as $dir => $x) {
-        saveHash($adapter->get($ns, $dir));
-    }
-}
-
-// vim: et sw=4 sts=4

+ 0 - 32
main/inc/lib/htmlpurifier/maintenance/old-remove-require-once.php

@@ -1,32 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-echo "Please do not run this script. It is here for historical purposes only.";
-exit;
-
-/**
- * @file
- * Removes leading includes from files.
- *
- * @note
- *      This does not remove inline includes; those must be handled manually.
- */
-
-chdir(dirname(__FILE__) . '/../tests/HTMLPurifier');
-$FS = new FSTools();
-
-$files = $FS->globr('.', '*.php');
-foreach ($files as $file) {
-    if (substr_count(basename($file), '.') > 1) continue;
-    $old_code = file_get_contents($file);
-    $new_code = preg_replace("#^require_once .+[\n\r]*#m", '', $old_code);
-    if ($old_code !== $new_code) {
-        file_put_contents($file, $new_code);
-    }
-}
-
-// vim: et sw=4 sts=4

+ 0 - 32
main/inc/lib/htmlpurifier/maintenance/old-remove-schema-def.php

@@ -1,32 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-echo "Please do not run this script. It is here for historical purposes only.";
-exit;
-
-/**
- * @file
- * Removes ConfigSchema function calls from source files.
- */
-
-chdir(dirname(__FILE__) . '/../library/');
-$FS = new FSTools();
-
-$files = $FS->globr('.', '*.php');
-foreach ($files as $file) {
-    if (substr_count(basename($file), '.') > 1) continue;
-    $old_code = file_get_contents($file);
-    $new_code = preg_replace("#^HTMLPurifier_ConfigSchema::.+?\);[\n\r]*#ms", '', $old_code);
-    if ($old_code !== $new_code) {
-        file_put_contents($file, $new_code);
-    }
-    if (preg_match('#^\s+HTMLPurifier_ConfigSchema::#m', $new_code)) {
-        echo "Indented ConfigSchema call in $file\n";
-    }
-}
-
-// vim: et sw=4 sts=4

+ 0 - 367
main/inc/lib/htmlpurifier/maintenance/phpt-modifications.patch

@@ -1,367 +0,0 @@
-Index: src/PHPT/Case.php
-===================================================================
---- src/PHPT/Case.php	(revision 691)
-+++ src/PHPT/Case.php	(working copy)
-@@ -28,17 +28,14 @@
-     {
-         $reporter->onCaseStart($this);
-         try {
--            if ($this->sections->filterByInterface('RunnableBefore')->valid()) {
--                foreach ($this->sections as $section) {
--                    $section->run($this);
--                }
-+            $runnable_before = $this->sections->filterByInterface('RunnableBefore');
-+            foreach ($runnable_before as $section) {
-+                $section->run($this);
-             }
--            $this->sections->filterByInterface();
-             $this->sections->FILE->run($this);
--            if ($this->sections->filterByInterface('RunnableAfter')->valid()) {
--                foreach ($this->sections as $section) {
--                    $section->run($this);
--                }
-+            $runnable_after = $this->sections->filterByInterface('RunnableAfter');
-+            foreach ($runnable_after as $section) {
-+                $section->run($this);
-             }
-             $reporter->onCasePass($this);
-         } catch (PHPT_Case_VetoException $veto) {
-@@ -46,7 +43,6 @@
-         } catch (PHPT_Case_FailureException $failure) {
-             $reporter->onCaseFail($this, $failure);
-         }
--        $this->sections->filterByInterface();
-         $reporter->onCaseEnd($this);
-     }
-     
-Index: src/PHPT/Case/Validator/CgiRequired.php
-===================================================================
---- src/PHPT/Case/Validator/CgiRequired.php	(revision 691)
-+++ src/PHPT/Case/Validator/CgiRequired.php	(working copy)
-@@ -17,7 +17,6 @@
-     public function is(PHPT_Case $case)
-     {
-         $return = $case->sections->filterByInterface('CgiExecutable')->valid();
--        $case->sections->filterByInterface();
-         return $return;
-     }
- }
-Index: src/PHPT/CodeRunner/CommandLine.php
-===================================================================
---- src/PHPT/CodeRunner/CommandLine.php	(revision 691)
-+++ src/PHPT/CodeRunner/CommandLine.php	(working copy)
-@@ -13,7 +13,7 @@
-         $this->_filename = $runner->filename;
-         $this->_ini = (string)$runner->ini;
-         $this->_args = (string)$runner->args;
--        $this->_executable = str_replace(' ', '\ ', (string)$runner->executable);
-+        $this->_executable = $runner->executable;
-         $this->_post_filename = (string)$runner->post_filename;
-     }
-     
-Index: src/PHPT/CodeRunner/Driver/WScriptShell.php
-===================================================================
---- src/PHPT/CodeRunner/Driver/WScriptShell.php	(revision 691)
-+++ src/PHPT/CodeRunner/Driver/WScriptShell.php	(working copy)
-@@ -23,9 +23,9 @@
-             }
-         }
-         if ($found == false) {
--            throw new PHPT_CodeRunner_InvalidExecutableException(
--                'unable to locate PHP executable: ' . $this->executable
--            );
-+            //throw new PHPT_CodeRunner_InvalidExecutableException(
-+            //    'unable to locate PHP executable: ' . $this->executable
-+            //);
-         }
-     }
- 
-@@ -69,7 +69,7 @@
- 
-         $error = $this->_process->StdErr->ReadAll();
-         if (!empty($error)) {
--            throw new PHPT_CodeRunner_ExecutionException($error);
-+            throw new PHPT_CodeRunner_ExecutionException($error, $this->_commandFactory());
-         }
- 
-         return $this->_process->StdOut->ReadAll();
-@@ -93,6 +93,7 @@
-     {
-         $return = '';
-         foreach ($this->environment as $key => $value) {
-+            $value = str_replace('&', '^&', $value);
-             $return .= "set {$key}={$value} & ";
-         }
-         return $return;
-Index: src/PHPT/CodeRunner/Factory.php
-===================================================================
---- src/PHPT/CodeRunner/Factory.php	(revision 691)
-+++ src/PHPT/CodeRunner/Factory.php	(working copy)
-@@ -33,7 +33,13 @@
-                 'php-cgi';
-         }
- 
--        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
-+        if (
-+            strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' &&
-+            (
-+                $runner->executable == 'php' ||
-+                $runner->executable == 'php-cgi'
-+            )
-+        ) {
-             $runner->executable = $runner->executable . '.exe';
-         }
-         try {
-Index: src/PHPT/Section/ModifiableAbstract.php
-===================================================================
---- src/PHPT/Section/ModifiableAbstract.php	(revision 691)
-+++ src/PHPT/Section/ModifiableAbstract.php	(working copy)
-@@ -15,12 +15,10 @@
-     
-     public function run(PHPT_Case $case)
-     {
--        $sections = clone $case->sections;
--        if ($sections->filterByInterface($this->_modifier_name . 'Modifier')->valid()) {
--            $modifyMethod = 'modify' . $this->_modifier_name;
--            foreach ($sections as $section) {
--                $section->$modifyMethod($this);
--            }
-+        $modifiers = $case->sections->filterByInterface($this->_modifier_name . 'Modifier');
-+        $modifyMethod = 'modify' . $this->_modifier_name;
-+        foreach ($modifiers as $section) {
-+            $section->$modifyMethod($this);
-         }
-     }
-     
-Index: src/PHPT/Section/SKIPIF.php
-===================================================================
---- src/PHPT/Section/SKIPIF.php	(revision 691)
-+++ src/PHPT/Section/SKIPIF.php	(working copy)
-@@ -3,10 +3,12 @@
- class PHPT_Section_SKIPIF implements PHPT_Section_RunnableBefore
- {
-     private $_data = null;
-+    private $_runner_factory = null;
-     
-     public function __construct($data)
-     {
-         $this->_data = $data;
-+        $this->_runner_factory = new PHPT_CodeRunner_Factory();
-     }
-     
-     public function run(PHPT_Case $case)
-@@ -16,9 +18,7 @@
-         
-         // @todo refactor to PHPT_CodeRunner
-         file_put_contents($filename, $this->_data);
--        $response = array();
--        exec('php -f ' . $filename, $response);
--        $response = implode("\n", $response);
-+        $response = $this->_runner_factory->factory($case)->run($filename)->output;
-         unlink($filename);
-         
-         if (preg_match('/^skip( - (.*))?/', $response, $matches)) {
-Index: src/PHPT/SectionList.php
-===================================================================
---- src/PHPT/SectionList.php	(revision 691)
-+++ src/PHPT/SectionList.php	(working copy)
-@@ -2,7 +2,6 @@
- 
- class PHPT_SectionList implements Iterator
- {
--    private $_raw_sections = array();
-     private $_sections = array();
-     private $_section_map = array();
-     private $_key_map = array();
-@@ -15,14 +14,12 @@
-             }
-             $name = strtoupper(str_replace('PHPT_Section_', '', get_class($section)));
-             $key = $section instanceof PHPT_Section_Runnable ? $section->getPriority() . '.' . $name : $name;
--            $this->_raw_sections[$key] = $section;
-+            $this->_sections[$key] = $section;
-             $this->_section_map[$name] = $key;
-             $this->_key_map[$key] = $name;
-         }
-         
--        ksort($this->_raw_sections);
--        
--        $this->_sections = $this->_raw_sections;
-+        ksort($this->_sections);
-     }
-     
-     public function current()
-@@ -52,21 +49,23 @@
-     
-     public function filterByInterface($interface = null)
-     {
-+        $ret = new PHPT_SectionList();
-+        
-         if (is_null($interface)) {
--            $this->_sections = $this->_raw_sections;
--            return $this;
-+            $ret->_sections = $this->_sections;
-+            return $ret;
-         }
-         
-         $full_interface = 'PHPT_Section_' . $interface;
--        $this->_sections = array();
--        foreach ($this->_raw_sections as $name => $section) {
-+        $ret->_sections = array();
-+        foreach ($this->_sections as $name => $section) {
-             if (!$section instanceof $full_interface) {
-                 continue;
-             }
--            $this->_sections[$name] = $section;
-+            $ret->_sections[$name] = $section;
-         }
-         
--        return $this;
-+        return $ret;
-     }
-     
-     public function has($name)
-@@ -74,11 +73,11 @@
-         if (!isset($this->_section_map[$name])) {
-             return false;
-         }
--        return isset($this->_raw_sections[$this->_section_map[$name]]);
-+        return isset($this->_sections[$this->_section_map[$name]]);
-     }
-     
-     public function __get($key)
-     {
--        return $this->_raw_sections[$this->_section_map[$key]];
-+        return $this->_sections[$this->_section_map[$key]];
-     }
- }
-Index: tests/CodeRunner/Driver/WScriptShell/injects-ini-settings.phpt
-===================================================================
---- tests/CodeRunner/Driver/WScriptShell/injects-ini-settings.phpt	(revision 691)
-+++ tests/CodeRunner/Driver/WScriptShell/injects-ini-settings.phpt	(working copy)
-@@ -17,9 +17,9 @@
- 
- // sanity check
- $obj = new FoobarIni();
--assert('(string)$obj == " -d display_errors=1 "');
-+assert('(string)$obj == " -d \"display_errors=1\" "');
- $obj->display_errors = 0;
--assert('(string)$obj == " -d display_errors=0 "');
-+assert('(string)$obj == " -d \"display_errors=0\" "');
- unset($obj);
- 
- 
-Index: tests/Section/File/restores-case-sections.phpt
-===================================================================
---- tests/Section/File/restores-case-sections.phpt	(revision 691)
-+++ tests/Section/File/restores-case-sections.phpt	(working copy)
-@@ -1,24 +0,0 @@
----TEST--
--After PHPT_Section_FILE::run(), the sections property of the provide $case object
--is restored to its unfiltered state
----FILE--
--<?php
--
--require_once dirname(__FILE__) . '/../../_setup.inc';
--require_once dirname(__FILE__) . '/../_simple-test-case.inc';
--require_once dirname(__FILE__) . '/_simple-file-modifier.inc';
--
--$case = new PHPT_SimpleTestCase();
--$case->sections = new PHPT_SectionList(array(
--    new PHPT_Section_ARGS('foo=bar'),
--));
--
--$section = new PHPT_Section_FILE('hello world');
--$section->run($case);
--
--assert('$case->sections->valid()');
--
--?>
--===DONE===
----EXPECT--
--===DONE===
-Index: tests/SectionList/filter-by-interface.phpt
-===================================================================
---- tests/SectionList/filter-by-interface.phpt	(revision 691)
-+++ tests/SectionList/filter-by-interface.phpt	(working copy)
-@@ -17,10 +17,10 @@
- 
- $data = array_merge($runnable, $non_runnable);
- $list = new PHPT_SectionList($data);
--$list->filterByInterface('Runnable');
--assert('$list->valid()');
--$list->filterByInterface('EnvModifier');
--assert('$list->valid() == false');
-+$runnable = $list->filterByInterface('Runnable');
-+assert('$runnable->valid()');
-+$env_modifier = $list->filterByInterface('EnvModifier');
-+assert('$env_modifier->valid() == false');
- 
- ?>
- ===DONE===
-Index: tests/SectionList/filter-resets-with-null.phpt
-===================================================================
---- tests/SectionList/filter-resets-with-null.phpt	(revision 691)
-+++ tests/SectionList/filter-resets-with-null.phpt	(working copy)
-@@ -1,36 +0,0 @@
----TEST--
--If you call filterByInterface() with null or no-value, the full dataset is restored
----FILE--
--<?php
--
--require_once dirname(__FILE__) . '/../_setup.inc';
--
--$runnable = array(
--    'ENV' => new PHPT_Section_ENV(''),
--    'CLEAN' => new PHPT_Section_CLEAN(''),
--);
--
--class PHPT_Section_FOO implements PHPT_Section { }
--$non_runnable = array(
--    'FOO' => new PHPT_Section_FOO(), 
--);
--
--$data = array_merge($runnable, $non_runnable);
--$list = new PHPT_SectionList($data);
--$list->filterByInterface('Runnable');
--
--// sanity check
--foreach ($list as $key => $value) {
--    assert('$runnable[$key] == $value');
--}
--
--$list->filterByInterface();
--
--foreach ($list as $key => $value) {
--    assert('$data[$key] == $value');
--}
--
--?>
--===DONE===
----EXPECT--
--===DONE===
-Index: tests/Util/Code/runAsFile-executes-in-file.phpt
-===================================================================
---- tests/Util/Code/runAsFile-executes-in-file.phpt	(revision 691)
-+++ tests/Util/Code/runAsFile-executes-in-file.phpt	(working copy)
-@@ -10,7 +10,7 @@
- 
- $util = new PHPT_Util_Code($code);
- 
--$file = dirname(__FILE__) . '/foobar.php';
-+$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'foobar.php';
- $result = $util->runAsFile($file);
- 
- assert('$result == $file');
-Index: tests/Util/Code/runAsFile-returns-output-if-no-return.phpt
-===================================================================
---- tests/Util/Code/runAsFile-returns-output-if-no-return.phpt	(revision 691)
-+++ tests/Util/Code/runAsFile-returns-output-if-no-return.phpt	(working copy)
-@@ -9,7 +9,7 @@
- 
- $util = new PHPT_Util_Code($code);
- 
--$file = dirname(__FILE__) . '/foobar.php';
-+$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'foobar.php';
- $result = $util->runAsFile($file);
- 
- assert('$result == $file');

+ 0 - 37
main/inc/lib/htmlpurifier/maintenance/remove-trailing-whitespace.php

@@ -1,37 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Removes trailing whitespace from files.
- */
-
-chdir(dirname(__FILE__) . '/..');
-$FS = new FSTools();
-
-$files = $FS->globr('.', '{,.}*', GLOB_BRACE);
-foreach ($files as $file) {
-    if (
-        !is_file($file) ||
-        prefix_is('./.git', $file) ||
-        prefix_is('./docs/doxygen', $file) ||
-        postfix_is('.ser', $file) ||
-        postfix_is('.tgz', $file) ||
-        postfix_is('.patch', $file) ||
-        postfix_is('.dtd', $file) ||
-        postfix_is('.ent', $file) ||
-        $file == './library/HTMLPurifier/Lexer/PH5P.php' ||
-        $file == './maintenance/PH5P.php'
-    ) continue;
-    $contents = file_get_contents($file);
-    $result = preg_replace('/^(.*?)[ \t]+(\r?)$/m', '\1\2', $contents, -1, $count);
-    if (!$count) continue;
-    echo "$file\n";
-    file_put_contents($file, $result);
-}
-
-// vim: et sw=4 sts=4

+ 0 - 156
main/inc/lib/htmlpurifier/maintenance/update-freshmeat.php

@@ -1,156 +0,0 @@
-#!/usr/bin/php
-<?php
-
-chdir(dirname(__FILE__));
-require_once 'common.php';
-assertCli();
-
-/**
- * @file
- * Updates Freshmeat's HTML Purifier with the latest information via XML RPC.
- */
-
-class XmlRpc_Freshmeat
-{
-
-    const URL = 'http://freshmeat.net/xmlrpc/';
-
-    public $chatty = false;
-
-    public $encodeOptions = array(
-        'encoding' => 'utf-8',
-    );
-
-    /**
-     * This array defines shortcut method signatures for dealing with simple
-     * XML RPC methods. More complex ones (publish_release) should use the named parameter
-     * syntax.
-     */
-    public $signatures = array(
-        'login' => array('username', 'password'),
-        'fetch_branch_list' => array('project_name'),
-        'fetch_release'    => array('project_name', 'branch_name', 'version'),
-        'withdraw_release' => array('project_name', 'branch_name', 'version'),
-    );
-
-    protected $sid = null;
-
-    /**
-     * @param $username Username to login with
-     * @param $password Password to login with
-     */
-    public function __construct($username = null, $password = null) {
-        if ($username && $password) {
-            $this->login($username, $password);
-        }
-    }
-
-    /**
-     * Performs a raw XML RPC call to self::URL
-     */
-    protected function call($method, $params) {
-        $request = xmlrpc_encode_request($method, $params, $this->encodeOptions);
-        $ch = curl_init();
-        curl_setopt($ch, CURLOPT_URL, self::URL);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($ch, CURLOPT_TIMEOUT, 1);
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
-            'Content-type: text/xml',
-            'Content-length: ' . strlen($request)
-        ));
-        curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
-        $data = curl_exec($ch);
-        if ($errno = curl_errno($ch)) {
-            throw new Exception("Curl error [$errno]: " . curl_error($ch));
-        } else {
-            curl_close($ch);
-            return xmlrpc_decode($data);
-        }
-    }
-
-    /**
-     * Performs an XML RPC call to Freshmeat.
-     * @param $name Name of method to call, can be methodName or method_name
-     * @param $args Arguments of call, in form array('key1', 'val1', 'key2' ...)
-     */
-    public function __call($name, $args) {
-        $method = $this->camelToUnderscore($name);
-        $params = array();
-        if ($this->sid) $params['SID'] = $this->sid;
-        if (isset($this->signatures[$method])) {
-            for ($i = 0, $c = count($this->signatures[$method]); $i < $c; $i++) {
-                $params[$this->signatures[$method][$i]] = $args[$i];
-            }
-        } else {
-            for ($i = 0, $c = count($args); $i + 1 < $c; $i += 2) {
-                $params[$args[$i]] = $args[$i + 1];
-            }
-        }
-        $result = $this->call($method, $params);
-        switch ($method) {
-            case 'login':
-                $this->sid = $result['SID'];
-                break;
-            case 'logout':
-                $this->sid = null;
-                break;
-        }
-        if ($this->chatty) print_r($result);
-        return $result;
-    }
-
-    /**
-     * Munge methodName to method_name
-     */
-    private function camelToUnderscore($name) {
-        $method = '';
-        for ($i = 0, $c = strlen($name); $i < $c; $i++) {
-            $v = $name[$i];
-            if (ctype_lower($v)) $method .= $v;
-            else $method .= '_' . strtolower($v);
-        }
-        return $method;
-    }
-
-    /**
-     * Automatically logout at end of scope
-     */
-    public function __destruct() {
-        if ($this->sid) $this->logout();
-    }
-
-}
-
-$rpc = new XmlRpc_Freshmeat($argv[1], $argv[2]);
-$rpc->chatty = true;
-
-$project = 'htmlpurifier';
-$branch  = 'Default';
-$version = file_get_contents('../VERSION');
-
-$result = $rpc->fetchRelease($project, $branch, $version);
-if (!isset($result['faultCode'])) {
-    echo "Freshmeat release already exists.\n";
-    exit(0);
-}
-
-$changes = strtr(file_get_contents('../WHATSNEW'), array("\r" => '', "\n" => ' '));
-$focus = (int) trim(file_get_contents('../FOCUS'));
-
-if (strlen($changes) > 600) {
-    echo "WHATSNEW entry is too long.\n";
-    exit(1);
-}
-
-$rpc->publishRelease(
-    'project_name',  $project,
-    'branch_name',   $branch,
-    'version',       $version,
-    'changes',       $changes,
-    'release_focus', $focus,
-    'url_tgz',       "http://htmlpurifier.org/releases/htmlpurifier-$version.tar.gz",
-    'url_zip',       "http://htmlpurifier.org/releases/htmlpurifier-$version.zip",
-    'url_changelog', "http://htmlpurifier.org/svnroot/htmlpurifier/tags/$version/NEWS"
-);
-
-// vim: et sw=4 sts=4

+ 0 - 112
main/inc/lib/htmlpurifier/plugins/modx.txt

@@ -1,112 +0,0 @@
-
-MODx Plugin
-
-MODx <http://www.modxcms.com/> is an open source PHP application framework.
-I first came across them in my referrer logs when tillda asked if anyone
-could implement an HTML Purifier plugin.  This forum thread
-<http://modxcms.com/forums/index.php/topic,6604.0.html> eventually resulted
-in the fruition of this plugin that davidm says, "is on top of my favorite
-list."  HTML Purifier goes great with WYSIWYG editors!
-
-
-
-1. Credits
-
-PaulGregory wrote the overall structure of the code.  I added the
-slashes hack.
-
-
-
-2. Install
-
-First, you need to place HTML Purifier library somewhere.  The code here
-assumes that you've placed in MODx's assets/plugins/htmlpurifier (no version
-number).
-
-Log into the manager, and navigate:
-
-Resources > Manage Resources > Plugins tab > New Plugin
-
-Type in a name (probably HTML Purifier), and copy paste this code into the
-textarea:
-
---------------------------------------------------------------------------------
-$e = &$modx->Event;
-if ($e->name == 'OnBeforeDocFormSave') {
-    global $content;
-
-    include_once '../assets/plugins/htmlpurifier/library/HTMLPurifier.auto.php';
-    $purifier = new HTMLPurifier();
-
-    static $magic_quotes = null;
-    if ($magic_quotes === null) {
-        // this is an ugly hack because this hook hasn't
-        // had the backslashes removed yet when magic_quotes_gpc is on,
-        // but HTMLPurifier must not have the quotes slashed.
-        $magic_quotes = get_magic_quotes_gpc();
-    }
-
-    if ($magic_quotes) $content = stripslashes($content);
-    $content = $purifier->purify($content);
-    if ($magic_quotes) $content = addslashes($content);
-}
---------------------------------------------------------------------------------
-
-Then navigate to the System Events tab and check "OnBeforeDocFormSave".
-Save the plugin.  HTML Purifier now is integrated!
-
-
-
-3. Making sure it works
-
-You can test HTML Purifier by deliberately putting in crappy HTML and seeing
-whether or not it gets fixed.  A better way is to put in something like this:
-
-<p lang="fr">Il est bon</p>
-
-...and seeing whether or not the content comes out as:
-
-<p lang="fr" xml:lang="fr">Il est bon</p>
-
-(lang to xml:lang synchronization is one of the many features HTML Purifier
-has).
-
-
-
-4. Caveat Emptor
-
-This code does not intercept save requests from the QuickEdit plugin, this may
-be added in a later version.  It also modifies things on save, so there's a
-slight chance that HTML Purifier may make a boo-boo and accidently mess things
-up (the original version is not saved).
-
-Finally, make sure that MODx is using UTF-8.  If you are using, say, a French
-localisation, you may be using Latin-1, if that's the case, configure
-HTML Purifier properly like this:
-
-$config = HTMLPurifier_Config::createDefault();
-$config->set('Core', 'Encoding', 'ISO-8859-1'); // or whatever encoding
-$purifier = new HTMLPurifier($config);
-
-
-
-5. Known Bugs
-
-'rn' characters sometimes mysteriously appear after purification. We are
-currently investigating this issue. See: <http://htmlpurifier.org/phorum/read.php?3,1866>
-
-
-
-6. See Also
-
-A modified version of Jot 1.1.3 is available, which integrates with HTML
-Purifier. You can check it out here: <http://modxcms.com/forums/index.php/topic,25621.msg161970.html>
-
-
-X. Changelog
-
-2008-06-16
-- Updated code to work with 3.1.0 and later
-- Add Known Bugs and See Also section
-
-    vim: et sw=4 sts=4

+ 0 - 2
main/inc/lib/htmlpurifier/plugins/phorum/.gitignore

@@ -1,2 +0,0 @@
-migrate.php
-htmlpurifier/*

+ 0 - 26
main/inc/lib/htmlpurifier/plugins/phorum/Changelog

@@ -1,26 +0,0 @@
-Changelog                                         HTMLPurifier : Phorum Mod
-|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
-= KEY ====================
-    # Breaks back-compat
-    ! Feature
-    - Bugfix
-      + Sub-comment
-    . Internal change
-==========================
-
-Version 3.0.0.1 for Phorum 5.2, unknown release date
-! Better installation documentation
-- Fixed double encoded quotes
-- Fixed fatal error when migrate.php is blank
-
-Version 3.0.0 for Phorum 5.2, released January 12, 2008
-# WYSIWYG and suppress_message options are now configurable via web
-  interface.
-- Module now compatible with Phorum 5.2, primary bugs were in migration
-  code as well as signature and edit message handling. This module is NOT
-  compatible with Phorum 5.1.
-- Buggy WYSIWYG mode refined
-. AutoFormatParam added to list of default configuration namespaces
-
-    vim: et sw=4 sts=4

+ 0 - 79
main/inc/lib/htmlpurifier/plugins/phorum/INSTALL

@@ -1,79 +0,0 @@
-
-Install
-    How to install the Phorum HTML Purifier plugin
-
-1. UNZIP
---------
-Unzip phorum-htmlpurifier-x.y.z, producing an htmlpurifier folder.
-You've already done this step if you're reading this!
-
-2. MOVE
--------
-Move the htmlpurifier folder to the mods/ folder of your Phorum
-installation, so the directory structure looks like:
-
-phorum/
-    mods/
-        htmlpurifier/
-            INSTALL - this install file
-            info.txt, ... - the module files
-            htmlpurifier/
-
-3. INSTALL HTML PURIFIER
-------------------------
-Download and unzip HTML Purifier <htmlpurifier.org>. Place the contents of
-the library/ folder in the htmlpurifier/htmlpurifier folder. Your directory
-structure will look like:
-
-phorum/
-    mods/
-        htmlpurifier/
-            htmlpurifier/
-                HTMLPurifier.auto.php
-                ... - other files
-                HTMLPurifier/
-
-Advanced users:
-    If you have HTML Purifier installed elsewhere on your server,
-    all you need is an HTMLPurifier.auto.php file in the library folder which
-    includes the HTMLPurifier.auto.php file in your install.
-
-4. MIGRATE
-----------
-If you're setting up a new Phorum installation, all you need to do is create
-a blank migrate.php file in the htmlpurifier module folder (NOT the library
-folder.
-
-If you have an old Phorum installation and was using BBCode,
-copy migrate.bbcode.php to migrate.php. If you were using a different input
-format, follow the instructions in migrate.bbcode.php to create your own custom
-migrate.php file.
-
-Your directory structure should now look like this:
-
-phorum/
-    mods/
-        htmlpurifier/
-            migrate.php
-
-5. ENABLE
----------
-Navigate to your Phorum admin panel at http://example.com/phorum/admin.php,
-click on Global Settings > Modules, scroll to "HTML Purifier Phorum Mod" and
-turn it On.
-
-6. MIGRATE SIGNATURES
----------------------
-If you're setting up a new Phorum installation, skip this step.
-
-If you allowed your users to make signatures, navigate to the module settings
-page of HTML Purifier (Global Settings > Modules > HTML Purifier Phorum Mod >
-Configure), type in "yes" in the "Confirm" box, and press "Migrate."
-
-ONLY DO THIS ONCE! BE SURE TO BACK UP YOUR DATABASE!
-
-7. CONFIGURE
-------------
-Configure using Edit settings. See that page for more information.
-
-    vim: et sw=4 sts=4

+ 0 - 45
main/inc/lib/htmlpurifier/plugins/phorum/README

@@ -1,45 +0,0 @@
-
-HTML Purifier Phorum Mod - Filter your HTML the Standards-Compliant Way!
-
-This Phorum mod enables HTML posting on Phorum.  Under normal circumstances,
-this would cause a huge security risk, but because we are running
-HTML through HTML Purifier, output is guaranteed to be XSS free and
-standards-compliant.
-
-This mod requires HTML input, and previous markup languages need to be
-converted accordingly.  Thus, it is vital that you create a 'migrate.php'
-file that works with your installation. If you're using the built-in
-BBCode formatting, simply move migrate.bbcode.php to that place; for
-other markup languages, consult said file for instructions on how
-to adapt it to your needs.
-
-    -- NOTE -------------------------------------------------
-    You can also run this module in parallel with another
-    formatting module; this module attempts to place itself
-    at the end of the filtering chain. However, if any
-    previous modules produce insecure HTML (for instance,
-    a JavaScript email obfuscator) they will get cleaned.
-
-This module will not work if 'migrate.php' is not created, and an improperly
-made migration file may *CORRUPT* Phorum, so please take your time to
-do this correctly. It should go without saying to *BACKUP YOUR DATABASE*
-before attempting anything here. If no migration is necessary, you can
-simply create a blank migrate.php file. HTML Purifier is smart and will
-not re-migrate already processed messages. However, the original code
-is irretrievably lost (we may change this in the future.)
-
-This module will not automatically migrate user signatures, because this
-process may take a long time. After installing the HTML Purifier module and
-then configuring 'migrate.php', navigate to Settings and click 'Migrate
-Signatures' to migrate all user signatures to HTML.
-
-All of HTML Purifier's usual functions are configurable via the mod settings
-page. If you require custom configuration, create config.php file in
-the mod directory that edits a $config variable. Be sure, also, to
-set $PHORUM['mod_htmlpurifier']['wysiwyg'] to TRUE if you are using a
-WYSIWYG editor (you can do this through a common hook or the web
-configuration form).
-
-Visit HTML Purifier at <http://htmlpurifier.org/>.
-
-    vim: et sw=4 sts=4

+ 0 - 57
main/inc/lib/htmlpurifier/plugins/phorum/config.default.php

@@ -1,57 +0,0 @@
-<?php
-
-if(!defined("PHORUM")) exit;
-
-// default HTML Purifier configuration settings
-$config->set('HTML', 'Allowed',
-  // alphabetically sorted
-'a[href|title]
-abbr[title]
-acronym[title]
-b
-blockquote[cite]
-br
-caption
-cite
-code
-dd
-del
-dfn
-div
-dl
-dt
-em
-i
-img[src|alt|title|class]
-ins
-kbd
-li
-ol
-p
-pre
-s
-strike
-strong
-sub
-sup
-table
-tbody
-td
-tfoot
-th
-thead
-tr
-tt
-u
-ul
-var');
-$config->set('AutoFormat', 'AutoParagraph', true);
-$config->set('AutoFormat', 'Linkify', true);
-$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional');
-$config->set('Core', 'AggressivelyFixLt', true);
-$config->set('Core', 'Encoding', $GLOBALS['PHORUM']['DATA']['CHARSET']); // we'll change this eventually
-if (strtolower($GLOBALS['PHORUM']['DATA']['CHARSET']) !== 'utf-8') {
-  $config->set('Core', 'EscapeNonASCIICharacters', true);
-}
-
-// vim: et sw=4 sts=4

+ 0 - 309
main/inc/lib/htmlpurifier/plugins/phorum/htmlpurifier.php

@@ -1,309 +0,0 @@
-<?php
-
-/**
- * HTML Purifier Phorum Mod. Filter your HTML the Standards-Compliant Way!
- *
- * This Phorum mod enables users to post raw HTML into Phorum.  But never
- * fear: with the help of HTML Purifier, this HTML will be beat into
- * de-XSSed and standards-compliant form, safe for general consumption.
- * It is not recommended, but possible to run this mod in parallel
- * with other formatters (in short, please DISABLE the BBcode mod).
- *
- * For help migrating from your previous markup language to pure HTML
- * please check the migrate.bbcode.php file.
- *
- * If you'd like to use this with a WYSIWYG editor, make sure that
- * editor sets $PHORUM['mod_htmlpurifier']['wysiwyg'] to true. Otherwise,
- * administrators who need to edit other people's comments may be at
- * risk for some nasty attacks.
- *
- * Tested with Phorum 5.2.6.
- */
-
-// Note: Cache data is base64 encoded because Phorum insists on flinging
-// to the user and expecting it to come back unharmed, newlines and
-// all, which ain't happening. It's slower, it takes up more space, but
-// at least it won't get mutilated
-
-/**
- * Purifies a data array
- */
-function phorum_htmlpurifier_format($data)
-{
-    $PHORUM = $GLOBALS["PHORUM"];
-
-    $purifier =& HTMLPurifier::getInstance();
-    $cache_serial = $PHORUM['mod_htmlpurifier']['body_cache_serial'];
-
-    foreach($data as $message_id => $message){
-        if(isset($message['body'])) {
-
-            if ($message_id) {
-                // we're dealing with a real message, not a fake, so
-                // there a number of shortcuts that can be taken
-
-                if (isset($message['meta']['htmlpurifier_light'])) {
-                    // format hook was called outside of Phorum's normal
-                    // functions, do the abridged purification
-                    $data[$message_id]['body'] = $purifier->purify($message['body']);
-                    continue;
-                }
-
-                if (!empty($PHORUM['args']['purge'])) {
-                    // purge the cache, must be below the following if
-                    unset($message['meta']['body_cache']);
-                }
-
-                if (
-                    isset($message['meta']['body_cache']) &&
-                    isset($message['meta']['body_cache_serial']) &&
-                    $message['meta']['body_cache_serial'] == $cache_serial
-                ) {
-                    // cached version is present, bail out early
-                    $data[$message_id]['body'] = base64_decode($message['meta']['body_cache']);
-                    continue;
-                }
-            }
-
-            // migration might edit this array, that's why it's defined
-            // so early
-            $updated_message = array();
-
-            // create the $body variable
-            if (
-                $message_id && // message must be real to migrate
-                !isset($message['meta']['body_cache_serial'])
-            ) {
-                // perform migration
-                $fake_data = array();
-                list($signature, $edit_message) = phorum_htmlpurifier_remove_sig_and_editmessage($message);
-                $fake_data[$message_id] = $message;
-                $fake_data = phorum_htmlpurifier_migrate($fake_data);
-                $body = $fake_data[$message_id]['body'];
-                $body = str_replace("<phorum break>\n", "\n", $body);
-                $updated_message['body'] = $body; // save it in
-                $body .= $signature . $edit_message; // add it back in
-            } else {
-                // reverse Phorum's pre-processing
-                $body = $message['body'];
-                // order is important
-                $body = str_replace("<phorum break>\n", "\n", $body);
-                $body = str_replace(array('&lt;','&gt;','&amp;', '&quot;'), array('<','>','&','"'), $body);
-                if (!$message_id && defined('PHORUM_CONTROL_CENTER')) {
-                    // we're in control.php, so it was double-escaped
-                    $body = str_replace(array('&lt;','&gt;','&amp;', '&quot;'), array('<','>','&','"'), $body);
-                }
-            }
-
-            $body = $purifier->purify($body);
-
-            // dynamically update the cache (MUST BE DONE HERE!)
-            // this is inefficient because it's one db call per
-            // cache miss, but once the cache is in place things are
-            // a lot zippier.
-
-            if ($message_id) { // make sure it's not a fake id
-                $updated_message['meta'] = $message['meta'];
-                $updated_message['meta']['body_cache'] = base64_encode($body);
-                $updated_message['meta']['body_cache_serial'] = $cache_serial;
-                phorum_db_update_message($message_id, $updated_message);
-            }
-
-            // must not get overloaded until after we cache it, otherwise
-            // we'll inadvertently change the original text
-            $data[$message_id]['body'] = $body;
-
-        }
-    }
-
-    return $data;
-}
-
-// -----------------------------------------------------------------------
-// This is fragile code, copied from read.php:596 (Phorum 5.2.6). Please
-// keep this code in-sync with Phorum
-
-/**
- * Generates a signature based on a message array
- */
-function phorum_htmlpurifier_generate_sig($row) {
-    $phorum_sig = '';
-    if(isset($row["user"]["signature"])
-       && isset($row['meta']['show_signature']) && $row['meta']['show_signature']==1){
-           $phorum_sig=trim($row["user"]["signature"]);
-           if(!empty($phorum_sig)){
-               $phorum_sig="\n\n$phorum_sig";
-           }
-    }
-    return $phorum_sig;
-}
-
-/**
- * Generates an edit message based on a message array
- */
-function phorum_htmlpurifier_generate_editmessage($row) {
-    $PHORUM = $GLOBALS['PHORUM'];
-    $editmessage = '';
-    if(isset($row['meta']['edit_count']) && $row['meta']['edit_count'] > 0) {
-        $editmessage = str_replace ("%count%", $row['meta']['edit_count'], $PHORUM["DATA"]["LANG"]["EditedMessage"]);
-        $editmessage = str_replace ("%lastedit%", phorum_date($PHORUM["short_date_time"],$row['meta']['edit_date']),  $editmessage);
-        $editmessage = str_replace ("%lastuser%", $row['meta']['edit_username'],  $editmessage);
-        $editmessage = "\n\n\n\n$editmessage";
-    }
-    return $editmessage;
-}
-
-// End fragile code
-// -----------------------------------------------------------------------
-
-/**
- * Removes the signature and edit message from a message
- * @param $row Message passed by reference
- */
-function phorum_htmlpurifier_remove_sig_and_editmessage(&$row) {
-    $signature = phorum_htmlpurifier_generate_sig($row);
-    $editmessage = phorum_htmlpurifier_generate_editmessage($row);
-    $replacements = array();
-    // we need to remove add <phorum break> as that is the form these
-    // extra bits are in.
-    if ($signature) $replacements[str_replace("\n", "<phorum break>\n", $signature)] = '';
-    if ($editmessage) $replacements[str_replace("\n", "<phorum break>\n", $editmessage)] = '';
-    $row['body'] = strtr($row['body'], $replacements);
-    return array($signature, $editmessage);
-}
-
-/**
- * Indicate that data is fully HTML and not from migration, invalidate
- * previous caches
- * @note This function could generate the actual cache entries, but
- *       since there's data missing that must be deferred to the first read
- */
-function phorum_htmlpurifier_posting($message) {
-    $PHORUM = $GLOBALS["PHORUM"];
-    unset($message['meta']['body_cache']); // invalidate the cache
-    $message['meta']['body_cache_serial'] = $PHORUM['mod_htmlpurifier']['body_cache_serial'];
-    return $message;
-}
-
-/**
- * Overload quoting mechanism to prevent default, mail-style quote from happening
- */
-function phorum_htmlpurifier_quote($array) {
-    $PHORUM = $GLOBALS["PHORUM"];
-    $purifier =& HTMLPurifier::getInstance();
-    $text = $purifier->purify($array[1]);
-    $source = htmlspecialchars($array[0]);
-    return "<blockquote cite=\"$source\">\n$text\n</blockquote>";
-}
-
-/**
- * Ensure that our format hook is processed last. Also, loads the library.
- * @credits <http://secretsauce.phorum.org/snippets/make_bbcode_last_formatter.php.txt>
- */
-function phorum_htmlpurifier_common() {
-
-    require_once(dirname(__FILE__).'/htmlpurifier/HTMLPurifier.auto.php');
-    require(dirname(__FILE__).'/init-config.php');
-
-    $config = phorum_htmlpurifier_get_config();
-    HTMLPurifier::getInstance($config);
-
-    // increment revision.txt if you want to invalidate the cache
-    $GLOBALS['PHORUM']['mod_htmlpurifier']['body_cache_serial'] = $config->getSerial();
-
-    // load migration
-    if (file_exists(dirname(__FILE__) . '/migrate.php')) {
-        include(dirname(__FILE__) . '/migrate.php');
-    } else {
-        echo '<strong>Error:</strong> No migration path specified for HTML Purifier, please check
-        <tt>modes/htmlpurifier/migrate.bbcode.php</tt> for instructions on
-        how to migrate from your previous markup language.';
-        exit;
-    }
-
-    if (!function_exists('phorum_htmlpurifier_migrate')) {
-        // Dummy function
-        function phorum_htmlpurifier_migrate($data) {return $data;}
-    }
-
-}
-
-/**
- * Pre-emptively performs purification if it looks like a WYSIWYG editor
- * is being used
- */
-function phorum_htmlpurifier_before_editor($message) {
-    if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg'])) {
-        if (!empty($message['body'])) {
-            $body = $message['body'];
-            // de-entity-ize contents
-            $body = str_replace(array('&lt;','&gt;','&amp;'), array('<','>','&'), $body);
-            $purifier =& HTMLPurifier::getInstance();
-            $body = $purifier->purify($body);
-            // re-entity-ize contents
-            $body = htmlspecialchars($body, ENT_QUOTES, $GLOBALS['PHORUM']['DATA']['CHARSET']);
-            $message['body'] = $body;
-        }
-    }
-    return $message;
-}
-
-function phorum_htmlpurifier_editor_after_subject() {
-    // don't show this message if it's a WYSIWYG editor, since it will
-    // then be handled automatically
-    if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg'])) {
-        $i = $GLOBALS['PHORUM']['DATA']['MODE'];
-        if ($i == 'quote' || $i == 'edit' || $i == 'moderation') {
-          ?>
-          <div>
-            <p>
-              <strong>Notice:</strong> HTML has been scrubbed for your safety.
-              If you would like to see the original, turn off WYSIWYG mode
-              (consult your administrator for details.)
-            </p>
-          </div>
-          <?php
-        }
-        return;
-    }
-    if (!empty($GLOBALS['PHORUM']['mod_htmlpurifier']['suppress_message'])) return;
-    ?><div class="htmlpurifier-help">
-    <p>
-        <strong>HTML input</strong> is enabled. Make sure you escape all HTML and
-        angled brackets with <code>&amp;lt;</code> and <code>&amp;gt;</code>.
-    </p><?php
-            $purifier =& HTMLPurifier::getInstance();
-            $config = $purifier->config;
-            if ($config->get('AutoFormat', 'AutoParagraph')) {
-                ?><p>
-                    <strong>Auto-paragraphing</strong> is enabled. Double
-                    newlines will be converted to paragraphs; for single
-                    newlines, use the <code>pre</code> tag.
-                </p><?php
-            }
-            $html_definition = $config->getDefinition('HTML');
-            $allowed = array();
-            foreach ($html_definition->info as $name => $x) $allowed[] = "<code>$name</code>";
-            sort($allowed);
-            $allowed_text = implode(', ', $allowed);
-            ?><p><strong>Allowed tags:</strong> <?php
-            echo $allowed_text;
-            ?>.</p><?php
-        ?>
-    </p>
-    <p>
-        For inputting literal code such as HTML and PHP for display, use
-        CDATA tags to auto-escape your angled brackets, and <code>pre</code>
-        to preserve newlines:
-    </p>
-    <pre>&lt;pre&gt;&lt;![CDATA[
-<em>Place code here</em>
-]]&gt;&lt;/pre&gt;</pre>
-    <p>
-        Power users, you can hide this notice with:
-        <pre>.htmlpurifier-help {display:none;}</pre>
-    </p>
-    </div><?php
-}
-
-// vim: et sw=4 sts=4

+ 0 - 504
main/inc/lib/htmlpurifier/plugins/phorum/htmlpurifier/LICENSE

@@ -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

+ 0 - 3
main/inc/lib/htmlpurifier/plugins/phorum/htmlpurifier/README

@@ -1,3 +0,0 @@
-The contents of the library/ folder should be here.
-
-    vim: et sw=4 sts=4

+ 0 - 18
main/inc/lib/htmlpurifier/plugins/phorum/info.txt

@@ -1,18 +0,0 @@
-title:   HTML Purifier Phorum Mod
-desc:    This module enables standards-compliant HTML filtering on Phorum. Please check migrate.bbcode.php before enabling this mod.
-author:  Edward Z. Yang
-url:     http://htmlpurifier.org/
-version: 3.0.0
-
-hook:  format|phorum_htmlpurifier_format
-hook:  quote|phorum_htmlpurifier_quote
-hook:  posting_custom_action|phorum_htmlpurifier_posting
-hook:  common|phorum_htmlpurifier_common
-hook:  before_editor|phorum_htmlpurifier_before_editor
-hook:  tpl_editor_after_subject|phorum_htmlpurifier_editor_after_subject
-
-# This module is meant to be a drop-in for bbcode, so make it run last.
-priority: run module after *
-priority: run hook format after *
-
-    vim: et sw=4 sts=4

+ 0 - 28
main/inc/lib/htmlpurifier/plugins/phorum/init-config.php

@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Initializes the appropriate configuration from either a PHP file
- * or a module configuration value
- * @return Instance of HTMLPurifier_Config
- */
-function phorum_htmlpurifier_get_config($default = false) {
-    global $PHORUM;
-    $config_exists = phorum_htmlpurifier_config_file_exists();
-    if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) {
-        $config = HTMLPurifier_Config::createDefault();
-        include(dirname(__FILE__) . '/config.default.php');
-        if ($config_exists) {
-            include(dirname(__FILE__) . '/config.php');
-        }
-        unset($PHORUM['mod_htmlpurifier']['config']); // unnecessary
-    } else {
-        $config = HTMLPurifier_Config::create($PHORUM['mod_htmlpurifier']['config']);
-    }
-    return $config;
-}
-
-function phorum_htmlpurifier_config_file_exists() {
-    return file_exists(dirname(__FILE__) . '/config.php');
-}
-
-// vim: et sw=4 sts=4

+ 0 - 30
main/inc/lib/htmlpurifier/plugins/phorum/migrate.bbcode.php

@@ -1,30 +0,0 @@
-<?php
-
-/**
- * This file is responsible for migrating from a specific markup language
- * like BBCode or Markdown to HTML. WARNING: THIS PROCESS IS NOT REVERSIBLE
- *
- * Copy this file to 'migrate.php' and it will automatically work for
- * BBCode; you may need to tweak this a little to get it to work for other
- * languages (usually, just replace the include name and the function name).
- *
- * If you do NOT want to have any migration performed (for instance, you
- * are installing the module on a new forum with no posts), simply remove
- * phorum_htmlpurifier_migrate() function. You still need migrate.php
- * present, otherwise the module won't work. This ensures that the user
- * explicitly says, "No, I do not need to migrate."
- */
-
-if(!defined("PHORUM")) exit;
-
-require_once(dirname(__FILE__) . "/../bbcode/bbcode.php");
-
-/**
- * 'format' hook style function that will be called to convert
- * legacy markup into HTML.
- */
-function phorum_htmlpurifier_migrate($data) {
-    return phorum_mod_bbcode_format($data); // bbcode's 'format' hook
-}
-
-// vim: et sw=4 sts=4

+ 0 - 64
main/inc/lib/htmlpurifier/plugins/phorum/settings.php

@@ -1,64 +0,0 @@
-<?php
-
-// based off of BBCode's settings file
-
-/**
- * HTML Purifier Phorum mod settings configuration. This provides
- * a convenient web-interface for editing the most common HTML Purifier
- * configuration directives. You can also specify custom configuration
- * by creating a 'config.php' file.
- */
-
-if(!defined("PHORUM_ADMIN")) exit;
-
-// error reporting is good!
-error_reporting(E_ALL ^ E_NOTICE);
-
-// load library and other paraphenalia
-require_once './include/admin/PhorumInputForm.php';
-require_once (dirname(__FILE__) . '/htmlpurifier/HTMLPurifier.auto.php');
-require_once (dirname(__FILE__) . '/init-config.php');
-require_once (dirname(__FILE__) . '/settings/migrate-sigs-form.php');
-require_once (dirname(__FILE__) . '/settings/migrate-sigs.php');
-require_once (dirname(__FILE__) . '/settings/form.php');
-require_once (dirname(__FILE__) . '/settings/save.php');
-
-// define friendly configuration directives. you can expand this array
-// to get more web-definable directives
-$PHORUM['mod_htmlpurifier']['directives'] = array(
-    'URI.Host', // auto-detectable
-    'URI.DisableExternal',
-    'URI.DisableExternalResources',
-    'URI.DisableResources',
-    'URI.Munge',
-    'URI.HostBlacklist',
-    'URI.Disable',
-    'HTML.TidyLevel',
-    'HTML.Doctype', // auto-detectable
-    'HTML.Allowed',
-    'AutoFormat',
-    '-AutoFormat.Custom',
-    'AutoFormatParam',
-    'Output.TidyFormat',
-);
-
-// lower this setting if you're getting time outs/out of memory
-$PHORUM['mod_htmlpurifier']['migrate-sigs-increment'] = 100;
-
-if (isset($_POST['reset'])) {
-    unset($PHORUM['mod_htmlpurifier']['config']);
-}
-
-if ($offset = phorum_htmlpurifier_migrate_sigs_check()) {
-    // migrate signatures
-    phorum_htmlpurifier_migrate_sigs($offset);
-} elseif(!empty($_POST)){
-    // save settings
-    phorum_htmlpurifier_save_settings();
-}
-
-phorum_htmlpurifier_show_migrate_sigs_form();
-echo '<br />';
-phorum_htmlpurifier_show_form();
-
-// vim: et sw=4 sts=4

+ 0 - 93
main/inc/lib/htmlpurifier/plugins/phorum/settings/form.php

@@ -1,93 +0,0 @@
-<?php
-
-function phorum_htmlpurifier_show_form() {
-    if (phorum_htmlpurifier_config_file_exists()) {
-        phorum_htmlpurifier_show_config_info();
-        return;
-    }
-
-    global $PHORUM;
-
-    $config = phorum_htmlpurifier_get_config();
-
-    $frm = new PhorumInputForm ("", "post", "Save");
-    $frm->hidden("module", "modsettings");
-    $frm->hidden("mod", "htmlpurifier"); // this is the directory name that the Settings file lives in
-
-    if (!empty($error)){
-        echo "$error<br />";
-    }
-
-    $frm->addbreak("Edit settings for the HTML Purifier module");
-
-    $frm->addMessage('<p>The box below sets <code>$PHORUM[\'mod_htmlpurifier\'][\'wysiwyg\']</code>.
-    When checked, contents sent for edit are now purified and the
-    informative message is disabled. If your WYSIWYG editor is disabled for
-    admin edits, you can safely keep this unchecked.</p>');
-    $frm->addRow('Use WYSIWYG?', $frm->checkbox('wysiwyg', '1', '', $PHORUM['mod_htmlpurifier']['wysiwyg']));
-
-    $frm->addMessage('<p>The box below sets <code>$PHORUM[\'mod_htmlpurifier\'][\'suppress_message\']</code>,
-    which removes the big how-to use
-    HTML Purifier message.</p>');
-    $frm->addRow('Suppress information?', $frm->checkbox('suppress_message', '1', '', $PHORUM['mod_htmlpurifier']['suppress_message']));
-
-    $frm->addMessage('<p>Click on directive links to read what each option does
-    (links do not open in new windows).</p>
-    <p>For more flexibility (for instance, you want to edit the full
-    range of configuration directives), you can create a <tt>config.php</tt>
-    file in your <tt>mods/htmlpurifier/</tt> directory. Doing so will,
-    however, make the web configuration interface unavailable.</p>');
-
-    require_once 'HTMLPurifier/Printer/ConfigForm.php';
-    $htmlpurifier_form = new HTMLPurifier_Printer_ConfigForm('config', 'http://htmlpurifier.org/live/configdoc/plain.html#%s');
-    $htmlpurifier_form->setTextareaDimensions(23, 7); // widen a little, since we have space
-
-    $frm->addMessage($htmlpurifier_form->render(
-        $config, $PHORUM['mod_htmlpurifier']['directives'], false));
-
-    $frm->addMessage("<strong>Warning: Changing HTML Purifier's configuration will invalidate
-      the cache. Expect to see a flurry of database activity after you change
-      any of these settings.</strong>");
-
-    $frm->addrow('Reset to defaults:', $frm->checkbox("reset", "1", "", false));
-
-    // hack to include extra styling
-    echo '<style type="text/css">' . $htmlpurifier_form->getCSS() . '
-    .hp-config {margin-left:auto;margin-right:auto;}
-    </style>';
-    $js = $htmlpurifier_form->getJavaScript();
-    echo '<script type="text/javascript">'."<!--\n$js\n//-->".'</script>';
-
-    $frm->show();
-}
-
-function phorum_htmlpurifier_show_config_info() {
-    global $PHORUM;
-
-    // update mod_htmlpurifier for housekeeping
-    phorum_htmlpurifier_commit_settings();
-
-    // politely tell user how to edit settings manually
-?>
-        <div class="input-form-td-break">How to edit settings for HTML Purifier module</div>
-        <p>
-          A <tt>config.php</tt> file exists in your <tt>mods/htmlpurifier/</tt>
-          directory. This file contains your custom configuration: in order to
-          change it, please navigate to that file and edit it accordingly.
-          You can also set <code>$GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg']</code>
-          or <code>$GLOBALS['PHORUM']['mod_htmlpurifier']['suppress_message']</code>
-        </p>
-        <p>
-          To use the web interface, delete <tt>config.php</tt> (or rename it to
-          <tt>config.php.bak</tt>).
-        </p>
-        <p>
-          <strong>Warning: Changing HTML Purifier's configuration will invalidate
-          the cache. Expect to see a flurry of database activity after you change
-          any of these settings.</strong>
-        </p>
-<?php
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 22
main/inc/lib/htmlpurifier/plugins/phorum/settings/migrate-sigs-form.php

@@ -1,22 +0,0 @@
-<?php
-
-function phorum_htmlpurifier_show_migrate_sigs_form() {
-
-    $frm = new PhorumInputForm ('', "post", "Migrate");
-    $frm->hidden("module", "modsettings");
-    $frm->hidden("mod", "htmlpurifier");
-    $frm->hidden("migrate-sigs", "1");
-    $frm->addbreak("Migrate user signatures to HTML");
-    $frm->addMessage('This operation will migrate your users signatures
-        to HTML. <strong>This process is irreversible and must only be performed once.</strong>
-        Type in yes in the confirmation field to migrate.');
-    if (!file_exists(dirname(__FILE__) . '/../migrate.php')) {
-        $frm->addMessage('Migration file does not exist, cannot migrate signatures.
-            Please check <tt>migrate.bbcode.php</tt> on how to create an appropriate file.');
-    } else {
-        $frm->addrow('Confirm:', $frm->text_box("confirmation", ""));
-    }
-    $frm->show();
-}
-
-// vim: et sw=4 sts=4

+ 0 - 77
main/inc/lib/htmlpurifier/plugins/phorum/settings/migrate-sigs.php

@@ -1,77 +0,0 @@
-<?php
-
-function phorum_htmlpurifier_migrate_sigs_check() {
-    global $PHORUM;
-    $offset = 0;
-    if (!empty($_POST['migrate-sigs'])) {
-        if (!isset($_POST['confirmation']) || strtolower($_POST['confirmation']) !== 'yes') {
-            echo 'Invalid confirmation code.';
-            exit;
-        }
-        $PHORUM['mod_htmlpurifier']['migrate-sigs'] = true;
-        phorum_db_update_settings(array("mod_htmlpurifier"=>$PHORUM["mod_htmlpurifier"]));
-        $offset = 1;
-    } elseif (!empty($_GET['migrate-sigs']) && $PHORUM['mod_htmlpurifier']['migrate-sigs']) {
-        $offset = (int) $_GET['migrate-sigs'];
-    }
-    return $offset;
-}
-
-function phorum_htmlpurifier_migrate_sigs($offset) {
-    global $PHORUM;
-
-    if(!$offset) return; // bail out quick if $offset == 0
-
-    // theoretically, we could get rid of this multi-request
-    // doo-hickery if safe mode is off
-    @set_time_limit(0); // attempt to let this run
-    $increment = $PHORUM['mod_htmlpurifier']['migrate-sigs-increment'];
-
-    require_once(dirname(__FILE__) . '/../migrate.php');
-    // migrate signatures
-    // do this in batches so we don't run out of time/space
-    $end = $offset + $increment;
-    $user_ids = array();
-    for ($i = $offset; $i < $end; $i++) {
-        $user_ids[] = $i;
-    }
-    $userinfos = phorum_db_user_get_fields($user_ids, 'signature');
-    foreach ($userinfos as $i => $user) {
-        if (empty($user['signature'])) continue;
-        $sig = $user['signature'];
-        // perform standard Phorum processing on the sig
-        $sig = str_replace(array("&","<",">"), array("&amp;","&lt;","&gt;"), $sig);
-        $sig = preg_replace("/<((http|https|ftp):\/\/[a-z0-9;\/\?:@=\&\$\-_\.\+!*'\(\),~%]+?)>/i", "$1", $sig);
-        // prepare fake data to pass to migration function
-        $fake_data = array(array("author"=>"", "email"=>"", "subject"=>"", 'body' => $sig));
-        list($fake_message) = phorum_htmlpurifier_migrate($fake_data);
-        $user['signature'] = $fake_message['body'];
-        if (!phorum_api_user_save($user)) {
-            exit('Error while saving user data');
-        }
-    }
-    unset($userinfos); // free up memory
-
-    // query for highest ID in database
-    $type = $PHORUM['DBCONFIG']['type'];
-    $sql = "select MAX(user_id) from {$PHORUM['user_table']}";
-    $row = phorum_db_interact(DB_RETURN_ROW, $sql);
-    $top_id = (int) $row[0];
-
-    $offset += $increment;
-    if ($offset > $top_id) { // test for end condition
-        echo 'Migration finished';
-        $PHORUM['mod_htmlpurifier']['migrate-sigs'] = false;
-        phorum_htmlpurifier_commit_settings();
-        return true;
-    }
-    $host  = $_SERVER['HTTP_HOST'];
-    $uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
-    $extra = 'admin.php?module=modsettings&mod=htmlpurifier&migrate-sigs=' . $offset;
-    // relies on output buffering to work
-    header("Location: http://$host$uri/$extra");
-    exit;
-
-}
-
-// vim: et sw=4 sts=4

+ 0 - 27
main/inc/lib/htmlpurifier/plugins/phorum/settings/save.php

@@ -1,27 +0,0 @@
-<?php
-
-function phorum_htmlpurifier_save_settings() {
-    global $PHORUM;
-    if (phorum_htmlpurifier_config_file_exists()) {
-        echo "Cannot update settings, <code>mods/htmlpurifier/config.php</code> already exists. To change
-        settings, edit that file. To use the web form, delete that file.<br />";
-    } else {
-        $config = phorum_htmlpurifier_get_config(true);
-        if (!isset($_POST['reset'])) $config->mergeArrayFromForm($_POST, 'config', $PHORUM['mod_htmlpurifier']['directives']);
-        $PHORUM['mod_htmlpurifier']['config'] = $config->getAll();
-    }
-    $PHORUM['mod_htmlpurifier']['wysiwyg'] = !empty($_POST['wysiwyg']);
-    $PHORUM['mod_htmlpurifier']['suppress_message'] = !empty($_POST['suppress_message']);
-    if(!phorum_htmlpurifier_commit_settings()){
-        $error="Database error while updating settings.";
-    } else {
-        echo "Settings Updated<br />";
-    }
-}
-
-function phorum_htmlpurifier_commit_settings() {
-    global $PHORUM;
-    return phorum_db_update_settings(array("mod_htmlpurifier"=>$PHORUM["mod_htmlpurifier"]));
-}
-
-// vim: et sw=4 sts=4

+ 0 - 44
main/inc/lib/htmlpurifier/smoketests/all.php

@@ -1,44 +0,0 @@
-<?php
-
-require_once 'common.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-loose.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title>HTML Purifier: All Smoketests</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <style type="text/css">
-        #content {margin:5em;}
-        iframe {width:100%;height:30em;}
-    </style>
-</head>
-<body>
-<h1>HTML Purifier: All Smoketests</h1>
-<div id="content">
-<?php
-
-$dir = './';
-$dh  = opendir($dir);
-while (false !== ($filename = readdir($dh))) {
-    if ($filename[0] == '.') continue;
-    if (strpos($filename, '.php') === false) continue;
-    if ($filename == 'common.php') continue;
-    if ($filename == 'all.php') continue;
-    if ($filename == 'testSchema.php') continue;
-    ?>
-    <iframe src="<?php echo escapeHTML($filename); if (isset($_GET['standalone'])) {echo '?standalone';} ?>"></iframe>
-    <?php
-}
-
-?>
-</div>
-</body>
-</html>
-<?php
-
-// vim: et sw=4 sts=4

+ 0 - 72
main/inc/lib/htmlpurifier/smoketests/attrTransform.php

@@ -1,72 +0,0 @@
-<?php
-
-require 'common.php';
-
-?><!DOCTYPE html
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title>HTML Purifier Attribute Transformation Smoketest</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <style type="text/css">
-        div.container {position:relative;height:120px;border:1px solid #CCC;
-            margin-bottom:1em; width:225px; float:left; margin-top:1em;
-            margin-right:1em;}
-        h2 {clear:left;margin-bottom:0;}
-        div.container.legend .test {text-align:center;line-height:100px;}
-        div.test {width:100px;height:100px;border:1px solid black;
-            position:absolute;top:10px;overflow:auto;}
-        div.test.html {left:10px;border-right:none;background:#FCC;}
-        div.test.css  {left:110px;background:#CFC;}
-        img.marked {border:1px solid #000;background:#FFF;}
-        table.bright {background-color:#F00;}
-        hr.short {width:50px;}
-    </style>
-</head>
-<body>
-<h1>HTML Purifier Attribute Transformation Smoketest</h1>
-<div class="container legend">
-<div class="test html">
-    HTML
-</div>
-<div class="test css">
-    CSS
-</div>
-</div>
-<?php
-
-if (version_compare(PHP_VERSION, '5', '<')) exit('<p>Requires PHP 5.</p>');
-
-$xml = simplexml_load_file('attrTransform.xml');
-
-// attr transform enabled HTML Purifier
-$config = HTMLPurifier_Config::createDefault();
-$config->set('HTML', 'Doctype', 'XHTML 1.0 Strict');
-$purifier = new HTMLPurifier($config);
-
-$title = isset($_GET['title']) ? $_GET['title'] : true;
-
-foreach ($xml->group as $group) {
-    echo '<h2>' . $group['title'] . '</h2>';
-    foreach ($group->sample as $sample) {
-        $sample = (string) $sample;
-?>
-<div class="container">
-<div class="test html">
-    <?php echo $sample; ?>
-</div>
-<div class="test css">
-    <?php echo $purifier->purify($sample); ?>
-</div>
-</div>
-<?php
-    }
-}
-
-?>
-</body>
-</html>
-<?php
-
-// vim: et sw=4 sts=4

+ 0 - 191
main/inc/lib/htmlpurifier/smoketests/attrTransform.xml

@@ -1,191 +0,0 @@
-<?xml version="1.0"?>
-<samples>
-    <group title="menu,dir">
-        <sample><![CDATA[<menu><li>menu</li></menu>]]></sample>
-        <sample><![CDATA[<dir><li>dir</li></dir>]]></sample>
-    </group>
-    <group title="font">
-        <sample><![CDATA[<font color="red">Red</font>]]></sample>
-        <sample><![CDATA[<font color="#0000FF">#0000FF</font>]]></sample>
-        <sample><![CDATA[<font face="Arial">Arial</font>]]></sample>
-    </group>
-    <group title="font.size">
-        <sample><![CDATA[<font size="-2">-2</font>]]></sample>
-        <sample><![CDATA[<font size="-1">-1</font>]]></sample>
-        <sample><![CDATA[<font size="0">0</font>]]></sample>
-        <sample><![CDATA[<font size="1">1</font>]]></sample>
-        <sample><![CDATA[<font size="2">2</font>]]></sample>
-        <sample><![CDATA[<font size="3">3</font>]]></sample>
-        <sample><![CDATA[<font size="4">4</font>]]></sample>
-        <sample><![CDATA[<font size="5">5</font>]]></sample>
-        <sample><![CDATA[<font size="6">6</font>]]></sample>
-        <sample><![CDATA[<font size="7">7</font>]]></sample>
-        <sample><![CDATA[<font size="8">8</font>]]></sample>
-        <sample><![CDATA[<font size="+1">+1</font>]]></sample>
-        <sample><![CDATA[<font size="+2">+2</font>]]></sample>
-        <sample><![CDATA[<font size="+3">+3</font>]]></sample>
-        <sample><![CDATA[<font size="+4">+4</font>]]></sample>
-        <sample><![CDATA[<font size="+5">+5</font>]]></sample>
-    </group>
-    <group title="center">
-        <sample><![CDATA[<center>Centered</center>]]></sample>
-    </group>
-    <group title="p.align">
-        <sample><![CDATA[<p align="left">Left</p>]]></sample>
-        <sample><![CDATA[<p align="center">Center</p>]]></sample>
-        <sample><![CDATA[<p align="right">Right</p>]]></sample>
-    </group>
-    <group title="table.bgcolor">
-        <sample><![CDATA[
-            <table bgcolor="black" cellspacing="2" cellpadding="2" border="1">
-                <tr bgcolor="red">
-                    <th bgcolor="green">To</th>
-                    <td bgcolor="blue">Be</td>
-                </tr>
-                <tr>
-                    <th bgcolor="green">Or</th>
-                    <td>Not</td>
-                </tr>
-                <tr bgcolor="red">
-                    <th>To</th>
-                    <td>Be</td>
-                </tr>
-            </table>
-       ]]></sample>
-        <sample><![CDATA[
-            <table class="bright" bgcolor="black" cellspacing="2" cellpadding="2" border="1">
-                <tr>
-                    <th bgcolor="green">Or</th>
-                    <td>Not</td>
-                </tr>
-                <tr bgcolor="blue">
-                    <th bgcolor="green">To</th>
-                    <td>Be</td>
-                </tr>
-            </table>
-       ]]></sample>
-    </group>
-    <group title="img.border">
-        <sample><![CDATA[<img src="img.png" alt="I" border="2" />]]></sample>
-        <sample><![CDATA[<a href="http://example.com/"><img src="img.png" alt="I" border="2" /></a>]]></sample>
-    </group>
-    <group title="td,th,hr.width">
-        <sample><![CDATA[
-            <table border="1">
-                <tr>
-                    <th width="20">x1</th>
-                    <td width="40">x2</td>
-                </tr>
-            </table>
-        ]]></sample>
-        <sample><![CDATA[
-            <table border="1">
-                <tr>
-                    <th width="33%">x1</th>
-                    <td width="67%">x2</td>
-                </tr>
-            </table>
-        ]]></sample>
-        <sample><![CDATA[<hr width="70%" /><hr width="30" />]]></sample>
-    </group>
-    <group title="td,th.nowrap">
-        <sample><![CDATA[
-            <table border="1">
-                <tr>
-                    <th>This wants to wrap</th>
-                    <td>really badly yes it does</td>
-                </tr>
-            </table>
-        ]]></sample>
-        <sample><![CDATA[
-            <table border="1">
-                <tr>
-                    <th nowrap>This wants to wrap</th>
-                    <td nowrap>really badly yes it does</td>
-                </tr>
-            </table>
-        ]]></sample>
-    </group>
-    <group title="td,th.height">
-        <sample><![CDATA[<table border="1"><tr><td height="60">tall</td></tr></table>]]></sample>
-    </group>
-    <group title="img.vspace,hspace">
-        <sample><![CDATA[a<img src="img.png" alt="I" class="marked" hspace="7" />a]]></sample>
-        <sample><![CDATA[<img src="img.png" alt="I" class="marked" vspace="7" /><br />o]]></sample>
-    </group>
-    <group title="hr">
-        <sample><![CDATA[<hr size="4" />]]></sample>
-        <sample><![CDATA[<hr size="50" noshade />]]></sample>
-    </group>
-    <group title="br.clear">
-        <sample><![CDATA[<img src="img.png" alt="I" align="right" />B<br />A]]></sample>
-        <sample><![CDATA[<img src="img.png" alt="I" align="right" />B<br clear="right" />A]]></sample>
-        <sample><![CDATA[<img src="img.png" alt="I" align="right" /><img src="img.png" alt="I" align="left" />B<br />A]]></sample>
-        <sample><![CDATA[<img src="img.png" alt="I" align="right" /><img src="img.png" alt="I" align="left" />B<br clear="all" />A]]></sample>
-    </group>
-    <group title="caption.align">
-        <sample><![CDATA[
-            <table border="1">
-                <caption align="left">Left</caption>
-                <tr><td>1.1</td><td>1.2</td></tr>
-            </table>
-        ]]></sample>
-        <sample><![CDATA[
-            <table border="1">
-                <caption align="right">Right</caption>
-                <tr><td>1.1</td><td>1.2</td></tr>
-            </table>
-        ]]></sample>
-        <sample><![CDATA[
-            <table border="1">
-                <caption align="top">Top</caption>
-                <tr><td>1.1</td><td>1.2</td></tr>
-            </table>
-        ]]></sample>
-        <sample><![CDATA[
-            <table border="1">
-                <caption align="bottom">Bottom</caption>
-                <tr><td>1.1</td><td>1.2</td></tr>
-            </table>
-        ]]></sample>
-    </group>
-    <group title="img.align">
-        <sample><![CDATA[left<img src="img.png" alt="I" class="marked" align="left" />]]></sample>
-        <sample><![CDATA[right<img src="img.png" alt="I" class="marked" align="right" />]]></sample>
-        <sample><![CDATA[o<img src="img.png" alt="I" class="marked" align="top" /> top]]></sample>
-        <sample><![CDATA[o<img src="img.png" alt="I" class="marked" align="bottom" /> bottom]]></sample>
-        <sample><![CDATA[o<img src="img.png" alt="I" class="marked" align="middle" /> middle]]></sample>
-    </group>
-    <group title="table.align">
-        <sample><![CDATA[a<table align="left" class="bright"><tr><td>left</td></tr></table>a]]></sample>
-        <sample><![CDATA[a<table align="center" class="bright"><tr><td>center</td></tr></table>a]]></sample>
-        <sample><![CDATA[a<table align="right" class="bright"><tr><td>right</td></tr></table>a]]></sample>
-    </group>
-    <group title="hr.align">
-        <sample><![CDATA[<hr align="left" class="short" />left]]></sample>
-        <sample><![CDATA[<hr align="center" class="short" />center]]></sample>
-        <sample><![CDATA[<hr align="right" class="short" />right]]></sample>
-    </group>
-    <group title="ul,ol,li.type">
-        <sample><![CDATA[<ul type="disc"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ul type="square"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ul type="circle"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ol type="a"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ol type="A"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ol type="i"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ol type="I"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ol type="1"><li>1</li><li>2</li></ul>]]></sample>
-        <sample><![CDATA[<ol><li type="a">1</li><li type="I">2</li></ul>]]></sample>
-    </group>
-
-
-    <!-- sample
-    <group title="">
-        <sample><![CDATA[]]></sample>
-        <sample><![CDATA[]]></sample>
-        <sample><![CDATA[]]></sample>
-    </group>
-    -->
-</samples>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 73
main/inc/lib/htmlpurifier/smoketests/basic.php

@@ -1,73 +0,0 @@
-<?php
-
-require_once 'common.php';
-
-// todo : modularize the HTML in to separate files
-
-$allowed = array(
-    'allElements' => true,
-    'legacy' => true
-);
-
-$page = isset($_GET['p']) ? $_GET['p'] : false;
-if (!isset($allowed[$page])) $page = false;
-
-$strict = isset($_GET['d']) ? (bool) $_GET['d'] : false;
-
-echo '<?xml version="1.0" encoding="UTF-8" ?>';
-?>
-<?php if ($strict) { ?>
-<!DOCTYPE html
-     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1- Strict.dtd">
-<?php } else { ?>
-<!DOCTYPE html
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">
-<?php } ?>
-<html>
-<head>
-    <title>HTML Purifier Basic Smoketest</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<?php
-    if ($page) {
-        if (file_exists("basic/$page.css")) {
-            ?><link rel="stylesheet" href="basic/<?php echo $page ?>.css" type="text/css" /><?php
-        }
-    }
-?>
-</head>
-<body>
-<?php
-
-if ($page) {
-?>
-<div style="float:right;"><div><?php echo $strict ? 'Strict' : 'Loose'; ?>:
-<a href="?d=<?php echo (int) !$strict; ?>&amp;p=<?php echo $page ?>">Swap</a></div>
-<a href="http://validator.w3.org/check?uri=referer"><img
-        src="http://www.w3.org/Icons/valid-xhtml10"
-        alt="Valid XHTML 1.0 Transitional" height="31" width="88" style="border:0;" /></a>
-</div>
-<?php
-    $config = HTMLPurifier_Config::createDefault();
-    $config->set('Attr', 'EnableID', true);
-    $config->set('HTML', 'Strict', $strict);
-    $purifier = new HTMLPurifier($config);
-    echo $purifier->purify(file_get_contents("basic/$page.html"));
-} else {
-    ?>
-    <h1>HTML Purifier Basic Smoketest Index</h1>
-    <ul>
-    <?php
-    foreach ($allowed as $val => $b) {
-        ?><li><a href="?p=<?php echo $val ?>"><?php echo $val ?></a></li><?php
-    }
-    ?></ul><?php
-}
-
-?>
-</body>
-</html>
-<?php
-
-// vim: et sw=4 sts=4

+ 0 - 50
main/inc/lib/htmlpurifier/smoketests/basic/allElements.css

@@ -1,50 +0,0 @@
-div > * {background:#F00; color:#FFF; font-weight:bold; padding:0.2em; margin:0.1em;}
-#core-attributes #core-attributes-id,
-#core-attributes .core-attributes-class,
-#core-attributes div[title='tooltip'],
-#core-attributes div[lang='en'],
-#core-attributes div[onclick="alert('foo');"],
-#module-text abbr,
-#module-text acronym,
-#module-text div blockquote,
-#module-text blockquote[cite='http://www.example.com'],
-#module-text br,
-#module-text cite,
-#module-text code,
-#module-text dfn,
-#module-text em,
-#module-text h1,
-#module-text h2,
-#module-text h3,
-#module-text h4,
-#module-text h5,
-#module-text h6,
-#module-text kbd,
-#module-text p,
-#module-text pre,
-#module-text span q,
-#module-text q[cite='http://www.example.com'],
-#module-text samp,
-#module-text strong,
-#module-text var,
-#module-hypertext span a,
-#module-hypertext a[accesskey='q'],
-#module-hypertext a[charset='UTF-8'],
-#module-hypertext a[href='http://www.example.com/'],
-#module-hypertext a[hreflang='en'],
-#module-hypertext a[rel='nofollow'],
-#module-hypertext a[rev='index'],
-#module-hypertext a[tabindex='1'],
-#module-hypertext a[type='text/plain'],
-#module-list dl,
-#module-list ul,
-#module-list ol,
-#module-list li,
-#module-list dd,
-#module-list dt,
-.insert-declarations-above
- {background:#008000; margin:0; padding:0.2em;}
-#module-text span, #module-text div {padding:0; margin:0.1em;}
-#module-list li, #module-list dd, #module-list dt {border:1px solid #FFF;}
-
-/* vim: et sw=4 sts=4 */

+ 0 - 81
main/inc/lib/htmlpurifier/smoketests/basic/allElements.html

@@ -1,81 +0,0 @@
-<?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-loose.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>HTML Purifier All Elements Smoketest</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" href="allElements.css" type="text/css" />
-</head>
-<body>
-
-<h1>HTML Purifier All Elements Smoketest</h1>
-
-<p>This is the all elements smoke
-test. It is divided by XHTML 1.1 style modules. Make sure
-<code>div</code>, <code>span</code> and <code>id</code> are allowed,
-otherwise there will be problems.</p>
-
-<h2>Core attributes</h2>
-<div id="core-attributes">
- <div id="core-attributes-id">id</div>
- <div class="core-attributes-class">class</div>
- <div title="tooltip">title</div>
- <div lang="en">lang</div>
- <div xml:lang="en">xml:lang (green when lang also present)</div>
- <div style="background:#008000">style</div>
- <div onclick="alert('foo');">onclick (and other event handlers)</div>
-</div>
-
-<h2>Text module</h2>
-<div id="module-text">
- <abbr>abbr</abbr>
- <acronym>acronym</acronym>
- <div><blockquote>blockquote</blockquote></div>
- <blockquote cite="http://www.example.com">blockquote@cite</blockquote>
- <br />
- <cite>cite</cite>
- <code>code</code>
- <dfn>dfn</dfn>
- <em>em</em>
- <h1>h1</h1>
- <h2>h2</h2>
- <h3>h3</h3>
- <h4>h4</h4>
- <h5>h5</h5>
- <h6>h6</h6>
- <kbd>kbd</kbd>
- <p>p</p>
- <pre>pre</pre>
- <span><q>q</q></span>
- <q cite="http://www.example.com">q@cite</q>
- <samp>samp</samp>
- <strong>strong</strong>
- <var>var</var>
-</div>
-
-<h2>Hypertext module</h2>
-<div id="module-hypertext">
- <span><a>a</a></span>:
- <a accesskey="q">accesskey</a>
- <a charset="UTF-8">charset</a>
- <a href="http://www.example.com/">href</a>
- <a hreflang="en">hreflang</a>
- <a rel="nofollow">rel</a>
- <a rev="index">rev</a>
- <a tabindex="1">tabindex</a>
- <a type="text/plain">type</a>
-</div>
-
-<h2>List module</h2>
-<div id="module-list">
- <dl><dt>dl dt</dt><dd>dl dd</dd></dl>
- <ol><li>ol li</li></ol>
- <ul><li>ul li</li></ul>
-</div>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 73
main/inc/lib/htmlpurifier/smoketests/basic/legacy.css

@@ -1,73 +0,0 @@
-
-center,
-dir[compact='compact'],
-isindex[prompt='Foo'],
-menu[compact='compact'],
-s,
-u,
-strike,
-
-caption[align='bottom'],
-div[align='center'],
-dl[compact='compact'],
-
-h1[align='right'],
-h2[align='right'],
-h3[align='right'],
-h4[align='right'],
-h5[align='right'],
-h6[align='right'],
-
-hr[align='right'],
-hr[noshade='noshade'],
-hr[width='50'],
-hr[size='50'],
-
-img[align='right'],
-img[border='3'],
-img[hspace='5'],
-img[vspace='5'],
-
-input[align='right'],
-legend[align='center'],
-
-li[type='A'],
-li[value='5'],
-
-ol[compact='compact'],
-ol[start='3'],
-ol[type='I'],
-
-p[align='right'],
-
-pre[width='50'],
-
-table[align='right'],
-table[bgcolor='#0000FF'],
-
-tr[bgcolor='#0000FF'],
-
-td[bgcolor='#0000FF'],
-td[height='50'],
-td[nowrap='nowrap'],
-td[width='200'],
-
-th[bgcolor='#0000FF'],
-th[height='50'],
-th[nowrap='nowrap'],
-th[width='200'],
-
-ul[compact='compact'],
-ul[type='square'],
-
-.insert-declarations-above
- {background:#008000; color:#FFF; font-weight:bold;}
-
-font {background:#BFB;}
-u {border:1px solid #000;}
-hr {height:1em;}
-hr[size='50'] {height:50px;}
-img[border='3'] {border: 3px solid #000;}
-li[type='a'], li[value='5'] {color:#DDD;}
-
-/* vim: et sw=4 sts=4 */

+ 0 - 126
main/inc/lib/htmlpurifier/smoketests/basic/legacy.html

@@ -1,126 +0,0 @@
-<?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-loose.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>HTML Purifier Legacy Smoketest Test Data</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" href="legacy.css" type="text/css" />
-</head>
-<body>
-
-<h1>HTML Purifier Legacy Smoketest Test Data</h1>
-
-<p>This is the legacy smoketest.</p>
-
-<h2>Elements</h2>
-
-<div>
-<div>
-    <basefont color="green" face="Arial" size="6" id="basefont" />
-    basefont: Green, Arial, size 6 text (IE-only)
-</div>
-
-<center>center</center>
-
-<dir compact="compact">
-    <li>dir</li>
-</dir>
-
-<font color="green" face="Arial" size="6">font: Green, Arial, size 6 text</font>
-
-isindex:
-<isindex prompt="Foo" />
-
-<menu compact="compact">
-    <li>menu</li>
-</menu>
-
-<s>s</s> <strike>strike</strike> <u>u</u>
-</div>
-
-<h2>Attributes</h2>
-
-<div>
-<!-- body -->
-
-<div style="font-size:42pt; float:left;">*</div>
-<br clear="left" />
-<p>br@clear (asterisk is up)</p>
-
-<table>
-    <caption align="bottom">caption@align</caption>
-    <tr><td>Cell</td></tr>
-</table>
-
-<div align="center">div@center</div>
-
-<dl compact="compact">
-    <dt>dl@compact</dt>
-</dl>
-
-<h1 align="right">h1</h1>
-<h2 align="right">h2</h2>
-<h3 align="right">h3</h3>
-<h4 align="right">h4</h4>
-<h5 align="right">h5</h5>
-<h6 align="right">h6</h6>
-
-hr@align
-<hr align="right" width="50" />
-hr@noshade
-<hr noshade="noshade" />
-hr@width
-<hr width="50" />
-hr@size
-<hr size="50" />
-
-<img src="" alt="img@align" align="right" /> |
-<img src="" alt="img@border" border="3" /> |
-<img src="" alt="img@hspace" hspace="5" /> |
-<img src="" alt="img@vspace" vspace="5" />
-
-<!-- needs context -->
-<input align="right" />
-<legend align="center">Legend</legend>
-
-<ol>
-    <li type="A">li@type (ensure that it's a capital A)</li>
-    <li value="5">li@value</li>
-</ol>
-
-<ol compact="compact"><li>ol@compact</li></ol>
-<ol start="3"><li>ol@start</li></ol>
-<ol type="I"><li>ol@type</li></ol>
-
-<p align="right">p@align</p>
-
-<pre width="50">pre@width</pre>
-
-<script language="JavaScript">document.writeln('script');</script>
-
-<table align="right"><tr><td>table@align</td></tr></table>
-<table bgcolor="#0000FF"><tr><td>table@bgcolor</td></tr></table>
-
-<table><tr bgcolor="#0000FF"><td>tr@bgcolor</td></tr></table>
-
-<table><tr><td bgcolor="#0000FF">td@bgcolor</td></tr></table>
-<table><tr><td height="50">td@height</td></tr></table>
-<table><tr><td nowrap="nowrap">td@nowrap</td></tr></table>
-<table><tr><td width="200">td@width</td></tr></table>
-
-<table><tr><th bgcolor="#0000FF">th@bgcolor</th></tr></table>
-<table><tr><th height="50">th@height</th></tr></table>
-<table><tr><th nowrap="nowrap">th@nowrap</th></tr></table>
-<table><tr><th width="200">th@width</th></tr></table>
-
-<ul compact="compact"><li>ul@compact</li></ul>
-<ul type="square"><li>ul@square</li></ul>
-
-</div>
-
-</body>
-</html>
-
-<!-- vim: et sw=4 sts=4 -->

+ 0 - 37
main/inc/lib/htmlpurifier/smoketests/common.php

@@ -1,37 +0,0 @@
-<?php
-
-header('Content-type: text/html; charset=UTF-8');
-
-if (!isset($_GET['standalone'])) {
-    require_once '../library/HTMLPurifier.auto.php';
-} else {
-    require_once '../library/HTMLPurifier.standalone.php';
-}
-error_reporting(E_ALL);
-
-function escapeHTML($string) {
-    $string = HTMLPurifier_Encoder::cleanUTF8($string);
-    $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
-    return $string;
-}
-
-if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
-    function fix_magic_quotes(&$array) {
-        foreach ($array as $k => $val) {
-            if (!is_array($val)) {
-                $array[$k] = stripslashes($val);
-            } else {
-                fix_magic_quotes($array[$k]);
-            }
-        }
-    }
-
-    fix_magic_quotes($_GET);
-    fix_magic_quotes($_POST);
-    fix_magic_quotes($_COOKIE);
-    fix_magic_quotes($_REQUEST);
-    fix_magic_quotes($_ENV);
-    fix_magic_quotes($_SERVER);
-}
-
-// vim: et sw=4 sts=4

+ 0 - 77
main/inc/lib/htmlpurifier/smoketests/configForm.php

@@ -1,77 +0,0 @@
-<?php
-
-require_once 'common.php';
-
-// Setup environment
-require_once '../extras/HTMLPurifierExtras.auto.php';
-$interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder::buildFromDirectory('test-schema/');
-$interchange->validate();
-
-if (isset($_GET['doc'])) {
-
-    // Hijack page generation to supply documentation
-
-    if (file_exists('test-schema.html') && !isset($_GET['purge'])) {
-        echo file_get_contents('test-schema.html');
-        exit;
-    }
-
-    $style = 'plain';
-    $configdoc_xml = 'test-schema.xml';
-
-    $xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml();
-    $xml_builder->openURI($configdoc_xml);
-    $xml_builder->build($interchange);
-    unset($xml_builder); // free handle
-
-    $xslt = new ConfigDoc_HTMLXSLTProcessor();
-    $xslt->importStylesheet("../configdoc/styles/$style.xsl");
-    $xslt->setParameters(array(
-      'css' => '../configdoc/styles/plain.css',
-    ));
-    $html = $xslt->transformToHTML($configdoc_xml);
-
-    unlink('test-schema.xml');
-    file_put_contents('test-schema.html', $html);
-    echo $html;
-
-    exit;
-}
-
-?><!DOCTYPE html
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<head>
-    <title>HTML Purifier Config Form Smoketest</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <link rel="stylesheet" href="../library/HTMLPurifier/Printer/ConfigForm.css" type="text/css" />
-    <script defer="defer" type="text/javascript" src="../library/HTMLPurifier/Printer/ConfigForm.js"></script>
-</head>
-<body>
-<h1>HTML Purifier Config Form Smoketest</h1>
-<p>This file outputs the configuration form for every single type
-of directive possible.</p>
-<form id="htmlpurifier-config" name="htmlpurifier-config" method="get" action=""
-style="float:right;">
-<?php
-
-$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
-$schema = $schema_builder->build($interchange);
-
-$config  = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config', true, true, $schema);
-$printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s');
-echo $printer->render(array(HTMLPurifier_Config::createDefault(), $config));
-
-?>
-</form>
-<pre>
-<?php
-echo htmlspecialchars(var_export($config->getAll(), true));
-?>
-</pre>
-</body>
-</html>
-<?php
-
-// vim: et sw=4 sts=4

Some files were not shown because too many files changed in this diff