]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19183 imported HTMLpurifier 3.3.0
authorskodak <skodak>
Thu, 14 May 2009 08:31:11 +0000 (08:31 +0000)
committerskodak <skodak>
Thu, 14 May 2009 08:31:11 +0000 (08:31 +0000)
324 files changed:
lib/htmlpurifier/CREDITS
lib/htmlpurifier/HTMLPurifier.php
lib/htmlpurifier/HTMLPurifier.safe-includes.php
lib/htmlpurifier/HTMLPurifier/AttrCollections.php
lib/htmlpurifier/HTMLPurifier/AttrDef.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/AlphaValue.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Background.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Border.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Color.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Composite.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Filter.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Font.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/FontFamily.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Length.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/ListStyle.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Multiple.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Number.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Percentage.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/TextDecoration.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/URI.php
lib/htmlpurifier/HTMLPurifier/AttrDef/Enum.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Bool.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Color.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/FrameTarget.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/ID.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Length.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/LinkTypes.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/MultiLength.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Nmtokens.php
lib/htmlpurifier/HTMLPurifier/AttrDef/HTML/Pixels.php
lib/htmlpurifier/HTMLPurifier/AttrDef/Integer.php
lib/htmlpurifier/HTMLPurifier/AttrDef/Lang.php
lib/htmlpurifier/HTMLPurifier/AttrDef/Switch.php
lib/htmlpurifier/HTMLPurifier/AttrDef/Text.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI/Email.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI/Host.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI/IPv4.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI/IPv6.php
lib/htmlpurifier/HTMLPurifier/AttrTransform.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Background.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/BdoDir.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/BgColor.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/BoolToCSS.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Border.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/EnumToCSS.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/ImgRequired.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/ImgSpace.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Input.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Lang.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Length.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Name.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/SafeEmbed.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/SafeObject.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/SafeParam.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/ScriptRequired.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/Textarea.php
lib/htmlpurifier/HTMLPurifier/AttrTypes.php
lib/htmlpurifier/HTMLPurifier/AttrValidator.php
lib/htmlpurifier/HTMLPurifier/Bootstrap.php
lib/htmlpurifier/HTMLPurifier/CSSDefinition.php
lib/htmlpurifier/HTMLPurifier/ChildDef.php
lib/htmlpurifier/HTMLPurifier/ChildDef/Chameleon.php
lib/htmlpurifier/HTMLPurifier/ChildDef/Custom.php
lib/htmlpurifier/HTMLPurifier/ChildDef/Empty.php
lib/htmlpurifier/HTMLPurifier/ChildDef/Optional.php
lib/htmlpurifier/HTMLPurifier/ChildDef/Required.php
lib/htmlpurifier/HTMLPurifier/ChildDef/StrictBlockquote.php
lib/htmlpurifier/HTMLPurifier/ChildDef/Table.php
lib/htmlpurifier/HTMLPurifier/Config.php
lib/htmlpurifier/HTMLPurifier/ConfigDef.php [deleted file]
lib/htmlpurifier/HTMLPurifier/ConfigDef/Directive.php [deleted file]
lib/htmlpurifier/HTMLPurifier/ConfigDef/DirectiveAlias.php [deleted file]
lib/htmlpurifier/HTMLPurifier/ConfigDef/Namespace.php [deleted file]
lib/htmlpurifier/HTMLPurifier/ConfigSchema.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/Xml.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Exception.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Directive.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Id.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Namespace.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/Validator.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/ValidatorAtom.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema.ser
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.AllowedFrameTargets.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRel.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.AllowedRev.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.DefaultImageAlt.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImage.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.DefaultInvalidImageAlt.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.DefaultTextDir.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.EnableID.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklist.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.IDBlacklistRegexp.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefix.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.IDPrefixLocal.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Attr.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.AutoParagraph.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.Custom.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.DisplayLinkURI.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.Linkify.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.PurifierLinkify.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormat.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormatParam.PurifierLinkifyDocURL.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/AutoFormatParam.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.AllowImportant.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.AllowTricky.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.AllowedProperties.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.DefinitionRev.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.MaxImgLength.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.Proprietary.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/CSS.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Cache.DefinitionImpl.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Cache.SerializerPath.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Cache.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyFixLt.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.CollectErrors.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.ConvertDocumentToFragment.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.DirectLexLineNumberSyncInterval.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.Encoding.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidChildren.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.EscapeInvalidTags.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.EscapeNonASCIICharacters.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.HiddenElements.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.Language.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.LexerImpl.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.MaintainLineNumbers.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.RemoveInvalidImg.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.RemoveScriptContents.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Filter.Custom.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Filter.YouTube.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Filter.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/FilterParam.ExtractStyleBlocksEscaping.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/FilterParam.ExtractStyleBlocksScope.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/FilterParam.ExtractStyleBlocksTidyImpl.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/FilterParam.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.Allowed.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.AllowedAttributes.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.AllowedElements.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.AllowedModules.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.BlockWrapper.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.CoreModules.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.CustomDoctype.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionID.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.DefinitionRev.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.Doctype.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenAttributes.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.ForbiddenElements.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.MaxImgLength.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.Parent.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.Proprietary.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.SafeEmbed.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.SafeObject.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.Strict.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.TidyAdd.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.TidyLevel.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.TidyRemove.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.Trusted.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.XHTML.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Output.CommentScriptContents.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Output.Newline.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Output.SortAttr.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Output.TidyFormat.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Output.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Test.ForceNoIconv.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Test.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.AllowedSchemes.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.Base.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DefinitionID.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DefinitionRev.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.Disable.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DisableExternal.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DisableExternalResources.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DisableResources.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.Host.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.HostBlacklist.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.MakeAbsolute.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.Munge.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.MungeResources.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.OverrideAllowedSchemes.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.txt
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/info.ini
lib/htmlpurifier/HTMLPurifier/ContentSets.php
lib/htmlpurifier/HTMLPurifier/Context.php
lib/htmlpurifier/HTMLPurifier/Definition.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Decorator.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Decorator/Memory.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Decorator/Template.php.in
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Null.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer/README
lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
lib/htmlpurifier/HTMLPurifier/Doctype.php
lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php
lib/htmlpurifier/HTMLPurifier/ElementDef.php
lib/htmlpurifier/HTMLPurifier/Encoder.php
lib/htmlpurifier/HTMLPurifier/EntityLookup.php
lib/htmlpurifier/HTMLPurifier/EntityParser.php
lib/htmlpurifier/HTMLPurifier/ErrorCollector.php
lib/htmlpurifier/HTMLPurifier/ErrorStruct.php
lib/htmlpurifier/HTMLPurifier/Exception.php
lib/htmlpurifier/HTMLPurifier/Filter.php
lib/htmlpurifier/HTMLPurifier/Filter/ExtractStyleBlocks.php
lib/htmlpurifier/HTMLPurifier/Filter/YouTube.php
lib/htmlpurifier/HTMLPurifier/Generator.php
lib/htmlpurifier/HTMLPurifier/HTMLDefinition.php
lib/htmlpurifier/HTMLPurifier/HTMLModule.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Bdo.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/CommonAttributes.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Edit.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Forms.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Hypertext.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Image.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Legacy.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/List.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Name.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Object.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Presentation.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Proprietary.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Ruby.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/SafeEmbed.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/SafeObject.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Scripting.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/StyleAttribute.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tables.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Target.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Text.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Name.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Proprietary.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Strict.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/Transitional.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTML.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/XMLCommonAttributes.php
lib/htmlpurifier/HTMLPurifier/HTMLModuleManager.php
lib/htmlpurifier/HTMLPurifier/IDAccumulator.php
lib/htmlpurifier/HTMLPurifier/Injector.php
lib/htmlpurifier/HTMLPurifier/Injector/AutoParagraph.php
lib/htmlpurifier/HTMLPurifier/Injector/DisplayLinkURI.php
lib/htmlpurifier/HTMLPurifier/Injector/Linkify.php
lib/htmlpurifier/HTMLPurifier/Injector/PurifierLinkify.php
lib/htmlpurifier/HTMLPurifier/Injector/RemoveEmpty.php
lib/htmlpurifier/HTMLPurifier/Injector/SafeObject.php
lib/htmlpurifier/HTMLPurifier/Language.php
lib/htmlpurifier/HTMLPurifier/Language/classes/en-x-test.php
lib/htmlpurifier/HTMLPurifier/Language/messages/en-x-test.php
lib/htmlpurifier/HTMLPurifier/Language/messages/en-x-testmini.php
lib/htmlpurifier/HTMLPurifier/Language/messages/en.php
lib/htmlpurifier/HTMLPurifier/LanguageFactory.php
lib/htmlpurifier/HTMLPurifier/Length.php
lib/htmlpurifier/HTMLPurifier/Lexer.php
lib/htmlpurifier/HTMLPurifier/Lexer/DOMLex.php
lib/htmlpurifier/HTMLPurifier/Lexer/DirectLex.php
lib/htmlpurifier/HTMLPurifier/Lexer/PEARSax3.php
lib/htmlpurifier/HTMLPurifier/PercentEncoder.php
lib/htmlpurifier/HTMLPurifier/Printer.php
lib/htmlpurifier/HTMLPurifier/Printer/CSSDefinition.php
lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.css
lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.js
lib/htmlpurifier/HTMLPurifier/Printer/ConfigForm.php
lib/htmlpurifier/HTMLPurifier/Printer/HTMLDefinition.php
lib/htmlpurifier/HTMLPurifier/PropertyList.php [new file with mode: 0755]
lib/htmlpurifier/HTMLPurifier/PropertyListIterator.php [new file with mode: 0755]
lib/htmlpurifier/HTMLPurifier/Strategy.php
lib/htmlpurifier/HTMLPurifier/Strategy/Composite.php
lib/htmlpurifier/HTMLPurifier/Strategy/Core.php
lib/htmlpurifier/HTMLPurifier/Strategy/FixNesting.php
lib/htmlpurifier/HTMLPurifier/Strategy/MakeWellFormed.php
lib/htmlpurifier/HTMLPurifier/Strategy/RemoveForeignElements.php
lib/htmlpurifier/HTMLPurifier/Strategy/ValidateAttributes.php
lib/htmlpurifier/HTMLPurifier/StringHash.php
lib/htmlpurifier/HTMLPurifier/StringHashParser.php
lib/htmlpurifier/HTMLPurifier/TagTransform.php
lib/htmlpurifier/HTMLPurifier/TagTransform/Font.php
lib/htmlpurifier/HTMLPurifier/TagTransform/Simple.php
lib/htmlpurifier/HTMLPurifier/Token.php
lib/htmlpurifier/HTMLPurifier/Token/Comment.php
lib/htmlpurifier/HTMLPurifier/Token/Empty.php
lib/htmlpurifier/HTMLPurifier/Token/End.php
lib/htmlpurifier/HTMLPurifier/Token/Start.php
lib/htmlpurifier/HTMLPurifier/Token/Tag.php
lib/htmlpurifier/HTMLPurifier/Token/Text.php
lib/htmlpurifier/HTMLPurifier/TokenFactory.php
lib/htmlpurifier/HTMLPurifier/URI.php
lib/htmlpurifier/HTMLPurifier/URIDefinition.php
lib/htmlpurifier/HTMLPurifier/URIFilter.php
lib/htmlpurifier/HTMLPurifier/URIFilter/DisableExternal.php
lib/htmlpurifier/HTMLPurifier/URIFilter/DisableExternalResources.php
lib/htmlpurifier/HTMLPurifier/URIFilter/HostBlacklist.php
lib/htmlpurifier/HTMLPurifier/URIFilter/MakeAbsolute.php
lib/htmlpurifier/HTMLPurifier/URIFilter/Munge.php
lib/htmlpurifier/HTMLPurifier/URIParser.php
lib/htmlpurifier/HTMLPurifier/URIScheme.php
lib/htmlpurifier/HTMLPurifier/URIScheme/ftp.php
lib/htmlpurifier/HTMLPurifier/URIScheme/http.php
lib/htmlpurifier/HTMLPurifier/URIScheme/https.php
lib/htmlpurifier/HTMLPurifier/URIScheme/mailto.php
lib/htmlpurifier/HTMLPurifier/URIScheme/news.php
lib/htmlpurifier/HTMLPurifier/URIScheme/nntp.php
lib/htmlpurifier/HTMLPurifier/URISchemeRegistry.php
lib/htmlpurifier/HTMLPurifier/UnitConverter.php
lib/htmlpurifier/HTMLPurifier/VarParser.php
lib/htmlpurifier/HTMLPurifier/VarParser/Flexible.php
lib/htmlpurifier/HTMLPurifier/VarParser/Native.php
lib/htmlpurifier/HTMLPurifier/VarParserException.php
lib/htmlpurifier/readme_moodle.txt

index c3e7bb8e2f87acb9bbb3387ea907c8b544c584e3..7921b45af7d572ab680da261a859274d044accef 100644 (file)
@@ -5,3 +5,5 @@ Almost everything written by Edward Z. Yang (Ambush Commander).  Lots of thanks
 to the DevNetwork Community for their help (see docs/ref-devnetwork.html for
 more details), Feyd especially (namely IPv6 and optimization).  Thanks to RSnake
 for letting me package his fantastic XSS cheatsheet for a smoketest.
+
+    vim: et sw=4 sts=4
index 629f3b269386b9c42e1aeabf51650a1cda0cc9f5..4b1eddecb59f97cda4af8039eea0f3fdfd0d3aeb 100644 (file)
@@ -1,11 +1,11 @@
 <?php
 
 /*! @mainpage
- * 
+ *
  * HTML Purifier is an HTML filter that will take an arbitrary snippet of
  * HTML and rigorously test, validate and filter it into a version that
  * is safe for output onto webpages. It achieves this by:
- * 
+ *
  *  -# Lexing (parsing into tokens) the document,
  *  -# Executing various strategies on the tokens:
  *      -# Removing all elements not in the whitelist,
  *      -# Fixing the nesting of the nodes, and
  *      -# Validating attributes of the nodes; and
  *  -# Generating HTML from the purified tokens.
- * 
+ *
  * However, most users will only need to interface with the HTMLPurifier
  * and HTMLPurifier_Config.
  */
 
 /*
-    HTML Purifier 3.2.0 - Standards Compliant HTML Filtering
+    HTML Purifier 3.3.0 - Standards Compliant HTML Filtering
     Copyright (C) 2006-2008 Edward Z. Yang
 
     This library is free software; you can redistribute it and/or
 
 /**
  * Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
- * 
- * @note There are several points in which configuration can be specified 
+ *
+ * @note There are several points in which configuration can be specified
  *       for HTML Purifier.  The precedence of these (from lowest to
  *       highest) is as follows:
  *          -# Instance: new HTMLPurifier($config)
  *          -# Invocation: purify($html, $config)
  *       These configurations are entirely independent of each other and
  *       are *not* merged (this behavior may change in the future).
- * 
+ *
  * @todo We need an easier way to inject strategies using the configuration
  *       object.
  */
 class HTMLPurifier
 {
-    
+
     /** Version of HTML Purifier */
-    public $version = '3.2.0';
-    
+    public $version = '3.3.0';
+
     /** Constant with version of HTML Purifier */
-    const VERSION = '3.2.0';
-    
+    const VERSION = '3.3.0';
+
     /** Global configuration object */
     public $config;
-    
+
     /** Array of extra HTMLPurifier_Filter objects to run on HTML, for backwards compatibility */
     private $filters = array();
-    
+
     /** Single instance of HTML Purifier */
     private static $instance;
-    
+
     protected $strategy, $generator;
-    
+
     /**
      * Resultant HTMLPurifier_Context of last run purification. Is an array
      * of contexts if the last called method was purifyArray().
      */
     public $context;
-    
+
     /**
      * Initializes the purifier.
      * @param $config Optional HTMLPurifier_Config object for all instances of
@@ -86,13 +86,13 @@ class HTMLPurifier
      *                HTMLPurifier_Config::create() supports.
      */
     public function __construct($config = null) {
-        
+
         $this->config = HTMLPurifier_Config::create($config);
-        
+
         $this->strategy     = new HTMLPurifier_Strategy_Core();
-        
+
     }
-    
+
     /**
      * Adds a filter to process the output. First come first serve
      * @param $filter HTMLPurifier_Filter object
@@ -101,10 +101,10 @@ class HTMLPurifier
         trigger_error('HTMLPurifier->addFilter() is deprecated, use configuration directives in the Filter namespace or Filter.Custom', E_USER_WARNING);
         $this->filters[] = $filter;
     }
-    
+
     /**
      * Filters an HTML snippet/document to be XSS-free and standards-compliant.
-     * 
+     *
      * @param $html String of HTML to purify
      * @param $config HTMLPurifier_Config object for this operation, if omitted,
      *                defaults to the config object specified during this
@@ -113,38 +113,38 @@ class HTMLPurifier
      * @return Purified HTML
      */
     public function purify($html, $config = null) {
-        
+
         // :TODO: make the config merge in, instead of replace
         $config = $config ? HTMLPurifier_Config::create($config) : $this->config;
-        
+
         // implementation is partially environment dependant, partially
         // configuration dependant
         $lexer = HTMLPurifier_Lexer::create($config);
-        
+
         $context = new HTMLPurifier_Context();
-        
+
         // setup HTML generator
         $this->generator = new HTMLPurifier_Generator($config, $context);
         $context->register('Generator', $this->generator);
-        
+
         // set up global context variables
         if ($config->get('Core', 'CollectErrors')) {
             // may get moved out if other facilities use it
             $language_factory = HTMLPurifier_LanguageFactory::instance();
             $language = $language_factory->create($config, $context);
             $context->register('Locale', $language);
-            
+
             $error_collector = new HTMLPurifier_ErrorCollector($context);
             $context->register('ErrorCollector', $error_collector);
         }
-        
+
         // setup id_accumulator context, necessary due to the fact that
         // AttrValidator can be called from many places
         $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
         $context->register('IDAccumulator', $id_accumulator);
-        
+
         $html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
-        
+
         // setup filters
         $filter_flags = $config->getBatch('Filter');
         $custom_filters = $filter_flags['Custom'];
@@ -161,13 +161,13 @@ class HTMLPurifier
         }
         $filters = array_merge($filters, $this->filters);
         // maybe prepare(), but later
-        
+
         for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) {
             $html = $filters[$i]->preFilter($html, $config, $context);
         }
-        
+
         // purified HTML
-        $html = 
+        $html =
             $this->generator->generateFromTokens(
                 // list of tokens
                 $this->strategy->execute(
@@ -179,16 +179,16 @@ class HTMLPurifier
                     $config, $context
                 )
             );
-        
+
         for ($i = $filter_size - 1; $i >= 0; $i--) {
             $html = $filters[$i]->postFilter($html, $config, $context);
         }
-        
+
         $html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context);
         $this->context =& $context;
         return $html;
     }
-    
+
     /**
      * Filters an array of HTML snippets
      * @param $config Optional HTMLPurifier_Config object for this operation.
@@ -204,7 +204,7 @@ class HTMLPurifier
         $this->context = $context_array;
         return $array_of_html;
     }
-    
+
     /**
      * Singleton for enforcing just one HTML Purifier in your system
      * @param $prototype Optional prototype HTMLPurifier instance to
@@ -223,12 +223,14 @@ class HTMLPurifier
         }
         return self::$instance;
     }
-    
+
     /**
      * @note Backwards compatibility, see instance()
      */
     public static function getInstance($prototype = null) {
         return HTMLPurifier::instance($prototype);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 05cc0a3c33f3ec16ece30259a6c0726d9b7caf37..7d393036a896a5fef42222f8390eeb8a75dd7a56 100644 (file)
@@ -6,7 +6,7 @@
  * 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.
  */
 
@@ -49,6 +49,8 @@ require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
 require_once $__dir . '/HTMLPurifier/Length.php';
 require_once $__dir . '/HTMLPurifier/Lexer.php';
 require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
+require_once $__dir . '/HTMLPurifier/PropertyList.php';
+require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
 require_once $__dir . '/HTMLPurifier/Strategy.php';
 require_once $__dir . '/HTMLPurifier/StringHash.php';
 require_once $__dir . '/HTMLPurifier/StringHashParser.php';
index 33f42984b02e006e5bb7b55429c7faf5d3c876f9..555b86d0428d7e3770ea58d1745d80d0bd2f73cf 100644 (file)
@@ -6,12 +6,12 @@
 
 class HTMLPurifier_AttrCollections
 {
-    
+
     /**
      * Associative array of attribute collections, indexed by name
      */
     public $info = array();
-    
+
     /**
      * Performs all expansions on internal data for use by other inclusions
      * It also collects all attribute collection extensions from
@@ -45,7 +45,7 @@ class HTMLPurifier_AttrCollections
             $this->expandIdentifiers($this->info[$name], $attr_types);
         }
     }
-    
+
     /**
      * Takes a reference to an attribute associative array and performs
      * all inclusions specified by the zero index.
@@ -72,7 +72,7 @@ class HTMLPurifier_AttrCollections
         }
         unset($attr[0]);
     }
-    
+
     /**
      * Expands all string identifiers in an attribute array by replacing
      * them with the appropriate values inside HTMLPurifier_AttrTypes
@@ -80,17 +80,17 @@ class HTMLPurifier_AttrCollections
      * @param $attr_types HTMLPurifier_AttrTypes instance
      */
     public function expandIdentifiers(&$attr, $attr_types) {
-        
+
         // because foreach will process new elements we add, make sure we
         // skip duplicates
         $processed = array();
-        
+
         foreach ($attr as $def_i => $def) {
             // skip inclusions
             if ($def_i === 0) continue;
-            
+
             if (isset($processed[$def_i])) continue;
-            
+
             // determine whether or not attribute is required
             if ($required = (strpos($def_i, '*') !== false)) {
                 // rename the definition
@@ -98,21 +98,21 @@ class HTMLPurifier_AttrCollections
                 $def_i = trim($def_i, '*');
                 $attr[$def_i] = $def;
             }
-            
+
             $processed[$def_i] = true;
-            
+
             // if we've already got a literal object, move on
             if (is_object($def)) {
                 // preserve previous required
                 $attr[$def_i]->required = ($required || $attr[$def_i]->required);
                 continue;
             }
-            
+
             if ($def === false) {
                 unset($attr[$def_i]);
                 continue;
             }
-            
+
             if ($t = $attr_types->get($def)) {
                 $attr[$def_i] = $t;
                 $attr[$def_i]->required = $required;
@@ -120,8 +120,9 @@ class HTMLPurifier_AttrCollections
                 unset($attr[$def_i]);
             }
         }
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index eefe1c5d16034a467227c9140bdb06cb547b9a96..d32fa62d6ad98b54c5915b3d96e2f1fbf7bb1a9f 100644 (file)
@@ -2,53 +2,53 @@
 
 /**
  * Base class for all validating attribute definitions.
- * 
+ *
  * This family of classes forms the core for not only HTML attribute validation,
  * but also any sort of string that needs to be validated or cleaned (which
- * means CSS properties and composite definitions are defined here too).  
+ * means CSS properties and composite definitions are defined here too).
  * Besides defining (through code) what precisely makes the string valid,
  * subclasses are also responsible for cleaning the code if possible.
  */
 
 abstract class HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Tells us whether or not an HTML attribute is minimized. Has no
      * meaning in other contexts.
      */
     public $minimized = false;
-    
+
     /**
      * Tells us whether or not an HTML attribute is required. Has no
      * meaning in other contexts
      */
     public $required = false;
-    
+
     /**
      * Validates and cleans passed string according to a definition.
-     * 
+     *
      * @param $string String to be validated and cleaned.
      * @param $config Mandatory HTMLPurifier_Config object.
      * @param $context Mandatory HTMLPurifier_AttrContext object.
      */
     abstract public function validate($string, $config, $context);
-    
+
     /**
      * Convenience method that parses a string as if it were CDATA.
-     * 
+     *
      * This method process a string in the manner specified at
      * <http://www.w3.org/TR/html4/types.html#h-6.2> by removing
      * leading and trailing whitespace, ignoring line feeds, and replacing
      * carriage returns and tabs with spaces.  While most useful for HTML
      * attributes specified as CDATA, it can also be applied to most CSS
      * values.
-     * 
+     *
      * @note This method is not entirely standards compliant, as trim() removes
      *       more types of whitespace than specified in the spec. In practice,
      *       this is rarely a problem, as those extra characters usually have
      *       already been removed by HTMLPurifier_Encoder.
-     * 
+     *
      * @warning This processing is inconsistent with XML's whitespace handling
      *          as specified by section 3.3.3 and referenced XHTML 1.0 section
      *          4.7.  However, note that we are NOT necessarily
@@ -60,7 +60,7 @@ abstract class HTMLPurifier_AttrDef
         $string = str_replace(array("\n", "\t", "\r"), ' ', $string);
         return $string;
     }
-    
+
     /**
      * Factory method for creating this class from a string.
      * @param $string String construction info
@@ -73,7 +73,7 @@ abstract class HTMLPurifier_AttrDef
         // to clone or instantiate new copies. (Instantiation is safer.)
         return $this;
     }
-    
+
     /**
      * Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
      * properly. THIS IS A HACK!
@@ -81,6 +81,7 @@ abstract class HTMLPurifier_AttrDef
     protected function mungeRgb($string) {
         return preg_replace('/rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\)/', 'rgb(\1,\2,\3)', $string);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 53afaf089f6360cd0a7f68df60526ba344757518..953e70675556b1074fcf18e946605b46efbd3052 100644 (file)
  */
 class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($css, $config, $context) {
-        
+
         $css = $this->parseCDATA($css);
-        
+
         $definition = $config->getCSSDefinition();
-        
+
         // we're going to break the spec and explode by semicolons.
         // This is because semicolon rarely appears in escaped form
         // Doing this is generally flaky but fast
         // IT MIGHT APPEAR IN URIs, see HTMLPurifier_AttrDef_CSSURI
         // for details
-        
+
         $declarations = explode(';', $css);
         $propvalues = array();
-        
+
         /**
          * Name of the current CSS property being validated.
          */
         $property = false;
         $context->register('CurrentCSSProperty', $property);
-        
+
         foreach ($declarations as $declaration) {
             if (!$declaration) continue;
             if (!strpos($declaration, ':')) continue;
@@ -66,21 +66,22 @@ class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
             if ($result === false) continue;
             $propvalues[$property] = $result;
         }
-        
+
         $context->destroy('CurrentCSSProperty');
-        
+
         // procedure does not write the new CSS simultaneously, so it's
         // slightly inefficient, but it's the only way of getting rid of
         // duplicates. Perhaps config to optimize it, but not now.
-        
+
         $new_declarations = '';
         foreach ($propvalues as $prop => $value) {
             $new_declarations .= "$prop:$value;";
         }
-        
+
         return $new_declarations ? $new_declarations : false;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 701e7e441329a9808e0daf15cfaf8573ed780a77..292c040d4bd525f708add43159301302eb717ff1 100644 (file)
@@ -2,11 +2,11 @@
 
 class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
 {
-    
+
     public function __construct() {
         parent::__construct(false); // opacity is non-negative, but we will clamp it
     }
-    
+
     public function validate($number, $config, $context) {
         $result = parent::validate($number, $config, $context);
         if ($result === false) return $result;
@@ -15,5 +15,7 @@ class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Numbe
         if ($float > 1.0) $result = '1';
         return $result;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 76afa44041801294fda9b53e4db0497996367f33..3a3d20cd6a7cb830204d2b1f8cfce3f05a5f8a9c 100644 (file)
@@ -6,13 +6,13 @@
  */
 class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Local copy of component validators.
      * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
      */
     protected $info;
-    
+
     public function __construct($config) {
         $def = $config->getCSSDefinition();
         $this->info['background-color'] = $def->info['background-color'];
@@ -21,29 +21,29 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
         $this->info['background-attachment'] = $def->info['background-attachment'];
         $this->info['background-position'] = $def->info['background-position'];
     }
-    
+
     public function validate($string, $config, $context) {
-        
+
         // regular pre-processing
         $string = $this->parseCDATA($string);
         if ($string === '') return false;
-        
+
         // munge rgb() decl if necessary
         $string = $this->mungeRgb($string);
-        
+
         // assumes URI doesn't have spaces in it
         $bits = explode(' ', strtolower($string)); // bits to process
-        
+
         $caught = array();
         $caught['color']    = false;
         $caught['image']    = false;
         $caught['repeat']   = false;
         $caught['attachment'] = false;
         $caught['position'] = false;
-        
+
         $i = 0; // number of catches
         $none = false;
-        
+
         foreach ($bits as $bit) {
             if ($bit === '') continue;
             foreach ($caught as $key => $status) {
@@ -64,23 +64,24 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
                 break;
             }
         }
-        
+
         if (!$i) return false;
         if ($caught['position'] !== false) {
             $caught['position'] = $this->info['background-position']->
                 validate($caught['position'], $config, $context);
         }
-        
+
         $ret = array();
         foreach ($caught as $value) {
             if ($value === false) continue;
             $ret[] = $value;
         }
-        
+
         if (empty($ret)) return false;
         return implode(' ', $ret);
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 7e424e12f40d5ea2bced909d561ca5c4fe23f345..35df3985e23dbb8a347334b1a92ad37b5996c255 100644 (file)
@@ -7,7 +7,7 @@
         [
             <percentage> | <length> | left | center | right
         ]
-        [ 
+        [
             <percentage> | <length> | top | center | bottom
         ]?
     ] |
 
 /* QuirksMode says:
     keyword + length/percentage must be ordered correctly, as per W3C
-    
+
     Internet Explorer and Opera, however, support arbitrary ordering. We
     should fix it up.
-    
+
     Minor issue though, not strictly necessary.
 */
 
  */
 class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
 {
-    
+
     protected $length;
     protected $percentage;
-    
+
     public function __construct() {
         $this->length     = new HTMLPurifier_AttrDef_CSS_Length();
         $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
     }
-    
+
     public function validate($string, $config, $context) {
         $string = $this->parseCDATA($string);
         $bits = explode(' ', $string);
-        
+
         $keywords = array();
         $keywords['h'] = false; // left, right
         $keywords['v'] = false; // top, bottom
         $keywords['c'] = false; // center
         $measures = array();
-        
+
         $i = 0;
-        
+
         $lookup = array(
             'top' => 'v',
             'bottom' => 'v',
@@ -71,10 +71,10 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
             'right' => 'h',
             'center' => 'c'
         );
-        
+
         foreach ($bits as $bit) {
             if ($bit === '') continue;
-            
+
             // test for keyword
             $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
             if (isset($lookup[$lbit])) {
@@ -82,28 +82,28 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
                 $keywords[$status] = $lbit;
                 $i++;
             }
-            
+
             // test for length
             $r = $this->length->validate($bit, $config, $context);
             if ($r !== false) {
                 $measures[] = $r;
                 $i++;
             }
-            
+
             // test for percentage
             $r = $this->percentage->validate($bit, $config, $context);
             if ($r !== false) {
                 $measures[] = $r;
                 $i++;
             }
-            
+
         }
-        
+
         if (!$i) return false; // no valid values were caught
-        
-        
+
+
         $ret = array();
-        
+
         // first keyword
         if     ($keywords['h'])     $ret[] = $keywords['h'];
         elseif (count($measures))   $ret[] = array_shift($measures);
@@ -111,15 +111,16 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
             $ret[] = $keywords['c'];
             $keywords['c'] = false; // prevent re-use: center = center center
         }
-        
+
         if     ($keywords['v'])     $ret[] = $keywords['v'];
         elseif (count($measures))   $ret[] = array_shift($measures);
         elseif ($keywords['c'])     $ret[] = $keywords['c'];
-        
+
         if (empty($ret)) return false;
         return implode(' ', $ret);
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index ec0249ef3e2a59b9610d9d43529246c3205e132e..42a1d1b4ae36290be99d29a24d7ee2c67a01abdc 100644 (file)
@@ -5,19 +5,19 @@
  */
 class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Local copy of properties this property is shorthand for.
      */
     protected $info = array();
-    
+
     public function __construct($config) {
         $def = $config->getCSSDefinition();
         $this->info['border-width'] = $def->info['border-width'];
         $this->info['border-style'] = $def->info['border-style'];
         $this->info['border-top-color'] = $def->info['border-top-color'];
     }
-    
+
     public function validate($string, $config, $context) {
         $string = $this->parseCDATA($string);
         $string = $this->mungeRgb($string);
@@ -37,6 +37,7 @@ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
         }
         return rtrim($ret);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index e47eac69824f419add06c2a03b9f0698aa568e71..14c6594b6069f55fabe38a14805b079be8badb88 100644 (file)
@@ -5,18 +5,18 @@
  */
 class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($color, $config, $context) {
-        
+
         static $colors = null;
         if ($colors === null) $colors = $config->get('Core', 'ColorKeywords');
-        
+
         $color = trim($color);
         if ($color === '') return false;
-        
+
         $lower = strtolower($color);
         if (isset($colors[$lower])) return $colors[$lower];
-        
+
         if (strpos($color, 'rgb(') !== false) {
             // rgb literal handling
             $length = strlen($color);
@@ -68,10 +68,11 @@ class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
             if ($length !== 3 && $length !== 6) return false;
             if (!ctype_xdigit($hex)) return false;
         }
-        
+
         return $color;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index c96506995c8db4254e9f212b939ac4095f342111..de1289cba8af47101e3ae09e0fc92de2fd061f95 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Allows multiple validators to attempt to validate attribute.
- * 
+ *
  * Composite is just what it sounds like: a composite of many validators.
  * This means that multiple HTMLPurifier_AttrDef objects will have a whack
  * at the string.  If one of them passes, that's what is returned.  This is
  */
 class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * List of HTMLPurifier_AttrDef objects that may process strings
      * @todo Make protected
      */
     public $defs;
-    
+
     /**
      * @param $defs List of HTMLPurifier_AttrDef objects
      */
     public function __construct($defs) {
         $this->defs = $defs;
     }
-    
+
     public function validate($string, $config, $context) {
         foreach ($this->defs as $i => $def) {
             $result = $this->defs[$i]->validate($string, $config, $context);
@@ -32,6 +32,7 @@ class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
         }
         return false;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 756dec3ce8e8f7574470beddf43d8b2817498f47..6599c5b2ddcee7afbfb9935027b2559e22845e05 100644 (file)
@@ -5,8 +5,8 @@
  */
 class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
 {
-    protected $def, $element;
-    
+    public $def, $element;
+
     /**
      * @param $def Definition to wrap
      * @param $element Element to deny
@@ -24,3 +24,5 @@ class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
         return $this->def->validate($string, $config, $context);
     }
 }
+
+// vim: et sw=4 sts=4
index 3fe5e589f62c33e275f2564548926a27013171d2..147894b8619719ada179523f30371b871292d2b7 100644 (file)
@@ -7,13 +7,13 @@
  */
 class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
 {
-    
+
     protected $intValidator;
-    
+
     public function __construct() {
         $this->intValidator = new HTMLPurifier_AttrDef_Integer();
     }
-    
+
     public function validate($value, $config, $context) {
         $value = $this->parseCDATA($value);
         if ($value === 'none') return $value;
@@ -48,5 +48,7 @@ class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
         $ret_function = "$function($ret_parameters)";
         return $ret_function;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index a4a74b43810ec09204cd439e8d4674ab6d03855e..699ee0b7012a6d1a5d951d7598ab528247b579b8 100644 (file)
@@ -5,17 +5,17 @@
  */
 class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Local copy of component validators.
-     * 
+     *
      * @note If we moved specific CSS property definitions to their own
      *       classes instead of having them be assembled at run time by
      *       CSSDefinition, this wouldn't be necessary.  We'd instantiate
      *       our own copies.
      */
     protected $info = array();
-    
+
     public function __construct($config) {
         $def = $config->getCSSDefinition();
         $this->info['font-style']   = $def->info['font-style'];
@@ -25,9 +25,9 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
         $this->info['line-height']  = $def->info['line-height'];
         $this->info['font-family']  = $def->info['font-family'];
     }
-    
+
     public function validate($string, $config, $context) {
-        
+
         static $system_fonts = array(
             'caption' => true,
             'icon' => true,
@@ -36,27 +36,27 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
             'small-caption' => true,
             'status-bar' => true
         );
-        
+
         // regular pre-processing
         $string = $this->parseCDATA($string);
         if ($string === '') return false;
-        
+
         // check if it's one of the keywords
         $lowercase_string = strtolower($string);
         if (isset($system_fonts[$lowercase_string])) {
             return $lowercase_string;
         }
-        
+
         $bits = explode(' ', $string); // bits to process
         $stage = 0; // this indicates what we're looking for
         $caught = array(); // which stage 0 properties have we caught?
         $stage_1 = array('font-style', 'font-variant', 'font-weight');
         $final = ''; // output
-        
+
         for ($i = 0, $size = count($bits); $i < $size; $i++) {
             if ($bits[$i] === '') continue;
             switch ($stage) {
-                
+
                 // attempting to catch font-style, font-variant or font-weight
                 case 0:
                     foreach ($stage_1 as $validator_name) {
@@ -72,7 +72,7 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
                     // all three caught, continue on
                     if (count($caught) >= 3) $stage = 1;
                     if ($r !== false) break;
-                
+
                 // attempting to catch font-size and perhaps line-height
                 case 1:
                     $found_slash = false;
@@ -126,7 +126,7 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
                         break;
                     }
                     return false;
-                
+
                 // attempting to catch font-family
                 case 2:
                     $font_family =
@@ -143,6 +143,7 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
         }
         return false;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index d7f04a8bf34821c76e76e1c14ec3620f4376df15..705ac893d1be4ffa6512730a076ada9401c6e2a6 100644 (file)
@@ -6,7 +6,7 @@
  */
 class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($string, $config, $context) {
         static $generic_names = array(
             'serif' => true,
@@ -15,7 +15,7 @@ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
             'fantasy' => true,
             'cursive' => true
         );
-        
+
         // assume that no font names contain commas in them
         $fonts = explode(',', $string);
         $final = '';
@@ -34,7 +34,7 @@ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
                 $quote = $font[0];
                 if ($font[$length - 1] !== $quote) continue;
                 $font = substr($font, 1, $length - 2);
-                
+
                 $new_font = '';
                 for ($i = 0, $c = strlen($font); $i < $c; $i++) {
                     if ($font[$i] === '\\') {
@@ -62,19 +62,19 @@ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
                     }
                     $new_font .= $font[$i];
                 }
-                
+
                 $font = $new_font;
             }
             // $font is a pure representation of the font name
-            
+
             if (ctype_alnum($font) && $font !== '') {
                 // very simple font, allow it in unharmed
                 $final .= $font . ', ';
                 continue;
             }
-            
+
             // complicated font, requires quoting
-            
+
             // armor single quotes and new lines
             $font = str_replace("\\", "\\\\", $font);
             $font = str_replace("'", "\\'", $font);
@@ -84,6 +84,7 @@ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
         if ($final === '') return false;
         return $final;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 97b414c770f17798555ae99466e7fa618d96c38b..4e6b35e5a0dffd031b35963945e71d6dee00ca41 100644 (file)
@@ -5,8 +5,8 @@
  */
 class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef
 {
-    protected $def, $allow;
-    
+    public $def, $allow;
+
     /**
      * @param $def Definition to wrap
      * @param $allow Whether or not to allow !important
@@ -36,3 +36,5 @@ class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef
         return $string;
     }
 }
+
+// vim: et sw=4 sts=4
index 2b8db17cc078e7361646db4b196034dd7ea13e12..a07ec58135c05525b6a66489574ef2463993d161 100644 (file)
@@ -5,9 +5,9 @@
  */
 class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
 {
-    
+
     protected $min, $max;
-    
+
     /**
      * @param HTMLPurifier_Length $max Minimum length, or null for no bound. String is also acceptable.
      * @param HTMLPurifier_Length $max Maximum length, or null for no bound. String is also acceptable.
@@ -16,18 +16,18 @@ class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
         $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null;
         $this->max = $max !== null ? HTMLPurifier_Length::make($max) : null;
     }
-    
+
     public function validate($string, $config, $context) {
         $string = $this->parseCDATA($string);
-        
+
         // Optimizations
         if ($string === '') return false;
         if ($string === '0') return '0';
         if (strlen($string) === 1) return false;
-        
+
         $length = HTMLPurifier_Length::make($string);
         if (!$length->isValid()) return false;
-        
+
         if ($this->min) {
             $c = $length->compareTo($this->min);
             if ($c === false) return false;
@@ -38,9 +38,10 @@ class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
             if ($c === false) return false;
             if ($c > 0) return false;
         }
-        
+
         return $length->toString();
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 836cb465ab23e1377da507ac9a250fabe73010b0..4406868c08b0b2d1e497ac4c1cd9694ca996a6b5 100644 (file)
@@ -6,37 +6,37 @@
  */
 class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Local copy of component validators.
      * @note See HTMLPurifier_AttrDef_CSS_Font::$info for a similar impl.
      */
     protected $info;
-    
+
     public function __construct($config) {
         $def = $config->getCSSDefinition();
         $this->info['list-style-type']     = $def->info['list-style-type'];
         $this->info['list-style-position'] = $def->info['list-style-position'];
         $this->info['list-style-image'] = $def->info['list-style-image'];
     }
-    
+
     public function validate($string, $config, $context) {
-        
+
         // regular pre-processing
         $string = $this->parseCDATA($string);
         if ($string === '') return false;
-        
+
         // assumes URI doesn't have spaces in it
         $bits = explode(' ', strtolower($string)); // bits to process
-        
+
         $caught = array();
         $caught['type']     = false;
         $caught['position'] = false;
         $caught['image']    = false;
-        
+
         $i = 0; // number of catches
         $none = false;
-        
+
         foreach ($bits as $bit) {
             if ($i >= 3) return; // optimization bit
             if ($bit === '') continue;
@@ -54,24 +54,25 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
                 break;
             }
         }
-        
+
         if (!$i) return false;
-        
+
         $ret = array();
-        
+
         // construct type
         if ($caught['type']) $ret[] = $caught['type'];
-        
+
         // construct image
         if ($caught['image']) $ret[] = $caught['image'];
-        
+
         // construct position
         if ($caught['position']) $ret[] = $caught['position'];
-        
+
         if (empty($ret)) return false;
         return implode(' ', $ret);
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 878940dbbfaf31771a44ac667851ded6050889c2..4d62a40d7fc6a6abb3a834e3f80139deb39a8ada 100644 (file)
@@ -2,30 +2,30 @@
 
 /**
  * Framework class for strings that involve multiple values.
- * 
+ *
  * Certain CSS properties such as border-width and margin allow multiple
  * lengths to be specified.  This class can take a vanilla border-width
  * definition and multiply it, usually into a max of four.
- * 
+ *
  * @note Even though the CSS specification isn't clear about it, inherit
  *       can only be used alone: it will never manifest as part of a multi
  *       shorthand declaration.  Thus, this class does not allow inherit.
  */
 class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Instance of component definition to defer validation to.
      * @todo Make protected
      */
     public $single;
-    
+
     /**
      * Max number of values allowed.
      * @todo Make protected
      */
     public $max;
-    
+
     /**
      * @param $single HTMLPurifier_AttrDef to multiply
      * @param $max Max number of values allowed (usually four)
@@ -34,7 +34,7 @@ class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
         $this->single = $single;
         $this->max = $max;
     }
-    
+
     public function validate($string, $config, $context) {
         $string = $this->parseCDATA($string);
         if ($string === '') return false;
@@ -52,6 +52,7 @@ class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
         if ($final === '') return false;
         return rtrim($final);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 15153e4b9cd3da95877691ff81ec42678eb44d77..3f99e12ec26f8a35cb79b942a74a20021c1b0007 100644 (file)
@@ -5,30 +5,30 @@
  */
 class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Bool indicating whether or not only positive values allowed.
      */
     protected $non_negative = false;
-    
+
     /**
      * @param $non_negative Bool indicating whether negatives are forbidden
      */
     public function __construct($non_negative = false) {
         $this->non_negative = $non_negative;
     }
-    
+
     /**
      * @warning Some contexts do not pass $config, $context. These
      *          variables should not be used without checking HTMLPurifier_Length
      */
     public function validate($number, $config, $context) {
-        
+
         $number = $this->parseCDATA($number);
-        
+
         if ($number === '') return false;
         if ($number === '0') return '0';
-        
+
         $sign = '';
         switch ($number[0]) {
             case '-':
@@ -37,32 +37,33 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
             case '+':
                 $number = substr($number, 1);
         }
-        
+
         if (ctype_digit($number)) {
             $number = ltrim($number, '0');
             return $number ? $sign . $number : '0';
         }
-        
+
         // Period is the only non-numeric character allowed
         if (strpos($number, '.') === false) return false;
-        
+
         list($left, $right) = explode('.', $number, 2);
-        
+
         if ($left === '' && $right === '') return false;
         if ($left !== '' && !ctype_digit($left)) return false;
-        
+
         $left  = ltrim($left,  '0');
         $right = rtrim($right, '0');
-        
+
         if ($right === '') {
             return $left ? $sign . $left : '0';
         } elseif (!ctype_digit($right)) {
             return false;
         }
-        
+
         return $sign . $left . '.' . $right;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 8b0fcd51a81875453eaa4bef7525b5f8c33ce635..c34b8fc3c392b90fa09652d6af38742937948c41 100644 (file)
@@ -5,35 +5,36 @@
  */
 class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Instance of HTMLPurifier_AttrDef_CSS_Number to defer number validation
      */
     protected $number_def;
-    
+
     /**
      * @param Bool indicating whether to forbid negative values
      */
     public function __construct($non_negative = false) {
         $this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
     }
-    
+
     public function validate($string, $config, $context) {
-        
+
         $string = $this->parseCDATA($string);
-        
+
         if ($string === '') return false;
         $length = strlen($string);
         if ($length === 1) return false;
         if ($string[$length - 1] !== '%') return false;
-        
+
         $number = substr($string, 0, $length - 1);
         $number = $this->number_def->validate($number, $config, $context);
-        
+
         if ($number === false) return false;
         return "$number%";
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index af16d5915572080277f36bf2c4c0a03362ef62df..772c922d80bde9e3ca6f24db8ebef6b20132adf5 100644 (file)
@@ -7,19 +7,19 @@
  */
 class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($string, $config, $context) {
-        
+
         static $allowed_values = array(
             'line-through' => true,
             'overline' => true,
             'underline' => true,
         );
-        
+
         $string = strtolower($this->parseCDATA($string));
-        
+
         if ($string === 'none') return $string;
-        
+
         $parts = explode(' ', $string);
         $final = '';
         foreach ($parts as $part) {
@@ -30,8 +30,9 @@ class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
         $final = rtrim($final);
         if ($final === '') return false;
         return $final;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index c7dae5037673f6251c4719097c63e9a098ba7144..435d7930bb0a378dbf4459806ee01ad34aca4c2c 100644 (file)
  */
 class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
 {
-    
+
     public function __construct() {
         parent::__construct(true); // always embedded
     }
-    
+
     public function validate($uri_string, $config, $context) {
         // parse the URI out of the string and then pass it onto
         // the parent object
-        
+
         $uri_string = $this->parseCDATA($uri_string);
         if (strpos($uri_string, 'url(') !== 0) return false;
         $uri_string = substr($uri_string, 4);
         $new_length = strlen($uri_string) - 1;
         if ($uri_string[$new_length] != ')') return false;
         $uri = trim(substr($uri_string, 0, $new_length));
-        
+
         if (!empty($uri) && ($uri[0] == "'" || $uri[0] == '"')) {
             $quote = $uri[0];
             $new_length = strlen($uri) - 1;
             if ($uri[$new_length] !== $quote) return false;
             $uri = substr($uri, 1, $new_length - 1);
         }
-        
+
         $keys   = array(  '(',   ')',   ',',   ' ',   '"',   "'");
         $values = array('\\(', '\\)', '\\,', '\\ ', '\\"', "\\'");
         $uri = str_replace($values, $keys, $uri);
-        
+
         $result = parent::validate($uri, $config, $context);
-        
+
         if ($result === false) return false;
-        
+
         // escape necessary characters according to CSS spec
         // except for the comma, none of these should appear in the
         // URI at all
         $result = str_replace($keys, $values, $result);
-        
+
         return "url($result)";
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 11d952e68aa1294766e55ee21f2251f61b6b00cc..5d603ebcc67d51ddad1eb47010d702b157f7fa85 100644 (file)
@@ -9,19 +9,19 @@
  */
 class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Lookup table of valid values.
      * @todo Make protected
      */
     public $valid_values   = array();
-    
+
     /**
      * Bool indicating whether or not enumeration is case sensitive.
      * @note In general this is always case insensitive.
      */
     protected $case_sensitive = false; // values according to W3C spec
-    
+
     /**
      * @param $valid_values List of valid values
      * @param $case_sensitive Bool indicating whether or not case sensitive
@@ -32,7 +32,7 @@ class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
         $this->valid_values = array_flip($valid_values);
         $this->case_sensitive = $case_sensitive;
     }
-    
+
     public function validate($string, $config, $context) {
         $string = trim($string);
         if (!$this->case_sensitive) {
@@ -40,10 +40,10 @@ class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
             $string = ctype_lower($string) ? $string : strtolower($string);
         }
         $result = isset($this->valid_values[$string]);
-        
+
         return $result ? $string : false;
     }
-    
+
     /**
      * @param $string In form of comma-delimited list of case-insensitive
      *      valid values. Example: "foo,bar,baz". Prepend "s:" to make
@@ -59,6 +59,7 @@ class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
         $values = explode(',', $string);
         return new HTMLPurifier_AttrDef_Enum($values, $sensitive);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index c88702790f0faf793bb81e6f6adf2961173d90cd..e06987eb8dbaf10b64b024495ed992fd83e96b35 100644 (file)
@@ -5,23 +5,24 @@
  */
 class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
 {
-    
+
     protected $name;
     public $minimized = true;
-    
+
     public function __construct($name = false) {$this->name = $name;}
-    
+
     public function validate($string, $config, $context) {
         if (empty($string)) return false;
         return $this->name;
     }
-    
+
     /**
      * @param $string Name of attribute
      */
     public function make($string) {
         return new HTMLPurifier_AttrDef_HTML_Bool($string);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 3aa193e96a79cb5caaae538f210b7bdcc7a17d4f..5311a3c6139631ba1fd02dea5e306a624419f5e0 100644 (file)
@@ -5,27 +5,28 @@
  */
 class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($string, $config, $context) {
-        
+
         static $colors = null;
         if ($colors === null) $colors = $config->get('Core', 'ColorKeywords');
-        
+
         $string = trim($string);
-        
+
         if (empty($string)) return false;
         if (isset($colors[$string])) return $colors[$string];
         if ($string[0] === '#') $hex = substr($string, 1);
         else $hex = $string;
-        
+
         $length = strlen($hex);
         if ($length !== 3 && $length !== 6) return false;
         if (!ctype_xdigit($hex)) return false;
         if ($length === 3) $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
-        
+
         return "#$hex";
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 0bc80432a317f09e4e4bb50794a94281221ff67f..bd281a89fb57a06627db011a30e1a46cce71704d 100644 (file)
@@ -5,16 +5,17 @@
  */
 class HTMLPurifier_AttrDef_HTML_FrameTarget extends HTMLPurifier_AttrDef_Enum
 {
-    
+
     public $valid_values = false; // uninitialized value
     protected $case_sensitive = false;
-    
+
     public function __construct() {}
-    
+
     public function validate($string, $config, $context) {
         if ($this->valid_values === false) $this->valid_values = $config->get('Attr', 'AllowedFrameTargets');
         return parent::validate($string, $config, $context);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 9c6aa37e710099a7f7ea59bd7c975eea28290fb1..7c5c169c25483dfc6dc93aa6760bf7e56e00dce4 100644 (file)
 
 class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
 {
-    
+
     // ref functionality disabled, since we also have to verify
     // whether or not the ID it refers to exists
-    
+
     public function validate($id, $config, $context) {
-        
+
         if (!$config->get('Attr', 'EnableID')) return false;
-        
+
         $id = trim($id); // trim it first
-        
+
         if ($id === '') return false;
-        
+
         $prefix = $config->get('Attr', 'IDPrefix');
         if ($prefix !== '') {
             $prefix .= $config->get('Attr', 'IDPrefixLocal');
@@ -32,14 +32,14 @@ class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
             trigger_error('%Attr.IDPrefixLocal cannot be used unless '.
                 '%Attr.IDPrefix is set', E_USER_WARNING);
         }
-        
+
         //if (!$this->ref) {
             $id_accumulator =& $context->get('IDAccumulator');
             if (isset($id_accumulator->ids[$id])) return false;
         //}
-        
+
         // we purposely avoid using regex, hopefully this is faster
-        
+
         if (ctype_alpha($id)) {
             $result = true;
         } else {
@@ -50,20 +50,21 @@ class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
               );
             $result = ($trim === '');
         }
-        
+
         $regexp = $config->get('Attr', 'IDBlacklistRegexp');
         if ($regexp && preg_match($regexp, $id)) {
             return false;
         }
-        
+
         if (/*!$this->ref && */$result) $id_accumulator->add($id);
-        
+
         // if no change was made to the ID, return the result
         // else, return the new id if stripping whitespace made it
         //     valid, or return false.
         return $result ? $id : false;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 3f995047b26ea9656105f2bec1bed210d3315cae..a242f9c238ea2108e059598eac16f8b6e5bf6eb0 100644 (file)
@@ -2,39 +2,40 @@
 
 /**
  * Validates the HTML type length (not to be confused with CSS's length).
- * 
+ *
  * This accepts integer pixels or percentages as lengths for certain
  * HTML attributes.
  */
 
 class HTMLPurifier_AttrDef_HTML_Length extends HTMLPurifier_AttrDef_HTML_Pixels
 {
-    
+
     public function validate($string, $config, $context) {
-        
+
         $string = trim($string);
         if ($string === '') return false;
-        
+
         $parent_result = parent::validate($string, $config, $context);
         if ($parent_result !== false) return $parent_result;
-        
+
         $length = strlen($string);
         $last_char = $string[$length - 1];
-        
+
         if ($last_char !== '%') return false;
-        
+
         $points = substr($string, 0, $length - 1);
-        
+
         if (!is_numeric($points)) return false;
-        
+
         $points = (int) $points;
-        
+
         if ($points < 0) return '0%';
         if ($points > 100) return '100%';
-        
+
         return ((string) $points) . '%';
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index dca75df3858ceedc8278a8c889b92f285fd302cc..8a0da0c89e0ccc02aa501b3d4b0d5e33e7dc3005 100644 (file)
@@ -8,10 +8,10 @@
  */
 class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
 {
-    
+
     /** Name config attribute to pull. */
     protected $name;
-    
+
     public function __construct($name) {
         $configLookup = array(
             'rel' => 'AllowedRel',
@@ -24,15 +24,15 @@ class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
         }
         $this->name = $configLookup[$name];
     }
-    
+
     public function validate($string, $config, $context) {
-        
+
         $allowed = $config->get('Attr', $this->name);
         if (empty($allowed)) return false;
-        
+
         $string = $this->parseCDATA($string);
         $parts = explode(' ', $string);
-        
+
         // lookup to prevent duplicates
         $ret_lookup = array();
         foreach ($parts as $part) {
@@ -40,13 +40,14 @@ class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
             if (!isset($allowed[$part])) continue;
             $ret_lookup[$part] = true;
         }
-        
+
         if (empty($ret_lookup)) return false;
         $string = implode(' ', array_keys($ret_lookup));
-        
+
         return $string;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index b7b9e0570a57a632415202c6be7c2cffd38be84d..c72fc76e4d99fab93084d1912753c9d07b64b239 100644 (file)
@@ -2,39 +2,40 @@
 
 /**
  * Validates a MultiLength as defined by the HTML spec.
- * 
+ *
  * A multilength is either a integer (pixel count), a percentage, or
  * a relative number.
  */
 class HTMLPurifier_AttrDef_HTML_MultiLength extends HTMLPurifier_AttrDef_HTML_Length
 {
-    
+
     public function validate($string, $config, $context) {
-        
+
         $string = trim($string);
         if ($string === '') return false;
-        
+
         $parent_result = parent::validate($string, $config, $context);
         if ($parent_result !== false) return $parent_result;
-        
+
         $length = strlen($string);
         $last_char = $string[$length - 1];
-        
+
         if ($last_char !== '*') return false;
-        
+
         $int = substr($string, 0, $length - 1);
-        
+
         if ($int == '') return '*';
         if (!is_numeric($int)) return false;
-        
+
         $int = (int) $int;
-        
+
         if ($int < 0) return false;
         if ($int == 0) return '0';
         if ($int == 1) return '*';
         return ((string) $int) . '*';
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 6ff057c2026a1b2b7ffc5f0d0e7bd3af1f6ce7d7..55035c4d04f57a9e93028c878c9760e763502e76 100644 (file)
@@ -9,17 +9,17 @@
  */
 class HTMLPurifier_AttrDef_HTML_Nmtokens extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($string, $config, $context) {
-        
+
         $string = trim($string);
-        
+
         // early abort: '' and '0' (strings that convert to false) are invalid
         if (!$string) return false;
-        
+
         // OPTIMIZABLE!
         // do the preg_match, capture all subpatterns for reformulation
-        
+
         // we don't support U+00A1 and up codepoints or
         // escaping because I don't know how to do that with regexps
         // and plus it would complicate optimization efforts (you never
@@ -29,19 +29,20 @@ class HTMLPurifier_AttrDef_HTML_Nmtokens extends HTMLPurifier_AttrDef
                    '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)'.
                    '(?:(?=\s)|\z)/'; // look ahead for space or string end
         preg_match_all($pattern, $string, $matches);
-        
+
         if (empty($matches[1])) return false;
-        
+
         // reconstruct string
         $new_string = '';
         foreach ($matches[1] as $token) {
             $new_string .= $token . ' ';
         }
         $new_string = rtrim($new_string);
-        
+
         return $new_string;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 6b615fe94de511d4986df996b06207a47f91d119..4cb2c1b8579b51cd22ccd140e6f6880fc2627faf 100644 (file)
@@ -5,15 +5,15 @@
  */
 class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
 {
-    
+
     protected $max;
-    
+
     public function __construct($max = null) {
         $this->max = $max;
     }
-    
+
     public function validate($string, $config, $context) {
-        
+
         $string = trim($string);
         if ($string === '0') return $string;
         if ($string === '')  return false;
@@ -23,25 +23,26 @@ class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
         }
         if (!is_numeric($string)) return false;
         $int = (int) $string;
-        
+
         if ($int < 0) return '0';
-        
+
         // upper-bound value, extremely high values can
         // crash operating systems, see <http://ha.ckers.org/imagecrash.html>
         // WARNING, above link WILL crash you if you're using Windows
-        
+
         if ($this->max !== null && $int > $this->max) return (string) $this->max;
-        
+
         return (string) $int;
-        
+
     }
-    
+
     public function make($string) {
         if ($string === '') $max = null;
         else $max = (int) $string;
         $class = get_class($this);
         return new $class($max);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 5f701f0d5779d47d71457ad738e7e4313da05c80..d59738d2a2b772d876cc0529e52b14a2ac680198 100644 (file)
@@ -9,22 +9,22 @@
  */
 class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Bool indicating whether or not negative values are allowed
      */
     protected $negative = true;
-    
+
     /**
      * Bool indicating whether or not zero is allowed
      */
     protected $zero = true;
-    
+
     /**
      * Bool indicating whether or not positive values are allowed
      */
     protected $positive = true;
-    
+
     /**
      * @param $negative Bool indicating whether or not negative values are allowed
      * @param $zero Bool indicating whether or not zero is allowed
@@ -37,15 +37,15 @@ class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
         $this->zero     = $zero;
         $this->positive = $positive;
     }
-    
+
     public function validate($integer, $config, $context) {
-        
+
         $integer = $this->parseCDATA($integer);
         if ($integer === '') return false;
-        
+
         // we could possibly simply typecast it to integer, but there are
         // certain fringe cases that must not return an integer.
-        
+
         // clip leading sign
         if ( $this->negative && $integer[0] === '-' ) {
             $digits = substr($integer, 1);
@@ -55,18 +55,19 @@ class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
         } else {
             $digits = $integer;
         }
-        
+
         // test if it's numeric
         if (!ctype_digit($digits)) return false;
-        
+
         // perform scope tests
         if (!$this->zero     && $integer == 0) return false;
         if (!$this->positive && $integer > 0) return false;
         if (!$this->negative && $integer < 0) return false;
-        
+
         return $integer;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 7eaccec4cab45f3f128fc734b6f76fb9dc927749..48b168948cd204f2ecc94bece14ac05401a2b4d6 100644 (file)
@@ -6,7 +6,7 @@
  */
 class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($string, $config, $context) {
 
 // moodle change - we use special lang strings unfortunatelly
@@ -15,12 +15,12 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
         
         $string = trim($string);
         if (!$string) return false;
-        
+
         $subtags = explode('-', $string);
         $num_subtags = count($subtags);
-        
+
         if ($num_subtags == 0) return false; // sanity check
-        
+
         // process primary subtag : $subtags[0]
         $length = strlen($subtags[0]);
         switch ($length) {
@@ -42,20 +42,20 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
             default:
                 return false;
         }
-        
+
         $new_string = $subtags[0];
         if ($num_subtags == 1) return $new_string;
-        
+
         // process second subtag : $subtags[1]
         $length = strlen($subtags[1]);
         if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) {
             return $new_string;
         }
         if (!ctype_lower($subtags[1])) $subtags[1] = strtolower($subtags[1]);
-        
+
         $new_string .= '-' . $subtags[1];
         if ($num_subtags == 2) return $new_string;
-        
+
         // process all other subtags, index 2 and up
         for ($i = 2; $i < $num_subtags; $i++) {
             $length = strlen($subtags[$i]);
@@ -67,10 +67,11 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
             }
             $new_string .= '-' . $subtags[$i];
         }
-        
+
         return $new_string;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 31398e25d9a0cb2212d782ab09d927fd5653fe20..c9e3ed193e77d0cbeac150d02105b81173eb37c0 100644 (file)
@@ -5,10 +5,10 @@
  */
 class HTMLPurifier_AttrDef_Switch
 {
-    
+
     protected $tag;
     protected $withTag, $withoutTag;
-    
+
     /**
      * @param string $tag Tag name to switch upon
      * @param HTMLPurifier_AttrDef $with_tag Call if token matches tag
@@ -19,7 +19,7 @@ class HTMLPurifier_AttrDef_Switch
         $this->withTag = $with_tag;
         $this->withoutTag = $without_tag;
     }
-    
+
     public function validate($string, $config, $context) {
         $token = $context->get('CurrentToken', true);
         if (!$token || $token->name !== $this->tag) {
@@ -28,5 +28,7 @@ class HTMLPurifier_AttrDef_Switch
             return $this->withTag->validate($string, $config, $context);
         }
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index e88a8456eb75a2a56494dbe118e302a6414efd33..c6216cc531d4b351799ea7b9764d88f578c9c26a 100644 (file)
@@ -5,10 +5,11 @@
  */
 class HTMLPurifier_AttrDef_Text extends HTMLPurifier_AttrDef
 {
-    
+
     public function validate($string, $config, $context) {
         return $this->parseCDATA($string);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index b814e9eeefbb103d3e2a7fd9c7851ee6582a15f6..93d2f0bbf4818b2cc12979a02a65015c7b1a3f95 100644 (file)
@@ -6,10 +6,10 @@
  */
 class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
 {
-    
+
     protected $parser;
     protected $embedsResource;
-    
+
     /**
      * @param $embeds_resource_resource Does the URI here result in an extra HTTP request?
      */
@@ -17,61 +17,61 @@ class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
         $this->parser = new HTMLPurifier_URIParser();
         $this->embedsResource = (bool) $embeds_resource;
     }
-    
+
     public function make($string) {
         $embeds = (bool) $string;
         return new HTMLPurifier_AttrDef_URI($embeds);
     }
-    
+
     public function validate($uri, $config, $context) {
-        
+
         if ($config->get('URI', 'Disable')) return false;
-        
+
         $uri = $this->parseCDATA($uri);
-        
+
         // parse the URI
         $uri = $this->parser->parse($uri);
         if ($uri === false) return false;
-        
+
         // add embedded flag to context for validators
-        $context->register('EmbeddedURI', $this->embedsResource); 
-        
+        $context->register('EmbeddedURI', $this->embedsResource);
+
         $ok = false;
         do {
-            
+
             // generic validation
             $result = $uri->validate($config, $context);
             if (!$result) break;
-            
+
             // chained filtering
             $uri_def = $config->getDefinition('URI');
             $result = $uri_def->filter($uri, $config, $context);
             if (!$result) break;
-            
-            // scheme-specific validation 
+
+            // scheme-specific validation
             $scheme_obj = $uri->getSchemeObj($config, $context);
             if (!$scheme_obj) break;
             if ($this->embedsResource && !$scheme_obj->browsable) break;
             $result = $scheme_obj->validate($uri, $config, $context);
             if (!$result) break;
-            
+
             // Post chained filtering
             $result = $uri_def->postFilter($uri, $config, $context);
             if (!$result) break;
-            
+
             // survived gauntlet
             $ok = true;
-            
+
         } while (false);
-        
+
         $context->destroy('EmbeddedURI');
         if (!$ok) return false;
-        
+
         // back to string
         return $uri->toString();
-        
+
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index 98d984c39e0eb9beac9625ab6d7c89ed28cf7243..bfee9d166c82ee6c0df47636afa4ea0948e8ba09 100644 (file)
@@ -2,14 +2,16 @@
 
 abstract class HTMLPurifier_AttrDef_URI_Email extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Unpacks a mailbox into its display-name and address
      */
     function unpack($string) {
         // needs to be implemented
     }
-    
+
 }
 
 // sub-implementations
+
+// vim: et sw=4 sts=4
index 98551c46ba2d8592e185df0138da610b4be590e1..94c715ab43258b923f89f300a853438ccce2da49 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 
 /**
- * Primitive email validation class based on the regexp found at 
+ * Primitive email validation class based on the regexp found at
  * http://www.regular-expressions.info/email.html
  */
 class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email
 {
-    
+
     public function validate($string, $config, $context) {
         // no support for named mailboxes i.e. "Bob <bob@example.com>"
         // that needs more percent encoding to be done
@@ -15,6 +15,7 @@ class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_UR
         $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
         return $result ? $string : false;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 8d1a7b2c38b9cdfb68805361f446ebc53a4f2301..2156c10c660e502bbfa8530a3425b9017aadedbd 100644 (file)
@@ -5,22 +5,22 @@
  */
 class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * Instance of HTMLPurifier_AttrDef_URI_IPv4 sub-validator
      */
     protected $ipv4;
-    
+
     /**
      * Instance of HTMLPurifier_AttrDef_URI_IPv6 sub-validator
      */
     protected $ipv6;
-    
+
     public function __construct() {
         $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
         $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
     }
-    
+
     public function validate($string, $config, $context) {
         $length = strlen($string);
         if ($string === '') return '';
@@ -31,17 +31,17 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
             if ($valid === false) return false;
             return '['. $valid . ']';
         }
-        
+
         // need to do checks on unusual encodings too
         $ipv4 = $this->ipv4->validate($string, $config, $context);
         if ($ipv4 !== false) return $ipv4;
-        
+
         // A regular domain name.
-        
+
         // This breaks I18N domain names, but we don't have proper IRI support,
-        // so force users to insert Punycode. If there's complaining we'll 
+        // so force users to insert Punycode. If there's complaining we'll
         // try to fix things into an international friendly form.
-        
+
         // The productions describing this are:
         $a   = '[a-z]';     // alpha
         $an  = '[a-z0-9]';  // alphanum
@@ -53,9 +53,10 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
         // hostname    = *( domainlabel "." ) toplabel [ "." ]
         $match = preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string);
         if (!$match) return false;
-        
+
         return $string;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 107e0605ab8354bf7c4855fbd166b445f9aaba75..ec4cf591b82b7d4bcd054d8556707a83a410568e 100644 (file)
@@ -6,25 +6,25 @@
  */
 class HTMLPurifier_AttrDef_URI_IPv4 extends HTMLPurifier_AttrDef
 {
-    
+
     /**
      * IPv4 regex, protected so that IPv6 can reuse it
      */
     protected $ip4;
-    
+
     public function validate($aIP, $config, $context) {
-        
+
         if (!$this->ip4) $this->_loadRegex();
-        
+
         if (preg_match('#^' . $this->ip4 . '$#s', $aIP))
         {
                 return $aIP;
         }
-        
+
         return false;
-        
+
     }
-    
+
     /**
      * Lazy load function to prevent regex from being stuffed in
      * cache.
@@ -33,6 +33,7 @@ class HTMLPurifier_AttrDef_URI_IPv4 extends HTMLPurifier_AttrDef
         $oct = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'; // 0-255
         $this->ip4 = "(?:{$oct}\\.{$oct}\\.{$oct}\\.{$oct})";
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 28fb8f5ba85648fa6100d2e448f938612db8ab85..9454e9be50eb96970d1eed77a61fd4976ff60911 100644 (file)
@@ -8,17 +8,17 @@
  */
 class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
 {
-    
+
     public function validate($aIP, $config, $context) {
-        
+
         if (!$this->ip4) $this->_loadRegex();
-        
+
         $original = $aIP;
-        
+
         $hex = '[0-9a-fA-F]';
         $blk = '(?:' . $hex . '{1,4})';
         $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))';   // /0 - /128
-        
+
         //      prefix check
         if (strpos($aIP, '/') !== false)
         {
@@ -32,8 +32,8 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
                         return false;
                 }
         }
-        
-        //      IPv4-compatiblity check       
+
+        //      IPv4-compatiblity check
         if (preg_match('#(?<=:'.')' . $this->ip4 . '$#s', $aIP, $find))
         {
                 $aIP = substr($aIP, 0, 0-strlen($find[0]));
@@ -42,7 +42,7 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
                 $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3];
                 unset($find, $ip);
         }
-        
+
         //      compression check
         $aIP = explode('::', $aIP);
         $c = count($aIP);
@@ -55,12 +55,12 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
                 list($first, $second) = $aIP;
                 $first = explode(':', $first);
                 $second = explode(':', $second);
-               
+
                 if (count($first) + count($second) > 8)
                 {
                         return false;
                 }
-               
+
                 while(count($first) < 8)
                 {
                         array_push($first, '0');
@@ -75,12 +75,12 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
                 $aIP = explode(':', $aIP[0]);
         }
         $c = count($aIP);
-        
+
         if ($c != 8)
         {
                 return false;
         }
-       
+
         //      All the pieces should be 16-bit hex strings. Are they?
         foreach ($aIP as $piece)
         {
@@ -89,10 +89,11 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
                         return false;
                 }
         }
-        
+
         return $original;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index a295c985da7fb65db0ea26c8da959fdc261f36f4..e61d3e01b6d55f3f83b42d2e3d82a21f83492c52 100644 (file)
@@ -2,13 +2,13 @@
 
 /**
  * Processes an entire attribute array for corrections needing multiple values.
- * 
+ *
  * Occasionally, a certain attribute will need to be removed and popped onto
  * another value.  Instead of creating a complex return syntax for
  * HTMLPurifier_AttrDef, we just pass the whole attribute array to a
  * specialized object and have that do the special work.  That is the
  * family of HTMLPurifier_AttrTransform.
- * 
+ *
  * An attribute transformation can be assigned to run before or after
  * HTMLPurifier_AttrDef validation.  See HTMLPurifier_HTMLDefinition for
  * more details.
 
 abstract class HTMLPurifier_AttrTransform
 {
-    
+
     /**
      * Abstract: makes changes to the attributes dependent on multiple values.
-     * 
+     *
      * @param $attr Assoc array of attributes, usually from
      *              HTMLPurifier_Token_Tag::$attr
      * @param $config Mandatory HTMLPurifier_Config object.
@@ -27,7 +27,7 @@ abstract class HTMLPurifier_AttrTransform
      * @returns Processed attribute array.
      */
     abstract public function transform($attr, $config, $context);
-    
+
     /**
      * Prepends CSS properties to the style attribute, creating the
      * attribute if it doesn't exist.
@@ -38,7 +38,7 @@ abstract class HTMLPurifier_AttrTransform
         $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
         $attr['style'] = $css . $attr['style'];
     }
-    
+
     /**
      * Retrieves and removes an attribute
      * @param $attr Attribute array to process (passed by reference)
@@ -50,6 +50,7 @@ abstract class HTMLPurifier_AttrTransform
         unset($attr[$key]);
         return $value;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index f7f0fedab7e1b87043e873e3ff09303f2bd93d62..0e1ff24a3ed8ed6758118ba293f40d5783150f1c 100644 (file)
@@ -6,17 +6,18 @@
 class HTMLPurifier_AttrTransform_Background extends HTMLPurifier_AttrTransform {
 
     public function transform($attr, $config, $context) {
-        
+
         if (!isset($attr['background'])) return $attr;
-        
+
         $background = $this->confiscateAttr($attr, 'background');
         // some validation should happen here
-        
+
         $this->prependCSS($attr, "background-image:url($background);");
-        
+
         return $attr;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index bf108bbbf1f8fdb2122415b68df32d5eacfbb0e3..40310b9144efc6f31462bd3f04e8b1db8737f175 100644 (file)
@@ -7,12 +7,13 @@
  */
 class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
 {
-    
+
     public function transform($attr, $config, $context) {
         if (isset($attr['dir'])) return $attr;
         $attr['dir'] = $config->get('Attr', 'DefaultTextDir');
         return $attr;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 5bc213676f09107805e342e0f3fa9a3d0d2462e4..ad3916bb9676a482104027657545a8a8e616c177 100644 (file)
@@ -6,17 +6,18 @@
 class HTMLPurifier_AttrTransform_BgColor extends HTMLPurifier_AttrTransform {
 
     public function transform($attr, $config, $context) {
-        
+
         if (!isset($attr['bgcolor'])) return $attr;
-        
+
         $bgcolor = $this->confiscateAttr($attr, 'bgcolor');
         // some validation should happen here
-        
+
         $this->prependCSS($attr, "background-color:$bgcolor;");
-        
+
         return $attr;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index ec523a119f7a36430d08fd51dbb825e36ffd505e..51159b67157de07846eb9f0b9af3486817ab5d69 100644 (file)
@@ -4,17 +4,17 @@
  * Pre-transform that changes converts a boolean attribute to fixed CSS
  */
 class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform {
-    
+
     /**
      * Name of boolean attribute that is trigger
      */
     protected $attr;
-    
+
     /**
      * CSS declarations to add to style, needs trailing semicolon
      */
     protected $css;
-    
+
     /**
      * @param $attr string attribute name to convert from
      * @param $css string CSS declarations to add to style (needs semicolon)
@@ -23,13 +23,14 @@ class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform {
         $this->attr = $attr;
         $this->css  = $css;
     }
-    
+
     public function transform($attr, $config, $context) {
         if (!isset($attr[$this->attr])) return $attr;
         unset($attr[$this->attr]);
         $this->prependCSS($attr, $this->css);
         return $attr;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index b72c019e998cc6dd89ae31f244ff9ad30aef9ce6..476b0b079b11074ce4e26f5ba163ed9849b7a161 100644 (file)
@@ -12,6 +12,7 @@ class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform {
         $this->prependCSS($attr, "border:{$border_width}px solid;");
         return $attr;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 5d36b6de7c88e5f4f68a21bb3f280fd65435f387..2a5b4514ab430df6d01a7e1b0bcbb3e26ac9baa5 100644 (file)
@@ -5,24 +5,24 @@
  * values (enumerated) to CSS.
  */
 class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform {
-    
+
     /**
      * Name of attribute to transform from
      */
     protected $attr;
-    
+
     /**
      * Lookup array of attribute values to CSS
      */
     protected $enumToCSS = array();
-    
+
     /**
      * Case sensitivity of the matching
      * @warning Currently can only be guaranteed to work with ASCII
      *          values.
      */
     protected $caseSensitive = false;
-    
+
     /**
      * @param $attr String attribute name to transform from
      * @param $enumToCSS Lookup array of attribute values to CSS
@@ -33,25 +33,26 @@ class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform {
         $this->enumToCSS = $enum_to_css;
         $this->caseSensitive = (bool) $case_sensitive;
     }
-    
+
     public function transform($attr, $config, $context) {
-        
+
         if (!isset($attr[$this->attr])) return $attr;
-        
+
         $value = trim($attr[$this->attr]);
         unset($attr[$this->attr]);
-        
+
         if (!$this->caseSensitive) $value = strtolower($value);
-        
+
         if (!isset($this->enumToCSS[$value])) {
             return $attr;
         }
-        
+
         $this->prependCSS($attr, $this->enumToCSS[$value]);
-        
+
         return $attr;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index e938f525dc70ba2b37b36fca422bd20a3de6ac90..25c9403c209344b54b0db62472ea9ca2ab4c1581 100644 (file)
  */
 class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
 {
-    
+
     public function transform($attr, $config, $context) {
-        
+
         $src = true;
         if (!isset($attr['src'])) {
             if ($config->get('Core', 'RemoveInvalidImg')) return $attr;
             $attr['src'] = $config->get('Attr', 'DefaultInvalidImage');
             $src = false;
         }
-        
+
         if (!isset($attr['alt'])) {
             if ($src) {
                 $alt = $config->get('Attr', 'DefaultImageAlt');
@@ -32,10 +32,11 @@ class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
                 $attr['alt'] = $config->get('Attr', 'DefaultInvalidImageAlt');
             }
         }
-        
+
         return $attr;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 02aaef599e3929c06519231c2f3714c17fb267c9..fd84c10c3618fb4642282ae307cf731e9e042490 100644 (file)
@@ -4,40 +4,41 @@
  * Pre-transform that changes deprecated hspace and vspace attributes to CSS
  */
 class HTMLPurifier_AttrTransform_ImgSpace extends HTMLPurifier_AttrTransform {
-    
+
     protected $attr;
     protected $css = array(
         'hspace' => array('left', 'right'),
         'vspace' => array('top', 'bottom')
     );
-    
+
     public function __construct($attr) {
         $this->attr = $attr;
         if (!isset($this->css[$attr])) {
             trigger_error(htmlspecialchars($attr) . ' is not valid space attribute');
         }
     }
-    
+
     public function transform($attr, $config, $context) {
-        
+
         if (!isset($attr[$this->attr])) return $attr;
-        
+
         $width = $this->confiscateAttr($attr, $this->attr);
         // some validation could happen here
-        
+
         if (!isset($this->css[$this->attr])) return $attr;
-        
+
         $style = '';
         foreach ($this->css[$this->attr] as $suffix) {
             $property = "margin-$suffix";
             $style .= "$property:{$width}px;";
         }
-        
+
         $this->prependCSS($attr, $style);
-        
+
         return $attr;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index f082c4de27de3206ded194e201aa2b6eb2b85fec..16829552d14d2a82502661ad530186a8c9e21cc9 100644 (file)
@@ -5,13 +5,13 @@
  * input elements. This is meant to be a post-transform.
  */
 class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform {
-    
+
     protected $pixels;
-    
+
     public function __construct() {
         $this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
     }
-    
+
     public function transform($attr, $config, $context) {
         if (!isset($attr['type'])) $t = 'text';
         else $t = strtolower($attr['type']);
@@ -34,6 +34,7 @@ class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform {
         }
         return $attr;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 960f489e685caf0843aba76af660f0004c90001b..5869e7f82037c5a38b9ea55789735181e4980160 100644 (file)
@@ -7,21 +7,22 @@
  */
 class HTMLPurifier_AttrTransform_Lang extends HTMLPurifier_AttrTransform
 {
-    
+
     public function transform($attr, $config, $context) {
-        
+
         $lang     = isset($attr['lang']) ? $attr['lang'] : false;
         $xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
-        
+
         if ($lang !== false && $xml_lang === false) {
             $attr['xml:lang'] = $lang;
         } elseif ($xml_lang !== false) {
             $attr['lang'] = $xml_lang;
         }
-        
+
         return $attr;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 817328021118d00a1b6a2117c312de05698f24e3..ea2f30473d6d14a7e77cff3a16f0fcd80712e3b5 100644 (file)
@@ -5,15 +5,15 @@
  */
 class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
 {
-    
+
     protected $name;
     protected $cssName;
-    
+
     public function __construct($name, $css_name = null) {
         $this->name = $name;
         $this->cssName = $css_name ? $css_name : $name;
     }
-    
+
     public function transform($attr, $config, $context) {
         if (!isset($attr[$this->name])) return $attr;
         $length = $this->confiscateAttr($attr, $this->name);
@@ -21,6 +21,7 @@ class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
         $this->prependCSS($attr, $this->cssName . ":$length;");
         return $attr;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 8de8c6ba3808a4bdbd19f8001e8c809080a2a58e..e6f93aee3bd41526588b611c527224254c708737 100644 (file)
@@ -5,7 +5,7 @@
  */
 class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
 {
-    
+
     public function transform($attr, $config, $context) {
         if (!isset($attr['name'])) return $attr;
         $id = $this->confiscateAttr($attr, 'name');
@@ -13,6 +13,7 @@ class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
         $attr['id'] = $id;
         return $attr;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index d3c1883b8990ccabd6d5761bec93c0e181284e46..4da449981fbd4b8f23992e317309ee46baaa347c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-class HTMLPurifier_AttrTransform_SafeEmbed extends HTMLPurifier_AttrTransform 
+class HTMLPurifier_AttrTransform_SafeEmbed extends HTMLPurifier_AttrTransform
 {
     public $name = "SafeEmbed";
 
@@ -11,3 +11,5 @@ class HTMLPurifier_AttrTransform_SafeEmbed extends HTMLPurifier_AttrTransform
         return $attr;
     }
 }
+
+// vim: et sw=4 sts=4
index 28d1ad6874166efb8b251456bccf4a5222083729..1ed74898bae41dbe0102ff8065a355fd016227a7 100644 (file)
@@ -12,3 +12,5 @@ class HTMLPurifier_AttrTransform_SafeObject extends HTMLPurifier_AttrTransform
         return $attr;
     }
 }
+
+// vim: et sw=4 sts=4
index ae72654fed0502a37513be9593ff34f61ebc909a..94e8052a9d09f3d71575a6a1d21176031d4a9013 100644 (file)
@@ -4,23 +4,23 @@
  * Validates name/value pairs in param tags to be used in safe objects. This
  * will only allow name values it recognizes, and pre-fill certain attributes
  * with required values.
- * 
+ *
  * @note
  *      This class only supports Flash. In the future, Quicktime support
  *      may be added.
- * 
+ *
  * @warning
  *      This class expects an injector to add the necessary parameters tags.
  */
-class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform 
+class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
 {
     public $name = "SafeParam";
     private $uri;
-    
+
     public function __construct() {
         $this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
     }
-    
+
     public function transform($attr, $config, $context) {
         // If we add support for other objects, we'll need to alter the
         // transforms.
@@ -46,3 +46,5 @@ class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
         return $attr;
     }
 }
+
+// vim: et sw=4 sts=4
index cc18b7e9e2771e4791ee0b70612ee54e4d2d2e6a..4499050a22ac7fbb0012459ecbd04fe615560f47 100644 (file)
@@ -12,3 +12,5 @@ class HTMLPurifier_AttrTransform_ScriptRequired extends HTMLPurifier_AttrTransfo
         return $attr;
     }
 }
+
+// vim: et sw=4 sts=4
index c7cc9888affdf7ffb22752e8c6310581880df15a..81ac3488ba87520621ec1a42131a9cc0131f2027 100644 (file)
@@ -5,12 +5,14 @@
  */
 class HTMLPurifier_AttrTransform_Textarea extends HTMLPurifier_AttrTransform
 {
-    
+
     public function transform($attr, $config, $context) {
         // Calculated from Firefox
         if (!isset($attr['cols'])) $attr['cols'] = '22';
         if (!isset($attr['rows'])) $attr['rows'] = '3';
         return $attr;
     }
-    
-}
\ No newline at end of file
+
+}
+
+// vim: et sw=4 sts=4
index c3116a162ede657c5b1941037926b2fb2698fc4d..6c624bb0ba6dc801d5212abe4088e2f0fd4e412e 100644 (file)
@@ -9,7 +9,7 @@ class HTMLPurifier_AttrTypes
      * Lookup array of attribute string identifiers to concrete implementations
      */
     protected $info = array();
-    
+
     /**
      * Constructs the info array, supplying default implementations for attribute
      * types.
@@ -18,7 +18,7 @@ class HTMLPurifier_AttrTypes
         // pseudo-types, must be instantiated via shorthand
         $this->info['Enum']    = new HTMLPurifier_AttrDef_Enum();
         $this->info['Bool']    = new HTMLPurifier_AttrDef_HTML_Bool();
-        
+
         $this->info['CDATA']    = new HTMLPurifier_AttrDef_Text();
         $this->info['ID']       = new HTMLPurifier_AttrDef_HTML_ID();
         $this->info['Length']   = new HTMLPurifier_AttrDef_HTML_Length();
@@ -29,38 +29,38 @@ class HTMLPurifier_AttrTypes
         $this->info['URI']      = new HTMLPurifier_AttrDef_URI();
         $this->info['LanguageCode'] = new HTMLPurifier_AttrDef_Lang();
         $this->info['Color']    = new HTMLPurifier_AttrDef_HTML_Color();
-        
+
         // unimplemented aliases
         $this->info['ContentType'] = new HTMLPurifier_AttrDef_Text();
         $this->info['ContentTypes'] = new HTMLPurifier_AttrDef_Text();
         $this->info['Charsets'] = new HTMLPurifier_AttrDef_Text();
         $this->info['Character'] = new HTMLPurifier_AttrDef_Text();
-        
+
         // number is really a positive integer (one or more digits)
         // FIXME: ^^ not always, see start and value of list items
         $this->info['Number']   = new HTMLPurifier_AttrDef_Integer(false, false, true);
     }
-    
+
     /**
      * Retrieves a type
      * @param $type String type name
      * @return Object AttrDef for type
      */
     public function get($type) {
-        
+
         // determine if there is any extra info tacked on
         if (strpos($type, '#') !== false) list($type, $string) = explode('#', $type, 2);
         else $string = '';
-        
+
         if (!isset($this->info[$type])) {
             trigger_error('Cannot retrieve undefined attribute type ' . $type, E_USER_ERROR);
             return;
         }
-        
+
         return $this->info[$type]->make($string);
-        
+
     }
-    
+
     /**
      * Sets a new implementation for a type
      * @param $type String type name
@@ -71,4 +71,4 @@ class HTMLPurifier_AttrTypes
     }
 }
 
-
+// vim: et sw=4 sts=4
index fb913fc020bd71fd8e7b0a4c4d092381c827bdef..829a0f8f225e5f56125c2daafc8ad835d694065a 100644 (file)
@@ -7,7 +7,7 @@
  */
 class HTMLPurifier_AttrValidator
 {
-    
+
     /**
      * Validates the attributes of a token, returning a modified token
      * that has valid tokens
@@ -19,33 +19,33 @@ class HTMLPurifier_AttrValidator
      * @param $context Instance of HTMLPurifier_Context
      */
     public function validateToken(&$token, &$config, $context) {
-            
+
         $definition = $config->getHTMLDefinition();
         $e =& $context->get('ErrorCollector', true);
-        
+
         // initialize IDAccumulator if necessary
         $ok =& $context->get('IDAccumulator', true);
         if (!$ok) {
             $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
             $context->register('IDAccumulator', $id_accumulator);
         }
-        
+
         // initialize CurrentToken if necessary
         $current_token =& $context->get('CurrentToken', true);
         if (!$current_token) $context->register('CurrentToken', $token);
-        
+
         if (
             !$token instanceof HTMLPurifier_Token_Start &&
             !$token instanceof HTMLPurifier_Token_Empty
         ) return $token;
-        
+
         // create alias to global definition array, see also $defs
         // DEFINITION CALL
         $d_defs = $definition->info_global_attr;
-        
+
         // don't update token until the very end, to ensure an atomic update
         $attr = $token->attr;
-        
+
         // do global transformations (pre)
         // nothing currently utilizes this
         foreach ($definition->info_attr_transform_pre as $transform) {
@@ -54,7 +54,7 @@ class HTMLPurifier_AttrValidator
                 if ($attr != $o) $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
             }
         }
-        
+
         // do local transformations only applicable to this element (pre)
         // ex. <p align="right"> to <p style="text-align:right;">
         foreach ($definition->info[$token->name]->attr_transform_pre as $transform) {
@@ -63,19 +63,19 @@ class HTMLPurifier_AttrValidator
                 if ($attr != $o) $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
             }
         }
-        
+
         // create alias to this element's attribute definition array, see
         // also $d_defs (global attribute definition array)
         // DEFINITION CALL
         $defs = $definition->info[$token->name]->attr;
-        
+
         $attr_key = false;
         $context->register('CurrentAttr', $attr_key);
-        
+
         // iterate through all the attribute keypairs
         // Watch out for name collisions: $key has previously been used
         foreach ($attr as $attr_key => $value) {
-            
+
             // call the definition
             if ( isset($defs[$attr_key]) ) {
                 // there is a local definition defined
@@ -102,37 +102,37 @@ class HTMLPurifier_AttrValidator
                 // system never heard of the attribute? DELETE!
                 $result = false;
             }
-            
+
             // put the results into effect
             if ($result === false || $result === null) {
                 // this is a generic error message that should replaced
                 // with more specific ones when possible
                 if ($e) $e->send(E_ERROR, 'AttrValidator: Attribute removed');
-                
+
                 // remove the attribute
                 unset($attr[$attr_key]);
             } elseif (is_string($result)) {
                 // generally, if a substitution is happening, there
                 // was some sort of implicit correction going on. We'll
                 // delegate it to the attribute classes to say exactly what.
-                
+
                 // simple substitution
                 $attr[$attr_key] = $result;
             } else {
                 // nothing happens
             }
-            
+
             // we'd also want slightly more complicated substitution
             // involving an array as the return value,
             // although we're not sure how colliding attributes would
             // resolve (certain ones would be completely overriden,
             // others would prepend themselves).
         }
-        
+
         $context->destroy('CurrentAttr');
-        
+
         // post transforms
-        
+
         // global (error reporting untested)
         foreach ($definition->info_attr_transform_post as $transform) {
             $attr = $transform->transform($o = $attr, $config, $context);
@@ -140,7 +140,7 @@ class HTMLPurifier_AttrValidator
                 if ($attr != $o) $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
             }
         }
-        
+
         // local (error reporting untested)
         foreach ($definition->info[$token->name]->attr_transform_post as $transform) {
             $attr = $transform->transform($o = $attr, $config, $context);
@@ -148,14 +148,15 @@ class HTMLPurifier_AttrValidator
                 if ($attr != $o) $e->send(E_NOTICE, 'AttrValidator: Attributes transformed', $o, $attr);
             }
         }
-        
+
         $token->attr = $attr;
-        
+
         // destroy CurrentToken if we made it ourselves
         if (!$current_token) $context->destroy('CurrentToken');
-        
+
     }
-    
-    
+
+
 }
 
+// vim: et sw=4 sts=4
index 09dcb5019d95f98dad1808110eb8481572c61cab..559f61a232024524fbf2b193f081cc93c245b434 100644 (file)
@@ -29,7 +29,7 @@ if (!defined('PHP_EOL')) {
  */
 class HTMLPurifier_Bootstrap
 {
-    
+
     /**
      * Autoload function for HTML Purifier
      * @param $class Class to load
@@ -40,7 +40,7 @@ class HTMLPurifier_Bootstrap
         require HTMLPURIFIER_PREFIX . '/' . $file;
         return true;
     }
-    
+
     /**
      * Returns the path for a specific class.
      */
@@ -56,7 +56,7 @@ class HTMLPurifier_Bootstrap
         if (!file_exists(HTMLPURIFIER_PREFIX . '/' . $file)) return false;
         return $file;
     }
-    
+
     /**
      * "Pre-registers" our autoloader on the SPL stack.
      */
@@ -92,5 +92,7 @@ class HTMLPurifier_Bootstrap
             foreach ($funcs as $func) spl_autoload_register($func);
         }
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 36dfa618b7fba5431028c9b0960e7cf154d9e816..1a1805733864381d11e99e52463a03eef1dca084 100644 (file)
@@ -6,32 +6,32 @@
  */
 class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
 {
-    
+
     public $type = 'CSS';
-    
+
     /**
      * Assoc array of attribute name to definition object.
      */
     public $info = array();
-    
+
     /**
      * Constructs the info array.  The meat of this class.
      */
     protected function doSetup($config) {
-        
+
         $this->info['text-align'] = new HTMLPurifier_AttrDef_Enum(
             array('left', 'right', 'center', 'justify'), false);
-        
+
         $border_style =
-        $this->info['border-bottom-style'] = 
-        $this->info['border-right-style'] = 
-        $this->info['border-left-style'] = 
+        $this->info['border-bottom-style'] =
+        $this->info['border-right-style'] =
+        $this->info['border-left-style'] =
         $this->info['border-top-style'] =  new HTMLPurifier_AttrDef_Enum(
             array('none', 'hidden', 'dotted', 'dashed', 'solid', 'double',
             'groove', 'ridge', 'inset', 'outset'), false);
-        
+
         $this->info['border-style'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_style);
-        
+
         $this->info['clear'] = new HTMLPurifier_AttrDef_Enum(
             array('none', 'left', 'right', 'both'), false);
         $this->info['float'] = new HTMLPurifier_AttrDef_Enum(
@@ -40,27 +40,27 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
             array('normal', 'italic', 'oblique'), false);
         $this->info['font-variant'] = new HTMLPurifier_AttrDef_Enum(
             array('normal', 'small-caps'), false);
-        
+
         $uri_or_none = new HTMLPurifier_AttrDef_CSS_Composite(
             array(
                 new HTMLPurifier_AttrDef_Enum(array('none')),
                 new HTMLPurifier_AttrDef_CSS_URI()
             )
         );
-        
+
         $this->info['list-style-position'] = new HTMLPurifier_AttrDef_Enum(
             array('inside', 'outside'), false);
         $this->info['list-style-type'] = new HTMLPurifier_AttrDef_Enum(
             array('disc', 'circle', 'square', 'decimal', 'lower-roman',
             'upper-roman', 'lower-alpha', 'upper-alpha', 'none'), false);
         $this->info['list-style-image'] = $uri_or_none;
-        
+
         $this->info['list-style'] = new HTMLPurifier_AttrDef_CSS_ListStyle($config);
-        
+
         $this->info['text-transform'] = new HTMLPurifier_AttrDef_Enum(
             array('capitalize', 'uppercase', 'lowercase', 'none'), false);
         $this->info['color'] = new HTMLPurifier_AttrDef_CSS_Color();
-        
+
         $this->info['background-image'] = $uri_or_none;
         $this->info['background-repeat'] = new HTMLPurifier_AttrDef_Enum(
             array('repeat', 'repeat-x', 'repeat-y', 'no-repeat')
@@ -69,42 +69,42 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
             array('scroll', 'fixed')
         );
         $this->info['background-position'] = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
-        
-        $border_color = 
-        $this->info['border-top-color'] = 
-        $this->info['border-bottom-color'] = 
-        $this->info['border-left-color'] = 
-        $this->info['border-right-color'] = 
+
+        $border_color =
+        $this->info['border-top-color'] =
+        $this->info['border-bottom-color'] =
+        $this->info['border-left-color'] =
+        $this->info['border-right-color'] =
         $this->info['background-color'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('transparent')),
             new HTMLPurifier_AttrDef_CSS_Color()
         ));
-        
+
         $this->info['background'] = new HTMLPurifier_AttrDef_CSS_Background($config);
-        
+
         $this->info['border-color'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_color);
-        
-        $border_width = 
-        $this->info['border-top-width'] = 
-        $this->info['border-bottom-width'] = 
-        $this->info['border-left-width'] = 
+
+        $border_width =
+        $this->info['border-top-width'] =
+        $this->info['border-bottom-width'] =
+        $this->info['border-left-width'] =
         $this->info['border-right-width'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('thin', 'medium', 'thick')),
             new HTMLPurifier_AttrDef_CSS_Length('0') //disallow negative
         ));
-        
+
         $this->info['border-width'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_width);
-        
+
         $this->info['letter-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('normal')),
             new HTMLPurifier_AttrDef_CSS_Length()
         ));
-        
+
         $this->info['word-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('normal')),
             new HTMLPurifier_AttrDef_CSS_Length()
         ));
-        
+
         $this->info['font-size'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('xx-small', 'x-small',
                 'small', 'medium', 'large', 'x-large', 'xx-large',
@@ -112,54 +112,54 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
             new HTMLPurifier_AttrDef_CSS_Percentage(),
             new HTMLPurifier_AttrDef_CSS_Length()
         ));
-        
+
         $this->info['line-height'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('normal')),
             new HTMLPurifier_AttrDef_CSS_Number(true), // no negatives
             new HTMLPurifier_AttrDef_CSS_Length('0'),
             new HTMLPurifier_AttrDef_CSS_Percentage(true)
         ));
-        
+
         $margin =
-        $this->info['margin-top'] = 
-        $this->info['margin-bottom'] = 
-        $this->info['margin-left'] = 
+        $this->info['margin-top'] =
+        $this->info['margin-bottom'] =
+        $this->info['margin-left'] =
         $this->info['margin-right'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_CSS_Length(),
             new HTMLPurifier_AttrDef_CSS_Percentage(),
             new HTMLPurifier_AttrDef_Enum(array('auto'))
         ));
-        
+
         $this->info['margin'] = new HTMLPurifier_AttrDef_CSS_Multiple($margin);
-        
+
         // non-negative
         $padding =
-        $this->info['padding-top'] = 
-        $this->info['padding-bottom'] = 
-        $this->info['padding-left'] = 
+        $this->info['padding-top'] =
+        $this->info['padding-bottom'] =
+        $this->info['padding-left'] =
         $this->info['padding-right'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_CSS_Length('0'),
             new HTMLPurifier_AttrDef_CSS_Percentage(true)
         ));
-        
+
         $this->info['padding'] = new HTMLPurifier_AttrDef_CSS_Multiple($padding);
-        
+
         $this->info['text-indent'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_CSS_Length(),
             new HTMLPurifier_AttrDef_CSS_Percentage()
         ));
-        
+
         $trusted_wh = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_CSS_Length('0'),
             new HTMLPurifier_AttrDef_CSS_Percentage(true),
             new HTMLPurifier_AttrDef_Enum(array('auto'))
         ));
         $max = $config->get('CSS', 'MaxImgLength');
-        
+
         $this->info['width'] =
         $this->info['height'] =
             $max === null ?
-            $trusted_wh : 
+            $trusted_wh :
             new HTMLPurifier_AttrDef_Switch('img',
                 // For img tags:
                 new HTMLPurifier_AttrDef_CSS_Composite(array(
@@ -169,65 +169,65 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
                 // For everyone else:
                 $trusted_wh
             );
-        
+
         $this->info['text-decoration'] = new HTMLPurifier_AttrDef_CSS_TextDecoration();
-        
+
         $this->info['font-family'] = new HTMLPurifier_AttrDef_CSS_FontFamily();
-        
+
         // this could use specialized code
         $this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
             array('normal', 'bold', 'bolder', 'lighter', '100', '200', '300',
             '400', '500', '600', '700', '800', '900'), false);
-        
+
         // MUST be called after other font properties, as it references
         // a CSSDefinition object
         $this->info['font'] = new HTMLPurifier_AttrDef_CSS_Font($config);
-        
+
         // same here
         $this->info['border'] =
-        $this->info['border-bottom'] = 
-        $this->info['border-top'] = 
-        $this->info['border-left'] = 
+        $this->info['border-bottom'] =
+        $this->info['border-top'] =
+        $this->info['border-left'] =
         $this->info['border-right'] = new HTMLPurifier_AttrDef_CSS_Border($config);
-        
+
         $this->info['border-collapse'] = new HTMLPurifier_AttrDef_Enum(array(
             'collapse', 'separate'));
-        
+
         $this->info['caption-side'] = new HTMLPurifier_AttrDef_Enum(array(
             'top', 'bottom'));
-        
+
         $this->info['table-layout'] = new HTMLPurifier_AttrDef_Enum(array(
             'auto', 'fixed'));
-        
+
         $this->info['vertical-align'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
             new HTMLPurifier_AttrDef_Enum(array('baseline', 'sub', 'super',
                 'top', 'text-top', 'middle', 'bottom', 'text-bottom')),
             new HTMLPurifier_AttrDef_CSS_Length(),
             new HTMLPurifier_AttrDef_CSS_Percentage()
         ));
-        
+
         $this->info['border-spacing'] = new HTMLPurifier_AttrDef_CSS_Multiple(new HTMLPurifier_AttrDef_CSS_Length(), 2);
-        
+
         // partial support
         $this->info['white-space'] = new HTMLPurifier_AttrDef_Enum(array('nowrap'));
-        
+
         if ($config->get('CSS', 'Proprietary')) {
             $this->doSetupProprietary($config);
         }
-        
+
         if ($config->get('CSS', 'AllowTricky')) {
             $this->doSetupTricky($config);
         }
-        
+
         $allow_important = $config->get('CSS', 'AllowImportant');
         // wrap all attr-defs with decorator that handles !important
         foreach ($this->info as $k => $v) {
             $this->info[$k] = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($v, $allow_important);
         }
-        
+
         $this->setupConfigStuff($config);
     }
-    
+
     protected function doSetupProprietary($config) {
         // Internet Explorer only scrollbar colors
         $this->info['scrollbar-arrow-color']        = new HTMLPurifier_AttrDef_CSS_Color();
@@ -236,17 +236,17 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
         $this->info['scrollbar-face-color']         = new HTMLPurifier_AttrDef_CSS_Color();
         $this->info['scrollbar-highlight-color']    = new HTMLPurifier_AttrDef_CSS_Color();
         $this->info['scrollbar-shadow-color']       = new HTMLPurifier_AttrDef_CSS_Color();
-        
+
         // technically not proprietary, but CSS3, and no one supports it
         $this->info['opacity']          = new HTMLPurifier_AttrDef_CSS_AlphaValue();
         $this->info['-moz-opacity']     = new HTMLPurifier_AttrDef_CSS_AlphaValue();
         $this->info['-khtml-opacity']   = new HTMLPurifier_AttrDef_CSS_AlphaValue();
-        
+
         // only opacity, for now
         $this->info['filter'] = new HTMLPurifier_AttrDef_CSS_Filter();
-        
+
     }
-    
+
     protected function doSetupTricky($config) {
         $this->info['display'] = new HTMLPurifier_AttrDef_Enum(array(
             'inline', 'block', 'list-item', 'run-in', 'compact',
@@ -257,9 +257,10 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
         $this->info['visibility'] = new HTMLPurifier_AttrDef_Enum(array(
             'visible', 'hidden', 'collapse'
         ));
+        $this->info['overflow'] = new HTMLPurifier_AttrDef_Enum(array('visible', 'hidden', 'auto', 'scroll'));
     }
-    
-    
+
+
     /**
      * Performs extra config-based processing. Based off of
      * HTMLPurifier_HTMLDefinition.
@@ -267,7 +268,7 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
      *       composition, not inheritance).
      */
     protected function setupConfigStuff($config) {
-        
+
         // setup allowed elements
         $support = "(for information on implementing this, see the ".
                    "support forums) ";
@@ -284,7 +285,8 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
                 trigger_error("Style attribute '$name' is not supported $support", E_USER_WARNING);
             }
         }
-        
+
     }
 }
 
+// vim: et sw=4 sts=4
index 38f3692f51ed83642c574fdcbeba4e3a9199a486..c5d5216dab2d2c29b3b1d6be417a550dbf5b2345 100644 (file)
@@ -10,31 +10,31 @@ abstract class HTMLPurifier_ChildDef
      * Used occasionally in terms of context.
      */
     public $type;
-    
+
     /**
      * Bool that indicates whether or not an empty array of children is okay
-     * 
+     *
      * This is necessary for redundant checking when changes affecting
      * a child node may cause a parent node to now be disallowed.
      */
     public $allow_empty;
-    
+
     /**
      * Lookup array of all elements that this definition could possibly allow
      */
     public $elements = array();
-    
+
     /**
      * Get lookup of tag names that should not close this element automatically.
      * All other elements will do so.
      */
-    public function getNonAutoCloseElements($config) {
+    public function getAllowedElements($config) {
         return $this->elements;
     }
-    
+
     /**
      * Validates nodes according to definition and returns modification.
-     * 
+     *
      * @param $tokens_of_children Array of HTMLPurifier_Token
      * @param $config HTMLPurifier_Config object
      * @param $context HTMLPurifier_Context object
@@ -45,4 +45,4 @@ abstract class HTMLPurifier_ChildDef
     abstract public function validateChildren($tokens_of_children, $config, $context);
 }
 
-
+// vim: et sw=4 sts=4
index d918080a19d931f37034277a09373d829739c242..15c364ee33c53bc36a0fddeb77bbb2eae0903d84 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Definition that uses different definitions depending on context.
- * 
+ *
  * The del and ins tags are notable because they allow different types of
  * elements depending on whether or not they're in a block or inline context.
  * Chameleon allows this behavior to happen by using two different
  */
 class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
 {
-    
+
     /**
      * Instance of the definition object to use when inline. Usually stricter.
      */
     public $inline;
-    
+
     /**
      * Instance of the definition object to use when block.
      */
     public $block;
-    
+
     public $type = 'chameleon';
-    
+
     /**
      * @param $inline List of elements to allow when inline.
      * @param $block List of elements to allow when block.
@@ -33,7 +33,7 @@ class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
         $this->block  = new HTMLPurifier_ChildDef_Optional($block);
         $this->elements = $this->block->elements;
     }
-    
+
     public function validateChildren($tokens_of_children, $config, $context) {
         if ($context->get('IsInline') === false) {
             return $this->block->validateChildren(
@@ -45,3 +45,4 @@ class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
     }
 }
 
+// vim: et sw=4 sts=4
index f79bfcae60b512bee0ffc8872d0749f7463d2b8b..b68047b4b55f9f6e3564f06e11b038c6a154fe94 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Custom validation class, accepts DTD child definitions
- * 
+ *
  * @warning Currently this class is an all or nothing proposition, that is,
  *          it will only give a bool return value.
  */
@@ -36,25 +36,25 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
         }
         $el = '[#a-zA-Z0-9_.-]+';
         $reg = $raw;
-        
+
         // COMPLICATED! AND MIGHT BE BUGGY! I HAVE NO CLUE WHAT I'M
         // DOING! Seriously: if there's problems, please report them.
-        
+
         // collect all elements into the $elements array
         preg_match_all("/$el/", $reg, $matches);
         foreach ($matches[0] as $match) {
             $this->elements[$match] = true;
         }
-        
+
         // setup all elements as parentheticals with leading commas
         $reg = preg_replace("/$el/", '(,\\0)', $reg);
-        
+
         // remove commas when they were not solicited
         $reg = preg_replace("/([^,(|]\(+),/", '\\1', $reg);
-        
+
         // remove all non-paranthetical commas: they are handled by first regex
         $reg = preg_replace("/,\(/", '(', $reg);
-        
+
         $this->_pcre_regex = $reg;
     }
     public function validateChildren($tokens_of_children, $config, $context) {
@@ -62,15 +62,15 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
         $nesting = 0; // depth into the nest
         foreach ($tokens_of_children as $token) {
             if (!empty($token->is_whitespace)) continue;
-            
+
             $is_child = ($nesting == 0); // direct
-            
+
             if ($token instanceof HTMLPurifier_Token_Start) {
                 $nesting++;
             } elseif ($token instanceof HTMLPurifier_Token_End) {
                 $nesting--;
             }
-            
+
             if ($is_child) {
                 $list_of_children .= $token->name . ',';
             }
@@ -82,8 +82,9 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
                 '/^,?'.$this->_pcre_regex.'$/',
                 $list_of_children
             );
-        
+
         return (bool) $okay;
     }
 }
 
+// vim: et sw=4 sts=4
index ad4dc0b7cdec420f98dbe37a39076c86e4bfcd10..13171f6651dc87ff98353d66454162cdf6392574 100644 (file)
@@ -17,3 +17,4 @@ class HTMLPurifier_ChildDef_Empty extends HTMLPurifier_ChildDef
     }
 }
 
+// vim: et sw=4 sts=4
index dcf39cdc862471047d3e1f193effdeb4201c79fb..32bcb9898eac9ea6fff386e1617ad332b5c19971 100644 (file)
@@ -13,11 +13,14 @@ class HTMLPurifier_ChildDef_Optional extends HTMLPurifier_ChildDef_Required
     public $type = 'optional';
     public function validateChildren($tokens_of_children, $config, $context) {
         $result = parent::validateChildren($tokens_of_children, $config, $context);
+        // we assume that $tokens_of_children is not modified
         if ($result === false) {
             if (empty($tokens_of_children)) return true;
+            elseif ($this->whitespace) return $tokens_of_children;
             else return array();
         }
         return $result;
     }
 }
 
+// vim: et sw=4 sts=4
index 2009fc883528d4fe81a328c0866362ea1863428b..c3e748b2601038486b2383dd4e9803a0239cdffe 100644 (file)
@@ -10,6 +10,10 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
      * @public
      */
     public $elements = array();
+    /**
+     * Whether or not the last passed node was all whitespace.
+     */
+    protected $whitespace = false;
     /**
      * @param $elements List of allowed element names (lowercase).
      */
@@ -31,47 +35,50 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
     public $allow_empty = false;
     public $type = 'required';
     public function validateChildren($tokens_of_children, $config, $context) {
+        // Flag for subclasses
+        $this->whitespace = false;
+
         // if there are no tokens, delete parent node
         if (empty($tokens_of_children)) return false;
-        
+
         // the new set of children
         $result = array();
-        
+
         // current depth into the nest
         $nesting = 0;
-        
+
         // whether or not we're deleting a node
         $is_deleting = false;
-        
+
         // whether or not parsed character data is allowed
         // this controls whether or not we silently drop a tag
         // or generate escaped HTML from it
         $pcdata_allowed = isset($this->elements['#PCDATA']);
-        
+
         // a little sanity check to make sure it's not ALL whitespace
         $all_whitespace = true;
-        
+
         // some configuration
         $escape_invalid_children = $config->get('Core', 'EscapeInvalidChildren');
-        
+
         // generator
         $gen = new HTMLPurifier_Generator($config, $context);
-        
+
         foreach ($tokens_of_children as $token) {
             if (!empty($token->is_whitespace)) {
                 $result[] = $token;
                 continue;
             }
             $all_whitespace = false; // phew, we're not talking about whitespace
-            
+
             $is_child = ($nesting == 0);
-            
+
             if ($token instanceof HTMLPurifier_Token_Start) {
                 $nesting++;
             } elseif ($token instanceof HTMLPurifier_Token_End) {
                 $nesting--;
             }
-            
+
             if ($is_child) {
                 $is_deleting = false;
                 if (!isset($this->elements[$token->name])) {
@@ -98,9 +105,13 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
             }
         }
         if (empty($result)) return false;
-        if ($all_whitespace) return false;
+        if ($all_whitespace) {
+            $this->whitespace = true;
+            return false;
+        }
         if ($tokens_of_children == $result) return true;
         return $result;
     }
 }
 
+// vim: et sw=4 sts=4
index ec0890d91796276b886ac2f429c2658b2be16bec..dfae8a6e5e1d28f81b7484bcf81d941e4bf6dfab 100644 (file)
@@ -10,35 +10,35 @@ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Requi
     public $allow_empty = true;
     public $type = 'strictblockquote';
     protected $init = false;
-    
+
     /**
      * @note We don't want MakeWellFormed to auto-close inline elements since
      *       they might be allowed.
      */
-    public function getNonAutoCloseElements($config) {
+    public function getAllowedElements($config) {
         $this->init($config);
         return $this->fake_elements;
     }
-    
+
     public function validateChildren($tokens_of_children, $config, $context) {
-        
+
         $this->init($config);
-        
+
         // trick the parent class into thinking it allows more
         $this->elements = $this->fake_elements;
         $result = parent::validateChildren($tokens_of_children, $config, $context);
         $this->elements = $this->real_elements;
-        
+
         if ($result === false) return array();
         if ($result === true) $result = $tokens_of_children;
-        
+
         $def = $config->getHTMLDefinition();
         $block_wrap_start = new HTMLPurifier_Token_Start($def->info_block_wrapper);
         $block_wrap_end   = new HTMLPurifier_Token_End(  $def->info_block_wrapper);
         $is_inline = false;
         $depth = 0;
         $ret = array();
-        
+
         // assuming that there are no comment tokens
         foreach ($result as $i => $token) {
             $token = $result[$i];
@@ -72,7 +72,7 @@ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Requi
         if ($is_inline) $ret[] = $block_wrap_end;
         return $ret;
     }
-    
+
     private function init($config) {
         if (!$this->init) {
             $def = $config->getHTMLDefinition();
@@ -85,3 +85,4 @@ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Requi
     }
 }
 
+// vim: et sw=4 sts=4
index d9d45bad95072a4c5df778e0dde6c0e15b5ee904..34f0227dd2cc549f4dacef4efd9d6ae8b43680d9 100644 (file)
@@ -12,31 +12,31 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
     public function __construct() {}
     public function validateChildren($tokens_of_children, $config, $context) {
         if (empty($tokens_of_children)) return false;
-        
+
         // this ensures that the loop gets run one last time before closing
         // up. It's a little bit of a hack, but it works! Just make sure you
         // get rid of the token later.
         $tokens_of_children[] = false;
-        
+
         // only one of these elements is allowed in a table
         $caption = false;
         $thead   = false;
         $tfoot   = false;
-        
+
         // as many of these as you want
         $cols    = array();
         $content = array();
-        
+
         $nesting = 0; // current depth so we can determine nodes
         $is_collecting = false; // are we globbing together tokens to package
                                 // into one of the collectors?
         $collection = array(); // collected nodes
         $tag_index = 0; // the first node might be whitespace,
                             // so this tells us where the start tag is
-        
+
         foreach ($tokens_of_children as $token) {
             $is_child = ($nesting == 0);
-            
+
             if ($token === false) {
                 // terminating sequence started
             } elseif ($token instanceof HTMLPurifier_Token_Start) {
@@ -44,7 +44,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
             } elseif ($token instanceof HTMLPurifier_Token_End) {
                 $nesting--;
             }
-            
+
             // handle node collection
             if ($is_collecting) {
                 if ($is_child) {
@@ -85,10 +85,10 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
                     $collection[] = $token;
                 }
             }
-            
+
             // terminate
             if ($token === false) break;
-            
+
             if ($is_child) {
                 // determine what we're dealing with
                 if ($token->name == 'col') {
@@ -110,7 +110,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
                         $collection[] = $token;
                         continue;
                     default:
-                        if ($token instanceof HTMLPurifier_Token_Text && $token->is_whitespace) {
+                        if (!empty($token->is_whitespace)) {
                             $collection[] = $token;
                             $tag_index++;
                         }
@@ -118,9 +118,9 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
                 }
             }
         }
-        
+
         if (empty($content)) return false;
-        
+
         $ret = array();
         if ($caption !== false) $ret = array_merge($ret, $caption);
         if ($cols !== false)    foreach ($cols as $token_array) $ret = array_merge($ret, $token_array);
@@ -131,11 +131,12 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
             // grab the trailing space
             $ret = array_merge($ret, $collection);
         }
-        
+
         array_pop($tokens_of_children); // remove phantom token
-        
+
         return ($ret === $tokens_of_children) ? true : $ret;
-        
+
     }
 }
 
+// vim: et sw=4 sts=4
index aca84982855fd9f1ee1976077218de0a00af54a2..f8e1f7804ea688b9976cc3776ca97a361c3ee596 100644 (file)
@@ -5,79 +5,79 @@
  *
  * @warning This class is strongly defined: that means that the class
  *          will fail if an undefined directive is retrieved or set.
- * 
+ *
  * @note Many classes that could (although many times don't) use the
  *       configuration object make it a mandatory parameter.  This is
  *       because a configuration object should always be forwarded,
  *       otherwise, you run the risk of missing a parameter and then
  *       being stumped when a configuration directive doesn't work.
- * 
+ *
  * @todo Reconsider some of the public member variables
  */
 class HTMLPurifier_Config
 {
-    
+
     /**
      * HTML Purifier's version
      */
-    public $version = '3.2.0';
-    
+    public $version = '3.3.0';
+
     /**
-     * Bool indicator whether or not to automatically finalize 
+     * Bool indicator whether or not to automatically finalize
      * the object if a read operation is done
      */
     public $autoFinalize = true;
-    
+
     // protected member variables
-    
+
     /**
      * Namespace indexed array of serials for specific namespaces (see
      * getSerial() for more info).
      */
     protected $serials = array();
-    
+
     /**
      * Serial for entire configuration object
      */
     protected $serial;
-    
-    /**
-     * Two-level associative array of configuration directives
-     */
-    protected $conf;
-    
+
     /**
      * Parser for variables
      */
     protected $parser;
-    
+
     /**
      * Reference HTMLPurifier_ConfigSchema for value checking
      * @note This is public for introspective purposes. Please don't
      *       abuse!
      */
     public $def;
-    
+
     /**
      * Indexed array of definitions
      */
     protected $definitions;
-    
+
     /**
      * Bool indicator whether or not config is finalized
      */
     protected $finalized = false;
-    
+
+    /**
+     * Property list containing configuration directives.
+     */
+    protected $plist;
+
     /**
      * @param $definition HTMLPurifier_ConfigSchema that defines what directives
      *                    are allowed.
      */
     public function __construct($definition) {
-        $this->conf = $definition->defaults; // set up, copy in defaults
-        $this->def  = $definition; // keep a copy around for checking
+        $this->plist = new HTMLPurifier_PropertyList($definition->defaultPlist);
+        $this->def = $definition; // keep a copy around for checking
         $this->parser = new HTMLPurifier_VarParser_Flexible();
     }
-    
+
     /**
      * Convenience constructor that creates a config object based on a mixed var
      * @param mixed $config Variable that defines the state of the config
@@ -101,7 +101,7 @@ class HTMLPurifier_Config
         elseif (is_array($config)) $ret->loadArray($config);
         return $ret;
     }
-    
+
     /**
      * Convenience constructor that creates a default configuration object.
      * @return Default HTMLPurifier_Config object.
@@ -111,14 +111,14 @@ class HTMLPurifier_Config
         $config = new HTMLPurifier_Config($definition);
         return $config;
     }
-    
+
     /**
      * Retreives a value from the configuration.
      * @param $namespace String namespace
      * @param $key String key
      */
     public function get($namespace, $key) {
-        if (!$this->finalized && $this->autoFinalize) $this->finalize();
+        if (!$this->finalized) $this->autoFinalize ? $this->finalize() : $this->plist->squash(true);
         if (!isset($this->def->info[$namespace][$key])) {
             // can't add % due to SimpleTest bug
             trigger_error('Cannot retrieve value of undefined directive ' . htmlspecialchars("$namespace.$key"),
@@ -131,23 +131,24 @@ class HTMLPurifier_Config
                 E_USER_ERROR);
             return;
         }
-        return $this->conf[$namespace][$key];
+        return $this->plist->get("$namespace.$key");
     }
-    
+
     /**
      * Retreives an array of directives to values from a given namespace
      * @param $namespace String namespace
      */
     public function getBatch($namespace) {
-        if (!$this->finalized && $this->autoFinalize) $this->finalize();
+        if (!$this->finalized) $this->autoFinalize ? $this->finalize() : $this->plist->squash(true);
         if (!isset($this->def->info[$namespace])) {
             trigger_error('Cannot retrieve undefined namespace ' . htmlspecialchars($namespace),
                 E_USER_WARNING);
             return;
         }
-        return $this->conf[$namespace];
+        $full = $this->getAll();
+        return $full[$namespace];
     }
-    
+
     /**
      * Returns a md5 signature of a segment of the configuration object
      * that uniquely identifies that particular configuration
@@ -163,7 +164,7 @@ class HTMLPurifier_Config
         }
         return $this->serials[$namespace];
     }
-    
+
     /**
      * Returns a md5 signature for the entire configuration object
      * that uniquely identifies that particular configuration
@@ -174,15 +175,20 @@ class HTMLPurifier_Config
         }
         return $this->serial;
     }
-    
+
     /**
      * Retrieves all directives, organized by namespace
      */
     public function getAll() {
-        if (!$this->finalized && $this->autoFinalize) $this->finalize();
-        return $this->conf;
+        if (!$this->finalized) $this->autoFinalize ? $this->finalize() : $this->plist->squash(true);
+        $ret = array();
+        foreach ($this->plist->squash() as $name => $value) {
+            list($ns, $key) = explode('.', $name, 2);
+            $ret[$ns][$key] = $value;
+        }
+        return $ret;
     }
-    
+
     /**
      * Sets a value to configuration.
      * @param $namespace String namespace
@@ -197,7 +203,7 @@ class HTMLPurifier_Config
             return;
         }
         $def = $this->def->info[$namespace][$key];
-        
+
         if (isset($def->isAlias)) {
             if ($from_alias) {
                 trigger_error('Double-aliases not allowed, please fix '.
@@ -210,7 +216,7 @@ class HTMLPurifier_Config
             trigger_error("$namespace.$key is an alias, preferred directive name is $new_ns.$new_dir", E_USER_NOTICE);
             return;
         }
-        
+
         // Raw type might be negative when using the fully optimized form
         // of stdclass, which indicates allow_null == true
         $rtype = is_int($def) ? $def : $def->type;
@@ -221,7 +227,7 @@ class HTMLPurifier_Config
             $type = $rtype;
             $allow_null = isset($def->allow_null);
         }
-        
+
         try {
             $value = $this->parser->parse($value, $type, $allow_null);
         } catch (HTMLPurifier_VarParserException $e) {
@@ -240,18 +246,18 @@ class HTMLPurifier_Config
                 return;
             }
         }
-        $this->conf[$namespace][$key] = $value;
-        
+        $this->plist->set("$namespace.$key", $value);
+
         // reset definitions if the directives they depend on changed
-        // this is a very costly process, so it's discouraged 
+        // this is a very costly process, so it's discouraged
         // with finalization
         if ($namespace == 'HTML' || $namespace == 'CSS') {
             $this->definitions[$namespace] = null;
         }
-        
+
         $this->serials[$namespace] = false;
     }
-    
+
     /**
      * Convenience function for error reporting
      */
@@ -260,7 +266,7 @@ class HTMLPurifier_Config
         foreach ($lookup as $name => $b) $list[] = $name;
         return implode(', ', $list);
     }
-    
+
     /**
      * Retrieves object reference to the HTML definition.
      * @param $raw Return a copy that has not been setup yet. Must be
@@ -269,7 +275,7 @@ class HTMLPurifier_Config
     public function getHTMLDefinition($raw = false) {
         return $this->getDefinition('HTML', $raw);
     }
-    
+
     /**
      * Retrieves object reference to the CSS definition
      * @param $raw Return a copy that has not been setup yet. Must be
@@ -278,14 +284,14 @@ class HTMLPurifier_Config
     public function getCSSDefinition($raw = false) {
         return $this->getDefinition('CSS', $raw);
     }
-    
+
     /**
      * Retrieves a definition
      * @param $type Type of definition: HTML, CSS, etc
      * @param $raw  Whether or not definition should be returned raw
      */
     public function getDefinition($type, $raw = false) {
-        if (!$this->finalized && $this->autoFinalize) $this->finalize();
+        if (!$this->finalized) $this->autoFinalize ? $this->finalize() : $this->plist->squash(true);
         $factory = HTMLPurifier_DefinitionCacheFactory::instance();
         $cache = $factory->create($type, $this);
         if (!$raw) {
@@ -334,7 +340,7 @@ class HTMLPurifier_Config
         $cache->set($this->definitions[$type], $this);
         return $this->definitions[$type];
     }
-    
+
     /**
      * Loads configuration values from an array with the following structure:
      * Namespace.Directive => Value
@@ -357,7 +363,7 @@ class HTMLPurifier_Config
             }
         }
     }
-    
+
     /**
      * Returns a list of array(namespace, directive) for all directives
      * that are allowed in a web-form context as per an allowed
@@ -401,13 +407,13 @@ class HTMLPurifier_Config
         }
         return $ret;
     }
-    
+
     /**
      * Loads configuration values from $_GET/$_POST that were posted
      * via ConfigForm
      * @param $array $_GET or $_POST array to import
      * @param $index Index/name that the config variables are in
-     * @param $allowed List of allowed namespaces/directives 
+     * @param $allowed List of allowed namespaces/directives
      * @param $mq_fix Boolean whether or not to enable magic quotes fix
      * @param $schema Instance of HTMLPurifier_ConfigSchema to use, if not global copy
      */
@@ -416,7 +422,7 @@ class HTMLPurifier_Config
         $config = HTMLPurifier_Config::create($ret, $schema);
         return $config;
     }
-    
+
     /**
      * Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
      * @note Same parameters as loadArrayFromForm
@@ -425,7 +431,7 @@ class HTMLPurifier_Config
          $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def);
          $this->loadArray($ret);
     }
-    
+
     /**
      * Prepares an array from a form into something usable for the more
      * strict parts of HTMLPurifier_Config
@@ -433,7 +439,7 @@ class HTMLPurifier_Config
     public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) {
         if ($index !== false) $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
         $mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
-        
+
         $allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
         $ret = array();
         foreach ($allowed as $key) {
@@ -449,7 +455,7 @@ class HTMLPurifier_Config
         }
         return $ret;
     }
-    
+
     /**
      * Loads configuration values from an ini file
      * @param $filename Name of ini file
@@ -459,7 +465,7 @@ class HTMLPurifier_Config
         $array = parse_ini_file($filename, true);
         $this->loadArray($array);
     }
-    
+
     /**
      * Checks whether or not the configuration object is finalized.
      * @param $error String error message, or false for no error
@@ -470,7 +476,7 @@ class HTMLPurifier_Config
         }
         return $this->finalized;
     }
-    
+
     /**
      * Finalizes configuration only if auto finalize is on and not
      * already finalized
@@ -478,15 +484,14 @@ class HTMLPurifier_Config
     public function autoFinalize() {
         if (!$this->finalized && $this->autoFinalize) $this->finalize();
     }
-    
+
     /**
      * Finalizes a configuration object, prohibiting further change
      */
     public function finalize() {
         $this->finalized = true;
     }
-    
-}
-
 
+}
 
+// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/HTMLPurifier/ConfigDef.php b/lib/htmlpurifier/HTMLPurifier/ConfigDef.php
deleted file mode 100644 (file)
index fe35e7a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-/**
- * Base class for configuration entity
- */
-abstract class HTMLPurifier_ConfigDef {
-    public $class = false;
-}
-
diff --git a/lib/htmlpurifier/HTMLPurifier/ConfigDef/Directive.php b/lib/htmlpurifier/HTMLPurifier/ConfigDef/Directive.php
deleted file mode 100644 (file)
index cb13291..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * Structure object containing definition of a directive.
- * @note This structure does not contain default values
- */
-class HTMLPurifier_ConfigDef_Directive extends HTMLPurifier_ConfigDef
-{
-    
-    public $class = 'directive';
-    
-    public function __construct(
-        $type = null,
-        $allow_null = null,
-        $allowed = null,
-        $aliases = null
-    ) {
-        if (       $type !== null)        $this->type = $type;
-        if ( $allow_null !== null)  $this->allow_null = $allow_null;
-        if (    $allowed !== null)     $this->allowed = $allowed;
-        if (    $aliases !== null)     $this->aliases = $aliases;
-    }
-    
-    /**
-     * Allowed type of the directive. Values are:
-     *      - string
-     *      - istring (case insensitive string)
-     *      - int
-     *      - float
-     *      - bool
-     *      - lookup (array of value => true)
-     *      - list (regular numbered index array)
-     *      - hash (array of key => value)
-     *      - mixed (anything goes)
-     */
-    public $type = 'mixed';
-    
-    /**
-     * Is null allowed? Has no effect for mixed type.
-     * @bool
-     */
-    public $allow_null = false;
-    
-    /**
-     * Lookup table of allowed values of the element, bool true if all allowed.
-     */
-    public $allowed = true;
-    
-    /**
-     * Hash of value aliases, i.e. values that are equivalent.
-     */
-    public $aliases = array();
-    
-}
-
diff --git a/lib/htmlpurifier/HTMLPurifier/ConfigDef/DirectiveAlias.php b/lib/htmlpurifier/HTMLPurifier/ConfigDef/DirectiveAlias.php
deleted file mode 100644 (file)
index 98b8edd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * Structure object describing a directive alias
- */
-class HTMLPurifier_ConfigDef_DirectiveAlias extends HTMLPurifier_ConfigDef
-{
-    public $class = 'alias';
-    
-    /**
-     * Namespace being aliased to
-     */
-    public $namespace;
-    /**
-     * Directive being aliased to
-     */
-    public $name;
-    
-    public function __construct($namespace, $name) {
-        $this->namespace = $namespace;
-        $this->name = $name;
-    }
-}
-
diff --git a/lib/htmlpurifier/HTMLPurifier/ConfigDef/Namespace.php b/lib/htmlpurifier/HTMLPurifier/ConfigDef/Namespace.php
deleted file mode 100644 (file)
index f282065..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-/**
- * Structure object describing of a namespace
- */
-class HTMLPurifier_ConfigDef_Namespace extends HTMLPurifier_ConfigDef
-{
-    public $class = 'namespace';
-}
-
index b324181ce49ecbd7d07cd0d30bff88f24eacaf43..340ed7dbc67bf571767fc3beede44a1ff6b6882c 100644 (file)
@@ -4,24 +4,29 @@
  * Configuration definition, defines directives and their defaults.
  */
 class HTMLPurifier_ConfigSchema {
-    
+
     /**
      * Defaults of the directives and namespaces.
      * @note This shares the exact same structure as HTMLPurifier_Config::$conf
      */
     public $defaults = array();
-    
+
+    /**
+     * The default property list. Do not edit this property list.
+     */
+    public $defaultPlist;
+
     /**
      * Definition of the directives. The structure of this is:
-     * 
+     *
      *  array(
      *      'Namespace' => array(
      *          'Directive' => new stdclass(),
      *      )
      *  )
-     * 
+     *
      * The stdclass may have the following properties:
-     * 
+     *
      *  - If isAlias isn't set:
      *      - type: Integer type of directive, see HTMLPurifier_VarParser for definitions
      *      - allow_null: If set, this directive allows null values
@@ -30,30 +35,34 @@ class HTMLPurifier_ConfigSchema {
      *  - If isAlias is set:
      *      - namespace: Namespace this directive aliases to
      *      - name: Directive name this directive aliases to
-     * 
+     *
      * In certain degenerate cases, stdclass will actually be an integer. In
      * that case, the value is equivalent to an stdclass with the type
      * property set to the integer. If the integer is negative, type is
      * equal to the absolute value of integer, and allow_null is true.
-     * 
+     *
      * This class is friendly with HTMLPurifier_Config. If you need introspection
      * about the schema, you're better of using the ConfigSchema_Interchange,
      * which uses more memory but has much richer information.
      */
     public $info = array();
-    
+
     /**
      * Application-wide singleton
      */
     static protected $singleton;
-    
+
+    public function __construct() {
+        $this->defaultPlist = new HTMLPurifier_PropertyList();
+    }
+
     /**
      * Unserializes the default ConfigSchema.
      */
     public static function makeFromSerial() {
         return unserialize(file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser'));
     }
-    
+
     /**
      * Retrieves an instance of the application-wide configuration definition.
      */
@@ -65,7 +74,7 @@ class HTMLPurifier_ConfigSchema {
         }
         return HTMLPurifier_ConfigSchema::$singleton;
     }
-    
+
     /**
      * Defines a directive for configuration
      * @warning Will fail of directive's namespace is defined.
@@ -84,8 +93,9 @@ class HTMLPurifier_ConfigSchema {
         if ($allow_null) $obj->allow_null = true;
         $this->info[$namespace][$name] = $obj;
         $this->defaults[$namespace][$name] = $default;
+        $this->defaultPlist->set("$namespace.$name", $default);
     }
-    
+
     /**
      * Defines a namespace for directives to be put into.
      * @warning This is slightly different from the corresponding static
@@ -96,10 +106,10 @@ class HTMLPurifier_ConfigSchema {
         $this->info[$namespace] = array();
         $this->defaults[$namespace] = array();
     }
-    
+
     /**
      * Defines a directive value alias.
-     * 
+     *
      * Directive value aliases are convenient for developers because it lets
      * them set a directive to several values and get the same result.
      * @param $namespace Directive's namespace
@@ -114,7 +124,7 @@ class HTMLPurifier_ConfigSchema {
             $this->info[$namespace][$name]->aliases[$alias] = $real;
         }
     }
-    
+
     /**
      * Defines a set of allowed values for a directive.
      * @warning This is slightly different from the corresponding static
@@ -126,7 +136,7 @@ class HTMLPurifier_ConfigSchema {
     public function addAllowedValues($namespace, $name, $allowed) {
         $this->info[$namespace][$name]->allowed = $allowed;
     }
-    
+
     /**
      * Defines a directive alias for backwards compatibility
      * @param $namespace
@@ -141,7 +151,7 @@ class HTMLPurifier_ConfigSchema {
         $obj->isAlias = true;
         $this->info[$namespace][$name] = $obj;
     }
-    
+
     /**
      * Replaces any stdclass that only has the type property with type integer.
      */
@@ -156,9 +166,9 @@ class HTMLPurifier_ConfigSchema {
             }
         }
     }
-    
+
     // DEPRECATED METHODS
-    
+
     /** @see HTMLPurifier_ConfigSchema->set() */
     public static function define($namespace, $name, $default, $type, $description) {
         HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
@@ -169,21 +179,21 @@ class HTMLPurifier_ConfigSchema {
         $def = HTMLPurifier_ConfigSchema::instance();
         $def->add($namespace, $name, $default, $type, $allow_null);
     }
-    
+
     /** @see HTMLPurifier_ConfigSchema->addNamespace() */
     public static function defineNamespace($namespace, $description) {
         HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
         $def = HTMLPurifier_ConfigSchema::instance();
         $def->addNamespace($namespace);
     }
-    
+
     /** @see HTMLPurifier_ConfigSchema->addValueAliases() */
     public static function defineValueAliases($namespace, $name, $aliases) {
         HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
         $def = HTMLPurifier_ConfigSchema::instance();
         $def->addValueAliases($namespace, $name, $aliases);
     }
-    
+
     /** @see HTMLPurifier_ConfigSchema->addAllowedValues() */
     public static function defineAllowedValues($namespace, $name, $allowed_values) {
         HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
@@ -194,28 +204,28 @@ class HTMLPurifier_ConfigSchema {
         $def = HTMLPurifier_ConfigSchema::instance();
         $def->addAllowedValues($namespace, $name, $allowed);
     }
-    
+
     /** @see HTMLPurifier_ConfigSchema->addAlias() */
     public static function defineAlias($namespace, $name, $new_namespace, $new_name) {
         HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
         $def = HTMLPurifier_ConfigSchema::instance();
         $def->addAlias($namespace, $name, $new_namespace, $new_name);
     }
-    
+
     /** @deprecated, use HTMLPurifier_VarParser->parse() */
     public function validate($a, $b, $c = false) {
         trigger_error("HTMLPurifier_ConfigSchema->validate deprecated, use HTMLPurifier_VarParser->parse instead", E_USER_NOTICE);
         $parser = new HTMLPurifier_VarParser();
         return $parser->parse($a, $b, $c);
     }
-    
+
     /**
      * Throws an E_USER_NOTICE stating that a method is deprecated.
      */
     private static function deprecated($method) {
         trigger_error("Static HTMLPurifier_ConfigSchema::$method deprecated, use add*() method instead", E_USER_NOTICE);
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index 727f58eefabb9cdb0040e5f5317049f3a04e469b..987f547bcaffcc1976517dfd21339ed3ecd4a3ac 100644 (file)
@@ -6,7 +6,7 @@
  */
 class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
 {
-    
+
     public function build($interchange) {
         $schema = new HTMLPurifier_ConfigSchema();
         foreach ($interchange->namespaces as $n) {
@@ -46,5 +46,7 @@ class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
         $schema->postProcess();
         return $schema;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 3c398d667efd52f15f28e2b6381ff2a94a652727..51bcab78cc4951e0c63548bd28890447a40b2e4d 100644 (file)
@@ -6,69 +6,69 @@
  */
 class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
 {
-    
+
     protected $interchange;
-    
+
     protected function writeHTMLDiv($html) {
         $this->startElement('div');
-        
+
         $purifier = HTMLPurifier::getInstance();
         $html = $purifier->purify($html);
         $this->writeAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
         $this->writeRaw($html);
-        
+
         $this->endElement(); // div
     }
-    
+
     protected function export($var) {
         if ($var === array()) return 'array()';
         return var_export($var, true);
     }
-    
+
     public function build($interchange) {
         // global access, only use as last resort
         $this->interchange = $interchange;
-        
+
         $this->setIndent(true);
         $this->startDocument('1.0', 'UTF-8');
         $this->startElement('configdoc');
         $this->writeElement('title', $interchange->name);
-        
+
         foreach ($interchange->namespaces as $namespace) {
             $this->buildNamespace($namespace);
         }
-        
+
         $this->endElement(); // configdoc
         $this->flush();
     }
-    
+
     public function buildNamespace($namespace) {
         $this->startElement('namespace');
         $this->writeAttribute('id', $namespace->namespace);
-        
+
         $this->writeElement('name', $namespace->namespace);
         $this->startElement('description');
             $this->writeHTMLDiv($namespace->description);
         $this->endElement(); // description
-        
+
         foreach ($this->interchange->directives as $directive) {
             if ($directive->id->namespace !== $namespace->namespace) continue;
             $this->buildDirective($directive);
         }
-        
+
         $this->endElement(); // namespace
     }
-    
+
     public function buildDirective($directive) {
         $this->startElement('directive');
         $this->writeAttribute('id', $directive->id->toString());
-        
+
         $this->writeElement('name', $directive->id->directive);
-        
+
         $this->startElement('aliases');
             foreach ($directive->aliases as $alias) $this->writeElement('alias', $alias->toString());
         $this->endElement(); // aliases
-        
+
         $this->startElement('constraints');
             if ($directive->version) $this->writeElement('version', $directive->version);
             $this->startElement('type');
@@ -88,19 +88,21 @@ class HTMLPurifier_ConfigSchema_Builder_Xml extends XMLWriter
                 $this->endElement();
             }
         $this->endElement(); // constraints
-        
+
         if ($directive->deprecatedVersion) {
             $this->startElement('deprecated');
                 $this->writeElement('version', $directive->deprecatedVersion);
                 $this->writeElement('use', $directive->deprecatedUse->toString());
             $this->endElement(); // deprecated
         }
-        
+
         $this->startElement('description');
             $this->writeHTMLDiv($directive->description);
         $this->endElement(); // description
-        
+
         $this->endElement(); // directive
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 4c51d67013a4ea7a55358468f3ab596907346477..2671516c58838b9f225b2e253b5f1a183543c60c 100644 (file)
@@ -5,5 +5,7 @@
  */
 class HTMLPurifier_ConfigSchema_Exception extends HTMLPurifier_Exception
 {
-    
+
 }
+
+// vim: et sw=4 sts=4
index 37a374f0a10b44df4fe12834a4a30e50911278c0..365c66357f55430b11f8220219a6fb9de939e44b 100644 (file)
@@ -7,22 +7,22 @@
  */
 class HTMLPurifier_ConfigSchema_Interchange
 {
-    
+
     /**
      * Name of the application this schema is describing.
      */
     public $name;
-    
+
     /**
      * Array of Namespace ID => array(namespace info)
      */
     public $namespaces = array();
-    
+
     /**
      * Array of Directive ID => array(directive info)
      */
     public $directives = array();
-    
+
     /**
      * Adds a namespace array to $namespaces
      */
@@ -32,7 +32,7 @@ class HTMLPurifier_ConfigSchema_Interchange
         }
         $this->namespaces[$i] = $namespace;
     }
-    
+
     /**
      * Adds a directive array to $directives
      */
@@ -42,7 +42,7 @@ class HTMLPurifier_ConfigSchema_Interchange
         }
         $this->directives[$i] = $directive;
     }
-    
+
     /**
      * Convenience function to perform standard validation. Throws exception
      * on failed validation.
@@ -51,5 +51,7 @@ class HTMLPurifier_ConfigSchema_Interchange
         $validator = new HTMLPurifier_ConfigSchema_Validator();
         return $validator->validate($this);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 5c8c4797ebdf1e819b5b21d0151e6c1e8bb0ddd7..ac8be0d9707d5f33b9012a40641411f25b0b5d2d 100644 (file)
@@ -5,71 +5,73 @@
  */
 class HTMLPurifier_ConfigSchema_Interchange_Directive
 {
-    
+
     /**
      * ID of directive, instance of HTMLPurifier_ConfigSchema_Interchange_Id.
      */
     public $id;
-    
+
     /**
      * String type, e.g. 'integer' or 'istring'.
      */
     public $type;
-    
+
     /**
      * Default value, e.g. 3 or 'DefaultVal'.
      */
     public $default;
-    
+
     /**
      * HTML description.
      */
     public $description;
-    
+
     /**
      * Boolean whether or not null is allowed as a value.
      */
     public $typeAllowsNull = false;
-    
+
     /**
      * Lookup table of allowed scalar values, e.g. array('allowed' => true).
      * Null if all values are allowed.
      */
     public $allowed;
-    
+
     /**
      * List of aliases for the directive,
      * e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))).
      */
     public $aliases = array();
-    
+
     /**
      * Hash of value aliases, e.g. array('alt' => 'real'). Null if value
      * aliasing is disabled (necessary for non-scalar types).
      */
     public $valueAliases;
-    
+
     /**
      * Version of HTML Purifier the directive was introduced, e.g. '1.3.1'.
      * Null if the directive has always existed.
      */
     public $version;
-    
+
     /**
      * ID of directive that supercedes this old directive, is an instance
      * of HTMLPurifier_ConfigSchema_Interchange_Id. Null if not deprecated.
      */
     public $deprecatedUse;
-    
+
     /**
      * Version of HTML Purifier this directive was deprecated. Null if not
      * deprecated.
      */
     public $deprecatedVersion;
-    
+
     /**
      * List of external projects this directive depends on, e.g. array('CSSTidy').
      */
     public $external = array();
-    
+
 }
+
+// vim: et sw=4 sts=4
index 40a5fe3cc505c4560395e798b1cd78fda0fcff18..ec01589b623a1262c28b1b76283873b33d68e8f2 100644 (file)
@@ -5,14 +5,14 @@
  */
 class HTMLPurifier_ConfigSchema_Interchange_Id
 {
-    
+
     public $namespace, $directive;
-    
+
     public function __construct($namespace, $directive) {
         $this->namespace = $namespace;
         $this->directive = $directive;
     }
-    
+
     /**
      * @warning This is NOT magic, to ensure that people don't abuse SPL and
      *          cause problems for PHP 5.0 support.
@@ -20,10 +20,12 @@ class HTMLPurifier_ConfigSchema_Interchange_Id
     public function toString() {
         return $this->namespace . '.' . $this->directive;
     }
-    
+
     public static function make($id) {
         list($namespace, $directive) = explode('.', $id);
         return new HTMLPurifier_ConfigSchema_Interchange_Id($namespace, $directive);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 8fe81581915e8c95e40041ef49d8f3585526c1af..3ffac0a0f4a766cbaca3551d8df6a84179f25430 100644 (file)
@@ -5,15 +5,17 @@
  */
 class HTMLPurifier_ConfigSchema_Interchange_Namespace
 {
-    
+
     /**
      * Name of namespace defined.
      */
     public $namespace;
-    
+
     /**
      * HTML description.
      */
     public $description;
-    
+
 }
+
+// vim: et sw=4 sts=4
index 98a0c9d323bfd6d49061ff08e9e7f364d2885443..a1a24eacbaffa1dd455b31926ea29906e337241b 100644 (file)
@@ -2,25 +2,25 @@
 
 class HTMLPurifier_ConfigSchema_InterchangeBuilder
 {
-    
+
     /**
      * Used for processing DEFAULT, nothing else.
      */
     protected $varParser;
-    
+
     public function __construct($varParser = null) {
         $this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native();
     }
-    
+
     public static function buildFromDirectory($dir = null) {
         $parser      = new HTMLPurifier_StringHashParser();
         $builder     = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
         $interchange = new HTMLPurifier_ConfigSchema_Interchange();
-        
+
         if (!$dir) $dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema/';
         $info = parse_ini_file($dir . 'info.ini');
         $interchange->name = $info['name'];
-        
+
         $files = array();
         $dh = opendir($dir);
         while (false !== ($file = readdir($dh))) {
@@ -30,7 +30,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
             $files[] = $file;
         }
         closedir($dh);
-        
+
         sort($files);
         foreach ($files as $file) {
             $builder->build(
@@ -38,10 +38,10 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
                 new HTMLPurifier_StringHash( $parser->parseFile($dir . $file) )
             );
         }
-        
+
         return $interchange;
     }
-    
+
     /**
      * Builds an interchange object based on a hash.
      * @param $interchange HTMLPurifier_ConfigSchema_Interchange object to build
@@ -61,7 +61,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
         }
         $this->_findUnused($hash);
     }
-    
+
     public function buildNamespace($interchange, $hash) {
         $namespace = new HTMLPurifier_ConfigSchema_Interchange_Namespace();
         $namespace->namespace   = $hash->offsetGet('ID');
@@ -70,14 +70,14 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
         }
         $interchange->addNamespace($namespace);
     }
-    
+
     public function buildDirective($interchange, $hash) {
         $directive = new HTMLPurifier_ConfigSchema_Interchange_Directive();
-        
+
         // These are required elements:
         $directive->id = $this->id($hash->offsetGet('ID'));
         $id = $directive->id->toString(); // convenience
-        
+
         if (isset($hash['TYPE'])) {
             $type = explode('/', $hash->offsetGet('TYPE'));
             if (isset($type[1])) $directive->typeAllowsNull = true;
@@ -85,7 +85,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
         } else {
             throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
         }
-        
+
         if (isset($hash['DEFAULT'])) {
             try {
                 $directive->default = $this->varParser->parse($hash->offsetGet('DEFAULT'), $directive->type, $directive->typeAllowsNull);
@@ -93,19 +93,19 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
                 throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'");
             }
         }
-        
+
         if (isset($hash['DESCRIPTION'])) {
             $directive->description = $hash->offsetGet('DESCRIPTION');
         }
-        
+
         if (isset($hash['ALLOWED'])) {
             $directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED')));
         }
-        
+
         if (isset($hash['VALUE-ALIASES'])) {
             $directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
         }
-        
+
         if (isset($hash['ALIASES'])) {
             $raw_aliases = trim($hash->offsetGet('ALIASES'));
             $aliases = preg_split('/\s*,\s*/', $raw_aliases);
@@ -113,33 +113,33 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
                 $directive->aliases[] = $this->id($alias);
             }
         }
-        
+
         if (isset($hash['VERSION'])) {
             $directive->version = $hash->offsetGet('VERSION');
         }
-        
+
         if (isset($hash['DEPRECATED-USE'])) {
             $directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE'));
         }
-        
+
         if (isset($hash['DEPRECATED-VERSION'])) {
             $directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION');
         }
-        
+
         if (isset($hash['EXTERNAL'])) {
             $directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL')));
         }
-        
+
         $interchange->addDirective($directive);
     }
-    
+
     /**
      * Evaluates an array PHP code string without array() wrapper
      */
     protected function evalArray($contents) {
         return eval('return array('. $contents .');');
     }
-    
+
     /**
      * Converts an array list into a lookup array.
      */
@@ -148,7 +148,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
         foreach ($array as $val) $ret[$val] = true;
         return $ret;
     }
-    
+
     /**
      * Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id
      * object based on a string Id.
@@ -156,7 +156,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
     protected function id($id) {
         return HTMLPurifier_ConfigSchema_Interchange_Id::make($id);
     }
-    
+
     /**
      * Triggers errors for any unused keys passed in the hash; such keys
      * may indicate typos, missing values, etc.
@@ -170,6 +170,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
             }
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 64a35430da6b8a29b161d419c3132ce4c13a4f43..2dfd37baed8bc9809883a753fc38b76d678f8dd2 100644 (file)
  */
 class HTMLPurifier_ConfigSchema_Validator
 {
-    
+
     /**
      * Easy to access global objects.
      */
     protected $interchange, $aliases;
-    
+
     /**
      * Context-stack to provide easy to read error messages.
      */
     protected $context = array();
-    
+
     /**
      * HTMLPurifier_VarParser to test default's type.
      */
     protected $parser;
-    
+
     public function __construct() {
         $this->parser = new HTMLPurifier_VarParser();
     }
-    
+
     /**
      * Validates a fully-formed interchange object. Throws an
      * HTMLPurifier_ConfigSchema_Exception if there's a problem.
@@ -50,7 +50,7 @@ class HTMLPurifier_ConfigSchema_Validator
         }
         return true;
     }
-    
+
     /**
      * Validates a HTMLPurifier_ConfigSchema_Interchange_Namespace object.
      */
@@ -64,7 +64,7 @@ class HTMLPurifier_ConfigSchema_Validator
             ->assertIsString(); // handled by InterchangeBuilder
         array_pop($this->context);
     }
-    
+
     /**
      * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
      */
@@ -83,7 +83,7 @@ class HTMLPurifier_ConfigSchema_Validator
             ->assertAlnum(); // implicit assertIsString handled by InterchangeBuilder
         array_pop($this->context);
     }
-    
+
     /**
      * Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
      */
@@ -91,10 +91,10 @@ class HTMLPurifier_ConfigSchema_Validator
         $id = $d->id->toString();
         $this->context[] = "directive '$id'";
         $this->validateId($d->id);
-        
+
         $this->with($d, 'description')
             ->assertNotEmpty();
-        
+
         // BEGIN - handled by InterchangeBuilder
         $this->with($d, 'type')
             ->assertNotEmpty();
@@ -107,7 +107,7 @@ class HTMLPurifier_ConfigSchema_Validator
             $this->error('default', 'had error: ' . $e->getMessage());
         }
         // END - handled by InterchangeBuilder
-        
+
         if (!is_null($d->allowed) || !empty($d->valueAliases)) {
             // allowed and valueAliases require that we be dealing with
             // strings, so check for that early.
@@ -116,14 +116,14 @@ class HTMLPurifier_ConfigSchema_Validator
                 $this->error('type', 'must be a string type when used with allowed or value aliases');
             }
         }
-        
+
         $this->validateDirectiveAllowed($d);
         $this->validateDirectiveValueAliases($d);
         $this->validateDirectiveAliases($d);
-        
+
         array_pop($this->context);
     }
-    
+
     /**
      * Extra validation if $allowed member variable of
      * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
@@ -142,7 +142,7 @@ class HTMLPurifier_ConfigSchema_Validator
         }
         array_pop($this->context);
     }
-    
+
     /**
      * Extra validation if $valueAliases member variable of
      * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
@@ -170,7 +170,7 @@ class HTMLPurifier_ConfigSchema_Validator
         }
         array_pop($this->context);
     }
-    
+
     /**
      * Extra validation if $aliases member variable of
      * HTMLPurifier_ConfigSchema_Interchange_Directive is defined.
@@ -193,9 +193,9 @@ class HTMLPurifier_ConfigSchema_Validator
         }
         array_pop($this->context);
     }
-    
+
     // protected helper functions
-    
+
     /**
      * Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom
      * for validating simple member variables of objects.
@@ -203,7 +203,7 @@ class HTMLPurifier_ConfigSchema_Validator
     protected function with($obj, $member) {
         return new HTMLPurifier_ConfigSchema_ValidatorAtom($this->getFormattedContext(), $obj, $member);
     }
-    
+
     /**
      * Emits an error, providing helpful context.
      */
@@ -212,12 +212,14 @@ class HTMLPurifier_ConfigSchema_Validator
         else $prefix = ucfirst($this->getFormattedContext());
         throw new HTMLPurifier_ConfigSchema_Exception(trim($prefix . ' ' . $msg));
     }
-    
+
     /**
      * Returns a formatted context string.
      */
     protected function getFormattedContext() {
         return implode(' in ', array_reverse($this->context));
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 2bb9967611b314bd1255b2c118939a00e1bc781e..b95aea18cc72f04f6675b92d66d62c8a67efe8f5 100644 (file)
@@ -8,47 +8,47 @@
  */
 class HTMLPurifier_ConfigSchema_ValidatorAtom
 {
-    
+
     protected $context, $obj, $member, $contents;
-    
+
     public function __construct($context, $obj, $member) {
         $this->context     = $context;
         $this->obj         = $obj;
         $this->member      = $member;
         $this->contents    =& $obj->$member;
     }
-    
+
     public function assertIsString() {
         if (!is_string($this->contents)) $this->error('must be a string');
         return $this;
     }
-    
+
     public function assertIsBool() {
         if (!is_bool($this->contents)) $this->error('must be a boolean');
         return $this;
     }
-    
+
     public function assertIsArray() {
         if (!is_array($this->contents)) $this->error('must be an array');
         return $this;
     }
-    
+
     public function assertNotNull() {
         if ($this->contents === null) $this->error('must not be null');
         return $this;
     }
-    
+
     public function assertAlnum() {
         $this->assertIsString();
         if (!ctype_alnum($this->contents)) $this->error('must be alphanumeric');
         return $this;
     }
-    
+
     public function assertNotEmpty() {
         if (empty($this->contents)) $this->error('must not be empty');
         return $this;
     }
-    
+
     public function assertIsLookup() {
         $this->assertIsArray();
         foreach ($this->contents as $v) {
@@ -56,11 +56,11 @@ class HTMLPurifier_ConfigSchema_ValidatorAtom
         }
         return $this;
     }
-    
+
     protected function error($msg) {
         throw new HTMLPurifier_ConfigSchema_Exception(ucfirst($this->member) . ' in ' . $this->context . ' ' . $msg);
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index 1ac5ff691eb70c078010f273ba80ef8619bb2034..1eaecd11f856504cde09c1b302c7c1cfd65ec00b 100644 (file)
Binary files a/lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema.ser and b/lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema.ser differ
index e1d82cf9005d141935081cfa23ae268b3e0ad2b9..249edd647b0f3a05e1e166145a30d35e27c7bb1a 100644 (file)
@@ -9,3 +9,4 @@ W3C's recommendation. XHTML 1.0 Strict does not permit the target attribute
 so this directive will have no effect in that doctype. XHTML 1.1 does not
 enable the Target module by default, you will have to manually enable it
 (see the module documentation for more details.)
+--# vim: et sw=4 sts=4
index e9f3febe689424d3de3bf3524f53438ffb4c945e..9a8fa6a2e202c1f32eee1503293f1460cb8e2e1b 100644 (file)
@@ -5,4 +5,5 @@ DEFAULT: array()
 --DESCRIPTION--
 List of allowed forward document relationships in the rel attribute. Common
 values may be nofollow or print. By default, this is empty, meaning that no
-document relationships are allowed. 
+document relationships are allowed.
+--# vim: et sw=4 sts=4
index 95cc372e1b78d47431e7574865f1d936bf6f7345..b017883485953fa1bb6fa31e21e2f284a34d9baa 100644 (file)
@@ -5,4 +5,5 @@ DEFAULT: array()
 --DESCRIPTION--
 List of allowed reverse document relationships in the rev attribute. This
 attribute is a bit of an edge-case; if you don't know what it is for, stay
-away. 
+away.
+--# vim: et sw=4 sts=4
index e0be51be86d12a5543f105a6b347e473ec603a46..533165e17590060510a5e0f8046df8b78234fb74 100644 (file)
@@ -1,9 +1,11 @@
 Attr.DefaultImageAlt
 TYPE: string/null
 DEFAULT: null
+VERSION: 3.2.0
 --DESCRIPTION--
 This is the content of the alt tag of an image if the user had not
 previously specified an alt attribute.  This applies to all images without
 a valid alt attribute, as opposed to %Attr.DefaultInvalidImageAlt, which
 only applies to invalid images, and overrides in the case of an invalid image.
 Default behavior with null is to use the basename of the src tag for the alt.
+--# vim: et sw=4 sts=4
index ebd15275efbe22b23d8a0ac8d683a115fb08cdd3..9eb7e38469f0c94ba880396a89ddf9da483005f2 100644 (file)
@@ -6,3 +6,4 @@ This is the default image an img tag will be pointed to if it does not have
 a valid src attribute.  In future versions, we may allow the image tag to
 be removed completely, but due to design issues, this is not possible right
 now.
+--# vim: et sw=4 sts=4
index 883e12e4142c672aa7b6da34fcc0f52aed320e93..2f17bf477a3dd2643fc3494b4926cc388fa287c2 100644 (file)
@@ -5,3 +5,4 @@ DEFAULT: 'Invalid image'
 This is the content of the alt tag of an invalid image if the user had not
 previously specified an alt attribute.  It has no effect when the image is
 valid but there was no alt attribute present.
+--# vim: et sw=4 sts=4
index f138c991b9bd63a4c9a665ee27b43a465d29e1f8..52654b53ae315bfbe70103acc2129487f8176c56 100644 (file)
@@ -7,3 +7,4 @@ parsed.  This generally is the same as the value of the dir attribute in
 HTML, or ltr if that is not specified.
 --ALLOWED--
 'ltr', 'rtl'
+--# vim: et sw=4 sts=4
index 8803e01f98d8265a91b434f950d71d2d80145109..6440d210321ade5b9bdb529c1b88060316304974 100644 (file)
@@ -13,3 +13,4 @@ you use (%Attr.IDBlacklist) or prefixing all user supplied IDs
 pre-1.2.0 versions.
 --ALIASES--
 HTML.EnableAttrID
+--# vim: et sw=4 sts=4
index 7ab584440b90ce882996ec71aa250e4674bc0839..5f2b5e3d2cda09d577272888aa2f3458e942009a 100644 (file)
@@ -2,3 +2,4 @@ Attr.IDBlacklist
 TYPE: list
 DEFAULT: array()
 DESCRIPTION: Array of IDs not allowed in the document.
+--# vim: et sw=4 sts=4
index 08a74a0a46e2cdee103c3c31ca76eecf131d6b09..6f5824586ec4f37cabe8afefe5c372bb0c39f295 100644 (file)
@@ -5,4 +5,5 @@ DEFAULT: NULL
 --DESCRIPTION--
 PCRE regular expression to be matched against all IDs. If the expression is
 matches, the ID is rejected. Use this with care: may cause significant
-degradation. ID matching is done after all other validation. 
+degradation. ID matching is done after all other validation.
+--# vim: et sw=4 sts=4
index 362aa2424cb626cab63b110180a3bd85df2a0ff3..cc49d43fd0c68abab6877d5a30f0251ed7dcb8b0 100644 (file)
@@ -8,4 +8,5 @@ you may opt to simply add a prefix to all user-submitted ID attributes so
 that they are still usable, but will not conflict with core page IDs.
 Example: setting the directive to 'user_' will result in a user submitted
 'foo' to become 'user_foo'  Be sure to set %HTML.EnableAttrID to true
-before using this.  
+before using this.
+--# vim: et sw=4 sts=4
index b4f6b315b2d00fb61873f9a86b19fd8861d93ccd..2c5924a7ade81d45386a280a40b2721c93299731 100644 (file)
@@ -10,4 +10,5 @@ seperately submitted user content displayed on the same page doesn't
 clobber each other. Ideal values are unique identifiers for the content it
 represents (i.e. the id of the row in the database). Be sure to add a
 seperator (like an underscore) at the end.  Warning: this directive will
-not work unless %Attr.IDPrefix is set to a non-empty value! 
+not work unless %Attr.IDPrefix is set to a non-empty value!
+--# vim: et sw=4 sts=4
index de0591d37d67d7fa84cc51e6c55f996285d7e155..2d72049d64f6dc7de6123d5f7417864905fbdc74 100644 (file)
@@ -1,2 +1,3 @@
 Attr
 DESCRIPTION: Features regarding attribute validation.
+--# vim: et sw=4 sts=4
index 1548c1f22db39c31001d6d7b0f0685573b34c009..d5caa1bb978b2e9368074dd9fb46c1842347a3ca 100644 (file)
@@ -28,3 +28,4 @@ DEFAULT: false
   in <code>div</code> tags (the behavior is slightly different outside of
   the root node.)
 </p>
+--# vim: et sw=4 sts=4
index a8bd4eb116c8ed54542101dcd9a941af0c240ec5..2a476481af6c1030ddf13c2df1c78a4aafb8960a 100644 (file)
@@ -7,6 +7,6 @@ DEFAULT: array()
 <p>
   This directive can be used to add custom auto-format injectors.
   Specify an array of injector names (class name minus the prefix)
-  or concrete implementations. Injector class must exist. 
+  or concrete implementations. Injector class must exist.
 </p>
-
+--# vim: et sw=4 sts=4
index 28a157ed48afbeafbf87aa52aef43708907d510f..663064a3447ba4155f9ed52e18786a58f4ce1689 100644 (file)
@@ -8,3 +8,4 @@ DEFAULT: false
   those links. For example, <a href="http://example.com">example</a> becomes
   example (<a>http://example.com</a>).
 </p>
+--# vim: et sw=4 sts=4
index 6c1cd7b671352be3a2c6bcc235f74dd53d31f3d2..3a48ba960e934877c00f4844eb248df416ecb6b9 100644 (file)
@@ -7,6 +7,6 @@ DEFAULT: false
 <p>
   This directive turns on linkification, auto-linking http, ftp and
   https URLs. <code>a</code> tags with the <code>href</code> attribute
-  must be allowed. 
+  must be allowed.
 </p>
-
+--# vim: et sw=4 sts=4
index cd7f0b8eb4a4edb35b2069658e4d05e271fcfdb0..7996488be0d0f94896da45b86db8944e900aeb31 100644 (file)
@@ -9,4 +9,4 @@ DEFAULT: false
   syntax <a>%Namespace.Directive</a> to links. <code>a</code> tags
   with the <code>href</code> attribute must be allowed.
 </p>
-
+--# vim: et sw=4 sts=4
index 9edf0d62565e211c747d84e9cfa95b4d10f96656..aaede47d62ffdd9c8d3b147b897b3e8283b927d6 100644 (file)
@@ -42,3 +42,4 @@ DEFAULT: false
   if a tag looked empty on the way end, it will get removed; if HTML Purifier
   made it empty, it will stay.
 </p>
+--# vim: et sw=4 sts=4
index c63fb699858e024e30177eb2362e1cb9fa9b1b02..161a52ef4820966d024ee94bbe16553bf398dae1 100644 (file)
@@ -1,2 +1,3 @@
 AutoFormat
 DESCRIPTION: Configuration for activating auto-formatting functionality (also known as <code>Injector</code>s)
+--# vim: et sw=4 sts=4
index 11d3b4e132f89d63861bd41181531418dda91f1d..3e8309e39e2b9832b2777f63ec9049ad0e3b961b 100644 (file)
@@ -7,6 +7,6 @@ DEFAULT: '#%s'
 <p>
   Location of configuration documentation to link to, let %s substitute
   into the configuration's namespace and directive names sans the percent
-  sign. 
+  sign.
 </p>
-
+--# vim: et sw=4 sts=4
index 95bffcd88faeae68599e992fd19b488a8c84ead4..6097a557e784a852df2c56e73300819f729b40e4 100644 (file)
@@ -1,2 +1,3 @@
 AutoFormatParam
 DESCRIPTION: Configuration for customizing auto-formatting functionality
+--# vim: et sw=4 sts=4
index 68fcde1bc8acd190ae5b52c8d5f7d9aaf66be07b..b324608f761c2d4f116576993beaefdef23fd237 100644 (file)
@@ -5,3 +5,4 @@ VERSION: 3.1.0
 --DESCRIPTION--
 This parameter determines whether or not !important cascade modifiers should
 be allowed in user CSS. If false, !important will stripped.
+--# vim: et sw=4 sts=4
index 1b4f524b115fc613986bae723df300d1be538ec5..748be0eec8bee195ccfd3cbcbfa662ea76db9615 100644 (file)
@@ -8,3 +8,4 @@ values. Tricky CSS properties/values can drastically modify page layout or
 be used for deceptive practices but do not directly constitute a security risk.
 For example, <code>display:none;</code> is considered a tricky property that
 will only be allowed if this directive is set to true.
+--# vim: et sw=4 sts=4
index b06689745ac90d6290293535bf5abf5b13e3eec1..460112ebe0ae49eff6c6514d1cd4461301117ebe 100644 (file)
@@ -5,13 +5,14 @@ DEFAULT: NULL
 --DESCRIPTION--
 
 <p>
-    If HTML Purifier's style attributes set is unsatisfactory for your needs, 
-    you can overload it with your own list of tags to allow.  Note that this 
-    method is subtractive: it does its job by taking away from HTML Purifier 
-    usual feature set, so you cannot add an attribute that HTML Purifier never 
+    If HTML Purifier's style attributes set is unsatisfactory for your needs,
+    you can overload it with your own list of tags to allow.  Note that this
+    method is subtractive: it does its job by taking away from HTML Purifier
+    usual feature set, so you cannot add an attribute that HTML Purifier never
     supported in the first place.
 </p>
 <p>
-    <strong>Warning:</strong> If another directive conflicts with the 
-    elements here, <em>that</em> directive will win and override. 
+    <strong>Warning:</strong> If another directive conflicts with the
+    elements here, <em>that</em> directive will win and override.
 </p>
+--# vim: et sw=4 sts=4
index 5b40de2a054650a86048d8641c9784001a76f4d1..5cb7dda3baea51be40f06bbc3d60e8eb97f333e7 100644 (file)
@@ -6,6 +6,6 @@ DEFAULT: 1
 
 <p>
     Revision identifier for your custom definition. See
-    %HTML.DefinitionRev for details. 
+    %HTML.DefinitionRev for details.
 </p>
-
+--# vim: et sw=4 sts=4
index 824111e74fbf5a94e14679b3750aa1d9fa3ff16a..7a3291470ccb798f1590a24bd58fe082c29e7900 100644 (file)
@@ -13,3 +13,4 @@ VERSION: 3.1.1
  subtle differences in the input format (the CSS max is a number with
  a unit).
 </p>
+--# vim: et sw=4 sts=4
index cc883dc57896f3780002cd94f9d040c1f6c71a9f..148eedb8be29e951f5ad92075d83a4b5d85f7456 100644 (file)
@@ -5,6 +5,6 @@ DEFAULT: false
 --DESCRIPTION--
 
 <p>
-    Whether or not to allow safe, proprietary CSS values. 
+    Whether or not to allow safe, proprietary CSS values.
 </p>
-
+--# vim: et sw=4 sts=4
index 8bafc4b3c8674fa29f2a3243e1a7fefbe6671be8..d14b490933945d411ad1d54fefa468215396d7f5 100644 (file)
@@ -1,2 +1,3 @@
 CSS
 DESCRIPTION: Configuration regarding allowed CSS.
+--# vim: et sw=4 sts=4
index 192db1f9e69fa1cff09902c4cd964b14b89fec66..c486724c88ae49e875f802b0eaf0c079c4003df7 100644 (file)
@@ -7,7 +7,8 @@ DEFAULT: 'Serializer'
 This directive defines which method to use when caching definitions,
 the complex data-type that makes HTML Purifier tick. Set to null
 to disable caching (not recommended, as you will see a definite
-performance degradation). 
+performance degradation).
 
 --ALIASES--
 Core.DefinitionCache
+--# vim: et sw=4 sts=4
index 600c567ecfb8a0b900b142fcca1748ced4aeb3c6..54036507d6ce240dff64f2d7009a2440d86c98f2 100644 (file)
@@ -8,6 +8,6 @@ DEFAULT: NULL
     Absolute path with no trailing slash to store serialized definitions in.
     Default is within the
     HTML Purifier library inside DefinitionCache/Serializer. This
-    path must be writable by the webserver. 
+    path must be writable by the webserver.
 </p>
-
+--# vim: et sw=4 sts=4
index 6edaae0c4788337ff279289e708f232b331cd877..57f30239a04bbe34082caf09226a26a9e05df353 100644 (file)
@@ -1,2 +1,3 @@
 Cache
 DESCRIPTION: Configuration for DefinitionCache and related subclasses.
+--# vim: et sw=4 sts=4
index 7fdca4924a0ed73de66f42cb08aac373649db137..568cbf3b32823326c2b662aba0fe43bbf993944c 100644 (file)
@@ -14,4 +14,5 @@ DEFAULT: true
 <p>
     <strong>Notice:</strong> This directive's default turned from false to true
     in HTML Purifier 3.2.0.
-</p>
\ No newline at end of file
+</p>
+--# vim: et sw=4 sts=4
index ccaf2ae3d9d67eb03166c43c774ea0f284722a6f..d7317911fa30e3ee87456d6ff669f1d872654ae7 100644 (file)
@@ -8,4 +8,5 @@ Whether or not to collect errors found while filtering the document. This
 is a useful way to give feedback to your users. <strong>Warning:</strong>
 Currently this feature is very patchy and experimental, with lots of
 possible error messages not yet implemented. It will not cause any
-problems, but it may not help your users either. 
+problems, but it may not help your users either.
+--# vim: et sw=4 sts=4
index 6ec36dbbcd298a2207829129145670088e9ab30a..08b381d34c1aeb49f55293decbe18588826d95e9 100644 (file)
@@ -25,5 +25,4 @@ array (
 
 Lookup array of color names to six digit hexadecimal number corresponding
 to color, with preceding hash mark. Used when parsing colors.
-
-
+--# vim: et sw=4 sts=4
index 3f832c104679c076995a60ccc1cbd327e1494df1..64b114fce2b108f426835b2f69281494e52b312d 100644 (file)
@@ -11,3 +11,4 @@ processing is not necessary.
 
 --ALIASES--
 Core.AcceptFullDocuments
+--# vim: et sw=4 sts=4
index 1ecc663787a1d9ca4e74fbafae33cecef58bfb62..36f16e07eaefe31bfc8814b1f6dcafeba6dbcaac 100644 (file)
@@ -12,6 +12,6 @@ DEFAULT: 0
   performance, and this is only strictly necessary if the counting
   algorithm is buggy (in which case you should report it as a bug).
   This has no effect when %Core.MaintainLineNumbers is disabled or DirectLex is
-  not being used. 
+  not being used.
 </p>
-
+--# vim: et sw=4 sts=4
index ab75dbd99565bf3cae4b323ec61d8d28c44df792..8bfb47c3ac1c97a0f11bec501d4f5b6c60d4434a 100644 (file)
@@ -12,3 +12,4 @@ entities), making it pretty useless for anything except the most I18N-blind
 applications, although %Core.EscapeNonASCIICharacters offers fixes this
 trouble with another tradeoff. This directive only accepts ISO-8859-1 if
 iconv is not enabled.
+--# vim: et sw=4 sts=4
index 554d6a249b4da739e06b11294cf8608357ca5c36..4d5b5055cd31d2f611125f8a0c52aec91ed79eb2 100644 (file)
@@ -7,3 +7,4 @@ parent element will be transformed into text as if it were ASCII. When
 false, that element and all internal tags will be dropped, though text will
 be preserved.  There is no option for dropping the element but preserving
 child nodes.
+--# vim: et sw=4 sts=4
index 779a573ecef2e41289b6f619deadddb4abb860fc..a7a5b249bb71bc7623d67ffb69e5dadc43f959aa 100644 (file)
@@ -4,3 +4,4 @@ DEFAULT: false
 --DESCRIPTION--
 When true, invalid tags will be written back to the document as plain text.
 Otherwise, they are silently dropped.
+--# vim: et sw=4 sts=4
index 93b8a4b203799c27876b6e7f72d315e68646346b..abb499948aca3b2402794f9b2709c8074ede5a00 100644 (file)
@@ -9,4 +9,5 @@ converting it to its native encoding. This means that even characters that
 can be expressed in the non-UTF-8 encoding will be entity-ized, which can
 be a real downer for encodings like Big5. It also assumes that the ASCII
 repetoire is available, although this is the case for almost all encodings.
-Anyway, use UTF-8! 
+Anyway, use UTF-8!
+--# vim: et sw=4 sts=4
index f317221c8bf55f50e9a19ba5cc4ba3a5abebb447..915391edb73fc1c3f573666ff436f6db6a149673 100644 (file)
@@ -10,10 +10,10 @@ array (
 <p>
   This directive is a lookup array of elements which should have their
   contents removed when they are not allowed by the HTML definition.
-  For example, the contents of a <code>script</code> tag are not 
+  For example, the contents of a <code>script</code> tag are not
   normally shown in a document, so if script tags are to be removed,
   their contents should be removed to. This is opposed to a <code>b</code>
   tag, which defines some presentational changes but does not hide its
   contents.
 </p>
-
+--# vim: et sw=4 sts=4
index 38d7e661de42b6cc95277347df299daf1eb4329f..233fca14f84b2020e0b8c83152d7c3bc83070ffc 100644 (file)
@@ -7,5 +7,4 @@ DEFAULT: 'en'
 ISO 639 language code for localizable things in HTML Purifier to use,
 which is mainly error reporting. There is currently only an English (en)
 translation, so this directive is currently useless.
-
-
+--# vim: et sw=4 sts=4
index c32a6f6517c991ddaa1ec4c6136118237e1b1d4c..8983e2cca9b3a9863e87c021d980f55440de0c8c 100644 (file)
@@ -31,3 +31,4 @@ implementation)
     to use it.
   </dd>
 </dl>
+--# vim: et sw=4 sts=4
index 00fa755020f439ee1f46bb3c2719aaa124316e6c..eb841a7597a0ab16913ca8396461692f936c0944 100644 (file)
@@ -9,8 +9,8 @@ DEFAULT: NULL
   This is useful when error reporting is turned on, but can result in
   significant performance degradation and should not be used when
   unnecessary. This directive must be used with the DirectLex lexer,
-  as the DOMLex lexer does not (yet) support this functionality. 
+  as the DOMLex lexer does not (yet) support this functionality.
   If the value is null, an appropriate value will be selected based
-  on other configuration. 
+  on other configuration.
 </p>
-
+--# vim: et sw=4 sts=4
index 3b5c8fd0cd55717c49b929e0ccf53f9c96b2a931..4070c2a0de20439361abcc5446c8fe0c072d2346 100644 (file)
@@ -5,8 +5,8 @@ VERSION: 1.3.0
 --DESCRIPTION--
 
 <p>
-  This directive enables pre-emptive URI checking in <code>img</code> 
-  tags, as the attribute validation strategy is not authorized to 
+  This directive enables pre-emptive URI checking in <code>img</code>
+  tags, as the attribute validation strategy is not authorized to
   remove elements from the document. Revert to pre-1.3.0 behavior by setting to false.
 </p>
-
+--# vim: et sw=4 sts=4
index 1d0e9779efa8d1ce032abf4e8449c635c5f7ceb1..a4cd966df89aa5f5ec80eff45e00e5fffb079b2f 100644 (file)
@@ -9,3 +9,4 @@ DEPRECATED-USE: Core.HiddenElements
   This directive enables HTML Purifier to remove not only script tags
   but all of their contents.
 </p>
+--# vim: et sw=4 sts=4
index 296982a5df1536506d78af6c63ae582348b2b47f..5edfe078635759d2d955cbdc819792bc27bab133 100644 (file)
@@ -1,2 +1,3 @@
 Core
 DESCRIPTION: Core features that are always available.
+--# vim: et sw=4 sts=4
index 83d9ebc2105aa73f92801c7c897e566297736d91..3db50ef204b4fc5d57e7757b6316774aa6c214f1 100644 (file)
@@ -8,3 +8,4 @@ DEFAULT: array()
   equivalent of the now deprecated <code>HTMLPurifier-&gt;addFilter()</code>
   method. Specify an array of concrete implementations.
 </p>
+--# vim: et sw=4 sts=4
index aaa741635169e1cf8356a7983e54649efba2df02..078d087417e2e5510d3d193704da98493bc5e89e 100644 (file)
@@ -27,15 +27,15 @@ EXTERNAL: CSSTidy
 <?php
     require_once '/path/to/library/HTMLPurifier.auto.php';
     require_once '/path/to/csstidy.class.php';
-    
+
     $dirty = '<style>body {color:#F00;}</style> Some text';
 
     $config = HTMLPurifier_Config::createDefault();
     $config->set('Filter', 'ExtractStyleBlocks', true);
     $purifier = new HTMLPurifier($config);
-    
+
     $html = $purifier->purify($dirty);
-    
+
     // This implementation writes the stylesheets to the styles/ directory.
     // You can also echo the styles inside the document, but it's a bit
     // more difficult to make sure they get interpreted properly by
@@ -71,3 +71,4 @@ EXTERNAL: CSSTidy
   height (somewhat reasonable). Whether or not these measures should be
   used is left to the reader.
 </p>
+--# vim: et sw=4 sts=4
index cbdc0068ca14aedc194bf2991c65c490d075d268..7fa6536b2c70f4b2593bb5ab8d32e57cce560194 100644 (file)
@@ -8,3 +8,4 @@ DEFAULT: false
   <a href="http://htmlpurifier.org/docs/enduser-youtube.html">this document
   on embedding videos</a> for more information on what this filter does.
 </p>
+--# vim: et sw=4 sts=4
index cf5f89cdc0e34ac52cee1fbaa1d4b903c4cdf045..f2d25a1b26d369695a70a55fbc07e80f18f9b761 100644 (file)
@@ -1,2 +1,3 @@
 Filter
 DESCRIPTION: Directives for turning filters on and off, or specifying custom filters.
+--# vim: et sw=4 sts=4
index 96ac5e5d1c4446eff9eb0ec5c0a32870e88533e6..d436ed015800084bc97a3b2d29aabfe78793c5e7 100644 (file)
@@ -9,6 +9,6 @@ ALIASES: Filter.ExtractStyleBlocksEscaping
   Whether or not to escape the dangerous characters &lt;, &gt; and &amp;
   as \3C, \3E and \26, respectively. This is can be safely set to false
   if the contents of StyleBlocks will be placed in an external stylesheet,
-  where there is no risk of it being interpreted as HTML. 
+  where there is no risk of it being interpreted as HTML.
 </p>
-
+--# vim: et sw=4 sts=4
index 366df44563460c384308cd090395d73e94e40f33..3943529c7b09f61c7f3b9161276bc84d9af5ddd9 100644 (file)
@@ -26,3 +26,4 @@ ALIASES: Filter.ExtractStyleBlocksScope
   Purifier, and I am working to get it fixed. Until then, HTML Purifier
   performs a basic check to prevent this.
 </p>
+--# vim: et sw=4 sts=4
index 78e69cbb5e7c5f56e15b3e4dd9012fe7d934fece..cafccf8b53cc220933587e1bbca05d80ca6e89fb 100644 (file)
@@ -12,3 +12,4 @@ DEFAULT: NULL
   disable cleaning. In addition, you can supply your own concrete implementation
   of Tidy's interface to use, although I don't know why you'd want to do that.
 </p>
+--# vim: et sw=4 sts=4
index 8e2bbe7c3def6d4542370f7a15f7ae59cb887ad8..dff9784b129ab7f2bb97c8f15cf777f54f8696e6 100644 (file)
@@ -1,2 +1,3 @@
 FilterParam
 DESCRIPTION: Configuration for filters.
+--# vim: et sw=4 sts=4
index 5fcd12441c52649e1d577ebbe07511df36b7c755..3e231d2d16a5c9ee671f98f618263df48f8223a2 100644 (file)
@@ -19,4 +19,4 @@ DEFAULT: NULL
     broken whitelists. If %HTML.AllowedElements or %HTML.AllowedAttributes
     are set, this directive has no effect.
 </p>
-
+--# vim: et sw=4 sts=4
index 88e696e8121b711f929f12c86739879116cc36c3..fcf093f17d1fbda44affba011425726b7257357a 100644 (file)
@@ -5,15 +5,15 @@ DEFAULT: NULL
 --DESCRIPTION--
 
 <p>
-    If HTML Purifier's attribute set is unsatisfactory, overload it! 
-    The syntax is "tag.attr" or "*.attr" for the global attributes 
+    If HTML Purifier's attribute set is unsatisfactory, overload it!
+    The syntax is "tag.attr" or "*.attr" for the global attributes
     (style, id, class, dir, lang, xml:lang).
 </p>
 <p>
-    <strong>Warning:</strong> If another directive conflicts with the 
-    elements here, <em>that</em> directive will win and override. For 
-    example, %HTML.EnableAttrID will take precedence over *.id in this 
-    directive.  You must set that directive to true before you can use 
-    IDs at all. 
+    <strong>Warning:</strong> If another directive conflicts with the
+    elements here, <em>that</em> directive will win and override. For
+    example, %HTML.EnableAttrID will take precedence over *.id in this
+    directive.  You must set that directive to true before you can use
+    IDs at all.
 </p>
-
+--# vim: et sw=4 sts=4
index b667b3da8b05688d7c6fdfb7d612fd5e3db68a50..888d55819690d49ef5d1776b07f44413b185c277 100644 (file)
@@ -4,15 +4,15 @@ VERSION: 1.3.0
 DEFAULT: NULL
 --DESCRIPTION--
 <p>
-    If HTML Purifier's tag set is unsatisfactory for your needs, you 
-    can overload it with your own list of tags to allow.  Note that this 
-    method is subtractive: it does its job by taking away from HTML Purifier 
-    usual feature set, so you cannot add a tag that HTML Purifier never 
-    supported in the first place (like embed, form or head).  If you 
+    If HTML Purifier's tag set is unsatisfactory for your needs, you
+    can overload it with your own list of tags to allow.  Note that this
+    method is subtractive: it does its job by taking away from HTML Purifier
+    usual feature set, so you cannot add a tag that HTML Purifier never
+    supported in the first place (like embed, form or head).  If you
     change this, you probably also want to change %HTML.AllowedAttributes.
 </p>
 <p>
-    <strong>Warning:</strong> If another directive conflicts with the 
-    elements here, <em>that</em> directive will win and override. 
+    <strong>Warning:</strong> If another directive conflicts with the
+    elements here, <em>that</em> directive will win and override.
 </p>
-
+--# vim: et sw=4 sts=4
index 85e39f7647b2e2fadc2fd9cf3697bd28ba0665ba..5a59a55c083e47c9e7eef4bb6bc40e21258de588 100644 (file)
@@ -15,6 +15,6 @@ DEFAULT: NULL
     If you specify a module that does not exist, the manager will silently
     fail to use it, so be careful! User-defined modules are not affected
     by this directive. Modules defined in %HTML.CoreModules are not
-    affected by this directive. 
+    affected by this directive.
 </p>
-
+--# vim: et sw=4 sts=4
index e12edb6414f91614a0c069151d78124f4295db34..45ae469ec9852bbb6cc85fb30123e3b3e300f99e 100644 (file)
@@ -13,6 +13,6 @@ DEFAULT: 'p'
     <code>&lt;blockquote&gt;Foo&lt;/blockquote&gt;</code> would become
     <code>&lt;blockquote&gt;&lt;p&gt;Foo&lt;/p&gt;&lt;/blockquote&gt;</code>.
     The <code>&lt;p&gt;</code> tags can be replaced with whatever you desire,
-    as long as it is a block level element. 
+    as long as it is a block level element.
 </p>
-
+--# vim: et sw=4 sts=4
index c629f66b45c530958d3da30ef9a4d4c88e49b0a8..5246188795507b0c161f3d2c45ff3ddfc392dbfb 100644 (file)
@@ -18,6 +18,6 @@ array (
     that must be included for the doctype to be an conforming document
     type: put those modules here. By default, XHTML's core modules
     are used. You can set this to a blank array to disable core module
-    protection, but this is not recommended. 
+    protection, but this is not recommended.
 </p>
-
+--# vim: et sw=4 sts=4
index ee410ff07c0fcd505ce9bbaa999f4c317c353222..a64e3d7c363ebaa06b555c02f8a88c8da49013a9 100644 (file)
@@ -6,5 +6,4 @@ DEFAULT: NULL
 
 A custom doctype for power-users who defined there own document
 type. This directive only applies when %HTML.Doctype is blank.
-
-
+--# vim: et sw=4 sts=4
index 36a3e9dab4d3a45a594f63d2c34e2efca34d6419..103db754a289a5c9ad194008325f41e317b538a7 100644 (file)
@@ -30,4 +30,4 @@ $def->addAttribute('a', 'tabindex', 'Number');
     You <em>must</em> specify a value to this directive to use the
     advanced API features.
 </p>
-
+--# vim: et sw=4 sts=4
index bc084fa37febf35a237d190decb433639560a27b..229ae0267a6ff6eae15db65167045f89f1179e16 100644 (file)
@@ -11,6 +11,6 @@ DEFAULT: 1
     context: revision 3 is more up-to-date then revision 2.  Thus, when
     this gets incremented, the cache handling is smart enough to clean
     up any older revisions of your definition as well as flush the
-    cache.  
+    cache.
 </p>
-
+--# vim: et sw=4 sts=4
index 051cf20a6221942171611e6bdfabbeb138feb3a9..9dab497f2f3ca79e9b217a0631a06b19ce83dd3e 100644 (file)
@@ -8,3 +8,4 @@ this name for sake of simplicity. When non-blank, this will override any
 older directives like %HTML.XHTML or %HTML.Strict.
 --ALLOWED--
 'HTML 4.01 Transitional', 'HTML 4.01 Strict', 'XHTML 1.0 Transitional', 'XHTML 1.0 Strict', 'XHTML 1.1'
+--# vim: et sw=4 sts=4
index 68c49cd616223e371e8d3714bccb037374f5fb88..57358f9bad296bca1b977480b11f6c0e89e6171c 100644 (file)
@@ -18,3 +18,4 @@ DEFAULT: array()
     out that directive for a discussion of why you
     should think twice before using this directive.
 </p>
+--# vim: et sw=4 sts=4
index 1a9c90f4ab56494ff7ffe577a9c292b9ea23616d..93a53e14fb4e9532479a6727c1bae261c8c634ff 100644 (file)
@@ -17,3 +17,4 @@ DEFAULT: array()
     a nasty surprise when people start using the <code>background-image</code>
     CSS property.
 </p>
+--# vim: et sw=4 sts=4
index 15d8dceccd898a0290c19fa2c0667a3ba38bfc94..e424c386ec31e391ee7c12e186af4a51d6101f2a 100644 (file)
@@ -10,4 +10,5 @@ VERSION: 3.1.1
  This directive is similar to %CSS.MaxImgLength, and both should be
  concurrently edited, although there are
  subtle differences in the input format (the HTML max is an integer).
-</p>
\ No newline at end of file
+</p>
+--# vim: et sw=4 sts=4
index ecc2f77b606419f464994b5223370e13a12d8e76..62e8e160c736570c69a1d5655dfad97053f85b16 100644 (file)
@@ -5,8 +5,8 @@ DEFAULT: 'div'
 --DESCRIPTION--
 
 <p>
-    String name of element that HTML fragment passed to library will be 
-    inserted in.  An interesting variation would be using span as the 
-    parent element, meaning that only inline tags would be allowed. 
+    String name of element that HTML fragment passed to library will be
+    inserted in.  An interesting variation would be using span as the
+    parent element, meaning that only inline tags would be allowed.
 </p>
-
+--# vim: et sw=4 sts=4
index 9784c1c42d5c87cd189207ba60fbfe768d65f36d..dfb720496dab5aa44f3893c53a90ff64f14d53b0 100644 (file)
@@ -9,3 +9,4 @@ DEFAULT: false
     <strong>Warning:</strong> This can cause your documents to stop
     validating!
 </p>
+--# vim: et sw=4 sts=4
index 98ed8f9f0b1d9c8bc463c566805fe32a095fd92e..f635a68548bad4985efd5615b6df8cd79d0f4fdf 100644 (file)
@@ -10,4 +10,5 @@ DEFAULT: false
     element and will cause your website to stop validating. You probably want
     to enable this with %HTML.SafeObject.
     <strong>Highly experimental.</strong>
-</p>
\ No newline at end of file
+</p>
+--# vim: et sw=4 sts=4
index 6270abea47d2c87aed7d04495323d8958af0cec9..32967b88fb7d34b4c757224c86d1d90386d89ca2 100644 (file)
@@ -6,8 +6,9 @@ DEFAULT: false
 <p>
     Whether or not to permit object tags in documents, with a number of extra
     security features added to prevent script execution. This is similar to
-    what websites like MySpace do to object tags. You may also want to 
+    what websites like MySpace do to object tags. You may also want to
     enable %HTML.SafeEmbed for maximum interoperability with Internet Explorer,
     although embed tags will cause your website to stop validating.
     <strong>Highly experimental.</strong>
 </p>
+--# vim: et sw=4 sts=4
index c9697bde82cc6bc415845d8ed2e353a17ea1d16e..a8b1de56bef7e9847fdf0c6e0ad9f9c1c6195929 100644 (file)
@@ -6,3 +6,4 @@ DEPRECATED-VERSION: 1.7.0
 DEPRECATED-USE: HTML.Doctype
 --DESCRIPTION--
 Determines whether or not to use Transitional (loose) or Strict rulesets.
+--# vim: et sw=4 sts=4
index 7fadf06c7388dc561dc9baf9c685383acb9ce177..b4c271b7fac768967c9b7f36c22075e88c9e8b33 100644 (file)
@@ -4,5 +4,5 @@ VERSION: 2.0.0
 DEFAULT: array()
 --DESCRIPTION--
 
-Fixes to add to the default set of Tidy fixes as per your level. 
-
+Fixes to add to the default set of Tidy fixes as per your level.
+--# vim: et sw=4 sts=4
index 9383bbaaed7c60ad64e68e1d201e4e0d468d010a..4186ccd0d196ad2a4846c7e25781e1f119c067c6 100644 (file)
@@ -21,3 +21,4 @@ There are four allowed values:</p>
 
 --ALLOWED--
 'none', 'light', 'medium', 'heavy'
+--# vim: et sw=4 sts=4
index 4717f39fdb7e8dd09901e90def903c0c27135d03..996762bd1d66f725cd76f456326672a0cc86b208 100644 (file)
@@ -4,5 +4,5 @@ VERSION: 2.0.0
 DEFAULT: array()
 --DESCRIPTION--
 
-Fixes to remove from the default set of Tidy fixes as per your level. 
-
+Fixes to remove from the default set of Tidy fixes as per your level.
+--# vim: et sw=4 sts=4
index 6a4015e7bfea363474059d9df7f5a0d66760fa84..89133b1a385d326c1e2882e7d1f18f75a09edb60 100644 (file)
@@ -4,4 +4,5 @@ VERSION: 2.0.0
 DEFAULT: false
 --DESCRIPTION--
 Indicates whether or not the user input is trusted or not. If the input is
-trusted, a more expansive set of allowed tags and attributes will be used. 
+trusted, a more expansive set of allowed tags and attributes will be used.
+--# vim: et sw=4 sts=4
index 8cca4b052a62006ee781e6532d4e30a6e9614628..2a47e384f4142490020436a837f081fb63841ceb 100644 (file)
@@ -8,3 +8,4 @@ DEPRECATED-USE: HTML.Doctype
 Determines whether or not output is XHTML 1.0 or HTML 4.01 flavor.
 --ALIASES--
 Core.XHTML
+--# vim: et sw=4 sts=4
index 935000863930bc37cd2f7b879ad92e6b9780bac8..f32ceb5b6e5ed5513c6b3221e973b526a1986f78 100644 (file)
@@ -1,2 +1,3 @@
 HTML
 DESCRIPTION: Configuration regarding allowed HTML.
+--# vim: et sw=4 sts=4
index 5a77edb4d229b632474a10c79d6c02db8d5357c6..08921fde70a17d49cfa7b555174e31ba2cf6cffb 100644 (file)
@@ -4,6 +4,7 @@ VERSION: 2.0.0
 DEFAULT: true
 --DESCRIPTION--
 Determines whether or not HTML Purifier should attempt to fix up the
-contents of script tags for legacy browsers with comments. 
+contents of script tags for legacy browsers with comments.
 --ALIASES--
 Core.CommentScriptContents
+--# vim: et sw=4 sts=4
index 2dd17999df4fbfd5a943e1b90f721dbd0010b278..79f8ad82cfc6b01eab440bf41d0af66d6db91d8a 100644 (file)
@@ -8,6 +8,6 @@ DEFAULT: NULL
     Newline string to format final output with. If left null, HTML Purifier
     will auto-detect the default newline type of the system and use that;
     you can manually override it here. Remember, \r\n is Windows, \r
-    is Mac, and \n is Unix. 
+    is Mac, and \n is Unix.
 </p>
-
+--# vim: et sw=4 sts=4
index 5392b3bd516a6fa67a4eedeb3292b0c62eb75b8f..232b02362a46af7a9fd7d44894dab9b1c59f0e54 100644 (file)
@@ -11,3 +11,4 @@ DEFAULT: false
   to text diffs. If you're not seeing this bug, chances are, you don't need
   this directive.
 </p>
+--# vim: et sw=4 sts=4
index 6d26c4ded9e14694d6f39cf398ea7a9ceef7efb2..06bab00a0a2a1bd066d1344742ea457d3df03896 100644 (file)
@@ -4,7 +4,7 @@ VERSION: 1.1.1
 DEFAULT: false
 --DESCRIPTION--
 <p>
-    Determines whether or not to run Tidy on the final output for pretty 
+    Determines whether or not to run Tidy on the final output for pretty
     formatting reasons, such as indentation and wrap.
 </p>
 <p>
@@ -22,3 +22,4 @@ DEFAULT: false
 </p>
 --ALIASES--
 Core.TidyFormat
+--# vim: et sw=4 sts=4
index abd4b1b39e4290fce517c71c3bd79372da1fe95a..7849d60d26f43b4a8d696e9cbe86eb2a4af2d5cd 100644 (file)
@@ -1,2 +1,3 @@
 Output
 DESCRIPTION: Configuration relating to the generation of (X)HTML.
+--# vim: et sw=4 sts=4
index 2cd7067ddcec023aa1cb3df95940048d8e61f5a2..071bc0295df30acd443e87f49f77420b6f84d93d 100644 (file)
@@ -4,3 +4,4 @@ DEFAULT: false
 --DESCRIPTION--
 When set to true, HTMLPurifier_Encoder will act as if iconv does not exist
 and use only pure PHP implementations.
+--# vim: et sw=4 sts=4
index a9928fec202a3ce59e012fdbf4d31648bf065312..5025f9d14f107563aacece1ac973b171c9dc87d4 100644 (file)
@@ -1,2 +1,3 @@
 Test
 DESCRIPTION: Developer testing configuration for our unit tests.
+--# vim: et sw=4 sts=4
index cf1271c0eba652d2b7cbe9c4d049682ed69a7c7b..98fdfe922260a2b6b574891c9cb05c5d99028f7f 100644 (file)
@@ -12,3 +12,4 @@ array (
 --DESCRIPTION--
 Whitelist that defines the schemes that a URI is allowed to have.  This
 prevents XSS attacks from using pseudo-schemes like javascript or mocha.
+--# vim: et sw=4 sts=4
index f68b82596eafafee57c28a91321e43d840507cb0..876f0680cf27769d7ad396db186635f163e05dbd 100644 (file)
@@ -9,9 +9,9 @@ DEFAULT: NULL
     inserted into.  This information is important if HTML Purifier needs
     to calculate absolute URIs from relative URIs, such as when %URI.MakeAbsolute
     is on.  You may use a non-absolute URI for this value, but behavior
-    may vary (%URI.MakeAbsolute deals nicely with both absolute and 
+    may vary (%URI.MakeAbsolute deals nicely with both absolute and
     relative paths, but forwards-compatibility is not guaranteed).
     <strong>Warning:</strong> If set, the scheme on this URI
-    overrides the one specified by %URI.DefaultScheme. 
+    overrides the one specified by %URI.DefaultScheme.
 </p>
-
+--# vim: et sw=4 sts=4
index ba472edadcd6fdb6940db3c7c38ae04c45bc4ac4..728e378cbeb462998a10de23946b60e3ebd74cc5 100644 (file)
@@ -4,7 +4,7 @@ DEFAULT: 'http'
 --DESCRIPTION--
 
 <p>
-    Defines through what scheme the output will be served, in order to 
+    Defines through what scheme the output will be served, in order to
     select the proper object validator when no scheme information is present.
 </p>
-
+--# vim: et sw=4 sts=4
index dd324a5923f56a8525b37c334fe1e1a5d0e69b87..f05312ba862690b00fb80399b299d24c25d1c7be 100644 (file)
@@ -8,4 +8,4 @@ DEFAULT: NULL
     Unique identifier for a custom-built URI definition. If you  want
     to add custom URIFilters, you must specify this value.
 </p>
-
+--# vim: et sw=4 sts=4
index 9049897b66a726c51164e75f09cc1873c57857a5..80cfea93f72dcc76d5ec39d68b5b0efccdef41fb 100644 (file)
@@ -6,6 +6,6 @@ DEFAULT: 1
 
 <p>
     Revision identifier for your custom definition. See
-    %HTML.DefinitionRev for details. 
+    %HTML.DefinitionRev for details.
 </p>
-
+--# vim: et sw=4 sts=4
index 85fe3df10ab35ae459dd70943441c1719b454921..71ce025a2dcf06fad2171c8fa849552d81af2c50 100644 (file)
@@ -5,9 +5,10 @@ DEFAULT: false
 --DESCRIPTION--
 
 <p>
-    Disables all URIs in all forms. Not sure why you'd want to do that 
-    (after all, the Internet's founded on the notion of a hyperlink). 
+    Disables all URIs in all forms. Not sure why you'd want to do that
+    (after all, the Internet's founded on the notion of a hyperlink).
 </p>
 
 --ALIASES--
 Attr.DisableURI
+--# vim: et sw=4 sts=4
index 5f9dc31f9f813ed81abc69fddcafc2545e77fe13..13c122c8cecabcda3c65897357de50955c1e91e8 100644 (file)
@@ -7,4 +7,5 @@ Disables links to external websites.  This is a highly effective anti-spam
 and anti-pagerank-leech measure, but comes at a hefty price: nolinks or
 images outside of your domain will be allowed.  Non-linkified URIs will
 still be preserved.  If you want to be able to link to subdomains or use
-absolute URIs, specify %URI.Host for your website. 
+absolute URIs, specify %URI.Host for your website.
+--# vim: et sw=4 sts=4
index af43b614022b47a5d0585a3814abc577213289c9..abcc1efd61328375ffdb5f233b265b69b612a0c9 100644 (file)
@@ -9,4 +9,5 @@ tracking (good for email viewers), bandwidth leeching, cross-site request
 forging, goatse.cx posting, and other nasties, but also results in a loss
 of end-user functionality (they can't directly post a pic they posted from
 Flickr anymore). Use it if you don't have a robust user-content moderation
-team. 
+team.
+--# vim: et sw=4 sts=4
index 2f4e57417abe0f5f2a6c26911e550190ac9cdbbb..51e6ea91f79cf36ea1e717ed5aebf26449cc5b61 100644 (file)
@@ -6,7 +6,7 @@ DEFAULT: false
 
 <p>
     Disables embedding resources, essentially meaning no pictures. You can
-    still link to them though. See %URI.DisableExternalResources for why 
-    this might be a good idea. 
+    still link to them though. See %URI.DisableExternalResources for why
+    this might be a good idea.
 </p>
-
+--# vim: et sw=4 sts=4
index 4815940753bccae0468025adb6bf12ca1f9d7b35..ee83b121dece74354d881dd76ce2b4dac9a74a7f 100644 (file)
@@ -5,15 +5,15 @@ DEFAULT: NULL
 --DESCRIPTION--
 
 <p>
-    Defines the domain name of the server, so we can determine whether or 
-    an absolute URI is from your website or not.  Not strictly necessary, 
-    as users should be using relative URIs to reference resources on your 
-    website.  It will, however, let you use absolute URIs to link to 
-    subdomains of the domain you post here: i.e. example.com will allow 
-    sub.example.com.  However, higher up domains will still be excluded: 
-    if you set %URI.Host to sub.example.com, example.com will be blocked. 
+    Defines the domain name of the server, so we can determine whether or
+    an absolute URI is from your website or not.  Not strictly necessary,
+    as users should be using relative URIs to reference resources on your
+    website.  It will, however, let you use absolute URIs to link to
+    subdomains of the domain you post here: i.e. example.com will allow
+    sub.example.com.  However, higher up domains will still be excluded:
+    if you set %URI.Host to sub.example.com, example.com will be blocked.
     <strong>Note:</strong> This directive overrides %URI.Base because
     a given page may be on a sub-domain, but you wish HTML Purifier to be
     more relaxed and allow some of the parent domains too.
 </p>
-
+--# vim: et sw=4 sts=4
index a62a354374d4976245c9be291e615fcd02e4a956..0b6df7625dca565406073ec4ffb0d63fc080a992 100644 (file)
@@ -5,4 +5,5 @@ DEFAULT: array()
 --DESCRIPTION--
 List of strings that are forbidden in the host of any URI. Use it to kill
 domain names of spam, etc. Note that it will catch anything in the domain,
-so <tt>moo.com</tt> will catch <tt>moo.com.example.com</tt>. 
+so <tt>moo.com</tt> will catch <tt>moo.com.example.com</tt>.
+--# vim: et sw=4 sts=4
index 0832b2cc6781454759897987764ade9cf69f5971..4214900a592c400030521a9cc26af9d7343da81e 100644 (file)
@@ -10,3 +10,4 @@ DEFAULT: false
     viewed in a different context (and setting an alternate base URI is
     not possible). %URI.Base must be set for this directive to work.
 </p>
+--# vim: et sw=4 sts=4
index ed9e142d8b72ce7e35dc1d8e1f3fe896d7662d84..58c81dcc441625b4ea966a7dd2b04131c0542e66 100644 (file)
@@ -7,8 +7,8 @@ DEFAULT: NULL
 <p>
     Munges all browsable (usually http, https and ftp)
     absolute URIs into another URI, usually a URI redirection service.
-    This directive accepts a URI, formatted with a <code>%s</code> where 
-    the url-encoded original URI should be inserted (sample: 
+    This directive accepts a URI, formatted with a <code>%s</code> where
+    the url-encoded original URI should be inserted (sample:
     <code>http://www.google.com/url?q=%s</code>).
 </p>
 <p>
@@ -16,10 +16,10 @@ DEFAULT: NULL
 </p>
 <ul>
     <li>
-        Prevent PageRank leaks, while being fairly transparent 
-        to users (you may also want to add some client side JavaScript to 
+        Prevent PageRank leaks, while being fairly transparent
+        to users (you may also want to add some client side JavaScript to
         override the text in the statusbar). <strong>Notice</strong>:
-        Many security experts believe that this form of protection does not deter spam-bots. 
+        Many security experts believe that this form of protection does not deter spam-bots.
     </li>
     <li>
         Redirect users to a splash page telling them they are leaving your
@@ -80,3 +80,4 @@ DEFAULT: NULL
     was picked because it came after n (and I couldn't use a), p is for
     property.
 </p>
+--# vim: et sw=4 sts=4
index 69b1ea830644fff8906cd2f39e7cd2d871e52ea4..6fce0fdc3735655c3a8416c71f9b8f6bf24c3169 100644 (file)
@@ -14,3 +14,4 @@ DEFAULT: false
     <strong>Warning:</strong> It is strongly advised you use this in conjunction
     %URI.MungeSecretKey to mitigate the security risk of an open redirector.
 </p>
+--# vim: et sw=4 sts=4
index a2f5a02cc5fc9928ebdbded13676ecd37897ce7a..0d00f62ea8a41daf20a83e2ce54170035604e200 100644 (file)
@@ -27,3 +27,4 @@ DEFAULT: NULL
 <p>
     Remember this has no effect if %URI.Munge is not on.
 </p>
+--# vim: et sw=4 sts=4
index e910ee54035bbdf1ecaeae5400ed16b598422dce..23331a4e79047ea1b0935802f34c0a92cc8df4cd 100644 (file)
@@ -6,3 +6,4 @@ If this is set to true (which it is by default), you can override
 %URI.AllowedSchemes by simply registering a HTMLPurifier_URIScheme to the
 registry.  If false, you will also have to update that directive in order
 to add more schemes.
+--# vim: et sw=4 sts=4
index 4bcdb95b1fd4a97f0addcf09cd688e9c7775571c..a13060f365936599a83317f1c00d10a2e31ed29d 100644 (file)
@@ -1,2 +1,3 @@
 URI
 DESCRIPTION: Features regarding Uniform Resource Identifiers.
+--# vim: et sw=4 sts=4
index cd67189232e8d3cbcc33a6249cef32af88ccf527..5de4505e1b04bcb2b35bfb9357b7b3f9ae6f7fb4 100644 (file)
@@ -1 +1,3 @@
 name = "HTML Purifier"
+
+; vim: et sw=4 sts=4
index 15c8d97fee260fcc80f65c2b6a045ed7a2a33db1..3b6e96f5f56a8fee3e8f3bcf4e48d1be85cce14d 100644 (file)
@@ -5,18 +5,18 @@
  */
 class HTMLPurifier_ContentSets
 {
-    
+
     /**
      * List of content set strings (pipe seperators) indexed by name.
      */
     public $info = array();
-    
+
     /**
      * List of content set lookups (element => true) indexed by name.
      * @note This is in HTMLPurifier_HTMLDefinition->info_content_sets
      */
     public $lookup = array();
-    
+
     /**
      * Synchronized list of defined content sets (keys of info)
      */
@@ -25,7 +25,7 @@ class HTMLPurifier_ContentSets
      * Synchronized list of defined content values (values of info)
      */
     protected $values = array();
-    
+
     /**
      * Merges in module's content sets, expands identifiers in the content
      * sets and populates the keys, values and lookup member variables.
@@ -60,14 +60,14 @@ class HTMLPurifier_ContentSets
                 $this->lookup[$i] += $add;
             }
         }
-        
+
         foreach ($this->lookup as $key => $lookup) {
             $this->info[$key] = implode(' | ', array_keys($lookup));
         }
         $this->keys   = array_keys($this->info);
         $this->values = array_values($this->info);
     }
-    
+
     /**
      * Accepts a definition; generates and assigns a ChildDef for it
      * @param $def HTMLPurifier_ElementDef reference
@@ -88,11 +88,11 @@ class HTMLPurifier_ContentSets
         }
         $def->child = $this->getChildDef($def, $module);
     }
-    
+
     public function generateChildDefCallback($matches) {
         return $this->info[$matches[0]];
     }
-    
+
     /**
      * Instantiates a ChildDef based on content_model and content_model_type
      * member variables in HTMLPurifier_ElementDef
@@ -134,7 +134,7 @@ class HTMLPurifier_ContentSets
         );
         return false;
     }
-    
+
     /**
      * Converts a string list of elements separated by pipes into
      * a lookup array.
@@ -149,6 +149,7 @@ class HTMLPurifier_ContentSets
         }
         return $ret;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 151a68eda8d0578e1f87ad041c5fed041263b3f0..9ddf0c5476a186d9bb694dee319e674f79ad868c 100644 (file)
@@ -9,12 +9,12 @@
  */
 class HTMLPurifier_Context
 {
-    
+
     /**
      * Private array that stores the references.
      */
     private $_storage = array();
-    
+
     /**
      * Registers a variable into the context.
      * @param $name String name
@@ -28,7 +28,7 @@ class HTMLPurifier_Context
         }
         $this->_storage[$name] =& $ref;
     }
-    
+
     /**
      * Retrieves a variable reference from the context.
      * @param $name String name
@@ -45,7 +45,7 @@ class HTMLPurifier_Context
         }
         return $this->_storage[$name];
     }
-    
+
     /**
      * Destorys a variable in the context.
      * @param $name String name
@@ -58,7 +58,7 @@ class HTMLPurifier_Context
         }
         unset($this->_storage[$name]);
     }
-    
+
     /**
      * Checks whether or not the variable exists.
      * @param $name String name
@@ -66,7 +66,7 @@ class HTMLPurifier_Context
     public function exists($name) {
         return isset($this->_storage[$name]);
     }
-    
+
     /**
      * Loads a series of variables from an associative array
      * @param $context_array Assoc array of variables to load
@@ -76,6 +76,7 @@ class HTMLPurifier_Context
             $this->register($key, $context_array[$key]);
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 7de8b73d7fb3efb37e4f76ee172bee9f48ac49a7..a7408c97498eabfa586ca762f82ae102ae88a7c7 100644 (file)
@@ -6,24 +6,24 @@
  */
 abstract class HTMLPurifier_Definition
 {
-    
+
     /**
      * Has setup() been called yet?
      */
     public $setup = false;
-    
+
     /**
      * What type of definition is it?
      */
     public $type;
-    
+
     /**
      * Sets up the definition object into the final form, something
      * not done by the constructor
      * @param $config HTMLPurifier_Config instance
      */
     abstract protected function doSetup($config);
-    
+
     /**
      * Setup function that aborts if already setup
      * @param $config HTMLPurifier_Config instance
@@ -33,6 +33,7 @@ abstract class HTMLPurifier_Definition
         $this->setup = true;
         $this->doSetup($config);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index f81af0c56ab220c4198d4d95f885e092e17a929d..fa5a087bb754b71c667746549a27e3386609ad91 100644 (file)
@@ -10,9 +10,9 @@
  */
 abstract class HTMLPurifier_DefinitionCache
 {
-    
+
     public $type;
-    
+
     /**
      * @param $name Type of definition objects this instance of the
      *      cache will handle.
@@ -20,7 +20,7 @@ abstract class HTMLPurifier_DefinitionCache
     public function __construct($type) {
         $this->type = $type;
     }
-    
+
     /**
      * Generates a unique identifier for a particular configuration
      * @param Instance of HTMLPurifier_Config
@@ -30,7 +30,7 @@ abstract class HTMLPurifier_DefinitionCache
                $config->getBatchSerial($this->type) . ',' .
                $config->get($this->type, 'DefinitionRev');
     }
-    
+
     /**
      * Tests whether or not a key is old with respect to the configuration's
      * version and revision number.
@@ -50,7 +50,7 @@ abstract class HTMLPurifier_DefinitionCache
         ) return true;
         return false;
     }
-    
+
     /**
      * Checks if a definition's type jives with the cache's type
      * @note Throws an error on failure
@@ -64,37 +64,37 @@ abstract class HTMLPurifier_DefinitionCache
         }
         return true;
     }
-    
+
     /**
      * Adds a definition object to the cache
      */
     abstract public function add($def, $config);
-    
+
     /**
      * Unconditionally saves a definition object to the cache
      */
     abstract public function set($def, $config);
-    
+
     /**
      * Replace an object in the cache
      */
     abstract public function replace($def, $config);
-    
+
     /**
      * Retrieves a definition object from the cache
      */
     abstract public function get($config);
-    
+
     /**
      * Removes a definition object to the cache
      */
     abstract public function remove($config);
-    
+
     /**
      * Clears all objects from cache
      */
     abstract public function flush($config);
-    
+
     /**
      * Clears all expired (older version or revision) objects from cache
      * @note Be carefuly implementing this method as flush. Flush must
@@ -102,6 +102,7 @@ abstract class HTMLPurifier_DefinitionCache
      *       should not be repeatedly called by userland code.
      */
     abstract public function cleanup($config);
-    
+
 }
 
+// vim: et sw=4 sts=4
index 39eb474f9afdc4e9bc1f7ff5c1ef7e3fca37da54..b0fb6d0cd67a21d6720fb13d3aca3c7aab64ca7f 100644 (file)
@@ -2,14 +2,14 @@
 
 class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCache
 {
-    
+
     /**
      * Cache object we are decorating
      */
     public $cache;
-    
+
     public function __construct() {}
-    
+
     /**
      * Lazy decorator function
      * @param $cache Reference to cache object to decorate
@@ -21,41 +21,42 @@ class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCach
         $decorator->type  = $cache->type;
         return $decorator;
     }
-    
+
     /**
      * Cross-compatible clone substitute
      */
     public function copy() {
         return new HTMLPurifier_DefinitionCache_Decorator();
     }
-    
+
     public function add($def, $config) {
         return $this->cache->add($def, $config);
     }
-    
+
     public function set($def, $config) {
         return $this->cache->set($def, $config);
     }
-    
+
     public function replace($def, $config) {
         return $this->cache->replace($def, $config);
     }
-    
+
     public function get($config) {
         return $this->cache->get($config);
     }
-    
+
     public function remove($config) {
         return $this->cache->remove($config);
     }
-    
+
     public function flush($config) {
         return $this->cache->flush($config);
     }
-    
+
     public function cleanup($config) {
         return $this->cache->cleanup($config);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 842382e4178aa794aef55b9f468d9b77ac689638..d4cc35c4bc1cd7e16a94742f03b72b1586c16532 100644 (file)
@@ -7,36 +7,37 @@
 class HTMLPurifier_DefinitionCache_Decorator_Cleanup extends
       HTMLPurifier_DefinitionCache_Decorator
 {
-    
+
     public $name = 'Cleanup';
-    
+
     public function copy() {
         return new HTMLPurifier_DefinitionCache_Decorator_Cleanup();
     }
-    
+
     public function add($def, $config) {
         $status = parent::add($def, $config);
         if (!$status) parent::cleanup($config);
         return $status;
     }
-    
+
     public function set($def, $config) {
         $status = parent::set($def, $config);
         if (!$status) parent::cleanup($config);
         return $status;
     }
-    
+
     public function replace($def, $config) {
         $status = parent::replace($def, $config);
         if (!$status) parent::cleanup($config);
         return $status;
     }
-    
+
     public function get($config) {
         $ret = parent::get($config);
         if (!$ret) parent::cleanup($config);
         return $ret;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 83ed2c0353fe4bc12437804986768683f910a2f6..18f16d32b6698eed50dbe0d8d3ee81d05ad7c724 100644 (file)
@@ -2,44 +2,45 @@
 
 /**
  * Definition cache decorator class that saves all cache retrievals
- * to PHP's memory; good for unit tests or circumstances where 
+ * to PHP's memory; good for unit tests or circumstances where
  * there are lots of configuration objects floating around.
  */
 class HTMLPurifier_DefinitionCache_Decorator_Memory extends
       HTMLPurifier_DefinitionCache_Decorator
 {
-    
+
     protected $definitions;
     public $name = 'Memory';
-    
+
     public function copy() {
         return new HTMLPurifier_DefinitionCache_Decorator_Memory();
     }
-    
+
     public function add($def, $config) {
         $status = parent::add($def, $config);
         if ($status) $this->definitions[$this->generateKey($config)] = $def;
         return $status;
     }
-    
+
     public function set($def, $config) {
         $status = parent::set($def, $config);
         if ($status) $this->definitions[$this->generateKey($config)] = $def;
         return $status;
     }
-    
+
     public function replace($def, $config) {
         $status = parent::replace($def, $config);
         if ($status) $this->definitions[$this->generateKey($config)] = $def;
         return $status;
     }
-    
+
     public function get($config) {
         $key = $this->generateKey($config);
         if (isset($this->definitions[$key])) return $this->definitions[$key];
         $this->definitions[$key] = parent::get($config);
         return $this->definitions[$key];
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index d741764c860feca646ebb0adcbb59163a73bc544..21a8fcfda2415808ba432ce7fa14041286198ada 100644 (file)
@@ -8,39 +8,40 @@ require_once 'HTMLPurifier/DefinitionCache/Decorator.php';
 class HTMLPurifier_DefinitionCache_Decorator_Template extends
       HTMLPurifier_DefinitionCache_Decorator
 {
-    
+
     var $name = 'Template'; // replace this
-    
+
     function copy() {
         // replace class name with yours
         return new HTMLPurifier_DefinitionCache_Decorator_Template();
     }
-    
+
     // remove methods you don't need
-    
+
     function add($def, $config) {
         return parent::add($def, $config);
     }
-    
+
     function set($def, $config) {
         return parent::set($def, $config);
     }
-    
+
     function replace($def, $config) {
         return parent::replace($def, $config);
     }
-    
+
     function get($config) {
         return parent::get($config);
     }
-    
+
     function flush() {
         return parent::flush();
     }
-    
+
     function cleanup($config) {
         return parent::cleanup($config);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 8e39e69d7b341d0524d7ce50d48f8c9b8d9246e8..41d97e734fe068e466c7bfffbc79e95791ba9171 100644 (file)
@@ -5,34 +5,35 @@
  */
 class HTMLPurifier_DefinitionCache_Null extends HTMLPurifier_DefinitionCache
 {
-    
+
     public function add($def, $config) {
         return false;
     }
-    
+
     public function set($def, $config) {
         return false;
     }
-    
+
     public function replace($def, $config) {
         return false;
     }
-    
+
     public function remove($config) {
         return false;
     }
-    
+
     public function get($config) {
         return false;
     }
-    
+
     public function flush($config) {
         return false;
     }
-    
+
     public function cleanup($config) {
         return false;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index ef082217a5919e387b5fccb28d355ae4293c9fb6..acbbe2c3b37f5c0766c717513ac59c01bc1680c0 100644 (file)
@@ -3,7 +3,7 @@
 class HTMLPurifier_DefinitionCache_Serializer extends
       HTMLPurifier_DefinitionCache
 {
-    
+
     public function add($def, $config) {
         if (!$this->checkDefType($def)) return;
         $file = $this->generateFilePath($config);
@@ -11,14 +11,14 @@ class HTMLPurifier_DefinitionCache_Serializer extends
         if (!$this->_prepareDir($config)) return false;
         return $this->_write($file, serialize($def));
     }
-    
+
     public function set($def, $config) {
         if (!$this->checkDefType($def)) return;
         $file = $this->generateFilePath($config);
         if (!$this->_prepareDir($config)) return false;
         return $this->_write($file, serialize($def));
     }
-    
+
     public function replace($def, $config) {
         if (!$this->checkDefType($def)) return;
         $file = $this->generateFilePath($config);
@@ -26,19 +26,19 @@ class HTMLPurifier_DefinitionCache_Serializer extends
         if (!$this->_prepareDir($config)) return false;
         return $this->_write($file, serialize($def));
     }
-    
+
     public function get($config) {
         $file = $this->generateFilePath($config);
         if (!file_exists($file)) return false;
         return unserialize(file_get_contents($file));
     }
-    
+
     public function remove($config) {
         $file = $this->generateFilePath($config);
         if (!file_exists($file)) return false;
         return unlink($file);
     }
-    
+
     public function flush($config) {
         if (!$this->_prepareDir($config)) return false;
         $dir = $this->generateDirectoryPath($config);
@@ -49,7 +49,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
             unlink($dir . '/' . $filename);
         }
     }
-    
+
     public function cleanup($config) {
         if (!$this->_prepareDir($config)) return false;
         $dir = $this->generateDirectoryPath($config);
@@ -61,7 +61,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
             if ($this->isOld($key, $config)) unlink($dir . '/' . $filename);
         }
     }
-    
+
     /**
      * Generates the file path to the serial file corresponding to
      * the configuration and definition name
@@ -71,7 +71,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
         $key = $this->generateKey($config);
         return $this->generateDirectoryPath($config) . '/' . $key . '.ser';
     }
-    
+
     /**
      * Generates the path to the directory contain this cache's serial files
      * @note No trailing slash
@@ -81,7 +81,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
         $base = $this->generateBaseDirectoryPath($config);
         return $base . '/' . $this->type;
     }
-    
+
     /**
      * Generates path to base directory that contains all definition type
      * serials
@@ -92,7 +92,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
         $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base;
         return $base;
     }
-    
+
     /**
      * Convenience wrapper function for file_put_contents
      * @param $file File name to write to
@@ -102,7 +102,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
     private function _write($file, $data) {
         return file_put_contents($file, $data);
     }
-    
+
     /**
      * Prepares the directory that this type stores the serials in
      * @return True if successful
@@ -114,7 +114,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
             if (!is_dir($base)) {
                 trigger_error('Base directory '.$base.' does not exist,
                     please create or change using %Cache.SerializerPath',
-                    E_USER_ERROR);
+                    E_USER_WARNING);
                 return false;
             } elseif (!$this->_testPermissions($base)) {
                 return false;
@@ -127,7 +127,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
         }
         return true;
     }
-    
+
     /**
      * Tests permissions on a directory and throws out friendly
      * error messages and attempts to chmod it itself if possible
@@ -139,7 +139,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends
             // generally, you'll want to handle this beforehand
             // so a more specific error message can be given
             trigger_error('Directory '.$dir.' does not exist',
-                E_USER_ERROR);
+                E_USER_WARNING);
             return false;
         }
         if (function_exists('posix_getuid')) {
@@ -157,15 +157,16 @@ class HTMLPurifier_DefinitionCache_Serializer extends
             }
             trigger_error('Directory '.$dir.' not writable, '.
                 'please chmod to ' . $chmod,
-                E_USER_ERROR);
+                E_USER_WARNING);
         } else {
             // generic error message
             trigger_error('Directory '.$dir.' not writable, '.
                 'please alter file permissions',
-                E_USER_ERROR);
+                E_USER_WARNING);
         }
         return false;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 962b80a341f697d22cc363892f4d363764a6cc83..2e35c1c3d06445db25e61ca9c64845728d023f7f 100644 (file)
@@ -1 +1,3 @@
 This is a dummy file to prevent Git from ignoring this empty directory.
+
+    vim: et sw=4 sts=4
index fca1b6c40eaeeb5879ee67c3c8c8d5503f590991..3adefbb661c5d55df6fd403f9ba07b4a57187a09 100644 (file)
@@ -5,18 +5,18 @@
  */
 class HTMLPurifier_DefinitionCacheFactory
 {
-    
+
     protected $caches = array('Serializer' => array());
     protected $implementations = array();
     protected $decorators = array();
-    
+
     /**
      * Initialize default decorators
      */
     public function setup() {
         $this->addDecorator('Cleanup');
     }
-    
+
     /**
      * Retrieves an instance of global definition cache factory.
      */
@@ -30,16 +30,16 @@ class HTMLPurifier_DefinitionCacheFactory
         }
         return $instance;
     }
-    
+
     /**
      * Registers a new definition cache object
      * @param $short Short name of cache object, for reference
-     * @param $long Full class name of cache object, for construction 
+     * @param $long Full class name of cache object, for construction
      */
     public function register($short, $long) {
         $this->implementations[$short] = $long;
     }
-    
+
     /**
      * Factory method that creates a cache object based on configuration
      * @param $name Name of definitions handled by cache
@@ -73,10 +73,10 @@ class HTMLPurifier_DefinitionCacheFactory
         $this->caches[$method][$type] = $cache;
         return $this->caches[$method][$type];
     }
-    
+
     /**
      * Registers a decorator to add to all new cache objects
-     * @param 
+     * @param
      */
     public function addDecorator($decorator) {
         if (is_string($decorator)) {
@@ -85,6 +85,7 @@ class HTMLPurifier_DefinitionCacheFactory
         }
         $this->decorators[$decorator->name] = $decorator;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 5e83a86989fc43f82b9adbfda306c4fef23c57db..1e3c574c065279b2338a1add7e303e90e3affd20 100644 (file)
@@ -12,38 +12,38 @@ class HTMLPurifier_Doctype
      * Full name of doctype
      */
     public $name;
-    
+
     /**
      * List of standard modules (string identifiers or literal objects)
      * that this doctype uses
      */
     public $modules = array();
-    
+
     /**
      * List of modules to use for tidying up code
      */
     public $tidyModules = array();
-    
+
     /**
      * Is the language derived from XML (i.e. XHTML)?
      */
     public $xml = true;
-    
+
     /**
      * List of aliases for this doctype
      */
     public $aliases = array();
-    
+
     /**
      * Public DTD identifier
      */
     public $dtdPublic;
-    
+
     /**
      * System DTD identifier
      */
     public $dtdSystem;
-    
+
     public function __construct($name = null, $xml = true, $modules = array(),
         $tidyModules = array(), $aliases = array(), $dtd_public = null, $dtd_system = null
     ) {
@@ -57,3 +57,4 @@ class HTMLPurifier_Doctype
     }
 }
 
+// vim: et sw=4 sts=4
index 6c969efc5bdbfbb38b2322531b15a8259ba2474c..d6552aa5503ecb2bb05715bdb9acf27b0a45b72f 100644 (file)
@@ -2,17 +2,17 @@
 
 class HTMLPurifier_DoctypeRegistry
 {
-    
+
     /**
      * Hash of doctype names to doctype objects
      */
     protected $doctypes;
-    
+
     /**
      * Lookup table of aliases to real doctype names
      */
     protected $aliases;
-    
+
     /**
      * Registers a doctype to the registry
      * @note Accepts a fully-formed doctype object, or the
@@ -45,7 +45,7 @@ class HTMLPurifier_DoctypeRegistry
         if (isset($this->aliases[$name])) unset($this->aliases[$name]);
         return $doctype;
     }
-    
+
     /**
      * Retrieves reference to a doctype of a certain name
      * @note This function resolves aliases
@@ -62,7 +62,7 @@ class HTMLPurifier_DoctypeRegistry
         }
         return $this->doctypes[$doctype];
     }
-    
+
     /**
      * Creates a doctype based on a configuration object,
      * will perform initialization on the doctype
@@ -74,7 +74,7 @@ class HTMLPurifier_DoctypeRegistry
     public function make($config) {
         return clone $this->get($this->getDoctypeFromConfig($config));
     }
-    
+
     /**
      * Retrieves the doctype from the configuration object
      */
@@ -97,6 +97,7 @@ class HTMLPurifier_DoctypeRegistry
         }
         return $doctype;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 341ce349d696ffdb020aed9a502ff3fe292e7160..b55c7bd79337e337a5e8f28fc1df6befa3f41a8f 100644 (file)
@@ -5,16 +5,18 @@
  * HTMLPurifier_HTMLDefinition and HTMLPurifier_HTMLModule.
  * @note This class is inspected by HTMLPurifier_Printer_HTMLDefinition.
  *       Please update that class too.
+ * @warning If you add new properties to this class, you MUST update
+ *          the mergeIn() method.
  */
 class HTMLPurifier_ElementDef
 {
-    
+
     /**
      * Does the definition work by itself, or is it created solely
      * for the purpose of merging into another definition?
      */
     public $standalone = true;
-    
+
     /**
      * Associative array of attribute name to HTMLPurifier_AttrDef
      * @note Before being processed by HTMLPurifier_AttrCollections
@@ -27,22 +29,22 @@ class HTMLPurifier_ElementDef
      *       HTMLPurifier_HTMLDefinition->setup() processing.
      */
     public $attr = array();
-    
+
     /**
      * Indexed list of tag's HTMLPurifier_AttrTransform to be done before validation
      */
     public $attr_transform_pre = array();
-    
+
     /**
      * Indexed list of tag's HTMLPurifier_AttrTransform to be done after validation
      */
     public $attr_transform_post = array();
-    
+
     /**
      * HTMLPurifier_ChildDef of this tag.
      */
     public $child;
-    
+
     /**
      * Abstract string representation of internal ChildDef rules. See
      * HTMLPurifier_ContentSets for how this is parsed and then transformed
@@ -51,7 +53,7 @@ class HTMLPurifier_ElementDef
      *      being processed by HTMLDefinition
      */
     public $content_model;
-    
+
     /**
      * Value of $child->type, used to determine which ChildDef to use,
      * used in combination with $content_model.
@@ -60,23 +62,23 @@ class HTMLPurifier_ElementDef
      *      being processed by HTMLDefinition
      */
     public $content_model_type;
-    
-    
-    
+
+
+
     /**
      * Does the element have a content model (#PCDATA | Inline)*? This
-     * is important for chameleon ins and del processing in 
+     * is important for chameleon ins and del processing in
      * HTMLPurifier_ChildDef_Chameleon. Dynamically set: modules don't
      * have to worry about this one.
      */
     public $descendants_are_inline = false;
-    
+
     /**
      * List of the names of required attributes this element has. Dynamically
      * populated by HTMLPurifier_HTMLDefinition::getElement
      */
     public $required_attr = array();
-    
+
     /**
      * Lookup table of tags excluded from all descendants of this tag.
      * @note SGML permits exclusions for all descendants, but this is
@@ -89,7 +91,18 @@ class HTMLPurifier_ElementDef
      *       distinctions.
      */
     public $excludes = array();
-    
+
+    /**
+     * This tag is explicitly auto-closed by the following tags.
+     */
+    public $autoclose = array();
+
+    /**
+     * Whether or not this is a formatting element affected by the
+     * "Active Formatting Elements" algorithm.
+     */
+    public $formatting;
+
     /**
      * Low-level factory constructor for creating new standalone element defs
      */
@@ -100,14 +113,14 @@ class HTMLPurifier_ElementDef
         $def->attr = $attr;
         return $def;
     }
-    
+
     /**
      * Merges the values of another element definition into this one.
      * Values from the new element def take precedence if a value is
      * not mergeable.
      */
     public function mergeIn($def) {
-        
+
         // later keys takes precedence
         foreach($def->attr as $k => $v) {
             if ($k === 0) {
@@ -127,7 +140,7 @@ class HTMLPurifier_ElementDef
         $this->_mergeAssocArray($this->attr_transform_pre, $def->attr_transform_pre);
         $this->_mergeAssocArray($this->attr_transform_post, $def->attr_transform_post);
         $this->_mergeAssocArray($this->excludes, $def->excludes);
-        
+
         if(!empty($def->content_model)) {
             $this->content_model .= ' | ' . $def->content_model;
             $this->child = false;
@@ -137,10 +150,11 @@ class HTMLPurifier_ElementDef
             $this->child = false;
         }
         if(!is_null($def->child)) $this->child = $def->child;
+        if(!is_null($def->formatting)) $this->formatting = $def->formatting;
         if($def->descendants_are_inline) $this->descendants_are_inline = $def->descendants_are_inline;
-        
+
     }
-    
+
     /**
      * Merges one array into another, removes values which equal false
      * @param $a1 Array by reference that is merged into
@@ -155,7 +169,7 @@ class HTMLPurifier_ElementDef
             $a1[$k] = $v;
         }
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index c2df31325433d37f4e8f9ae91185cef08f1a2ff2..79a42d26ec3cd70b4f5c816ab779a894b881cb10 100644 (file)
@@ -6,31 +6,31 @@
  */
 class HTMLPurifier_Encoder
 {
-    
+
     /**
      * Constructor throws fatal error if you attempt to instantiate class
      */
     private function __construct() {
         trigger_error('Cannot instantiate encoder, call methods statically', E_USER_ERROR);
     }
-    
+
     /**
      * Error-handler that mutes errors, alternative to shut-up operator.
      */
     private static function muteErrorHandler() {}
-    
+
     /**
      * Cleans a UTF-8 string for well-formedness and SGML validity
-     * 
+     *
      * It will parse according to UTF-8 and return a valid UTF8 string, with
      * non-SGML codepoints excluded.
-     * 
+     *
      * @note Just for reference, the non-SGML code points are 0 to 31 and
      *       127 to 159, inclusive.  However, we allow code points 9, 10
      *       and 13, which are the tab, line feed and carriage return
      *       respectively. 128 and above the code points map to multibyte
      *       UTF-8 representations.
-     * 
+     *
      * @note Fallback code adapted from utf8ToUnicode by Henri Sivonen and
      *       hsivonen@iki.fi at <http://iki.fi/hsivonen/php-utf8/> under the
      *       LGPL license.  Notes on what changed are inside, but in general,
@@ -45,7 +45,7 @@ class HTMLPurifier_Encoder
      *       Once again, PHP 6 should solve all our problems.
      */
     public static function cleanUTF8($str, $force_php = false) {
-        
+
         // UTF-8 validity is checked since PHP 4.3.5
         // This is an optimization: if the string is already valid UTF-8, no
         // need to do PHP stuff. 99% of the time, this will be the case.
@@ -54,31 +54,31 @@ class HTMLPurifier_Encoder
         if (preg_match('/^[\x{9}\x{A}\x{D}\x{20}-\x{7E}\x{A0}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]*$/Du', $str)) {
             return $str;
         }
-        
+
         $mState = 0; // cached expected number of octets after the current octet
                      // until the beginning of the next UTF8 character sequence
         $mUcs4  = 0; // cached Unicode character
         $mBytes = 1; // cached expected number of octets in the current sequence
-        
+
         // original code involved an $out that was an array of Unicode
         // codepoints.  Instead of having to convert back into UTF-8, we've
         // decided to directly append valid UTF-8 characters onto a string
         // $out once they're done.  $char accumulates raw bytes, while $mUcs4
         // turns into the Unicode code point, so there's some redundancy.
-        
+
         $out = '';
         $char = '';
-        
+
         $len = strlen($str);
         for($i = 0; $i < $len; $i++) {
             $in = ord($str{$i});
             $char .= $str[$i]; // append byte to char
             if (0 == $mState) {
-                // When mState is zero we expect either a US-ASCII character 
+                // When mState is zero we expect either a US-ASCII character
                 // or a multi-octet sequence.
                 if (0 == (0x80 & ($in))) {
                     // US-ASCII, pass straight through.
-                    if (($in <= 31 || $in == 127) && 
+                    if (($in <= 31 || $in == 127) &&
                         !($in == 9 || $in == 13 || $in == 10) // save \r\t\n
                     ) {
                         // control characters, remove
@@ -108,12 +108,12 @@ class HTMLPurifier_Encoder
                     $mBytes = 4;
                 } elseif (0xF8 == (0xFC & ($in))) {
                     // First octet of 5 octet sequence.
-                    // 
-                    // This is illegal because the encoded codepoint must be 
+                    //
+                    // This is illegal because the encoded codepoint must be
                     // either:
                     // (a) not the shortest form or
                     // (b) outside the Unicode range of 0-0x10FFFF.
-                    // Rather than trying to resynchronize, we will carry on 
+                    // Rather than trying to resynchronize, we will carry on
                     // until the end of the sequence and let the later error
                     // handling code catch it.
                     $mUcs4 = ($in);
@@ -128,7 +128,7 @@ class HTMLPurifier_Encoder
                     $mState = 5;
                     $mBytes = 6;
                 } else {
-                    // Current octet is neither in the US-ASCII range nor a 
+                    // Current octet is neither in the US-ASCII range nor a
                     // legal first octet of a multi-octet sequence.
                     $mState = 0;
                     $mUcs4  = 0;
@@ -144,13 +144,13 @@ class HTMLPurifier_Encoder
                     $tmp = $in;
                     $tmp = ($tmp & 0x0000003F) << $shift;
                     $mUcs4 |= $tmp;
-                    
+
                     if (0 == --$mState) {
                         // End of the multi-octet sequence. mUcs4 now contains
                         // the final Unicode codepoint to be output
-                        
+
                         // Check for illegal sequences and codepoints.
-                        
+
                         // From Unicode 3.1, non-shortest form is illegal
                         if (((2 == $mBytes) && ($mUcs4 < 0x0080)) ||
                             ((3 == $mBytes) && ($mUcs4 < 0x0800)) ||
@@ -161,7 +161,7 @@ class HTMLPurifier_Encoder
                             // Codepoints outside the Unicode range are illegal
                             ($mUcs4 > 0x10FFFF)
                         ) {
-                            
+
                         } elseif (0xFEFF != $mUcs4 && // omit BOM
                             // check for valid Char unicode codepoints
                             (
@@ -196,7 +196,7 @@ class HTMLPurifier_Encoder
         }
         return $out;
     }
-    
+
     /**
      * Translates a Unicode codepoint into its corresponding UTF-8 character.
      * @note Based on Feyd's function at
@@ -209,7 +209,7 @@ class HTMLPurifier_Encoder
      *       maintenance/generate-entity-file.php (although this is superior,
      *       due to its sanity checks).
      */
-    
+
     // +----------+----------+----------+----------+
     // | 33222222 | 22221111 | 111111   |          |
     // | 10987654 | 32109876 | 54321098 | 76543210 | bit
@@ -221,17 +221,17 @@ class HTMLPurifier_Encoder
     // +----------+----------+----------+----------+
     // | 00000000 | 00011111 | 11111111 | 11111111 | Theoretical upper limit of legal scalars: 2097151 (0x001FFFFF)
     // | 00000000 | 00010000 | 11111111 | 11111111 | Defined upper limit of legal scalar codes
-    // +----------+----------+----------+----------+ 
-    
+    // +----------+----------+----------+----------+
+
     public static function unichr($code) {
         if($code > 1114111 or $code < 0 or
           ($code >= 55296 and $code <= 57343) ) {
             // bits are set outside the "valid" range as defined
-            // by UNICODE 4.1.0 
+            // by UNICODE 4.1.0
             return '';
         }
-        
-        $x = $y = $z = $w = 0; 
+
+        $x = $y = $z = $w = 0;
         if ($code < 128) {
             // regular ASCII character
             $x = $code;
@@ -248,18 +248,18 @@ class HTMLPurifier_Encoder
                     $z = (($code >> 12) & 63) | 128;
                     $w = (($code >> 18) & 7)  | 240;
                 }
-            } 
+            }
         }
         // set up the actual character
         $ret = '';
         if($w) $ret .= chr($w);
         if($z) $ret .= chr($z);
         if($y) $ret .= chr($y);
-        $ret .= chr($x); 
-        
+        $ret .= chr($x);
+
         return $ret;
     }
-    
+
     /**
      * Converts a string to UTF-8 based on configuration.
      */
@@ -290,7 +290,7 @@ class HTMLPurifier_Encoder
         }
         trigger_error('Encoding not supported, please install iconv', E_USER_ERROR);
     }
-    
+
     /**
      * Converts a string from UTF-8 based on configuration.
      * @note Currently, this is a lossy conversion, with unexpressable
@@ -325,7 +325,7 @@ class HTMLPurifier_Encoder
         }
         trigger_error('Encoding not supported', E_USER_ERROR);
     }
-    
+
     /**
      * Lossless (character-wise) conversion of HTML to ASCII
      * @param $str UTF-8 string to be converted to ASCII
@@ -372,13 +372,13 @@ class HTMLPurifier_Encoder
         }
         return $result;
     }
-    
+
     /**
      * This expensive function tests whether or not a given character
      * encoding supports ASCII. 7/8-bit encodings like Shift_JIS will
      * fail this test, and require special processing. Variable width
      * encodings shouldn't ever fail.
-     * 
+     *
      * @param string $encoding Encoding name to test, as per iconv format
      * @param bool $bypass Whether or not to bypass the precompiled arrays.
      * @return Array of UTF-8 characters to their corresponding ASCII,
@@ -401,8 +401,14 @@ class HTMLPurifier_Encoder
         set_error_handler(array('HTMLPurifier_Encoder', 'muteErrorHandler'));
         if (iconv('UTF-8', $encoding, 'a') === false) return false;
         for ($i = 0x20; $i <= 0x7E; $i++) { // all printable ASCII chars
-            $c = chr($i);
-            if (iconv('UTF-8', "$encoding//IGNORE", $c) === '') {
+            $c = chr($i); // UTF-8 char
+            $r = iconv('UTF-8', "$encoding//IGNORE", $c); // initial conversion
+            if (
+                $r === '' ||
+                // This line is needed for iconv implementations that do not
+                // omit characters that do not exist in the target character set
+                ($r === $c && iconv($encoding, 'UTF-8//IGNORE', $r) !== $c)
+            ) {
                 // Reverse engineer: what's the UTF-8 equiv of this byte
                 // sequence? This assumes that there's no variable width
                 // encoding that doesn't support ASCII.
@@ -413,7 +419,8 @@ class HTMLPurifier_Encoder
         $encodings[$encoding] = $ret;
         return $ret;
     }
-    
-    
+
+
 }
 
+// vim: et sw=4 sts=4
index f9252a2ea524ccb8ece1297075144103c105da8d..b4dfce94c3852a21162e588e69b87e4062af23a8 100644 (file)
@@ -4,12 +4,12 @@
  * Object that provides entity lookup table from entity name to character
  */
 class HTMLPurifier_EntityLookup {
-    
+
     /**
      * Assoc array of entity name to character represented.
      */
     public $table;
-    
+
     /**
      * Sets up the entity lookup table from the serialized file contents.
      * @note The serialized contents are versioned, but were generated
@@ -22,7 +22,7 @@ class HTMLPurifier_EntityLookup {
         }
         $this->table = unserialize(file_get_contents($file));
     }
-    
+
     /**
      * Retrieves sole instance of the object.
      * @param Optional prototype of custom lookup table to overload with.
@@ -38,6 +38,7 @@ class HTMLPurifier_EntityLookup {
         }
         return $instance;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index cb4c5082ef7d3b4398d63758a6a3c944531c8086..8c384472dc6c12ee507c396f12bdf1722c00646a 100644 (file)
@@ -9,20 +9,20 @@
  */
 class HTMLPurifier_EntityParser
 {
-    
+
     /**
      * Reference to entity lookup table.
      */
     protected $_entity_lookup;
-    
+
     /**
      * Callback regex string for parsing entities.
-     */                             
+     */
     protected $_substituteEntitiesRegex =
 '/&(?:[#]x([a-fA-F0-9]+)|[#]0*(\d+)|([A-Za-z_:][A-Za-z0-9.\-_:]*));?/';
 //     1. hex             2. dec      3. string (XML style)
-    
-    
+
+
     /**
      * Decimal to parsed string conversion table for special entities.
      */
@@ -34,7 +34,7 @@ class HTMLPurifier_EntityParser
                     60 => '<',
                     62 => '>'
             );
-    
+
     /**
      * Stripped entity names to decimal conversion table for special entities.
      */
@@ -45,12 +45,12 @@ class HTMLPurifier_EntityParser
                     'lt'   => 60,
                     'gt'   => 62
             );
-    
+
     /**
      * Substitutes non-special entities with their parsed equivalents. Since
      * running this whenever you have parsed character is t3h 5uck, we run
      * it before everything else.
-     * 
+     *
      * @param $string String to have non-special entities parsed.
      * @returns Parsed string.
      */
@@ -62,16 +62,16 @@ class HTMLPurifier_EntityParser
             $string
             );
     }
-    
+
     /**
      * Callback function for substituteNonSpecialEntities() that does the work.
-     * 
+     *
      * @param $matches  PCRE matches array, with 0 the entire match, and
      *                  either index 1, 2 or 3 set with a hex value, dec value,
      *                  or string (respectively).
      * @returns Replacement string.
      */
-    
+
     protected function nonSpecialEntityCallback($matches) {
         // replaces all but big five
         $entity = $matches[0];
@@ -79,10 +79,10 @@ class HTMLPurifier_EntityParser
         if ($is_num) {
             $is_hex = (@$entity[2] === 'x');
             $code = $is_hex ? hexdec($matches[1]) : (int) $matches[2];
-            
+
             // abort for special characters
             if (isset($this->_special_dec2str[$code]))  return $entity;
-            
+
             return HTMLPurifier_Encoder::unichr($code);
         } else {
             if (isset($this->_special_ent2dec[$matches[3]])) return $entity;
@@ -96,13 +96,13 @@ class HTMLPurifier_EntityParser
             }
         }
     }
-    
+
     /**
      * Substitutes only special entities with their parsed equivalents.
-     * 
+     *
      * @notice We try to avoid calling this function because otherwise, it
      * would have to be called a lot (for every parsed section).
-     * 
+     *
      * @param $string String to have non-special entities parsed.
      * @returns Parsed string.
      */
@@ -112,12 +112,12 @@ class HTMLPurifier_EntityParser
             array($this, 'specialEntityCallback'),
             $string);
     }
-    
+
     /**
      * Callback function for substituteSpecialEntities() that does the work.
-     * 
+     *
      * This callback has same syntax as nonSpecialEntityCallback().
-     * 
+     *
      * @param $matches  PCRE-style matches array, with 0 the entire match, and
      *                  either index 1, 2 or 3 set with a hex value, dec value,
      *                  or string (respectively).
@@ -138,6 +138,7 @@ class HTMLPurifier_EntityParser
                 $entity;
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 16cc89c67e09b8f30b31b1ce7e60ea581d74d419..6713eaf77309c1a9a6b5e3297899b92b01ae12e2 100644 (file)
@@ -6,7 +6,7 @@
  */
 class HTMLPurifier_ErrorCollector
 {
-    
+
     /**
      * Identifiers for the returned error array. These are purposely numeric
      * so list() can be used.
@@ -15,23 +15,23 @@ class HTMLPurifier_ErrorCollector
     const SEVERITY = 1;
     const MESSAGE  = 2;
     const CHILDREN = 3;
-    
+
     protected $errors;
     protected $_current;
     protected $_stacks = array(array());
     protected $locale;
     protected $generator;
     protected $context;
-    
+
     protected $lines = array();
-    
+
     public function __construct($context) {
         $this->locale    =& $context->get('Locale');
         $this->context   = $context;
         $this->_current  =& $this->_stacks[0];
         $this->errors    =& $this->_stacks[0];
     }
-    
+
     /**
      * Sends an error message to the collector for later use
      * @param $severity int Error severity, PHP error style (don't use E_USER_)
@@ -40,19 +40,19 @@ class HTMLPurifier_ErrorCollector
      * @param $subst2 string ...
      */
     public function send($severity, $msg) {
-        
+
         $args = array();
         if (func_num_args() > 2) {
             $args = func_get_args();
             array_shift($args);
             unset($args[0]);
         }
-        
+
         $token = $this->context->get('CurrentToken', true);
         $line  = $token ? $token->line : $this->context->get('CurrentLine', true);
         $col   = $token ? $token->col  : $this->context->get('CurrentCol',  true);
         $attr  = $this->context->get('CurrentAttr', true);
-        
+
         // perform special substitutions, also add custom parameters
         $subst = array();
         if (!is_null($token)) {
@@ -62,15 +62,15 @@ class HTMLPurifier_ErrorCollector
             $subst['$CurrentAttr.Name'] = $attr;
             if (isset($token->attr[$attr])) $subst['$CurrentAttr.Value'] = $token->attr[$attr];
         }
-        
+
         if (empty($args)) {
             $msg = $this->locale->getMessage($msg);
         } else {
             $msg = $this->locale->formatMessage($msg, $args);
         }
-        
+
         if (!empty($subst)) $msg = strtr($msg, $subst);
-        
+
         // (numerically indexed)
         $error = array(
             self::LINENO   => $line,
@@ -79,10 +79,10 @@ class HTMLPurifier_ErrorCollector
             self::CHILDREN => array()
         );
         $this->_current[] = $error;
-        
-        
+
+
         // NEW CODE BELOW ...
-        
+
         $struct = null;
         // Top-level errors are either:
         //  TOKEN type, if $value is set appropriately, or
@@ -106,7 +106,7 @@ class HTMLPurifier_ErrorCollector
             }
         }
         ksort($this->lines, SORT_NUMERIC);
-        
+
         // Now, check if we need to operate on a lower structure
         if (!empty($attr)) {
             $struct = $struct->getChild(HTMLPurifier_ErrorStruct::ATTR, $attr);
@@ -121,11 +121,11 @@ class HTMLPurifier_ErrorCollector
                 $struct->value = array($cssprop, 'PUT VALUE HERE');
             }
         }
-        
+
         // Ok, structs are all setup, now time to register the error
         $struct->addError($severity, $msg);
     }
-    
+
     /**
      * Retrieves raw error data for custom formatter to use
      * @param List of arrays in format of array(line of error,
@@ -135,7 +135,7 @@ class HTMLPurifier_ErrorCollector
     public function getRaw() {
         return $this->errors;
     }
-    
+
     /**
      * Default HTML formatting implementation for error messages
      * @param $config Configuration array, vital for HTML output nature
@@ -143,12 +143,12 @@ class HTMLPurifier_ErrorCollector
      */
     public function getHTMLFormatted($config, $errors = null) {
         $ret = array();
-        
+
         $this->generator = new HTMLPurifier_Generator($config, $this->context);
         if ($errors === null) $errors = $this->errors;
-        
+
         // 'At line' message needs to be removed
-        
+
         // generation code for new structure goes here. It needs to be recursive.
         foreach ($this->lines as $line => $col_array) {
             if ($line == -1) continue;
@@ -159,15 +159,15 @@ class HTMLPurifier_ErrorCollector
         if (isset($this->lines[-1])) {
             $this->_renderStruct($ret, $this->lines[-1]);
         }
-        
+
         if (empty($errors)) {
             return '<p>' . $this->locale->getMessage('ErrorCollector: No errors') . '</p>';
         } else {
             return '<ul><li>' . implode('</li><li>', $ret) . '</li></ul>';
         }
-        
+
     }
-    
+
     private function _renderStruct(&$ret, $struct, $line = null, $col = null) {
         $stack = array($struct);
         $context_stack = array(array());
@@ -203,6 +203,7 @@ class HTMLPurifier_ErrorCollector
             }
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 9da712b714f322aac327fb399e3f4c316cd45024..9bc8996ec1939d6a0d1da83ec4c651e9ce00b390 100644 (file)
@@ -8,7 +8,7 @@
  */
 class HTMLPurifier_ErrorStruct
 {
-    
+
     /**
      * Possible values for $children first-key. Note that top-level structures
      * are automatically token-level.
@@ -16,12 +16,12 @@ class HTMLPurifier_ErrorStruct
     const TOKEN     = 0;
     const ATTR      = 1;
     const CSSPROP   = 2;
-    
+
     /**
      * Type of this struct.
      */
     public $type;
-    
+
     /**
      * Value of the struct we are recording errors for. There are various
      * values for this:
@@ -30,19 +30,19 @@ class HTMLPurifier_ErrorStruct
      *  - CSSPROP: array('prop-name', 'value')
      */
     public $value;
-    
+
     /**
      * Errors registered for this structure.
      */
     public $errors = array();
-    
+
     /**
      * Child ErrorStructs that are from this structure. For example, a TOKEN
      * ErrorStruct would contain ATTR ErrorStructs. This is a multi-dimensional
      * array in structure: [TYPE]['identifier']
      */
     public $children = array();
-    
+
     public function getChild($type, $id) {
         if (!isset($this->children[$type][$id])) {
             $this->children[$type][$id] = new HTMLPurifier_ErrorStruct();
@@ -50,9 +50,11 @@ class HTMLPurifier_ErrorStruct
         }
         return $this->children[$type][$id];
     }
-    
+
     public function addError($severity, $message) {
         $this->errors[] = array($severity, $message);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index d36d88e0a8aa959627b038d77bc5e5da3f5c6957..be85b4c560e04ffed27885d7dddaba6450b12059 100644 (file)
@@ -6,6 +6,7 @@
  */
 class HTMLPurifier_Exception extends Exception
 {
-    
+
 }
 
+// vim: et sw=4 sts=4
index 61b9b0d6d9744325b27990aec205d0fb81aec2df..9a0e7b09f3b90079200832695d9af51041395648 100644 (file)
@@ -2,44 +2,45 @@
 
 /**
  * Represents a pre or post processing filter on HTML Purifier's output
- * 
+ *
  * Sometimes, a little ad-hoc fixing of HTML has to be done before
  * it gets sent through HTML Purifier: you can use filters to acheive
  * this effect. For instance, YouTube videos can be preserved using
  * this manner. You could have used a decorator for this task, but
  * PHP's support for them is not terribly robust, so we're going
  * to just loop through the filters.
- * 
+ *
  * Filters should be exited first in, last out. If there are three filters,
  * named 1, 2 and 3, the order of execution should go 1->preFilter,
  * 2->preFilter, 3->preFilter, purify, 3->postFilter, 2->postFilter,
  * 1->postFilter.
- * 
+ *
  * @note Methods are not declared abstract as it is perfectly legitimate
  *       for an implementation not to want anything to happen on a step
  */
 
 class HTMLPurifier_Filter
 {
-    
+
     /**
      * Name of the filter for identification purposes
      */
     public $name;
-    
+
     /**
-     * Pre-processor function, handles HTML before HTML Purifier 
+     * Pre-processor function, handles HTML before HTML Purifier
      */
     public function preFilter($html, $config, $context) {
         return $html;
     }
-    
+
     /**
      * Post-processor function, handles HTML after HTML Purifier
      */
     public function postFilter($html, $config, $context) {
         return $html;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 438d7b79bbfdbe0397852b08323e24cb3d61de7c..970f9e0c9d4589da76b07c75252b12e3fa2e772c 100644 (file)
@@ -4,11 +4,11 @@
  * This filter extracts <style> blocks from input HTML, cleans them up
  * using CSSTidy, and then places them in $purifier->context->get('StyleBlocks')
  * so they can be used elsewhere in the document.
- * 
+ *
  * @note
  *      See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for
  *      sample usage.
- * 
+ *
  * @note
  *      This filter can also be used on stylesheets not included in the
  *      document--something purists would probably prefer. Just directly
  */
 class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
 {
-    
+
     public $name = 'ExtractStyleBlocks';
     private $_styleMatches = array();
     private $_tidy;
-    
+
     public function __construct() {
         $this->_tidy = new csstidy();
     }
-    
+
     /**
      * Save the contents of CSS blocks to style matches
      * @param $matches preg_replace style $matches array
@@ -32,7 +32,7 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
     protected function styleCallback($matches) {
         $this->_styleMatches[] = $matches[1];
     }
-    
+
     /**
      * Removes inline <style> tags from HTML, saves them for later use
      * @todo Extend to indicate non-text/css style blocks
@@ -51,7 +51,7 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
         }
         return $html;
     }
-    
+
     /**
      * Takes CSS (the stuff found in <style>) and cleans it.
      * @warning Requires CSSTidy <http://csstidy.sourceforge.net/>
@@ -129,6 +129,7 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
         }
         return $css;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index cf3d0cc2c25fb059c936526a516635f3be165ec7..aca972f6c56fb1f4fcb7b00e6e1a0c4b91aa2033 100644 (file)
@@ -2,30 +2,38 @@
 
 class HTMLPurifier_Filter_YouTube extends HTMLPurifier_Filter
 {
-    
+
     public $name = 'YouTube';
-    
+
     public function preFilter($html, $config, $context) {
         $pre_regex = '#<object[^>]+>.+?'.
             'http://www.youtube.com/v/([A-Za-z0-9\-_]+).+?</object>#s';
         $pre_replace = '<span class="youtube-embed">\1</span>';
         return preg_replace($pre_regex, $pre_replace, $html);
     }
-    
+
     public function postFilter($html, $config, $context) {
         $post_regex = '#<span class="youtube-embed">([A-Za-z0-9\-_]+)</span>#';
-        $post_replace = '<object width="425" height="350" '.
-            'data="http://www.youtube.com/v/\1">'.
-            '<param name="movie" value="http://www.youtube.com/v/\1"></param>'.
-            '<param name="wmode" value="transparent"></param>'.
+        return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
+    }
+
+    protected function armorUrl($url) {
+        return str_replace('--', '-&#45;', $url);
+    }
+
+    protected function postFilterCallback($matches) {
+        $url = $this->armorUrl($matches[1]);
+        return '<object width="425" height="350" type="application/x-shockwave-flash" '.
+            'data="http://www.youtube.com/v/'.$url.'">'.
+            '<param name="movie" value="http://www.youtube.com/v/'.$url.'"></param>'.
             '<!--[if IE]>'.
-            '<embed src="http://www.youtube.com/v/\1"'.
+            '<embed src="http://www.youtube.com/v/'.$url.'"'.
             'type="application/x-shockwave-flash"'.
             'wmode="transparent" width="425" height="350" />'.
             '<![endif]-->'.
             '</object>';
-        return preg_replace($post_regex, $post_replace, $html);
+
     }
-    
 }
 
+// vim: et sw=4 sts=4
index d4c42fbff9d1556006234cf5c6e0e922947b9faa..a1b96b9e49e59859daa21360e83b5e7f9a273c2c 100644 (file)
@@ -9,33 +9,33 @@
  */
 class HTMLPurifier_Generator
 {
-    
+
     /**
      * Whether or not generator should produce XML output
      */
     private $_xhtml = true;
-    
+
     /**
      * :HACK: Whether or not generator should comment the insides of <script> tags
      */
     private $_scriptFix = false;
-    
+
     /**
      * Cache of HTMLDefinition during HTML output to determine whether or
      * not attributes should be minimized.
      */
     private $_def;
-    
+
     /**
      * Cache of %Output.SortAttr
      */
     private $_sortAttr;
-    
+
     /**
      * Configuration for the generator
      */
     protected $config;
-    
+
     /**
      * @param $config Instance of HTMLPurifier_Config
      * @param $context Instance of HTMLPurifier_Context
@@ -47,7 +47,7 @@ class HTMLPurifier_Generator
         $this->_def = $config->getHTMLDefinition();
         $this->_xhtml = $this->_def->doctype->xml;
     }
-    
+
     /**
      * Generates HTML from an array of tokens.
      * @param $tokens Array of HTMLPurifier_Token
@@ -56,7 +56,7 @@ class HTMLPurifier_Generator
      */
     public function generateFromTokens($tokens) {
         if (!$tokens) return '';
-        
+
         // Basic algorithm
         $html = '';
         for ($i = 0, $size = count($tokens); $i < $size; $i++) {
@@ -70,7 +70,7 @@ class HTMLPurifier_Generator
             }
             $html .= $this->generateFromToken($tokens[$i]);
         }
-        
+
         // Tidy cleanup
         if (extension_loaded('tidy') && $this->config->get('Output', 'TidyFormat')) {
             $tidy = new Tidy;
@@ -84,14 +84,14 @@ class HTMLPurifier_Generator
             $tidy->cleanRepair();
             $html = (string) $tidy; // explicit cast necessary
         }
-        
+
         // Normalize newlines to system defined value
         $nl = $this->config->get('Output', 'Newline');
         if ($nl === null) $nl = PHP_EOL;
         if ($nl !== "\n") $html = str_replace("\n", $nl, $html);
         return $html;
     }
-    
+
     /**
      * Generates HTML from a single token.
      * @param $token HTMLPurifier_Token object.
@@ -101,31 +101,31 @@ class HTMLPurifier_Generator
         if (!$token instanceof HTMLPurifier_Token) {
             trigger_error('Cannot generate HTML from non-HTMLPurifier_Token object', E_USER_WARNING);
             return '';
-            
+
         } elseif ($token instanceof HTMLPurifier_Token_Start) {
             $attr = $this->generateAttributes($token->attr, $token->name);
             return '<' . $token->name . ($attr ? ' ' : '') . $attr . '>';
-            
+
         } elseif ($token instanceof HTMLPurifier_Token_End) {
             return '</' . $token->name . '>';
-            
+
         } elseif ($token instanceof HTMLPurifier_Token_Empty) {
             $attr = $this->generateAttributes($token->attr, $token->name);
              return '<' . $token->name . ($attr ? ' ' : '') . $attr .
                 ( $this->_xhtml ? ' /': '' ) // <br /> v. <br>
                 . '>';
-            
+
         } elseif ($token instanceof HTMLPurifier_Token_Text) {
             return $this->escape($token->data, ENT_NOQUOTES);
-            
+
         } elseif ($token instanceof HTMLPurifier_Token_Comment) {
             return '<!--' . $token->data . '-->';
         } else {
             return '';
-            
+
         }
     }
-    
+
     /**
      * Special case processor for the contents of script tags
      * @warning This runs into problems if there's already a literal
@@ -137,7 +137,7 @@ class HTMLPurifier_Generator
         $data = preg_replace('#//\s*$#', '', $token->data);
         return '<!--//--><![CDATA[//><!--' . "\n" . trim($data) . "\n" . '//--><!]]>';
     }
-    
+
     /**
      * Generates attribute declarations from attribute array.
      * @note This does not include the leading or trailing space.
@@ -163,7 +163,7 @@ class HTMLPurifier_Generator
         }
         return rtrim($html);
     }
-    
+
     /**
      * Escapes raw text data.
      * @todo This really ought to be protected, but until we have a facility
@@ -177,6 +177,7 @@ class HTMLPurifier_Generator
     public function escape($string, $quote = ENT_COMPAT) {
         return htmlspecialchars($string, $quote, 'UTF-8');
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index e647228c54815661b8b62c63e0b8503bb86a2dc8..3368821c74fc7ec13ca9e4f43b2c75a5d72fab28 100644 (file)
@@ -3,20 +3,20 @@
 /**
  * Definition of the purified HTML that describes allowed children,
  * attributes, and many other things.
- * 
+ *
  * Conventions:
- * 
+ *
  * All member variables that are prefixed with info
  * (including the main $info array) are used by HTML Purifier internals
  * and should not be directly edited when customizing the HTMLDefinition.
  * They can usually be set via configuration directives or custom
  * modules.
- * 
+ *
  * On the other hand, member variables without the info prefix are used
  * internally by the HTMLDefinition and MUST NOT be used by other HTML
  * Purifier internals. Many of them, however, are public, and may be
  * edited by userspace code to tweak the behavior of HTMLDefinition.
- * 
+ *
  * @note This class is inspected by Printer_HTMLDefinition; please
  *       update that class if things here change.
  *
  */
 class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
 {
-    
+
     // FULLY-PUBLIC VARIABLES ---------------------------------------------
-    
+
     /**
      * Associative array of element names to HTMLPurifier_ElementDef
      */
     public $info = array();
-    
+
     /**
      * Associative array of global attribute name to attribute definition.
      */
     public $info_global_attr = array();
-    
+
     /**
      * String name of parent element HTML will be going into.
      */
     public $info_parent = 'div';
-    
+
     /**
      * Definition for parent element, allows parent element to be a
      * tag that's not allowed inside the HTML fragment.
      */
     public $info_parent_def;
-    
+
     /**
      * String name of element used to wrap inline elements in block context
      * @note This is rarely used except for BLOCKQUOTEs in strict mode
      */
     public $info_block_wrapper = 'p';
-    
+
     /**
      * Associative array of deprecated tag name to HTMLPurifier_TagTransform
      */
     public $info_tag_transform = array();
-    
+
     /**
      * Indexed list of HTMLPurifier_AttrTransform to be performed before validation.
      */
     public $info_attr_transform_pre = array();
-    
+
     /**
      * Indexed list of HTMLPurifier_AttrTransform to be performed after validation.
      */
     public $info_attr_transform_post = array();
-    
+
     /**
      * Nested lookup array of content set name (Block, Inline) to
      * element name to whether or not it belongs in that content set.
      */
     public $info_content_sets = array();
-    
+
     /**
      * Indexed list of HTMLPurifier_Injector to be used.
      */
     public $info_injector = array();
-    
+
     /**
      * Doctype object
      */
     public $doctype;
-    
-    
-    
+
+
+
     // RAW CUSTOMIZATION STUFF --------------------------------------------
-    
+
     /**
      * Adds a custom attribute to a pre-existing element
      * @note This is strictly convenience, and does not have a corresponding
@@ -108,10 +108,10 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
         }
         $element->attr[$attr_name] = $def;
     }
-    
+
     /**
      * Adds a custom element to your HTML definition
-     * @note See HTMLPurifier_HTMLModule::addElement for detailed 
+     * @note See HTMLPurifier_HTMLModule::addElement for detailed
      *       parameter and return value descriptions.
      */
     public function addElement($element_name, $type, $contents, $attr_collections, $attributes) {
@@ -121,7 +121,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
         $element = $module->addElement($element_name, $type, $contents, $attr_collections, $attributes);
         return $element;
     }
-    
+
     /**
      * Adds a blank element to your HTML definition, for overriding
      * existing behavior
@@ -133,7 +133,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
         $element = $module->addBlankElement($element_name);
         return $element;
     }
-    
+
     /**
      * Retrieves a reference to the anonymous module, so you can
      * bust out advanced features without having to make your own
@@ -146,39 +146,39 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
         }
         return $this->_anonModule;
     }
-    
+
     private $_anonModule;
-    
-    
+
+
     // PUBLIC BUT INTERNAL VARIABLES --------------------------------------
-    
+
     public $type = 'HTML';
     public $manager; /**< Instance of HTMLPurifier_HTMLModuleManager */
-    
+
     /**
      * Performs low-cost, preliminary initialization.
      */
     public function __construct() {
         $this->manager = new HTMLPurifier_HTMLModuleManager();
     }
-    
+
     protected function doSetup($config) {
         $this->processModules($config);
         $this->setupConfigStuff($config);
         unset($this->manager);
-        
+
         // cleanup some of the element definitions
         foreach ($this->info as $k => $v) {
             unset($this->info[$k]->content_model);
             unset($this->info[$k]->content_model_type);
         }
     }
-    
+
     /**
      * Extract out the information from the manager
      */
     protected function processModules($config) {
-        
+
         if ($this->_anonModule) {
             // for user specific changes
             // this is late-loaded so we don't have to deal with PHP4
@@ -186,10 +186,10 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
             $this->manager->addModule($this->_anonModule);
             unset($this->_anonModule);
         }
-        
+
         $this->manager->setup($config);
         $this->doctype = $this->manager->doctype;
-        
+
         foreach ($this->manager->modules as $module) {
             foreach($module->info_tag_transform as $k => $v) {
                 if ($v === false) unset($this->info_tag_transform[$k]);
@@ -208,17 +208,17 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                 else $this->info_injector[$k] = $v;
             }
         }
-        
+
         $this->info = $this->manager->getElements();
         $this->info_content_sets = $this->manager->contentSets->lookup;
-        
+
     }
-    
+
     /**
      * Sets up stuff based on config. We need a better way of doing this.
      */
     protected function setupConfigStuff($config) {
-        
+
         $block_wrapper = $config->get('HTML', 'BlockWrapper');
         if (isset($this->info_content_sets['Block'][$block_wrapper])) {
             $this->info_block_wrapper = $block_wrapper;
@@ -226,7 +226,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
             trigger_error('Cannot use non-block element as block wrapper',
                 E_USER_ERROR);
         }
-        
+
         $parent = $config->get('HTML', 'Parent');
         $def = $this->manager->getElement($parent, true);
         if ($def) {
@@ -237,23 +237,23 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                 E_USER_ERROR);
             $this->info_parent_def = $this->manager->getElement($this->info_parent, true);
         }
-        
+
         // support template text
         $support = "(for information on implementing this, see the ".
                    "support forums) ";
-        
+
         // setup allowed elements -----------------------------------------
-        
+
         $allowed_elements = $config->get('HTML', 'AllowedElements');
         $allowed_attributes = $config->get('HTML', 'AllowedAttributes'); // retrieve early
-        
+
         if (!is_array($allowed_elements) && !is_array($allowed_attributes)) {
             $allowed = $config->get('HTML', 'Allowed');
             if (is_string($allowed)) {
                 list($allowed_elements, $allowed_attributes) = $this->parseTinyMCEAllowedList($allowed);
             }
         }
-        
+
         if (is_array($allowed_elements)) {
             foreach ($this->info as $name => $d) {
                 if(!isset($allowed_elements[$name])) unset($this->info[$name]);
@@ -265,12 +265,12 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                 trigger_error("Element '$element' is not supported $support", E_USER_WARNING);
             }
         }
-        
+
         // setup allowed attributes ---------------------------------------
-        
+
         $allowed_attributes_mutable = $allowed_attributes; // by copy!
         if (is_array($allowed_attributes)) {
-            
+
             // This actually doesn't do anything, since we went away from
             // global attributes. It's possible that userland code uses
             // it, but HTMLModuleManager doesn't!
@@ -287,7 +287,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                 }
                 if ($delete) unset($this->info_global_attr[$attr]);
             }
-            
+
             foreach ($this->info as $tag => $info) {
                 foreach ($info->attr as $attr => $x) {
                     $keys = array("$tag@$attr", $attr, "*@$attr", "$tag.$attr", "*.$attr");
@@ -329,14 +329,14 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                         break;
                 }
             }
-            
+
         }
-        
+
         // setup forbidden elements ---------------------------------------
-        
+
         $forbidden_elements   = $config->get('HTML', 'ForbiddenElements');
         $forbidden_attributes = $config->get('HTML', 'ForbiddenAttributes');
-        
+
         foreach ($this->info as $tag => $info) {
             if (isset($forbidden_elements[$tag])) {
                 unset($this->info[$tag]);
@@ -364,7 +364,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                 trigger_error("Error with $key: *.attr syntax not supported for HTML.ForbiddenAttributes; use attr instead", E_USER_WARNING);
             }
         }
-        
+
         // setup injectors -----------------------------------------------------
         foreach ($this->info_injector as $i => $injector) {
             if ($injector->checkNeeded($config) !== false) {
@@ -374,7 +374,7 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
             }
         }
     }
-    
+
     /**
      * Parses a TinyMCE-flavored Allowed Elements and Attributes list into
      * separate lists for processing. Format is element[attr1|attr2],element2...
@@ -385,12 +385,12 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
      * @todo Give this its own class, probably static interface
      */
     public function parseTinyMCEAllowedList($list) {
-        
+
         $list = str_replace(array(' ', "\t"), '', $list);
-        
+
         $elements = array();
         $attributes = array();
-        
+
         $chunks = preg_split('/(,|[\n\r]+)/', $list);
         foreach ($chunks as $chunk) {
             if (empty($chunk)) continue;
@@ -409,12 +409,12 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition
                 $attributes["$element.$key"] = true;
             }
         }
-        
+
         return array($elements, $attributes);
-        
+
     }
-    
-    
-}
 
 
+}
+
+// vim: et sw=4 sts=4
index 22af15469018edf22dea6172384d632dbaa9ef0e..072cf68084aff232148e8416ffdfda993d89011d 100644 (file)
 
 class HTMLPurifier_HTMLModule
 {
-    
+
     // -- Overloadable ----------------------------------------------------
-    
+
     /**
      * Short unique string identifier of the module
      */
     public $name;
-    
+
     /**
      * Informally, a list of elements this module changes. Not used in
      * any significant way.
      */
     public $elements = array();
-    
+
     /**
      * Associative array of element names to element definitions.
      * Some definitions may be incomplete, to be merged in later
      * with the full definition.
      */
     public $info = array();
-    
+
     /**
      * Associative array of content set names to content set additions.
      * This is commonly used to, say, add an A element to the Inline
@@ -45,7 +45,7 @@ class HTMLPurifier_HTMLModule
      * and NOT info_content_sets member variable of HTMLDefinition.
      */
     public $content_sets = array();
-    
+
     /**
      * Associative array of attribute collection names to attribute
      * collection additions. More rarely used for adding attributes to
@@ -55,22 +55,22 @@ class HTMLPurifier_HTMLModule
      * with extra behavior associated with it.
      */
     public $attr_collections = array();
-    
+
     /**
      * Associative array of deprecated tag name to HTMLPurifier_TagTransform
      */
     public $info_tag_transform = array();
-    
+
     /**
      * List of HTMLPurifier_AttrTransform to be performed before validation.
      */
     public $info_attr_transform_pre = array();
-    
+
     /**
      * List of HTMLPurifier_AttrTransform to be performed after validation.
      */
     public $info_attr_transform_post = array();
-    
+
     /**
      * List of HTMLPurifier_Injector to be performed during well-formedness fixing.
      * An injector will only be invoked if all of it's pre-requisites are met;
@@ -78,7 +78,7 @@ class HTMLPurifier_HTMLModule
      * silently disabled.
      */
     public $info_injector = array();
-    
+
     /**
      * Boolean flag that indicates whether or not getChildDef is implemented.
      * For optimization reasons: may save a call to a function. Be sure
@@ -86,23 +86,23 @@ class HTMLPurifier_HTMLModule
      * no effect!
      */
     public $defines_child_def = false;
-    
+
     /**
      * Boolean flag whether or not this module is safe. If it is not safe, all
      * of its members are unsafe. Modules are safe by default (this might be
      * slightly dangerous, but it doesn't make much sense to force HTML Purifier,
      * which is based off of safe HTML, to explicitly say, "This is safe," even
      * though there are modules which are "unsafe")
-     * 
+     *
      * @note Previously, safety could be applied at an element level granularity.
      *       We've removed this ability, so in order to add "unsafe" elements
      *       or attributes, a dedicated module with this property set to false
      *       must be used.
      */
     public $safe = true;
-    
+
     /**
-     * Retrieves a proper HTMLPurifier_ChildDef subclass based on 
+     * Retrieves a proper HTMLPurifier_ChildDef subclass based on
      * content_model and content_model_type member variables of
      * the HTMLPurifier_ElementDef class. There is a similar function
      * in HTMLPurifier_HTMLDefinition.
@@ -110,9 +110,9 @@ class HTMLPurifier_HTMLModule
      * @return HTMLPurifier_ChildDef subclass
      */
     public function getChildDef($def) {return false;}
-    
+
     // -- Convenience -----------------------------------------------------
-    
+
     /**
      * Convenience function that sets up a new element
      * @param $element Name of element to add
@@ -124,7 +124,7 @@ class HTMLPurifier_HTMLModule
      *              element?
      * @param $attr What unique attributes does the element define?
      * @note See ElementDef for in-depth descriptions of these parameters.
-     * @return Created element definition object, so you 
+     * @return Created element definition object, so you
      *         can set advanced parameters
      */
     public function addElement($element, $type, $contents, $attr_includes = array(), $attr = array()) {
@@ -143,7 +143,7 @@ class HTMLPurifier_HTMLModule
         if (!is_string($contents)) $this->info[$element]->child = $contents;
         return $this->info[$element];
     }
-    
+
     /**
      * Convenience function that creates a totally blank, non-standalone
      * element.
@@ -160,7 +160,7 @@ class HTMLPurifier_HTMLModule
         }
         return $this->info[$element];
     }
-    
+
     /**
      * Convenience function that registers an element to a content set
      * @param Element to register
@@ -172,7 +172,7 @@ class HTMLPurifier_HTMLModule
         else $this->content_sets[$type] .= ' | ';
         $this->content_sets[$type] .= $element;
     }
-    
+
     /**
      * Convenience function that transforms single-string contents
      * into separate content model and content model type
@@ -198,7 +198,7 @@ class HTMLPurifier_HTMLModule
         $content_model = trim($content_model);
         return array($content_model_type, $content_model);
     }
-    
+
     /**
      * Convenience function that merges a list of attribute includes into
      * an attribute array.
@@ -212,7 +212,7 @@ class HTMLPurifier_HTMLModule
         }
         $attr[0] = $attr_includes;
     }
-    
+
     /**
      * Convenience function that generates a lookup table with boolean
      * true as value.
@@ -230,7 +230,7 @@ class HTMLPurifier_HTMLModule
         }
         return $ret;
     }
-    
+
     /**
      * Lazy load construction of the module after determining whether
      * or not it's needed, and also when a finalized configuration object
@@ -238,6 +238,7 @@ class HTMLPurifier_HTMLModule
      * @param $config Instance of HTMLPurifier_Config
      */
     public function setup($config) {}
-    
+
 }
 
+// vim: et sw=4 sts=4
index 0d643e8172f878bd83effc3e1746172fd30d8e3a..3d66f1b4e124681986fff442250006ab874dd009 100644 (file)
@@ -6,12 +6,12 @@
  */
 class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Bdo';
     public $attr_collections = array(
         'I18N' => array('dir' => false)
     );
-    
+
     public function setup($config) {
         $bdo = $this->addElement(
             'bdo', 'Inline', 'Inline', array('Core', 'Lang'),
@@ -22,9 +22,10 @@ class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
             )
         );
         $bdo->attr_transform_post['required-dir'] = new HTMLPurifier_AttrTransform_BdoDir();
-        
+
         $this->attr_collections['I18N']['dir'] = 'Enum#ltr,rtl';
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index dd1bcaf2d7b87da4d9c4a217f058b9e24e11411f..fdf7b323993dad10d5d0a72b1c8966f59a4ad234 100644 (file)
@@ -3,7 +3,7 @@
 class HTMLPurifier_HTMLModule_CommonAttributes extends HTMLPurifier_HTMLModule
 {
     public $name = 'CommonAttributes';
-    
+
     public $attr_collections = array(
         'Core' => array(
             0 => array('Style'),
@@ -22,3 +22,4 @@ class HTMLPurifier_HTMLModule_CommonAttributes extends HTMLPurifier_HTMLModule
     );
 }
 
+// vim: et sw=4 sts=4
index 157fca16d7ca7454640ac6f20bf3a4c9012059a4..ff93690555fc76ce60c598d7e18df0c53dc5afc3 100644 (file)
@@ -6,9 +6,9 @@
  */
 class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Edit';
-    
+
     public function setup($config) {
         $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
         $attr = array(
@@ -18,20 +18,21 @@ class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
         $this->addElement('del', 'Inline', $contents, 'Common', $attr);
         $this->addElement('ins', 'Inline', $contents, 'Common', $attr);
     }
-    
+
     // HTML 4.01 specifies that ins/del must not contain block
     // elements when used in an inline context, chameleon is
     // a complicated workaround to acheive this effect
-    
+
     // Inline context ! Block context (exclamation mark is
     // separator, see getChildDef for parsing)
-    
+
     public $defines_child_def = true;
     public function getChildDef($def) {
         if ($def->content_model_type != 'chameleon') return false;
         $value = explode('!', $def->content_model);
         return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 6a2dc69a823127c06bd10a62694469b779a793ab..44c22f6f8b53283d5bc2a28608d5b997d9cb2fb1 100644 (file)
@@ -7,12 +7,12 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
 {
     public $name = 'Forms';
     public $safe = false;
-    
+
     public $content_sets = array(
         'Block' => 'Form',
         'Inline' => 'Formctrl',
     );
-    
+
     public function setup($config) {
         $form = $this->addElement('form', 'Form',
           'Required: Heading | List | Block | fieldset', 'Common', array(
@@ -24,7 +24,7 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
             'enctype' => 'Enum#application/x-www-form-urlencoded,multipart/form-data',
         ));
         $form->excludes = array('form' => true);
-        
+
         $input = $this->addElement('input', 'Formctrl', 'Empty', 'Common', array(
             'accept' => 'ContentTypes',
             'accesskey' => 'Character',
@@ -41,7 +41,7 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
             'value' => 'CDATA',
         ));
         $input->attr_transform_post[] = new HTMLPurifier_AttrTransform_Input();
-        
+
         $this->addElement('select', 'Formctrl', 'Required: optgroup | option', 'Common', array(
             'disabled' => 'Bool#disabled',
             'multiple' => 'Bool#multiple',
@@ -49,7 +49,7 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
             'size' => 'Number',
             'tabindex' => 'Number',
         ));
-        
+
         $this->addElement('option', false, 'Optional: #PCDATA', 'Common', array(
             'disabled' => 'Bool#disabled',
             'label' => 'Text',
@@ -59,7 +59,7 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
         // It's illegal for there to be more than one selected, but not
         // be multiple. Also, no selected means undefined behavior. This might
         // be difficult to implement; perhaps an injector, or a context variable.
-        
+
         $textarea = $this->addElement('textarea', 'Formctrl', 'Optional: #PCDATA', 'Common', array(
             'accesskey' => 'Character',
             'cols*' => 'Number',
@@ -70,7 +70,7 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
             'tabindex' => 'Number',
         ));
         $textarea->attr_transform_pre[] = new HTMLPurifier_AttrTransform_Textarea();
-        
+
         $button = $this->addElement('button', 'Formctrl', 'Optional: #PCDATA | Heading | List | Block | Inline', 'Common', array(
             'accesskey' => 'Character',
             'disabled' => 'Bool#disabled',
@@ -79,39 +79,40 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
             'type' => 'Enum#button,submit,reset',
             'value' => 'CDATA',
         ));
-        
+
         // For exclusions, ideally we'd specify content sets, not literal elements
         $button->excludes = $this->makeLookup(
             'form', 'fieldset', // Form
             'input', 'select', 'textarea', 'label', 'button', // Formctrl
             'a' // as per HTML 4.01 spec, this is omitted by modularization
         );
-        
+
         // Extra exclusion: img usemap="" is not permitted within this element.
         // We'll omit this for now, since we don't have any good way of
         // indicating it yet.
-        
+
         // This is HIGHLY user-unfriendly; we need a custom child-def for this
         $this->addElement('fieldset', 'Form', 'Custom: (#WS?,legend,(Flow|#PCDATA)*)', 'Common');
-        
+
         $label = $this->addElement('label', 'Formctrl', 'Optional: #PCDATA | Inline', 'Common', array(
             'accesskey' => 'Character',
             // 'for' => 'IDREF', // IDREF not implemented, cannot allow
         ));
         $label->excludes = array('label' => true);
-        
+
         $this->addElement('legend', false, 'Optional: #PCDATA | Inline', 'Common', array(
             'accesskey' => 'Character',
         ));
-        
+
         $this->addElement('optgroup', false, 'Required: option', 'Common', array(
             'disabled' => 'Bool#disabled',
             'label*' => 'Text',
         ));
-        
+
         // Don't forget an injector for <isindex>. This one's a little complex
         // because it maps to multiple elements.
-        
+
     }
 }
 
+// vim: et sw=4 sts=4
index 4451f2bbc7f7c910b1c408198d8042f49aecf8b3..d7e9bdd27ee1814fe8fc054707ea4779608b6ad7 100644 (file)
@@ -5,9 +5,9 @@
  */
 class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Hypertext';
-    
+
     public function setup($config) {
         $a = $this->addElement(
             'a', 'Inline', 'Inline', 'Common',
@@ -22,8 +22,10 @@ class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
                 // 'type' => 'ContentType',
             )
         );
+        $a->formatting = true;
         $a->excludes = array('a' => true);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 7a80e3271627ad18300a154a6d1ad3b05804cc66..e6ed53aea21bb7eaed7fafef49a5776b4c6bbf73 100644 (file)
@@ -7,9 +7,9 @@
  */
 class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Image';
-    
+
     public function setup($config) {
         $max = $config->get('HTML', 'MaxImgLength');
         $img = $this->addElement(
@@ -20,7 +20,7 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
                 // be abused, so we allow only Pixels.
                 'height' => 'Pixels#' . $max,
                 'width'  => 'Pixels#' . $max,
-                'longdesc' => 'URI', 
+                'longdesc' => 'URI',
                 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded
             )
         );
@@ -28,12 +28,13 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
             $img->attr['height'] =
             $img->attr['width'] = 'Length';
         }
-        
+
         // kind of strange, but splitting things up would be inefficient
         $img->attr_transform_pre[] =
         $img->attr_transform_post[] =
             new HTMLPurifier_AttrTransform_ImgRequired();
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index dd1f04e000e58609ed35433b59c7f72edd2afa38..df33927ba6b27d6e7f0151545bd3a9cda929eb60 100644 (file)
@@ -1,14 +1,14 @@
 <?php
 
 /**
- * XHTML 1.1 Legacy module defines elements that were previously 
+ * XHTML 1.1 Legacy module defines elements that were previously
  * deprecated.
- * 
+ *
  * @note Not all legacy elements have been implemented yet, which
  *       is a bit of a reverse problem as compared to browsers! In
  *       addition, this legacy module may implement a bit more than
  *       mandated by XHTML 1.1.
- * 
+ *
  * This module can be used in combination with TransformToStrict in order
  * to transform as many deprecated elements as possible, but retain
  * questionably deprecated elements that do not have good alternatives
 
 class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Legacy';
-    
+
     public function setup($config) {
-        
+
         $this->addElement('basefont', 'Inline', 'Empty', false, array(
             'color' => 'Color',
             'face' => 'Text', // extremely broad, we should
@@ -41,96 +41,103 @@ class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
         $this->addElement('menu', 'Block', 'Required: li', 'Common', array(
             'compact' => 'Bool#compact'
         ));
-        $this->addElement('s', 'Inline', 'Inline', 'Common');
-        $this->addElement('strike', 'Inline', 'Inline', 'Common');
-        $this->addElement('u', 'Inline', 'Inline', 'Common');
-        
+
+        $s = $this->addElement('s', 'Inline', 'Inline', 'Common');
+        $s->formatting = true;
+
+        $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common');
+        $strike->formatting = true;
+
+        $u = $this->addElement('u', 'Inline', 'Inline', 'Common');
+        $u->formatting = true;
+
         // setup modifications to old elements
-        
+
         $align = 'Enum#left,right,center,justify';
-        
+
         $address = $this->addBlankElement('address');
         $address->content_model = 'Inline | #PCDATA | p';
         $address->content_model_type = 'optional';
         $address->child = false;
-        
+
         $blockquote = $this->addBlankElement('blockquote');
         $blockquote->content_model = 'Flow | #PCDATA';
         $blockquote->content_model_type = 'optional';
         $blockquote->child = false;
-        
+
         $br = $this->addBlankElement('br');
         $br->attr['clear'] = 'Enum#left,all,right,none';
-        
+
         $caption = $this->addBlankElement('caption');
         $caption->attr['align'] = 'Enum#top,bottom,left,right';
-        
+
         $div = $this->addBlankElement('div');
         $div->attr['align'] = $align;
-        
+
         $dl = $this->addBlankElement('dl');
         $dl->attr['compact'] = 'Bool#compact';
-        
+
         for ($i = 1; $i <= 6; $i++) {
             $h = $this->addBlankElement("h$i");
             $h->attr['align'] = $align;
         }
-        
+
         $hr = $this->addBlankElement('hr');
         $hr->attr['align'] = $align;
         $hr->attr['noshade'] = 'Bool#noshade';
         $hr->attr['size'] = 'Pixels';
         $hr->attr['width'] = 'Length';
-        
+
         $img = $this->addBlankElement('img');
         $img->attr['align'] = 'Enum#top,middle,bottom,left,right';
         $img->attr['border'] = 'Pixels';
         $img->attr['hspace'] = 'Pixels';
         $img->attr['vspace'] = 'Pixels';
-        
+
         // figure out this integer business
-        
+
         $li = $this->addBlankElement('li');
         $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
         $li->attr['type']  = 'Enum#s:1,i,I,a,A,disc,square,circle';
-        
+
         $ol = $this->addBlankElement('ol');
         $ol->attr['compact'] = 'Bool#compact';
         $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
         $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
-        
+
         $p = $this->addBlankElement('p');
         $p->attr['align'] = $align;
-        
+
         $pre = $this->addBlankElement('pre');
         $pre->attr['width'] = 'Number';
-        
+
         // script omitted
-        
+
         $table = $this->addBlankElement('table');
         $table->attr['align'] = 'Enum#left,center,right';
         $table->attr['bgcolor'] = 'Color';
-        
+
         $tr = $this->addBlankElement('tr');
         $tr->attr['bgcolor'] = 'Color';
-        
+
         $th = $this->addBlankElement('th');
         $th->attr['bgcolor'] = 'Color';
         $th->attr['height'] = 'Length';
         $th->attr['nowrap'] = 'Bool#nowrap';
         $th->attr['width'] = 'Length';
-        
+
         $td = $this->addBlankElement('td');
         $td->attr['bgcolor'] = 'Color';
         $td->attr['height'] = 'Length';
         $td->attr['nowrap'] = 'Bool#nowrap';
         $td->attr['width'] = 'Length';
-        
+
         $ul = $this->addBlankElement('ul');
         $ul->attr['compact'] = 'Bool#compact';
         $ul->attr['type'] = 'Enum#square,disc,circle';
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index a2cf2f56002ad831e3b58afaa37b9df98d6ab5d2..1d15f27293df88085fda3e9ef8aba988bfa25c18 100644 (file)
@@ -5,9 +5,9 @@
  */
 class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'List';
-    
+
     // According to the abstract schema, the List content set is a fully formed
     // one or more expr, but it invariably occurs in an optional declaration
     // so we're not going to do that subtlety. It might cause trouble
@@ -16,19 +16,20 @@ class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
     // Furthermore, the actual XML Schema may disagree. Regardless,
     // we don't have support for such nested expressions without using
     // the incredibly inefficient and draconic Custom ChildDef.
-    
+
     public $content_sets = array('Flow' => 'List');
-    
+
     public function setup($config) {
         $this->addElement('ol', 'List', 'Required: li', 'Common');
         $this->addElement('ul', 'List', 'Required: li', 'Common');
         $this->addElement('dl', 'List', 'Required: dt | dd', 'Common');
-        
+
         $this->addElement('li', false, 'Flow', 'Common');
-        
+
         $this->addElement('dd', false, 'Flow', 'Common');
         $this->addElement('dt', false, 'Inline', 'Common');
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index db2ab4f4c10633dd2b5c75525ed3576bc791a447..d908a0ada6c0a53abd7511ed1cc63f25845be7d6 100644 (file)
@@ -2,9 +2,9 @@
 
 class HTMLPurifier_HTMLModule_Name extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Name';
-    
+
     public function setup($config) {
         $elements = array('a', 'applet', 'form', 'frame', 'iframe', 'img', 'map');
         foreach ($elements as $name) {
@@ -12,5 +12,7 @@ class HTMLPurifier_HTMLModule_Name extends HTMLPurifier_HTMLModule
             $element->attr['name'] = 'ID';
         }
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 2ee7adffe5ff064f3c12d9f1710bfe317aaff4e2..5f1b14abb8a572f84614429a3020aefff1f6f718 100644 (file)
@@ -3,7 +3,7 @@
 class HTMLPurifier_HTMLModule_NonXMLCommonAttributes extends HTMLPurifier_HTMLModule
 {
     public $name = 'NonXMLCommonAttributes';
-    
+
     public $attr_collections = array(
         'Lang' => array(
             'lang' => 'LanguageCode',
@@ -11,3 +11,4 @@ class HTMLPurifier_HTMLModule_NonXMLCommonAttributes extends HTMLPurifier_HTMLMo
     );
 }
 
+// vim: et sw=4 sts=4
index cd4ce2648ad9173d03e776aaf0470f73da408c9d..193c1011f84e532adb1ae4da33b039c43157a2c0 100644 (file)
@@ -7,13 +7,13 @@
  */
 class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Object';
     public $safe = false;
-    
+
     public function setup($config) {
-        
-        $this->addElement('object', 'Inline', 'Optional: #PCDATA | Flow | param', 'Common', 
+
+        $this->addElement('object', 'Inline', 'Optional: #PCDATA | Flow | param', 'Common',
             array(
                 'archive' => 'URI',
                 'classid' => 'URI',
@@ -39,8 +39,9 @@ class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule
                 'valuetype' => 'Enum#data,ref,object'
            )
         );
-    
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 857b3abf01b59c07a63ebc3d446adf9db34c0115..8ff0b5ed7848e9872354e53ddb05d44d74f2713d 100644 (file)
  */
 class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Presentation';
-    
+
     public function setup($config) {
-        $this->addElement('b',      'Inline', 'Inline', 'Common');
-        $this->addElement('big',    'Inline', 'Inline', 'Common');
         $this->addElement('hr',     'Block',  'Empty',  'Common');
-        $this->addElement('i',      'Inline', 'Inline', 'Common');
-        $this->addElement('small',  'Inline', 'Inline', 'Common');
         $this->addElement('sub',    'Inline', 'Inline', 'Common');
         $this->addElement('sup',    'Inline', 'Inline', 'Common');
-        $this->addElement('tt',     'Inline', 'Inline', 'Common');
+        $b = $this->addElement('b',      'Inline', 'Inline', 'Common');
+        $b->formatting = true;
+        $big = $this->addElement('big',    'Inline', 'Inline', 'Common');
+        $big->formatting = true;
+        $i = $this->addElement('i',      'Inline', 'Inline', 'Common');
+        $i->formatting = true;
+        $small = $this->addElement('small',  'Inline', 'Inline', 'Common');
+        $small->formatting = true;
+        $tt = $this->addElement('tt',     'Inline', 'Inline', 'Common');
+        $tt->formatting = true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index bcbcd124ff018e547f2446b5e7fbf12c9076c906..dd36a3de0efc0d45f36dd5d9f3868f487b5d1cc5 100644 (file)
@@ -6,12 +6,12 @@
  */
 class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Proprietary';
-    
+
     public function setup($config) {
-        
-        $this->addElement('marquee', 'Inline', 'Flow', 'Common', 
+
+        $this->addElement('marquee', 'Inline', 'Flow', 'Common',
             array(
                 'direction' => 'Enum#left,right,up,down',
                 'behavior' => 'Enum#alternate',
@@ -25,8 +25,9 @@ class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule
                 'vspace' => 'Pixels',
             )
         );
-    
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index caee035fcf912c901da45ea087305bb4014b344b..b26a0a30a0e1f4c3fefcddd457231d1ee1f164f0 100644 (file)
@@ -6,9 +6,9 @@
  */
 class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Ruby';
-    
+
     public function setup($config) {
         $this->addElement('ruby', 'Inline',
             'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
@@ -21,6 +21,7 @@ class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
         $rt->excludes = array('ruby' => true);
         $this->addElement('rp', false, 'Optional: #PCDATA', 'Common');
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 8e57752199de23301513472c587a9776501d25bd..635e8f2d2b94066863d9446f5224f02cd8fbec9a 100644 (file)
@@ -5,11 +5,11 @@
  */
 class HTMLPurifier_HTMLModule_SafeEmbed extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'SafeEmbed';
-    
+
     public function setup($config) {
-        
+
         $max = $config->get('HTML', 'MaxImgLength');
         $embed = $this->addElement(
             'embed', 'Inline', 'Empty', 'Common',
@@ -25,7 +25,9 @@ class HTMLPurifier_HTMLModule_SafeEmbed extends HTMLPurifier_HTMLModule
             )
         );
         $embed->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeEmbed();
-        
+
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index a33be7d4fcebd530aeff96478ac29f0633dc48d5..bbda7a2147e0c1e7ed86e9cf664812a1c93f1603 100644 (file)
@@ -8,14 +8,14 @@
  */
 class HTMLPurifier_HTMLModule_SafeObject extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'SafeObject';
-    
+
     public function setup($config) {
-        
+
         // These definitions are not intrinsically safe: the attribute transforms
         // are a vital part of ensuring safety.
-        
+
         $max = $config->get('HTML', 'MaxImgLength');
         $object = $this->addElement(
             'object',
@@ -36,13 +36,15 @@ class HTMLPurifier_HTMLModule_SafeObject extends HTMLPurifier_HTMLModule
         $param = $this->addElement('param', false, 'Empty', false,
             array(
                 'id' => 'ID',
-                'name*' => 'Text', 
+                'name*' => 'Text',
                 'value' => 'Text'
             )
         );
         $param->attr_transform_post[] = new HTMLPurifier_AttrTransform_SafeParam();
         $this->info_injector[] = 'SafeObject';
-    
+
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 2b7e2ced49b825fc3fcc763caa801a2865c51334..cecdea6c30a88a5d6e5556fdbf450705c434f09d 100644 (file)
@@ -19,24 +19,24 @@ class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
     public $elements = array('script', 'noscript');
     public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
     public $safe = false;
-    
+
     public function setup($config) {
         // TODO: create custom child-definition for noscript that
-        // auto-wraps stray #PCDATA in a similar manner to 
+        // auto-wraps stray #PCDATA in a similar manner to
         // blockquote's custom definition (we would use it but
         // blockquote's contents are optional while noscript's contents
         // are required)
-        
+
         // TODO: convert this to new syntax, main problem is getting
         // both content sets working
-        
+
         // In theory, this could be safe, but I don't see any reason to
         // allow it.
         $this->info['noscript'] = new HTMLPurifier_ElementDef();
         $this->info['noscript']->attr = array( 0 => array('Common') );
         $this->info['noscript']->content_model = 'Heading | List | Block';
         $this->info['noscript']->content_model_type = 'required';
-        
+
         $this->info['script'] = new HTMLPurifier_ElementDef();
         $this->info['script']->attr = array(
             'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')),
@@ -51,3 +51,4 @@ class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
     }
 }
 
+// vim: et sw=4 sts=4
index 9775536dccb2b497a99853c7b81c6232ed2de131..eb78464cc0d6ae1450b1f5c9edc3f9844a6b9f8d 100644 (file)
@@ -6,7 +6,7 @@
  */
 class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'StyleAttribute';
     public $attr_collections = array(
         // The inclusion routine differs from the Abstract Modules but
@@ -14,10 +14,11 @@ class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
         'Style' => array('style' => false), // see constructor
         'Core' => array(0 => array('Style'))
     );
-    
+
     public function setup($config) {
         $this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS();
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index dd70bddfc9969e981719faf0c2bf889ebe51d97b..f314ced3f82ea6e36346d057f6404252b78c74f1 100644 (file)
@@ -5,15 +5,15 @@
  */
 class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Tables';
-    
+
     public function setup($config) {
-        
+
         $this->addElement('caption', false, 'Inline', 'Common');
-        
-        $this->addElement('table', 'Block', 
-            new HTMLPurifier_ChildDef_Table(),  'Common', 
+
+        $this->addElement('table', 'Block',
+            new HTMLPurifier_ChildDef_Table(),  'Common',
             array(
                 'border' => 'Pixels',
                 'cellpadding' => 'Length',
@@ -24,14 +24,14 @@ class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
                 'width' => 'Length'
             )
         );
-        
+
         // common attributes
         $cell_align = array(
             'align' => 'Enum#left,center,right,justify,char',
             'charoff' => 'Length',
             'valign' => 'Enum#top,middle,bottom,baseline',
         );
-        
+
         $cell_t = array_merge(
             array(
                 'abbr'    => 'Text',
@@ -42,9 +42,9 @@ class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
         );
         $this->addElement('td', false, 'Flow', 'Common', $cell_t);
         $this->addElement('th', false, 'Flow', 'Common', $cell_t);
-        
+
         $this->addElement('tr', false, 'Required: td | th', 'Common', $cell_align);
-        
+
         $cell_col = array_merge(
             array(
                 'span'  => 'Number',
@@ -54,12 +54,13 @@ class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
         );
         $this->addElement('col',      false, 'Empty',         'Common', $cell_col);
         $this->addElement('colgroup', false, 'Optional: col', 'Common', $cell_col);
-        
+
         $this->addElement('tbody', false, 'Required: tr', 'Common', $cell_align);
         $this->addElement('thead', false, 'Required: tr', 'Common', $cell_align);
         $this->addElement('tfoot', false, 'Required: tr', 'Common', $cell_align);
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 042d458c5886cfac133c224e06c2e05c8d3bcad3..2b844ecc45dbe591d4019e93621ac8d2f68994a6 100644 (file)
@@ -5,9 +5,9 @@
  */
 class HTMLPurifier_HTMLModule_Target extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Target';
-    
+
     public function setup($config) {
         $elements = array('a');
         foreach ($elements as $name) {
@@ -17,6 +17,7 @@ class HTMLPurifier_HTMLModule_Target extends HTMLPurifier_HTMLModule
             );
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 3fce4ee53faf88d9001d739a5291cabc89962672..e6a5d0d81b7c9e81e1ff36de5f35f7c50cc4a66e 100644 (file)
  */
 class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
 {
-    
+
     public $name = 'Text';
     public $content_sets = array(
         'Flow' => 'Heading | Block | Inline'
     );
-    
+
     public function setup($config) {
-        
+
         // Inline Phrasal -------------------------------------------------
         $this->addElement('abbr',    'Inline', 'Inline', 'Common');
         $this->addElement('acronym', 'Inline', 'Inline', 'Common');
         $this->addElement('cite',    'Inline', 'Inline', 'Common');
-        $this->addElement('code',    'Inline', 'Inline', 'Common');
         $this->addElement('dfn',     'Inline', 'Inline', 'Common');
-        $this->addElement('em',      'Inline', 'Inline', 'Common');
         $this->addElement('kbd',     'Inline', 'Inline', 'Common');
         $this->addElement('q',       'Inline', 'Inline', 'Common', array('cite' => 'URI'));
         $this->addElement('samp',    'Inline', 'Inline', 'Common');
-        $this->addElement('strong',  'Inline', 'Inline', 'Common');
         $this->addElement('var',     'Inline', 'Inline', 'Common');
-        
+
+        $em = $this->addElement('em',      'Inline', 'Inline', 'Common');
+        $em->formatting = true;
+
+        $strong = $this->addElement('strong',  'Inline', 'Inline', 'Common');
+        $strong->formatting = true;
+
+        $code = $this->addElement('code',    'Inline', 'Inline', 'Common');
+        $code->formatting = true;
+
         // Inline Structural ----------------------------------------------
         $this->addElement('span', 'Inline', 'Inline', 'Common');
         $this->addElement('br',   'Inline', 'Empty',  'Core');
@@ -58,12 +64,15 @@ class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
         $this->addElement('h4', 'Heading', 'Inline', 'Common');
         $this->addElement('h5', 'Heading', 'Inline', 'Common');
         $this->addElement('h6', 'Heading', 'Inline', 'Common');
-        
+
         // Block Structural -----------------------------------------------
-        $this->addElement('p', 'Block', 'Inline', 'Common');
+        $p = $this->addElement('p', 'Block', 'Inline', 'Common');
+        $p->autoclose = array_flip(array("address", "blockquote", "center", "dir", "div", "dl", "fieldset", "ol", "p", "ul"));
+
         $this->addElement('div', 'Block', 'Flow', 'Common');
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index a95d453b407a394dd1534c0ffd9da81af49a39b5..c9d470648561416bb64b322e51df04c7e12f41a0 100644 (file)
@@ -7,18 +7,18 @@
  */
 class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
 {
-    
+
     /**
      * List of supported levels. Index zero is a special case "no fixes"
      * level.
      */
     public $levels = array(0 => 'none', 'light', 'medium', 'heavy');
-    
+
     /**
      * Default level to place all fixes in. Disabled by default
      */
     public $defaultLevel = null;
-    
+
     /**
      * Lists of fixes used by getFixesForLevel(). Format is:
      *      HTMLModule_Tidy->fixesForLevel[$level] = array('fix-1', 'fix-2');
@@ -28,7 +28,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
         'medium' => array(),
         'heavy'  => array()
     );
-    
+
     /**
      * Lazy load constructs the module by determining the necessary
      * fixes to create and then delegating to the populate() function.
@@ -36,19 +36,19 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
      *       subtracted fix has no effect.
      */
     public function setup($config) {
-        
+
         // create fixes, initialize fixesForLevel
         $fixes = $this->makeFixes();
         $this->makeFixesForLevel($fixes);
-        
+
         // figure out which fixes to use
         $level = $config->get('HTML', 'TidyLevel');
         $fixes_lookup = $this->getFixesForLevel($level);
-        
+
         // get custom fix declarations: these need namespace processing
         $add_fixes    = $config->get('HTML', 'TidyAdd');
         $remove_fixes = $config->get('HTML', 'TidyRemove');
-        
+
         foreach ($fixes as $name => $fix) {
             // needs to be refactored a little to implement globbing
             if (
@@ -58,12 +58,12 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
                 unset($fixes[$name]);
             }
         }
-        
+
         // populate this module with necessary fixes
         $this->populate($fixes);
-        
+
     }
-    
+
     /**
      * Retrieves all fixes per a level, returning fixes for that specific
      * level as well as all levels below it.
@@ -94,7 +94,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
         }
         return $ret;
     }
-    
+
     /**
      * Dynamically populates the $fixesForLevel member variable using
      * the fixes array. It may be custom overloaded, used in conjunction
@@ -111,7 +111,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
         }
         $this->fixesForLevel[$this->defaultLevel] = array_keys($fixes);
     }
-    
+
     /**
      * Populates the module with transforms and other special-case code
      * based on a list of fixes passed to it
@@ -160,7 +160,7 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
             }
         }
     }
-    
+
     /**
      * Parses a fix name and determines what kind of fix it is, as well
      * as other information defined by the fix
@@ -174,34 +174,34 @@ class HTMLPurifier_HTMLModule_Tidy extends HTMLPurifier_HTMLModule
         $property = $attr = null;
         if (strpos($name, '#') !== false) list($name, $property) = explode('#', $name);
         if (strpos($name, '@') !== false) list($name, $attr)     = explode('@', $name);
-        
+
         // figure out the parameters
         $params = array();
         if ($name !== '')    $params['element'] = $name;
         if (!is_null($attr)) $params['attr'] = $attr;
-        
+
         // special case: attribute transform
         if (!is_null($attr)) {
             if (is_null($property)) $property = 'pre';
             $type = 'attr_transform_' . $property;
             return array($type, $params);
         }
-        
+
         // special case: tag transform
         if (is_null($property)) {
             return array('tag_transform', $params);
         }
-        
+
         return array($property, $params);
-        
+
     }
-    
+
     /**
      * Defines all fixes the module will perform in a compact
      * associative array of fix name to fix implementation.
      */
     public function makeFixes() {}
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index 9056e5fe14e6bed373028ceef6306a312045b5fb..61ff85ce2fa66e66bf1227b35c506ceb9ca2c365 100644 (file)
@@ -8,16 +8,17 @@ class HTMLPurifier_HTMLModule_Tidy_Name extends HTMLPurifier_HTMLModule_Tidy
     public $name = 'Tidy_Name';
     public $defaultLevel = 'heavy';
     public function makeFixes() {
-        
+
         $r = array();
-        
+
         // @name for img, a -----------------------------------------------
         // Technically, it's allowed even on strict, so we allow authors to use
         // it. However, it's deprecated in future versions of XHTML.
-        $r['img@name'] = 
+        $r['img@name'] =
         $r['a@name'] = new HTMLPurifier_AttrTransform_Name();
-        
+
         return $r;
     }
 }
 
+// vim: et sw=4 sts=4
index 41c1f78eacc717067548830f1abf9ed3b8ab45bb..85fa90a942d89a5b1c5240c508d07e4980ce4951 100644 (file)
@@ -2,10 +2,10 @@
 
 class HTMLPurifier_HTMLModule_Tidy_Proprietary extends HTMLPurifier_HTMLModule_Tidy
 {
-    
+
     public $name = 'Tidy_Proprietary';
     public $defaultLevel = 'light';
-    
+
     public function makeFixes() {
         $r = array();
         $r['table@background'] = new HTMLPurifier_AttrTransform_Background();
@@ -17,6 +17,7 @@ class HTMLPurifier_HTMLModule_Tidy_Proprietary extends HTMLPurifier_HTMLModule_T
         $r['tbody@background'] = new HTMLPurifier_AttrTransform_Background();
         return $r;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 80d8cf4da122e82c6b4730c9cd378737ad5621c3..c73dc3c4d19a93715f674a0eb7d2acb1185bd258 100644 (file)
@@ -4,16 +4,18 @@ class HTMLPurifier_HTMLModule_Tidy_Strict extends HTMLPurifier_HTMLModule_Tidy_X
 {
     public $name = 'Tidy_Strict';
     public $defaultLevel = 'light';
-    
+
     public function makeFixes() {
         $r = parent::makeFixes();
         $r['blockquote#content_model_type'] = 'strictblockquote';
         return $r;
     }
-    
+
     public $defines_child_def = true;
     public function getChildDef($def) {
         if ($def->content_model_type != 'strictblockquote') return parent::getChildDef($def);
         return new HTMLPurifier_ChildDef_StrictBlockquote($def->content_model);
     }
 }
+
+// vim: et sw=4 sts=4
index 5a0e1170070f49f91c4128e36ea63c8d68b91a1a..9960b1dd10b18103d9069ce100a0b38d5a742692 100644 (file)
@@ -6,3 +6,4 @@ class HTMLPurifier_HTMLModule_Tidy_Transitional extends HTMLPurifier_HTMLModule_
     public $defaultLevel = 'heavy';
 }
 
+// vim: et sw=4 sts=4
index 7e6400b056056925bced2cc93e519ab3e54954c3..db5a378e53973ccba20b749a3a50e4320bb775d2 100644 (file)
@@ -2,15 +2,16 @@
 
 class HTMLPurifier_HTMLModule_Tidy_XHTML extends HTMLPurifier_HTMLModule_Tidy
 {
-    
+
     public $name = 'Tidy_XHTML';
     public $defaultLevel = 'medium';
-    
+
     public function makeFixes() {
         $r = array();
         $r['@lang'] = new HTMLPurifier_AttrTransform_Lang();
         return $r;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 9e1292500c83a8d92b6e52f4eeea088727784b29..02e9438139704f5876fa347afc1725802fdc92ee 100644 (file)
@@ -2,13 +2,13 @@
 
 class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule_Tidy
 {
-    
+
     public function makeFixes() {
-        
+
         $r = array();
-        
+
         // == deprecated tag transforms ===================================
-        
+
         $r['font']   = new HTMLPurifier_TagTransform_Font();
         $r['menu']   = new HTMLPurifier_TagTransform_Simple('ul');
         $r['dir']    = new HTMLPurifier_TagTransform_Simple('ul');
@@ -16,10 +16,10 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
         $r['u']      = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:underline;');
         $r['s']      = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
         $r['strike'] = new HTMLPurifier_TagTransform_Simple('span', 'text-decoration:line-through;');
-        
+
         // == deprecated attribute transforms =============================
-        
-        $r['caption@align'] = 
+
+        $r['caption@align'] =
             new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
                 // we're following IE's behavior, not Firefox's, due
                 // to the fact that no one supports caption-side:right,
@@ -30,7 +30,7 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
                 'top'    => 'caption-side:top;',
                 'bottom' => 'caption-side:bottom;' // not supported by IE
             ));
-        
+
         // @align for img -------------------------------------------------
         $r['img@align'] =
             new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
@@ -40,7 +40,7 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
                 'middle' => 'vertical-align:middle;',
                 'bottom' => 'vertical-align:baseline;',
             ));
-        
+
         // @align for table -----------------------------------------------
         $r['table@align'] =
             new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
@@ -48,7 +48,7 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
                 'center' => 'margin-left:auto;margin-right:auto;',
                 'right'  => 'float:right;'
             ));
-        
+
         // @align for hr -----------------------------------------------
         $r['hr@align'] =
             new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
@@ -60,7 +60,7 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
                 'center' => 'margin-left:auto;margin-right:auto;text-align:center;',
                 'right'  => 'margin-left:auto;margin-right:0;text-align:right;'
             ));
-        
+
         // @align for h1, h2, h3, h4, h5, h6, p, div ----------------------
         // {{{
             $align_lookup = array();
@@ -74,18 +74,18 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
         $r['h5@align'] =
         $r['h6@align'] =
         $r['p@align']  =
-        $r['div@align'] = 
+        $r['div@align'] =
             new HTMLPurifier_AttrTransform_EnumToCSS('align', $align_lookup);
-        
+
         // @bgcolor for table, tr, td, th ---------------------------------
         $r['table@bgcolor'] =
         $r['td@bgcolor'] =
         $r['th@bgcolor'] =
             new HTMLPurifier_AttrTransform_BgColor();
-        
+
         // @border for img ------------------------------------------------
         $r['img@border'] = new HTMLPurifier_AttrTransform_Border();
-        
+
         // @clear for br --------------------------------------------------
         $r['br@clear'] =
             new HTMLPurifier_AttrTransform_EnumToCSS('clear', array(
@@ -94,15 +94,15 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
                 'all'   => 'clear:both;',
                 'none'  => 'clear:none;',
             ));
-        
+
         // @height for td, th ---------------------------------------------
-        $r['td@height'] = 
+        $r['td@height'] =
         $r['th@height'] =
             new HTMLPurifier_AttrTransform_Length('height');
-        
+
         // @hspace for img ------------------------------------------------
         $r['img@hspace'] = new HTMLPurifier_AttrTransform_ImgSpace('hspace');
-        
+
         // @noshade for hr ------------------------------------------------
         // this transformation is not precise but often good enough.
         // different browsers use different styles to designate noshade
@@ -111,18 +111,18 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
                 'noshade',
                 'color:#808080;background-color:#808080;border:0;'
             );
-        
+
         // @nowrap for td, th ---------------------------------------------
-        $r['td@nowrap'] = 
+        $r['td@nowrap'] =
         $r['th@nowrap'] =
             new HTMLPurifier_AttrTransform_BoolToCSS(
                 'nowrap',
                 'white-space:nowrap;'
             );
-        
+
         // @size for hr  --------------------------------------------------
         $r['hr@size'] = new HTMLPurifier_AttrTransform_Length('size', 'height');
-        
+
         // @type for li, ol, ul -------------------------------------------
         // {{{
             $ul_types = array(
@@ -139,22 +139,23 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
             );
             $li_types = $ul_types + $ol_types;
         // }}}
-        
+
         $r['ul@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ul_types);
         $r['ol@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $ol_types, true);
         $r['li@type'] = new HTMLPurifier_AttrTransform_EnumToCSS('type', $li_types, true);
-        
+
         // @vspace for img ------------------------------------------------
         $r['img@vspace'] = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
-        
+
         // @width for hr, td, th ------------------------------------------
         $r['td@width'] =
-        $r['th@width'] = 
+        $r['th@width'] =
         $r['hr@width'] = new HTMLPurifier_AttrTransform_Length('width');
-        
+
         return $r;
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 0fd0efb85c9fb8ad28654a8f2feab428b381126d..0913f3c8ddfee7d83e54050266e92b365600e709 100644 (file)
@@ -3,7 +3,7 @@
 class HTMLPurifier_HTMLModule_XMLCommonAttributes extends HTMLPurifier_HTMLModule
 {
     public $name = 'XMLCommonAttributes';
-    
+
     public $attr_collections = array(
 /* moodle comment - xml:lang breaks our multilang
         'Lang' => array(
@@ -13,3 +13,4 @@ class HTMLPurifier_HTMLModule_XMLCommonAttributes extends HTMLPurifier_HTMLModul
     );
 }
 
+// vim: et sw=4 sts=4
index 63e0ebf8983b205573fa050deeda0302850323a0..78f38781d80421567fb9387caa2b662a15ce07de 100644 (file)
@@ -2,63 +2,63 @@
 
 class HTMLPurifier_HTMLModuleManager
 {
-    
+
     /**
      * Instance of HTMLPurifier_DoctypeRegistry
      */
     public $doctypes;
-    
+
     /**
      * Instance of current doctype
      */
     public $doctype;
-    
+
     /**
      * Instance of HTMLPurifier_AttrTypes
      */
     public $attrTypes;
-    
+
     /**
      * Active instances of modules for the specified doctype are
      * indexed, by name, in this array.
      */
     public $modules = array();
-    
+
     /**
-     * Array of recognized HTMLPurifier_Module instances, indexed by 
+     * Array of recognized HTMLPurifier_Module instances, indexed by
      * module's class name. This array is usually lazy loaded, but a
      * user can overload a module by pre-emptively registering it.
      */
     public $registeredModules = array();
-    
+
     /**
      * List of extra modules that were added by the user using addModule().
      * These get unconditionally merged into the current doctype, whatever
      * it may be.
      */
     public $userModules = array();
-    
+
     /**
      * Associative array of element name to list of modules that have
      * definitions for the element; this array is dynamically filled.
      */
     public $elementLookup = array();
-    
+
     /** List of prefixes we should use for registering small names */
     public $prefixes = array('HTMLPurifier_HTMLModule_');
-    
+
     public $contentSets;     /**< Instance of HTMLPurifier_ContentSets */
     public $attrCollections; /**< Instance of HTMLPurifier_AttrCollections */
-    
+
     /** If set to true, unsafe elements and attributes will be allowed */
     public $trusted = false;
-    
+
     public function __construct() {
-        
+
         // editable internal objects
         $this->attrTypes = new HTMLPurifier_AttrTypes();
         $this->doctypes  = new HTMLPurifier_DoctypeRegistry();
-        
+
         // setup basic modules
         $common = array(
             'CommonAttributes', 'Text', 'Hypertext', 'List',
@@ -67,12 +67,12 @@ class HTMLPurifier_HTMLModuleManager
             // Unsafe:
             'Scripting', 'Object',  'Forms',
             // Sorta legacy, but present in strict:
-            'Name', 
+            'Name',
         );
         $transitional = array('Legacy', 'Target');
         $xml = array('XMLCommonAttributes');
         $non_xml = array('NonXMLCommonAttributes');
-        
+
         // setup basic doctypes
         $this->doctypes->register(
             'HTML 4.01 Transitional', false,
@@ -82,7 +82,7 @@ class HTMLPurifier_HTMLModuleManager
             '-//W3C//DTD HTML 4.01 Transitional//EN',
             'http://www.w3.org/TR/html4/loose.dtd'
         );
-        
+
         $this->doctypes->register(
             'HTML 4.01 Strict', false,
             array_merge($common, $non_xml),
@@ -91,7 +91,7 @@ class HTMLPurifier_HTMLModuleManager
             '-//W3C//DTD HTML 4.01//EN',
             'http://www.w3.org/TR/html4/strict.dtd'
         );
-        
+
         $this->doctypes->register(
             'XHTML 1.0 Transitional', true,
             array_merge($common, $transitional, $xml, $non_xml),
@@ -100,7 +100,7 @@ class HTMLPurifier_HTMLModuleManager
             '-//W3C//DTD XHTML 1.0 Transitional//EN',
             'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
         );
-        
+
         $this->doctypes->register(
             'XHTML 1.0 Strict', true,
             array_merge($common, $xml, $non_xml),
@@ -109,7 +109,7 @@ class HTMLPurifier_HTMLModuleManager
             '-//W3C//DTD XHTML 1.0 Strict//EN',
             'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
         );
-        
+
         $this->doctypes->register(
             'XHTML 1.1', true,
             array_merge($common, $xml, array('Ruby')),
@@ -118,9 +118,9 @@ class HTMLPurifier_HTMLModuleManager
             '-//W3C//DTD XHTML 1.1//EN',
             'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'
         );
-        
+
     }
-    
+
     /**
      * Registers a module to the recognized module list, useful for
      * overloading pre-existing modules.
@@ -173,7 +173,7 @@ class HTMLPurifier_HTMLModuleManager
         }
         $this->registeredModules[$module->name] = $module;
     }
-    
+
     /**
      * Adds a module to the current doctype by first registering it,
      * and then tacking it on to the active doctype
@@ -183,7 +183,7 @@ class HTMLPurifier_HTMLModuleManager
         if (is_object($module)) $module = $module->name;
         $this->userModules[] = $module;
     }
-    
+
     /**
      * Adds a class prefix that registerModule() will use to resolve a
      * string name to a concrete class
@@ -191,37 +191,37 @@ class HTMLPurifier_HTMLModuleManager
     public function addPrefix($prefix) {
         $this->prefixes[] = $prefix;
     }
-    
+
     /**
      * Performs processing on modules, after being called you may
      * use getElement() and getElements()
      * @param $config Instance of HTMLPurifier_Config
      */
     public function setup($config) {
-        
+
         $this->trusted = $config->get('HTML', 'Trusted');
-        
+
         // generate
         $this->doctype = $this->doctypes->make($config);
         $modules = $this->doctype->modules;
-        
+
         // take out the default modules that aren't allowed
         $lookup = $config->get('HTML', 'AllowedModules');
         $special_cases = $config->get('HTML', 'CoreModules');
-        
+
         if (is_array($lookup)) {
             foreach ($modules as $k => $m) {
                 if (isset($special_cases[$m])) continue;
                 if (!isset($lookup[$m])) unset($modules[$k]);
             }
         }
-        
+
         // add proprietary module (this gets special treatment because
         // it is completely removed from doctypes, etc.)
         if ($config->get('HTML', 'Proprietary')) {
             $modules[] = 'Proprietary';
         }
-        
+
         // add SafeObject/Safeembed modules
         if ($config->get('HTML', 'SafeObject')) {
             $modules[] = 'SafeObject';
@@ -229,20 +229,20 @@ class HTMLPurifier_HTMLModuleManager
         if ($config->get('HTML', 'SafeEmbed')) {
             $modules[] = 'SafeEmbed';
         }
-        
+
         // merge in custom modules
         $modules = array_merge($modules, $this->userModules);
-        
+
         foreach ($modules as $module) {
             $this->processModule($module);
             $this->modules[$module]->setup($config);
         }
-        
+
         foreach ($this->doctype->tidyModules as $module) {
             $this->processModule($module);
             $this->modules[$module]->setup($config);
         }
-        
+
         // prepare any injectors
         foreach ($this->modules as $module) {
             $n = array();
@@ -255,7 +255,7 @@ class HTMLPurifier_HTMLModuleManager
             }
             $module->info_injector = $n;
         }
-        
+
         // setup lookup table based on all valid modules
         foreach ($this->modules as $module) {
             foreach ($module->info as $name => $def) {
@@ -265,7 +265,7 @@ class HTMLPurifier_HTMLModuleManager
                 $this->elementLookup[$name][] = $module->name;
             }
         }
-        
+
         // note the different choice
         $this->contentSets = new HTMLPurifier_ContentSets(
             // content set assembly deals with all possible modules,
@@ -280,7 +280,7 @@ class HTMLPurifier_HTMLModuleManager
             $this->modules
         );
     }
-    
+
     /**
      * Takes a module and adds it to the active module collection,
      * registering it if necessary.
@@ -291,13 +291,13 @@ class HTMLPurifier_HTMLModuleManager
         }
         $this->modules[$module] = $this->registeredModules[$module];
     }
-    
+
     /**
      * Retrieves merged element definitions.
      * @return Array of HTMLPurifier_ElementDef
      */
     public function getElements() {
-        
+
         $elements = array();
         foreach ($this->modules as $module) {
             if (!$this->trusted && !$module->safe) continue;
@@ -306,17 +306,17 @@ class HTMLPurifier_HTMLModuleManager
                 $elements[$name] = $this->getElement($name);
             }
         }
-        
+
         // remove dud elements, this happens when an element that
         // appeared to be safe actually wasn't
         foreach ($elements as $n => $v) {
             if ($v === false) unset($elements[$n]);
         }
-        
+
         return $elements;
-        
+
     }
-    
+
     /**
      * Retrieves a single merged element definition
      * @param $name Name of element
@@ -325,35 +325,35 @@ class HTMLPurifier_HTMLModuleManager
      * @return Merged HTMLPurifier_ElementDef
      * @note You may notice that modules are getting iterated over twice (once
      *       in getElements() and once here). This
-     *       is because 
+     *       is because
      */
     public function getElement($name, $trusted = null) {
-        
+
         if (!isset($this->elementLookup[$name])) {
             return false;
         }
-        
+
         // setup global state variables
         $def = false;
         if ($trusted === null) $trusted = $this->trusted;
-        
+
         // iterate through each module that has registered itself to this
         // element
         foreach($this->elementLookup[$name] as $module_name) {
-            
+
             $module = $this->modules[$module_name];
-            
+
             // refuse to create/merge from a module that is deemed unsafe--
             // pretend the module doesn't exist--when trusted mode is not on.
             if (!$trusted && !$module->safe) {
                 continue;
             }
-            
+
             // clone is used because, ideally speaking, the original
             // definition should not be modified. Usually, this will
             // make no difference, but for consistency's sake
             $new_def = clone $module->info[$name];
-            
+
             if (!$def && $new_def->standalone) {
                 $def = $new_def;
             } elseif ($def) {
@@ -366,11 +366,11 @@ class HTMLPurifier_HTMLModuleManager
                 // to merge into could be deferred to the end
                 continue;
             }
-            
+
             // attribute value expansions
             $this->attrCollections->performInclusions($def->attr);
             $this->attrCollections->expandIdentifiers($def->attr, $this->attrTypes);
-            
+
             // descendants_are_inline, for ChildDef_Chameleon
             if (is_string($def->content_model) &&
                 strpos($def->content_model, 'Inline') !== false) {
@@ -379,25 +379,25 @@ class HTMLPurifier_HTMLModuleManager
                     $def->descendants_are_inline = true;
                 }
             }
-            
+
             $this->contentSets->generateChildDef($def, $module);
         }
-        
+
         // This can occur if there is a blank definition, but no base to
         // mix it in with
         if (!$def) return false;
-        
+
         // add information on required attributes
         foreach ($def->attr as $attr_name => $attr_def) {
             if ($attr_def->required) {
                 $def->required_attr[] = $attr_name;
             }
         }
-        
+
         return $def;
-        
+
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index 434836dd5fd8665f203bc5fb685fbf87824c4121..d546cd751c5b48cd156a6393358a3e9aa47f4559 100644 (file)
@@ -8,13 +8,13 @@
  */
 class HTMLPurifier_IDAccumulator
 {
-    
+
     /**
      * Lookup table of IDs we've accumulated.
      * @public
      */
     public $ids = array();
-    
+
     /**
      * Builds an IDAccumulator, also initializing the default blacklist
      * @param $config Instance of HTMLPurifier_Config
@@ -26,7 +26,7 @@ class HTMLPurifier_IDAccumulator
         $id_accumulator->load($config->get('Attr', 'IDBlacklist'));
         return $id_accumulator;
     }
-    
+
     /**
      * Add an ID to the lookup table.
      * @param $id ID to be added.
@@ -36,7 +36,7 @@ class HTMLPurifier_IDAccumulator
         if (isset($this->ids[$id])) return false;
         return $this->ids[$id] = true;
     }
-    
+
     /**
      * Load a list of IDs into the lookup table
      * @param $array_of_ids Array of IDs to load
@@ -47,6 +47,7 @@ class HTMLPurifier_IDAccumulator
             $this->ids[$id] = true;
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 2d6a861cc0cf92c1c436645a400ec9d35cb27ea7..bc093b805c730f2b75beff10b400459ef546eda6 100644 (file)
@@ -4,59 +4,59 @@
  * Injects tokens into the document while parsing for well-formedness.
  * This enables "formatter-like" functionality such as auto-paragraphing,
  * smiley-ification and linkification to take place.
- * 
+ *
  * A note on how handlers create changes; this is done by assigning a new
  * value to the $token reference. These values can take a variety of forms and
  * are best described HTMLPurifier_Strategy_MakeWellFormed->processToken()
  * documentation.
- * 
- * @todo Allow injectors to request a re-run on their output. This 
+ *
+ * @todo Allow injectors to request a re-run on their output. This
  *       would help if an operation is recursive.
  */
 abstract class HTMLPurifier_Injector
 {
-    
+
     /**
      * Advisory name of injector, this is for friendly error messages
      */
     public $name;
-    
+
     /**
      * Instance of HTMLPurifier_HTMLDefinition
      */
     protected $htmlDefinition;
-    
+
     /**
      * Reference to CurrentNesting variable in Context. This is an array
      * list of tokens that we are currently "inside"
      */
     protected $currentNesting;
-    
+
     /**
      * Reference to InputTokens variable in Context. This is an array
      * list of the input tokens that are being processed.
      */
     protected $inputTokens;
-    
+
     /**
      * Reference to InputIndex variable in Context. This is an integer
      * array index for $this->inputTokens that indicates what token
      * is currently being processed.
      */
     protected $inputIndex;
-    
+
     /**
      * Array of elements and attributes this injector creates and therefore
      * need to be allowed by the definition. Takes form of
      * array('element' => array('attr', 'attr2'), 'element2')
      */
     public $needed = array();
-    
+
     /**
      * Index of inputTokens to rewind to.
      */
     protected $rewind = false;
-    
+
     /**
      * Rewind to a spot to re-perform processing. This is useful if you
      * deleted a node, and now need to see if this change affected any
@@ -68,7 +68,7 @@ abstract class HTMLPurifier_Injector
     public function rewind($index) {
         $this->rewind = $index;
     }
-    
+
     /**
      * Retrieves rewind, and then unsets it.
      */
@@ -77,7 +77,7 @@ abstract class HTMLPurifier_Injector
         $this->rewind = false;
         return $r;
     }
-    
+
     /**
      * Prepares the injector by giving it the config and context objects:
      * this allows references to important variables to be made within
@@ -99,7 +99,7 @@ abstract class HTMLPurifier_Injector
         $this->inputIndex     =& $context->get('InputIndex');
         return false;
     }
-    
+
     /**
      * This function checks if the HTML environment
      * will work with the Injector: if p tags are not allowed, the
@@ -120,7 +120,7 @@ abstract class HTMLPurifier_Injector
         }
         return false;
     }
-    
+
     /**
      * Tests if the context node allows a certain element
      * @param $name Name of element to test for
@@ -139,7 +139,7 @@ abstract class HTMLPurifier_Injector
         }
         return true;
     }
-    
+
     /**
      * Iterator function, which starts with the next token and continues until
      * you reach the end of the input tokens.
@@ -155,7 +155,7 @@ abstract class HTMLPurifier_Injector
         $current = $this->inputTokens[$i];
         return true;
     }
-    
+
     /**
      * Similar to _forward, but accepts a third parameter $nesting (which
      * should be initialized at 0) and stops when we hit the end tag
@@ -172,7 +172,7 @@ abstract class HTMLPurifier_Injector
         }
         return true;
     }
-    
+
     /**
      * Iterator function, starts with the previous token and continues until
      * you reach the beginning of input tokens.
@@ -188,7 +188,7 @@ abstract class HTMLPurifier_Injector
         $current = $this->inputTokens[$i];
         return true;
     }
-    
+
     /**
      * Initializes the iterator at the current position. Use in a do {} while;
      * loop to force the _forward and _backward functions to start at the
@@ -202,31 +202,32 @@ abstract class HTMLPurifier_Injector
         if ($i === null) $i = $this->inputIndex;
         $current = $this->inputTokens[$i];
     }
-    
+
     /**
      * Handler that is called when a text token is processed
      */
     public function handleText(&$token) {}
-    
+
     /**
      * Handler that is called when a start or empty token is processed
      */
     public function handleElement(&$token) {}
-    
+
     /**
      * Handler that is called when an end token is processed
      */
     public function handleEnd(&$token) {
         $this->notifyEnd($token);
     }
-    
+
     /**
      * Notifier that is called when an end token is processed
      * @note This differs from handlers in that the token is read-only
      * @deprecated
      */
     public function notifyEnd($token) {}
-    
-    
+
+
 }
 
+// vim: et sw=4 sts=4
index 3a7666242fe7cc28b9b756362e1c97afe70fa627..8cc952549cc4c05e523d6c9ef0c60c4da4aaf49e 100644 (file)
@@ -8,16 +8,16 @@
  */
 class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
 {
-    
+
     public $name = 'AutoParagraph';
     public $needed = array('p');
-    
+
     private function _pStart() {
         $par = new HTMLPurifier_Token_Start('p');
         $par->armor['MakeWellFormed_TagClosedError'] = true;
         return $par;
     }
-    
+
     public function handleText(&$token) {
         $text = $token->data;
         // Does the current parent allow <p> tags?
@@ -27,7 +27,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                 // in the anonymous root node, or a node inside the document.
                 // If the text as a double-newline, the treatment is the same;
                 // if it doesn't, see the next if-block if you're in the document.
-                
+
                 $i = $nesting = null;
                 if (!$this->forwardUntilEndToken($i, $current, $nesting) && $token->is_whitespace) {
                     // State 1.1: ...    ^ (whitespace, then document end)
@@ -36,10 +36,10 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                 } else {
                     // State 1.2: PAR1
                     //            ----
-                    
+
                     // State 1.3: PAR1\n\nPAR2
                     //            ------------
-                    
+
                     // State 1.4: <div>PAR1\n\nPAR2 (see State 2)
                     //                 ------------
                     $token = array($this->_pStart());
@@ -48,7 +48,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
             } else {
                 // State 2:   <div>PAR1... (similar to 1.4)
                 //                 ----
-                
+
                 // We're in an element that allows paragraph tags, but we're not
                 // sure if we're going to need them.
                 if ($this->_pLookAhead()) {
@@ -62,7 +62,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                 } else {
                     // State 2.2.1: <div>PAR1<div>
                     //                   ----
-                    
+
                     // State 2.2.2: <div>PAR1<b>PAR1</b></div>
                     //                   ----
                 }
@@ -74,7 +74,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
         ) {
             // State 3.1: ...<p>PAR1
             //                  ----
-            
+
             // State 3.2: ...<p>PAR1\n\nPAR2
             //                  ------------
             $token = array();
@@ -83,12 +83,12 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
         } else {
             // State 4.1: ...<b>PAR1
             //                  ----
-            
+
             // State 4.2: ...<b>PAR1\n\nPAR2
             //                  ------------
         }
     }
-    
+
     public function handleElement(&$token) {
         // We don't have to check if we're already in a <p> tag for block
         // tokens, because the tag would have been autoclosed by MakeWellFormed.
@@ -97,39 +97,39 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                 if ($this->_isInline($token)) {
                     // State 1: <div>...<b>
                     //                  ---
-                    
+
                     // Check if this token is adjacent to the parent token
                     // (seek backwards until token isn't whitespace)
                     $i = null;
                     $this->backward($i, $prev);
-                    
+
                     if (!$prev instanceof HTMLPurifier_Token_Start) {
                         // Token wasn't adjacent
-                        
+
                         if (
                             $prev instanceof HTMLPurifier_Token_Text &&
                             substr($prev->data, -2) === "\n\n"
                         ) {
                             // State 1.1.4: <div><p>PAR1</p>\n\n<b>
                             //                                  ---
-                            
+
                             // Quite frankly, this should be handled by splitText
                             $token = array($this->_pStart(), $token);
                         } else {
                             // State 1.1.1: <div><p>PAR1</p><b>
                             //                              ---
-                            
+
                             // State 1.1.2: <div><br /><b>
                             //                         ---
-                            
+
                             // State 1.1.3: <div>PAR<b>
                             //                      ---
                         }
-                        
+
                     } else {
                         // State 1.2.1: <div><b>
                         //                   ---
-                        
+
                         // Lookahead to see if <p> is needed.
                         if ($this->_pLookAhead()) {
                             // State 1.3.1: <div><b>PAR1\n\nPAR2
@@ -138,7 +138,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                         } else {
                             // State 1.3.2: <div><b>PAR1</b></div>
                             //                   ---
-                            
+
                             // State 1.3.3: <div><b>PAR1</b><div></div>\n\n</div>
                             //                   ---
                         }
@@ -158,7 +158,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                     // State 3.2: <div>
                     //            -----
                 }
-                
+
                 $i = null;
                 if ($this->backward($i, $prev)) {
                     if (
@@ -166,19 +166,19 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                     ) {
                         // State 3.1.1: ...</p>{p}<b>
                         //                        ---
-                        
+
                         // State 3.2.1: ...</p><div>
                         //                     -----
-                        
+
                         if (!is_array($token)) $token = array($token);
                         array_unshift($token, new HTMLPurifier_Token_Text("\n\n"));
                     } else {
                         // State 3.1.2: ...</p>\n\n{p}<b>
                         //                            ---
-                        
+
                         // State 3.2.2: ...</p>\n\n<div>
                         //                         -----
-                        
+
                         // Note: PAR<ELEM> cannot occur because PAR would have been
                         // wrapped in <p> tags.
                     }
@@ -187,12 +187,12 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
         } else {
             // State 2.2: <ul><li>
             //                ----
-            
+
             // State 2.4: <p><b>
             //               ---
         }
     }
-    
+
     /**
      * Splits up a text in paragraph tokens and appends them
      * to the result stream that will replace the original
@@ -208,7 +208,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
         $paragraphs  = array(); // without empty paragraphs
         $needs_start = false;
         $needs_end   = false;
-        
+
         $c = count($raw_paragraphs);
         if ($c == 1) {
             // There were no double-newlines, abort quickly. In theory this
@@ -230,7 +230,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                         // a while, and the newline means we should start a new one.
                         $result[] = new HTMLPurifier_Token_End('p');
                         $result[] = new HTMLPurifier_Token_Text("\n\n");
-                        // However, the start token should only be added if 
+                        // However, the start token should only be added if
                         // there is more processing to be done (i.e. there are
                         // real paragraphs in here). If there are none, the
                         // next start paragraph tag will be handled by the
@@ -249,18 +249,18 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
                 }
             }
         }
-        
+
         // Check if this was just a giant blob of whitespace. Move this earlier,
         // perhaps?
         if (empty($paragraphs)) {
             return;
         }
-        
+
         // Add the start tag indicated by \n\n at the beginning of $data
         if ($needs_start) {
             $result[] = $this->_pStart();
         }
-        
+
         // Append the paragraphs onto the result
         foreach ($paragraphs as $par) {
             $result[] = new HTMLPurifier_Token_Text($par);
@@ -268,21 +268,21 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
             $result[] = new HTMLPurifier_Token_Text("\n\n");
             $result[] = $this->_pStart();
         }
-        
+
         // Remove trailing start token; Injector will handle this later if
         // it was indeed needed. This prevents from needing to do a lookahead,
         // at the cost of a lookbehind later.
         array_pop($result);
-        
-        // If there is no need for an end tag, remove all of it and let 
+
+        // If there is no need for an end tag, remove all of it and let
         // MakeWellFormed close it later.
         if (!$needs_end) {
             array_pop($result); // removes \n\n
             array_pop($result); // removes </p>
         }
-        
+
     }
-    
+
     /**
      * Returns true if passed token is inline (and, ergo, allowed in
      * paragraph tags)
@@ -290,7 +290,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
     private function _isInline($token) {
         return isset($this->htmlDefinition->info['p']->child->elements[$token->name]);
     }
-    
+
     /**
      * Looks ahead in the token list and determines whether or not we need
      * to insert a <p> tag.
@@ -309,7 +309,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
         }
         return $ok;
     }
-    
+
     /**
      * Determines if a particular token requires an earlier inline token
      * to get a paragraph. This should be used with _forwardUntilEndToken
@@ -334,6 +334,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
         }
         return null;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 6fc566d70c3a6a34ee4aff51f82cc81dc9db79f9..9dce9bd0857f3b80fead39894609a7f49413be9b 100644 (file)
@@ -5,13 +5,13 @@
  */
 class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier_Injector
 {
-    
+
     public $name = 'DisplayLinkURI';
     public $needed = array('a');
-    
+
     public function handleElement(&$token) {
     }
-    
+
     public function handleEnd(&$token) {
         if (isset($token->start->attr['href'])){
             $url = $token->start->attr['href'];
@@ -21,4 +21,6 @@ class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier_Injector
             // nothing to display
         }
     }
-}
\ No newline at end of file
+}
+
+// vim: et sw=4 sts=4
index c5d51789e62ce3d7cb28db2cc32bd1fafde1824f..296dac282996255c811ab9908c9ed6f512ab924d 100644 (file)
@@ -5,26 +5,26 @@
  */
 class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
 {
-    
+
     public $name = 'Linkify';
     public $needed = array('a' => array('href'));
-    
+
     public function handleText(&$token) {
         if (!$this->allowsElement('a')) return;
-        
+
         if (strpos($token->data, '://') === false) {
             // our really quick heuristic failed, abort
             // this may not work so well if we want to match things like
             // "google.com", but then again, most people don't
             return;
         }
-        
+
         // there is/are URL(s). Let's split the string:
         // Note: this regex is extremely permissive
         $bits = preg_split('#((?:https?|ftp)://[^\s\'"<>()]+)#S', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
-        
+
         $token = array();
-        
+
         // $i = index
         // $c = count
         // $l = is link
@@ -38,8 +38,9 @@ class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector
                 $token[] = new HTMLPurifier_Token_End('a');
             }
         }
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 378f5cd36cd94689a662011c2842162858ff87ad..3c706a33aff4934e0d49c54ad6ded042687e2840 100644 (file)
@@ -6,23 +6,23 @@
  */
 class HTMLPurifier_Injector_PurifierLinkify extends HTMLPurifier_Injector
 {
-    
+
     public $name = 'PurifierLinkify';
     public $docURL;
     public $needed = array('a' => array('href'));
-    
+
     public function prepare($config, $context) {
         $this->docURL = $config->get('AutoFormatParam', 'PurifierLinkifyDocURL');
         return parent::prepare($config, $context);
     }
-    
+
     public function handleText(&$token) {
         if (!$this->allowsElement('a')) return;
         if (strpos($token->data, '%') === false) return;
-        
+
         $bits = preg_split('#%([a-z0-9]+\.[a-z0-9]+)#Si', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
         $token = array();
-        
+
         // $i = index
         // $c = count
         // $l = is link
@@ -37,8 +37,9 @@ class HTMLPurifier_Injector_PurifierLinkify extends HTMLPurifier_Injector
                 $token[] = new HTMLPurifier_Token_End('a');
             }
         }
-        
+
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 53bb0f00c43d3bf92470cadc86a16c14d0f0abcc..d85ca97d92349abb77a6f35719f86169bedd97ba 100644 (file)
@@ -2,16 +2,16 @@
 
 class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector
 {
-    
+
     private $context, $config;
-    
+
     public function prepare($config, $context) {
         parent::prepare($config, $context);
         $this->config = $config;
         $this->context = $context;
         $this->attrValidator = new HTMLPurifier_AttrValidator();
     }
-    
+
     public function handleElement(&$token) {
         if (!$token instanceof HTMLPurifier_Token_Start) return;
         $next = false;
@@ -36,5 +36,7 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector
             return;
         }
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 1ac6c359368423526cead896a0b589cc6e697e7e..34158286858c6dcb65d85f866fadbf03a47ef988 100644 (file)
@@ -8,10 +8,10 @@ class HTMLPurifier_Injector_SafeObject extends HTMLPurifier_Injector
 {
     public $name = 'SafeObject';
     public $needed = array('object', 'param');
-    
+
     protected $objectStack = array();
     protected $paramStack  = array();
-    
+
     // Keep this synchronized with AttrTransform/SafeParam.php
     protected $addParam = array(
         'allowScriptAccess' => 'never',
@@ -21,11 +21,11 @@ class HTMLPurifier_Injector_SafeObject extends HTMLPurifier_Injector
         'wmode' => true,
         'movie' => true,
     );
-    
+
     public function prepare($config, $context) {
         parent::prepare($config, $context);
     }
-    
+
     public function handleElement(&$token) {
         if ($token->name == 'object') {
             $this->objectStack[] = $token;
@@ -71,7 +71,7 @@ class HTMLPurifier_Injector_SafeObject extends HTMLPurifier_Injector
             }
         }
     }
-    
+
     public function handleEnd(&$token) {
         // This is the WRONG way of handling the object and param stacks;
         // we should be inserting them directly on the relevant object tokens
@@ -81,6 +81,7 @@ class HTMLPurifier_Injector_SafeObject extends HTMLPurifier_Injector
             array_pop($this->paramStack);
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 7337c5bc81e6527903f205c1fefdaa79ba6864dd..3e2be03b584578bc944c389a0b80b49220399186 100644 (file)
@@ -6,50 +6,50 @@
  */
 class HTMLPurifier_Language
 {
-    
+
     /**
      * ISO 639 language code of language. Prefers shortest possible version
      */
     public $code = 'en';
-    
+
     /**
      * Fallback language code
      */
     public $fallback = false;
-    
+
     /**
      * Array of localizable messages
      */
     public $messages = array();
-    
+
     /**
      * Array of localizable error codes
      */
     public $errorNames = array();
-    
+
     /**
      * True if no message file was found for this language, so English
      * is being used instead. Check this if you'd like to notify the
      * user that they've used a non-supported language.
      */
     public $error = false;
-    
+
     /**
      * Has the language object been loaded yet?
      * @todo Make it private, fix usage in HTMLPurifier_LanguageTest
      */
     public $_loaded = false;
-    
+
     /**
      * Instances of HTMLPurifier_Config and HTMLPurifier_Context
      */
     protected $config, $context;
-    
+
     public function __construct($config, $context) {
         $this->config  = $config;
         $this->context = $context;
     }
-    
+
     /**
      * Loads language object with necessary info from factory cache
      * @note This is a lazy loader
@@ -63,7 +63,7 @@ class HTMLPurifier_Language
         }
         $this->_loaded = true;
     }
-    
+
     /**
      * Retrieves a localised message.
      * @param $key string identifier of message
@@ -74,7 +74,7 @@ class HTMLPurifier_Language
         if (!isset($this->messages[$key])) return "[$key]";
         return $this->messages[$key];
     }
-    
+
     /**
      * Retrieves a localised error name.
      * @param $int integer error number, corresponding to PHP's error
@@ -86,7 +86,7 @@ class HTMLPurifier_Language
         if (!isset($this->errorNames[$int])) return "[Error: $int]";
         return $this->errorNames[$int];
     }
-    
+
     /**
      * Converts an array list into a string readable representation
      */
@@ -105,7 +105,7 @@ class HTMLPurifier_Language
         }
         return $ret;
     }
-    
+
     /**
      * Formats a localised message with passed parameters
      * @param $key string identifier of message
@@ -127,7 +127,7 @@ class HTMLPurifier_Language
                     if (!$generator) $generator = $this->context->get('Generator');
                     if (isset($value->name)) $subst['$'.$i.'.Name'] = $value->name;
                     if (isset($value->data)) $subst['$'.$i.'.Data'] = $value->data;
-                    $subst['$'.$i.'.Compact'] = 
+                    $subst['$'.$i.'.Compact'] =
                     $subst['$'.$i.'.Serialized'] = $generator->generateFromToken($value);
                     // a more complex algorithm for compact representation
                     // could be introduced for all types of tokens. This
@@ -157,6 +157,7 @@ class HTMLPurifier_Language
         }
         return strtr($raw, $subst);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index cbf0e612b63e4dfea6c0307ce280f76b2bb7fb07..d52fcb7ac182678c7edcc123aeba30310563aecb 100644 (file)
@@ -4,8 +4,9 @@
 
 class HTMLPurifier_Language_en_x_test extends HTMLPurifier_Language
 {
-    
-    
-    
+
+
+
 }
 
+// vim: et sw=4 sts=4
index 3eac9ec65cedb77149db65f2b44dc44f0ad79b1a..1c046f379ef6fe9f8d568b796a7b7168ed5e982f 100644 (file)
@@ -8,3 +8,4 @@ $messages = array(
     'HTMLPurifier' => 'HTML Purifier X'
 );
 
+// vim: et sw=4 sts=4
index 4b16cd20a9c648fdcfd15b26a7a4ebb8efb9f420..806c83fbf751d137927f0ef6d7c7cf0d1d144473 100644 (file)
@@ -9,3 +9,4 @@ $messages = array(
     'HTMLPurifier' => 'HTML Purifier XNone'
 );
 
+// vim: et sw=4 sts=4
index 212acd822b432413db0b6a58e5db0baef4e27bdd..aab2e52ebc823b4cfaf52fa9a2621dd3ee498419 100644 (file)
@@ -37,6 +37,7 @@ $messages = array(
 'Strategy_MakeWellFormed: Unnecessary end tag removed' => 'Unnecessary $CurrentToken.Serialized tag removed',
 'Strategy_MakeWellFormed: Unnecessary end tag to text' => 'Unnecessary $CurrentToken.Serialized tag converted to text',
 'Strategy_MakeWellFormed: Tag auto closed'             => '$1.Compact started on line $1.Line auto-closed by $CurrentToken.Compact',
+'Strategy_MakeWellFormed: Tag carryover'               => '$1.Compact started on line $1.Line auto-continued into $CurrentToken.Compact',
 'Strategy_MakeWellFormed: Stray end tag removed'       => 'Stray $CurrentToken.Serialized tag removed',
 'Strategy_MakeWellFormed: Stray end tag to text'       => 'Stray $CurrentToken.Serialized tag converted to text',
 'Strategy_MakeWellFormed: Tag closed by element end'   => '$1.Compact tag started on line $1.Line closed by end of $CurrentToken.Serialized',
@@ -58,3 +59,4 @@ $errorNames = array(
     E_NOTICE  => 'Notice'
 );
 
+// vim: et sw=4 sts=4
index 296999b8c2ede490dae216e34d341093df1bb983..baa4422ebfa14c32067ea8df3aaf059863ad6aa7 100644 (file)
@@ -9,46 +9,46 @@
  */
 class HTMLPurifier_LanguageFactory
 {
-    
+
     /**
      * Cache of language code information used to load HTMLPurifier_Language objects
      * Structure is: $factory->cache[$language_code][$key] = $value
      * @value array map
      */
     public $cache;
-    
+
     /**
      * Valid keys in the HTMLPurifier_Language object. Designates which
      * variables to slurp out of a message file.
      * @value array list
      */
     public $keys = array('fallback', 'messages', 'errorNames');
-    
+
     /**
      * Instance of HTMLPurifier_AttrDef_Lang to validate language codes
      * @value object HTMLPurifier_AttrDef_Lang
      */
     protected $validator;
-    
+
     /**
      * Cached copy of dirname(__FILE__), directory of current file without
      * trailing slash
      * @value string filename
      */
     protected $dir;
-    
+
     /**
      * Keys whose contents are a hash map and can be merged
      * @value array lookup
      */
     protected $mergeable_keys_map = array('messages' => true, 'errorNames' => true);
-    
+
     /**
      * Keys whose contents are a list and can be merged
      * @value array lookup
      */
     protected $mergeable_keys_list = array();
-    
+
     /**
      * Retrieve sole instance of the factory.
      * @param $prototype Optional prototype to overload sole instance with,
@@ -64,7 +64,7 @@ class HTMLPurifier_LanguageFactory
         }
         return $instance;
     }
-    
+
     /**
      * Sets up the singleton, much like a constructor
      * @note Prevents people from getting this outside of the singleton
@@ -73,7 +73,7 @@ class HTMLPurifier_LanguageFactory
         $this->validator = new HTMLPurifier_AttrDef_Lang();
         $this->dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier';
     }
-    
+
     /**
      * Creates a language object, handles class fallbacks
      * @param $config Instance of HTMLPurifier_Config
@@ -81,7 +81,7 @@ class HTMLPurifier_LanguageFactory
      * @param $code Code to override configuration with. Private parameter.
      */
     public function create($config, $context, $code = false) {
-        
+
         // validate language code
         if ($code === false) {
             $code = $this->validator->validate(
@@ -91,10 +91,10 @@ class HTMLPurifier_LanguageFactory
             $code = $this->validator->validate($code, $config, $context);
         }
         if ($code === false) $code = 'en'; // malformed code becomes English
-        
+
         $pcode = str_replace('-', '_', $code); // make valid PHP classname
         static $depth = 0; // recursion protection
-        
+
         if ($code == 'en') {
             $lang = new HTMLPurifier_Language($config, $context);
         } else {
@@ -114,13 +114,13 @@ class HTMLPurifier_LanguageFactory
                 $depth--;
             }
         }
-        
+
         $lang->code = $code;
-        
+
         return $lang;
-        
+
     }
-    
+
     /**
      * Returns the fallback language for language
      * @note Loads the original language into cache
@@ -130,23 +130,23 @@ class HTMLPurifier_LanguageFactory
         $this->loadLanguage($code);
         return $this->cache[$code]['fallback'];
     }
-    
+
     /**
      * Loads language into the cache, handles message file and fallbacks
      * @param $code string language code
      */
     public function loadLanguage($code) {
         static $languages_seen = array(); // recursion guard
-        
+
         // abort if we've already loaded it
         if (isset($this->cache[$code])) return;
-        
+
         // generate filename
         $filename = $this->dir . '/Language/messages/' . $code . '.php';
-        
+
         // default fallback : may be overwritten by the ensuing include
         $fallback = ($code != 'en') ? 'en' : false;
-        
+
         // load primary localisation
         if (!file_exists($filename)) {
             // skip the include: will rely solely on fallback
@@ -156,10 +156,10 @@ class HTMLPurifier_LanguageFactory
             include $filename;
             $cache = compact($this->keys);
         }
-        
+
         // load fallback localisation
         if (!empty($fallback)) {
-            
+
             // infinite recursion guard
             if (isset($languages_seen[$code])) {
                 trigger_error('Circular fallback reference in language ' .
@@ -167,11 +167,11 @@ class HTMLPurifier_LanguageFactory
                 $fallback = 'en';
             }
             $language_seen[$code] = true;
-            
+
             // load the fallback recursively
             $this->loadLanguage($fallback);
             $fallback_cache = $this->cache[$fallback];
-            
+
             // merge fallback with current language
             foreach ( $this->keys as $key ) {
                 if (isset($cache[$key]) && isset($fallback_cache[$key])) {
@@ -184,14 +184,15 @@ class HTMLPurifier_LanguageFactory
                     $cache[$key] = $fallback_cache[$key];
                 }
             }
-            
+
         }
-        
+
         // save to cache for later retrieval
         $this->cache[$code] = $cache;
-        
+
         return;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 758f9bb0e4dffc9af9427341fac729e1a0f91e74..8d2a46b7da9322fa88b30ead08ed6b63ef4f7c6c 100644 (file)
@@ -6,22 +6,22 @@
  */
 class HTMLPurifier_Length
 {
-    
+
     /**
      * String numeric magnitude.
      */
     protected $n;
-    
+
     /**
      * String unit. False is permitted if $n = 0.
      */
     protected $unit;
-    
+
     /**
      * Whether or not this length is valid. Null if not calculated yet.
      */
     protected $isValid;
-    
+
     /**
      * Lookup array of units recognized by CSS 2.1
      */
@@ -29,7 +29,7 @@ class HTMLPurifier_Length
         'em' => true, 'ex' => true, 'px' => true, 'in' => true,
         'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true
     );
-    
+
     /**
      * @param number $n Magnitude
      * @param string $u Unit
@@ -38,7 +38,7 @@ class HTMLPurifier_Length
         $this->n = (string) $n;
         $this->unit = $u !== false ? (string) $u : false;
     }
-    
+
     /**
      * @param string $s Unit string, like '2em' or '3.4in'
      * @warning Does not perform validation.
@@ -51,7 +51,7 @@ class HTMLPurifier_Length
         if ($unit === '') $unit = false;
         return new HTMLPurifier_Length($n, $unit);
     }
-    
+
     /**
      * Validates the number and unit.
      */
@@ -68,7 +68,7 @@ class HTMLPurifier_Length
         $this->n = $result;
         return true;
     }
-    
+
     /**
      * Returns string representation of number.
      */
@@ -76,17 +76,17 @@ class HTMLPurifier_Length
         if (!$this->isValid()) return false;
         return $this->n . $this->unit;
     }
-    
+
     /**
      * Retrieves string numeric magnitude.
      */
     public function getN() {return $this->n;}
-    
+
     /**
      * Retrieves string unit.
      */
     public function getUnit() {return $this->unit;}
-    
+
     /**
      * Returns true if this length unit is valid.
      */
@@ -94,7 +94,7 @@ class HTMLPurifier_Length
         if ($this->isValid === null) $this->isValid = $this->validate();
         return $this->isValid;
     }
-    
+
     /**
      * Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
      * @warning If both values are too large or small, this calculation will
@@ -109,5 +109,7 @@ class HTMLPurifier_Length
         }
         return $this->n - $l->n;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 043c0ea0db88b8cc911596147c6b3d6f89d9a03c..94588699834d1f6de32508c257a7833f2827b555 100644 (file)
@@ -2,38 +2,38 @@
 
 /**
  * Forgivingly lexes HTML (SGML-style) markup into tokens.
- * 
+ *
  * A lexer parses a string of SGML-style markup and converts them into
  * corresponding tokens.  It doesn't check for well-formedness, although its
  * internal mechanism may make this automatic (such as the case of
  * HTMLPurifier_Lexer_DOMLex).  There are several implementations to choose
  * from.
- * 
+ *
  * A lexer is HTML-oriented: it might work with XML, but it's not
  * recommended, as we adhere to a subset of the specification for optimization
  * reasons. This might change in the future. Also, most tokenizers are not
  * expected to handle DTDs or PIs.
- * 
+ *
  * This class should not be directly instantiated, but you may use create() to
  * retrieve a default copy of the lexer.  Being a supertype, this class
  * does not actually define any implementation, but offers commonly used
  * convenience functions for subclasses.
- * 
+ *
  * @note The unit tests will instantiate this class for testing purposes, as
  *       many of the utility functions require a class to be instantiated.
  *       This means that, even though this class is not runnable, it will
  *       not be declared abstract.
- * 
+ *
  * @par
- * 
+ *
  * @note
  * We use tokens rather than create a DOM representation because DOM would:
- * 
+ *
  * @par
  *  -# Require more processing and memory to create,
  *  -# Is not streamable, and
  *  -# Has the entire document structure (html and body not needed).
- * 
+ *
  * @par
  * However, DOM is helpful in that it makes it easy to move around nodes
  * without a lot of lookaheads to see when a tag is closed. This is a
  */
 class HTMLPurifier_Lexer
 {
-    
+
     /**
      * Whether or not this lexer implements line-number/column-number tracking.
      * If it does, set to true.
      */
     public $tracksLineNumbers = false;
-    
+
     // -- STATIC ----------------------------------------------------------
-    
+
     /**
      * Retrieves or sets the default Lexer as a Prototype Factory.
-     * 
+     *
      * By default HTMLPurifier_Lexer_DOMLex will be returned. There are
      * a few exceptions involving special features that only DirectLex
      * implements.
-     * 
+     *
      * @note The behavior of this class has changed, rather than accepting
      *       a prototype object, it now accepts a configuration object.
      *       To specify your own prototype, set %Core.LexerImpl to it.
      *       This change in behavior de-singletonizes the lexer object.
-     * 
+     *
      * @param $config Instance of HTMLPurifier_Config
      * @return Concrete lexer.
      */
     public static function create($config) {
-        
+
         if (!($config instanceof HTMLPurifier_Config)) {
             $lexer = $config;
-            trigger_error("Passing a prototype to 
+            trigger_error("Passing a prototype to
               HTMLPurifier_Lexer::create() is deprecated, please instead
               use %Core.LexerImpl", E_USER_WARNING);
         } else {
             $lexer = $config->get('Core', 'LexerImpl');
         }
-        
+
         $needs_tracking =
             $config->get('Core', 'MaintainLineNumbers') ||
             $config->get('Core', 'CollectErrors');
-        
+
         $inst = null;
         if (is_object($lexer)) {
             $inst = $lexer;
         } else {
-            
+
             if (is_null($lexer)) { do {
                 // auto-detection algorithm
-                
+
                 if ($needs_tracking) {
                     $lexer = 'DirectLex';
                     break;
                 }
-                
+
                 if (
                     class_exists('DOMDocument') &&
                     method_exists('DOMDocument', 'loadHTML') &&
@@ -106,9 +106,9 @@ class HTMLPurifier_Lexer
                 } else {
                     $lexer = 'DirectLex';
                 }
-                
+
             } while(0); } // do..while so we can break
-            
+
             // instantiate recognized string names
             switch ($lexer) {
                 case 'DOMLex':
@@ -124,25 +124,25 @@ class HTMLPurifier_Lexer
                     throw new HTMLPurifier_Exception("Cannot instantiate unrecognized Lexer type " . htmlspecialchars($lexer));
             }
         }
-        
+
         if (!$inst) throw new HTMLPurifier_Exception('No lexer was instantiated');
-        
+
         // once PHP DOM implements native line numbers, or we
         // hack out something using XSLT, remove this stipulation
         if ($needs_tracking && !$inst->tracksLineNumbers) {
             throw new HTMLPurifier_Exception('Cannot use lexer that does not support line numbers with Core.MaintainLineNumbers or Core.CollectErrors (use DirectLex instead)');
         }
-        
+
         return $inst;
-        
+
     }
-    
+
     // -- CONVENIENCE MEMBERS ---------------------------------------------
-    
+
     public function __construct() {
         $this->_entity_parser = new HTMLPurifier_EntityParser();
     }
-    
+
     /**
      * Most common entity to raw value conversion table for special entities.
      */
@@ -156,58 +156,58 @@ class HTMLPurifier_Lexer
                     '&#039;' => "'",
                     '&#x27;' => "'"
             );
-    
+
     /**
      * Parses special entities into the proper characters.
-     * 
+     *
      * This string will translate escaped versions of the special characters
      * into the correct ones.
-     * 
+     *
      * @warning
      * You should be able to treat the output of this function as
      * completely parsed, but that's only because all other entities should
      * have been handled previously in substituteNonSpecialEntities()
-     * 
+     *
      * @param $string String character data to be parsed.
      * @returns Parsed character data.
      */
     public function parseData($string) {
-        
+
         // following functions require at least one character
         if ($string === '') return '';
-        
+
         // subtracts amps that cannot possibly be escaped
         $num_amp = substr_count($string, '&') - substr_count($string, '& ') -
             ($string[strlen($string)-1] === '&' ? 1 : 0);
-        
+
         if (!$num_amp) return $string; // abort if no entities
         $num_esc_amp = substr_count($string, '&amp;');
         $string = strtr($string, $this->_special_entity2str);
-        
+
         // code duplication for sake of optimization, see above
         $num_amp_2 = substr_count($string, '&') - substr_count($string, '& ') -
             ($string[strlen($string)-1] === '&' ? 1 : 0);
-        
+
         if ($num_amp_2 <= $num_esc_amp) return $string;
-        
+
         // hmm... now we have some uncommon entities. Use the callback.
         $string = $this->_entity_parser->substituteSpecialEntities($string);
         return $string;
     }
-    
+
     /**
      * Lexes an HTML string into tokens.
-     * 
+     *
      * @param $string String HTML.
      * @return HTMLPurifier_Token array representation of HTML.
      */
     public function tokenizeHTML($string, $config, $context) {
         trigger_error('Call to abstract class', E_USER_ERROR);
     }
-    
+
     /**
      * Translates CDATA sections into regular sections (through escaping).
-     * 
+     *
      * @param $string HTML string to process.
      * @returns HTML with CDATA sections escaped.
      */
@@ -218,7 +218,7 @@ class HTMLPurifier_Lexer
             $string
         );
     }
-    
+
     /**
      * Special CDATA case that is especially convoluted for <script>
      */
@@ -229,10 +229,10 @@ class HTMLPurifier_Lexer
             $string
         );
     }
-    
+
     /**
      * Callback function for escapeCDATA() that does the work.
-     * 
+     *
      * @warning Though this is public in order to let the callback happen,
      *          calling it directly is not recommended.
      * @params $matches PCRE matches array, with index 0 the entire match
@@ -243,42 +243,42 @@ class HTMLPurifier_Lexer
         // not exactly sure why the character set is needed, but whatever
         return htmlspecialchars($matches[1], ENT_COMPAT, 'UTF-8');
     }
-    
+
     /**
      * Takes a piece of HTML and normalizes it by converting entities, fixing
      * encoding, extracting bits, and other good stuff.
      * @todo Consider making protected
      */
     public function normalize($html, $config, $context) {
-        
+
         // normalize newlines to \n
         $html = str_replace("\r\n", "\n", $html);
         $html = str_replace("\r", "\n", $html);
-        
+
         if ($config->get('HTML', 'Trusted')) {
             // escape convoluted CDATA
             $html = $this->escapeCommentedCDATA($html);
         }
-        
+
         // escape CDATA
         $html = $this->escapeCDATA($html);
-        
+
         // extract body from document if applicable
         if ($config->get('Core', 'ConvertDocumentToFragment')) {
             $html = $this->extractBody($html);
         }
-        
+
         // expand entities that aren't the big five
         $html = $this->_entity_parser->substituteNonSpecialEntities($html);
-        
+
         // clean into wellformed UTF-8 string for an SGML context: this has
         // to be done after entity expansion because the entities sometimes
         // represent non-SGML characters (horror, horror!)
         $html = HTMLPurifier_Encoder::cleanUTF8($html);
-        
+
         return $html;
     }
-    
+
     /**
      * Takes a string of HTML (fragment or document) and returns the content
      * @todo Consider making protected
@@ -292,6 +292,7 @@ class HTMLPurifier_Lexer
             return $html;
         }
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 3ffe7dbdf5a2f8b345fa7dddbee38f7c7299431a..0db3974bfa0f1324459c5aaa71136035e009b415 100644 (file)
@@ -2,20 +2,20 @@
 
 /**
  * Parser that uses PHP 5's DOM extension (part of the core).
- * 
+ *
  * In PHP 5, the DOM XML extension was revamped into DOM and added to the core.
  * It gives us a forgiving HTML parser, which we use to transform the HTML
  * into a DOM, and then into the tokens.  It is blazingly fast (for large
  * documents, it performs twenty times faster than
- * HTMLPurifier_Lexer_DirectLex,and is the default choice for PHP 5. 
- * 
+ * HTMLPurifier_Lexer_DirectLex,and is the default choice for PHP 5.
+ *
  * @note Any empty elements will have empty tokens associated with them, even if
  * this is prohibited by the spec. This is cannot be fixed until the spec
  * comes into play.
- * 
+ *
  * @note PHP's DOM extension does not actually parse any entities, we use
  *       our own function to do that.
- * 
+ *
  * @warning DOM tends to drop whitespace, which may wreak havoc on indenting.
  *          If this is a huge problem, due to the fact that HTML is hand
  *          edited and you are unable to get a parser cache that caches the
 
 class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
 {
-    
+
     private $factory;
-    
+
     public function __construct() {
         // setup the factory
         parent::__construct();
         $this->factory = new HTMLPurifier_TokenFactory();
     }
-    
+
     public function tokenizeHTML($html, $config, $context) {
-        
+
         $html = $this->normalize($html, $config, $context);
-        
+
         // attempt to armor stray angled brackets that cannot possibly
         // form tags and thus are probably being used as emoticons
         if ($config->get('Core', 'AggressivelyFixLt')) {
@@ -51,17 +51,17 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
             } while ($html !== $old);
             $html = preg_replace_callback($comment, array($this, 'callbackUndoCommentSubst'), $html); // fix comments
         }
-        
+
         // preprocess html, essential for UTF-8
         $html = $this->wrapHTML($html, $config, $context);
-        
+
         $doc = new DOMDocument();
         $doc->encoding = 'UTF-8'; // theoretically, the above has this covered
-        
+
         set_error_handler(array($this, 'muteErrorHandler'));
         $doc->loadHTML($html);
         restore_error_handler();
-        
+
         $tokens = array();
         $this->tokenizeDOM(
             $doc->getElementsByTagName('html')->item(0)-> // <html>
@@ -70,10 +70,10 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
             , $tokens);
         return $tokens;
     }
-    
+
     /**
      * Recursive function that tokenizes a node, putting it into an accumulator.
-     * 
+     *
      * @param $node     DOMNode to be tokenized.
      * @param $tokens   Array-list of already tokenized tokens.
      * @param $collect  Says whether or start and close are collected, set to
@@ -82,7 +82,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
      * @returns Tokens of node appended to previously passed tokens.
      */
     protected function tokenizeDOM($node, &$tokens, $collect = false) {
-        
+
         // intercept non element nodes. WE MUST catch all of them,
         // but we're not getting the character reference nodes because
         // those should have been preprocessed
@@ -119,11 +119,11 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
         ) {
             return;
         }
-        
+
         $attr = $node->hasAttributes() ?
             $this->transformAttrToAssoc($node->attributes) :
             array();
-        
+
         // We still have to make sure that the element actually IS empty
         if (!$node->childNodes->length) {
             if ($collect) {
@@ -145,12 +145,12 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
                 $tokens[] = $this->factory->createEnd($tag_name);
             }
         }
-        
+
     }
-    
+
     /**
      * Converts a DOMNamedNodeMap of DOMAttr objects into an assoc array.
-     * 
+     *
      * @param $attribute_list DOMNamedNodeMap of DOMAttr objects.
      * @returns Associative array of attributes.
      */
@@ -165,12 +165,12 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
         }
         return $array;
     }
-    
+
     /**
      * An error handler that mutes all errors
      */
     public function muteErrorHandler($errno, $errstr) {}
-    
+
     /**
      * Callback function for undoing escaping of stray angled brackets
      * in comments
@@ -178,7 +178,7 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
     public function callbackUndoCommentSubst($matches) {
         return '<!--' . strtr($matches[1], array('&amp;'=>'&','&lt;'=>'<')) . $matches[2];
     }
-    
+
     /**
      * Callback function that entity-izes ampersands in comments so that
      * callbackUndoCommentSubst doesn't clobber them
@@ -186,27 +186,28 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
     public function callbackArmorCommentEntities($matches) {
         return '<!--' . str_replace('&', '&amp;', $matches[1]) . $matches[2];
     }
-    
+
     /**
      * Wraps an HTML fragment in the necessary HTML
      */
     protected function wrapHTML($html, $config, $context) {
         $def = $config->getDefinition('HTML');
         $ret = '';
-        
+
         if (!empty($def->doctype->dtdPublic) || !empty($def->doctype->dtdSystem)) {
             $ret .= '<!DOCTYPE html ';
             if (!empty($def->doctype->dtdPublic)) $ret .= 'PUBLIC "' . $def->doctype->dtdPublic . '" ';
             if (!empty($def->doctype->dtdSystem)) $ret .= '"' . $def->doctype->dtdSystem . '" ';
             $ret .= '>';
         }
-        
+
         $ret .= '<html><head>';
         $ret .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
         // No protection if $html contains a stray </div>!
         $ret .= '</head><body><div>'.$html.'</div></body></html>';
         return $ret;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 45ddc876e42b5fc0b936a2ec768ea5daa99c6b8a..bfca4533d8c0447f564695f31df8159754bbb063 100644 (file)
@@ -2,24 +2,24 @@
 
 /**
  * Our in-house implementation of a parser.
- * 
+ *
  * A pure PHP parser, DirectLex has absolutely no dependencies, making
  * it a reasonably good default for PHP4.  Written with efficiency in mind,
  * it can be four times faster than HTMLPurifier_Lexer_PEARSax3, although it
  * pales in comparison to HTMLPurifier_Lexer_DOMLex.
- * 
+ *
  * @todo Reread XML spec and document differences.
  */
 class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
 {
-    
+
     public $tracksLineNumbers = true;
-    
+
     /**
      * Whitespace characters for str(c)spn.
      */
     protected $_whitespace = "\x20\x09\x0D\x0A";
-    
+
     /**
      * Callback function for script CDATA fudge
      * @param $matches, in form of array(opening tag, contents, closing tag)
@@ -27,9 +27,9 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
     protected function scriptCallback($matches) {
         return $matches[1] . htmlspecialchars($matches[2], ENT_COMPAT, 'UTF-8') . $matches[3];
     }
-    
+
     public function tokenizeHTML($html, $config, $context) {
-        
+
         // special normalization for script tags without any armor
         // our "armor" heurstic is a < sign any number of whitespaces after
         // the first script tag
@@ -37,25 +37,25 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
             $html = preg_replace_callback('#(<script[^>]*>)(\s*[^<].+?)(</script>)#si',
                 array($this, 'scriptCallback'), $html);
         }
-        
+
         $html = $this->normalize($html, $config, $context);
-        
+
         $cursor = 0; // our location in the text
         $inside_tag = false; // whether or not we're parsing the inside of a tag
         $array = array(); // result array
-        
+
         // This is also treated to mean maintain *column* numbers too
         $maintain_line_numbers = $config->get('Core', 'MaintainLineNumbers');
-        
+
         if ($maintain_line_numbers === null) {
             // automatically determine line numbering by checking
             // if error collection is on
             $maintain_line_numbers = $config->get('Core', 'CollectErrors');
         }
-        
+
         if ($maintain_line_numbers) {
             $current_line = 1;
-            $current_col  = 0; 
+            $current_col  = 0;
             $length = strlen($html);
         } else {
             $current_line = false;
@@ -67,34 +67,34 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
         $nl = "\n";
         // how often to manually recalculate. This will ALWAYS be right,
         // but it's pretty wasteful. Set to 0 to turn off
-        $synchronize_interval = $config->get('Core', 'DirectLexLineNumberSyncInterval'); 
-        
+        $synchronize_interval = $config->get('Core', 'DirectLexLineNumberSyncInterval');
+
         $e = false;
         if ($config->get('Core', 'CollectErrors')) {
             $e =& $context->get('ErrorCollector');
         }
-        
+
         // for testing synchronization
         $loops = 0;
-        
+
         while(++$loops) {
-            
+
             // $cursor is either at the start of a token, or inside of
             // a tag (i.e. there was a < immediately before it), as indicated
             // by $inside_tag
-            
+
             if ($maintain_line_numbers) {
-                
+
                 // $rcursor, however, is always at the start of a token.
                 $rcursor = $cursor - (int) $inside_tag;
-                
+
                 // Column number is cheap, so we calculate it every round.
-                // We're interested at the *end* of the newline string, so 
+                // We're interested at the *end* of the newline string, so
                 // we need to add strlen($nl) == 1 to $nl_pos before subtracting it
                 // from our "rcursor" position.
                 $nl_pos = strrpos($html, $nl, $rcursor - $length);
                 $current_col = $rcursor - (is_bool($nl_pos) ? 0 : $nl_pos + 1);
-                
+
                 // recalculate lines
                 if (
                     $synchronize_interval &&  // synchronization is on
@@ -103,19 +103,19 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                 ) {
                     $current_line = 1 + $this->substrCount($html, $nl, 0, $cursor);
                 }
-                
+
             }
-            
+
             $position_next_lt = strpos($html, '<', $cursor);
             $position_next_gt = strpos($html, '>', $cursor);
-            
+
             // triggers on "<b>asdf</b>" but not "asdf <b></b>"
             // special case to set up context
             if ($position_next_lt === $cursor) {
                 $inside_tag = true;
                 $cursor++;
             }
-            
+
             if (!$inside_tag && $position_next_lt !== false) {
                 // We are not inside tag and there still is another tag to parse
                 $token = new
@@ -154,22 +154,22 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                 // We are in tag and it is well formed
                 // Grab the internals of the tag
                 $strlen_segment = $position_next_gt - $cursor;
-                
+
                 if ($strlen_segment < 1) {
                     // there's nothing to process!
                     $token = new HTMLPurifier_Token_Text('<');
                     $cursor++;
                     continue;
                 }
-                
+
                 $segment = substr($html, $cursor, $strlen_segment);
-                
+
                 if ($segment === false) {
                     // somehow, we attempted to access beyond the end of
                     // the string, defense-in-depth, reported by Nate Abele
                     break;
                 }
-                
+
                 // Check if it's a comment
                 if (
                     substr($segment, 0, 3) === '!--'
@@ -203,7 +203,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     $inside_tag = false;
                     continue;
                 }
-                
+
                 // Check if it's an end tag
                 $is_end_tag = (strpos($segment,'/') === 0);
                 if ($is_end_tag) {
@@ -218,7 +218,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     $cursor = $position_next_gt + 1;
                     continue;
                 }
-                
+
                 // Check leading character is alnum, if not, we may
                 // have accidently grabbed an emoticon. Translate into
                 // text and go our merry way
@@ -234,7 +234,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     $inside_tag = false;
                     continue;
                 }
-                
+
                 // Check if it is explicitly self closing, if so, remove
                 // trailing slash. Remember, we could have a tag like <br>, so
                 // any later token processing scripts must convert improperly
@@ -244,10 +244,10 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     $strlen_segment--;
                     $segment = substr($segment, 0, $strlen_segment);
                 }
-                
+
                 // Check if there are any attributes
                 $position_first_space = strcspn($segment, $this->_whitespace);
-                
+
                 if ($position_first_space >= $strlen_segment) {
                     if ($is_self_closing) {
                         $token = new HTMLPurifier_Token_Empty($segment);
@@ -263,7 +263,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     $cursor = $position_next_gt + 1;
                     continue;
                 }
-                
+
                 // Grab out all the data
                 $type = substr($segment, 0, $position_first_space);
                 $attribute_string =
@@ -280,7 +280,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                 } else {
                     $attr = array();
                 }
-                
+
                 if ($is_self_closing) {
                     $token = new HTMLPurifier_Token_Empty($type, $attr);
                 } else {
@@ -311,12 +311,12 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
             }
             break;
         }
-        
+
         $context->destroy('CurrentLine');
         $context->destroy('CurrentCol');
         return $array;
     }
-    
+
     /**
      * PHP 5.0.x compatible substr_count that implements offset and length
      */
@@ -332,23 +332,23 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
             return substr_count($haystack, $needle, $offset, $length);
         }
     }
-    
+
     /**
      * Takes the inside of an HTML tag and makes an assoc array of attributes.
-     * 
+     *
      * @param $string Inside of tag excluding name.
      * @returns Assoc array of attributes.
      */
     public function parseAttributeString($string, $config, $context) {
         $string = (string) $string; // quick typecast
-        
+
         if ($string == '') return array(); // no attributes
-        
+
         $e = false;
         if ($config->get('Core', 'CollectErrors')) {
             $e =& $context->get('ErrorCollector');
         }
-        
+
         // let's see if we can abort as quickly as possible
         // one equal sign, no spaces => one attribute
         $num_equal = substr_count($string, '=');
@@ -367,10 +367,10 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
             if (!$quoted_value) return array($key => '');
             $first_char = @$quoted_value[0];
             $last_char  = @$quoted_value[strlen($quoted_value)-1];
-            
+
             $same_quote = ($first_char == $last_char);
             $open_quote = ($first_char == '"' || $first_char == "'");
-            
+
             if ( $same_quote && $open_quote) {
                 // well behaved
                 $value = substr($quoted_value, 1, strlen($quoted_value) - 2);
@@ -386,67 +386,67 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
             if ($value === false) $value = '';
             return array($key => $value);
         }
-        
+
         // setup loop environment
         $array  = array(); // return assoc array of attributes
         $cursor = 0; // current position in string (moves forward)
         $size   = strlen($string); // size of the string (stays the same)
-        
+
         // if we have unquoted attributes, the parser expects a terminating
         // space, so let's guarantee that there's always a terminating space.
         $string .= ' ';
-        
+
         while(true) {
-            
+
             if ($cursor >= $size) {
                 break;
             }
-            
+
             $cursor += ($value = strspn($string, $this->_whitespace, $cursor));
             // grab the key
-            
+
             $key_begin = $cursor; //we're currently at the start of the key
-            
+
             // scroll past all characters that are the key (not whitespace or =)
             $cursor += strcspn($string, $this->_whitespace . '=', $cursor);
-            
+
             $key_end = $cursor; // now at the end of the key
-            
+
             $key = substr($string, $key_begin, $key_end - $key_begin);
-            
+
             if (!$key) {
                 if ($e) $e->send(E_ERROR, 'Lexer: Missing attribute key');
                 $cursor += strcspn($string, $this->_whitespace, $cursor + 1); // prevent infinite loop
                 continue; // empty key
             }
-            
+
             // scroll past all whitespace
             $cursor += strspn($string, $this->_whitespace, $cursor);
-            
+
             if ($cursor >= $size) {
                 $array[$key] = $key;
                 break;
             }
-            
+
             // if the next character is an equal sign, we've got a regular
             // pair, otherwise, it's a bool attribute
             $first_char = @$string[$cursor];
-            
+
             if ($first_char == '=') {
                 // key="value"
-                
+
                 $cursor++;
                 $cursor += strspn($string, $this->_whitespace, $cursor);
-                
+
                 if ($cursor === false) {
                     $array[$key] = '';
                     break;
                 }
-                
+
                 // we might be in front of a quote right now
-                
+
                 $char = @$string[$cursor];
-                
+
                 if ($char == '"' || $char == "'") {
                     // it's quoted, end bound is $char
                     $cursor++;
@@ -459,18 +459,18 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     $cursor += strcspn($string, $this->_whitespace, $cursor);
                     $value_end = $cursor;
                 }
-                
+
                 // we reached a premature end
                 if ($cursor === false) {
                     $cursor = $size;
                     $value_end = $cursor;
                 }
-                
+
                 $value = substr($string, $value_begin, $value_end - $value_begin);
                 if ($value === false) $value = '';
                 $array[$key] = $this->parseData($value);
                 $cursor++;
-                
+
             } else {
                 // boolattr
                 if ($key !== '') {
@@ -479,11 +479,12 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
                     // purely theoretical
                     if ($e) $e->send(E_ERROR, 'Lexer: Missing attribute key');
                 }
-                
+
             }
         }
         return $array;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 0716a049f1b026bbba3b9058131ea782600cf9ce..57cffa82ab0488495aeda42725d581cf07ed7e70 100644 (file)
@@ -2,52 +2,52 @@
 
 /**
  * Proof-of-concept lexer that uses the PEAR package XML_HTMLSax3 to parse HTML.
- * 
+ *
  * PEAR, not suprisingly, also has a SAX parser for HTML.  I don't know
  * very much about implementation, but it's fairly well written.  However, that
  * abstraction comes at a price: performance. You need to have it installed,
  * and if the API changes, it might break our adapter. Not sure whether or not
  * it's UTF-8 aware, but it has some entity parsing trouble (in all areas,
  * text and attributes).
- * 
+ *
  * Quite personally, I don't recommend using the PEAR class, and the defaults
  * don't use it. The unit tests do perform the tests on the SAX parser too, but
  * whatever it does for poorly formed HTML is up to it.
- * 
+ *
  * @todo Generalize so that XML_HTMLSax is also supported.
- * 
+ *
  * @warning Entity-resolution inside attributes is broken.
  */
 
 class HTMLPurifier_Lexer_PEARSax3 extends HTMLPurifier_Lexer
 {
-    
+
     /**
      * Internal accumulator array for SAX parsers.
      */
     protected $tokens = array();
-    
+
     public function tokenizeHTML($string, $config, $context) {
-        
+
         $this->tokens = array();
-        
+
         $string = $this->normalize($string, $config, $context);
-        
+
         $parser = new XML_HTMLSax3();
         $parser->set_object($this);
         $parser->set_element_handler('openHandler','closeHandler');
         $parser->set_data_handler('dataHandler');
         $parser->set_escape_handler('escapeHandler');
-        
+
         // doesn't seem to work correctly for attributes
         $parser->set_option('XML_OPTION_ENTITIES_PARSED', 1);
-        
+
         $parser->parse($string);
-        
+
         return $this->tokens;
-        
+
     }
-    
+
     /**
      * Open tag event handler, interface is defined by PEAR package.
      */
@@ -63,7 +63,7 @@ class HTMLPurifier_Lexer_PEARSax3 extends HTMLPurifier_Lexer
         }
         return true;
     }
-    
+
     /**
      * Close tag event handler, interface is defined by PEAR package.
      */
@@ -77,7 +77,7 @@ class HTMLPurifier_Lexer_PEARSax3 extends HTMLPurifier_Lexer
         $this->tokens[] = new HTMLPurifier_Token_End($name);
         return true;
     }
-    
+
     /**
      * Data event handler, interface is defined by PEAR package.
      */
@@ -85,7 +85,7 @@ class HTMLPurifier_Lexer_PEARSax3 extends HTMLPurifier_Lexer
         $this->tokens[] = new HTMLPurifier_Token_Text($data);
         return true;
     }
-    
+
     /**
      * Escaped text handler, interface is defined by PEAR package.
      */
@@ -100,6 +100,7 @@ class HTMLPurifier_Lexer_PEARSax3 extends HTMLPurifier_Lexer
         //}
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index e1358675b101120028a962d79a89c5db15133d58..a43c44f4c5861aae5208698b6a2fce093bf31b54 100644 (file)
  */
 class HTMLPurifier_PercentEncoder
 {
-    
+
     /**
      * Reserved characters to preserve when using encode().
      */
     protected $preserve = array();
-    
+
     /**
      * String of characters that should be preserved while using encode().
      */
@@ -28,7 +28,7 @@ class HTMLPurifier_PercentEncoder
         $this->preserve[46] = true; // Period       .
         $this->preserve[95] = true; // Underscore   _
         $this->preserve[126]= true; // Tilde        ~
-        
+
         // extra letters not to escape
         if ($preserve !== false) {
             for ($i = 0, $c = strlen($preserve); $i < $c; $i++) {
@@ -36,7 +36,7 @@ class HTMLPurifier_PercentEncoder
             }
         }
     }
-    
+
     /**
      * Our replacement for urlencode, it encodes all non-reserved characters,
      * as well as any extra characters that were instructed to be preserved.
@@ -58,7 +58,7 @@ class HTMLPurifier_PercentEncoder
         }
         return $ret;
     }
-    
+
     /**
      * Fix up percent-encoding by decoding unreserved characters and normalizing.
      * @warning This function is affected by $preserve, even though the
@@ -92,6 +92,7 @@ class HTMLPurifier_PercentEncoder
         }
         return $ret;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 238cf951d8ab43eb74e60a1f5cb6ce23e8ae60b2..e7eb82e83e480d9d55bacf38a2a12e1cbfd8b23e 100644 (file)
@@ -5,23 +5,23 @@
 
 class HTMLPurifier_Printer
 {
-    
+
     /**
      * Instance of HTMLPurifier_Generator for HTML generation convenience funcs
      */
     protected $generator;
-    
+
     /**
      * Instance of HTMLPurifier_Config, for easy access
      */
     protected $config;
-    
+
     /**
      * Initialize $generator.
      */
     public function __construct() {
     }
-    
+
     /**
      * Give generator necessary configuration if possible
      */
@@ -30,13 +30,13 @@ class HTMLPurifier_Printer
         $context = new HTMLPurifier_Context();
         $this->generator = new HTMLPurifier_Generator($config, $context);
     }
-    
+
     /**
      * Main function that renders object or aspect of that object
      * @note Parameters vary depending on printer
      */
     // function render() {}
-    
+
     /**
      * Returns a start tag
      * @param $tag Tag name
@@ -47,7 +47,7 @@ class HTMLPurifier_Printer
                     new HTMLPurifier_Token_Start($tag, $attr ? $attr : array())
                );
     }
-    
+
     /**
      * Returns an end teg
      * @param $tag Tag name
@@ -57,7 +57,7 @@ class HTMLPurifier_Printer
                     new HTMLPurifier_Token_End($tag)
                );
     }
-    
+
     /**
      * Prints a complete element with content inside
      * @param $tag Tag name
@@ -70,19 +70,19 @@ class HTMLPurifier_Printer
                ($escape ? $this->escape($contents) : $contents) .
                $this->end($tag);
     }
-    
+
     protected function elementEmpty($tag, $attr = array()) {
         return $this->generator->generateFromToken(
             new HTMLPurifier_Token_Empty($tag, $attr)
         );
     }
-    
+
     protected function text($text) {
         return $this->generator->generateFromToken(
             new HTMLPurifier_Token_Text($text)
         );
     }
-    
+
     /**
      * Prints a simple key/value row in a table.
      * @param $name Key
@@ -97,7 +97,7 @@ class HTMLPurifier_Printer
             $this->end('tr')
         ;
     }
-    
+
     /**
      * Escapes a string for HTML output.
      * @param $string String to escape
@@ -107,7 +107,7 @@ class HTMLPurifier_Printer
         $string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
         return $string;
     }
-    
+
     /**
      * Takes a list of strings and turns them into a single list
      * @param $array List of strings
@@ -125,7 +125,7 @@ class HTMLPurifier_Printer
         }
         return $ret;
     }
-    
+
     /**
      * Retrieves the class of an object without prefixes, as well as metadata
      * @param $obj Object to determine class of
@@ -158,10 +158,19 @@ class HTMLPurifier_Printer
                 $class .= $this->getClass($obj->single, $sec_prefix) . ', ';
                 $class .= $obj->max;
                 break;
+            case 'css_denyelementdecorator':
+                $class .= $this->getClass($obj->def, $sec_prefix) . ', ';
+                $class .= $obj->element;
+                break;
+            case 'css_importantdecorator':
+                $class .= $this->getClass($obj->def, $sec_prefix);
+                if ($obj->allow) $class .= ', !important';
+                break;
         }
         $class .= ')';
         return $class;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index bf43b020cba87a7ed1a8e62eaae9de869ea560ac..81f9865901db1214522c53eec4aea48eda63319c 100644 (file)
@@ -2,36 +2,37 @@
 
 class HTMLPurifier_Printer_CSSDefinition extends HTMLPurifier_Printer
 {
-    
+
     protected $def;
-    
+
     public function render($config) {
         $this->def = $config->getCSSDefinition();
         $ret = '';
-        
+
         $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));
         $ret .= $this->start('table');
-        
+
         $ret .= $this->element('caption', 'Properties ($info)');
-        
+
         $ret .= $this->start('thead');
         $ret .= $this->start('tr');
         $ret .= $this->element('th', 'Property', array('class' => 'heavy'));
         $ret .= $this->element('th', 'Definition', array('class' => 'heavy', 'style' => 'width:auto;'));
         $ret .= $this->end('tr');
         $ret .= $this->end('thead');
-        
+
         ksort($this->def->info);
         foreach ($this->def->info as $property => $obj) {
             $name = $this->getClass($obj, 'AttrDef_');
             $ret .= $this->row($property, $name);
         }
-        
+
         $ret .= $this->end('table');
         $ret .= $this->end('div');
-        
+
         return $ret;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 0653bbb0c0cc0fad2bc2b9749498b1e2c116a394..3ff1a88aa4251bcd9ae678952672f33d6cb7a16b 100644 (file)
@@ -6,3 +6,5 @@
 .hp-config .namespace th {text-align:center;}
 .hp-config .verbose {display:none;}
 .hp-config .controls {text-align:center;}
+
+/* vim: et sw=4 sts=4 */
index 119ca4a04d95a63e9ee57ca2a778daeceb5a1b6a..cba00c9b80b9cfd379696958a0b5fafeee90a50d 100644 (file)
@@ -1,3 +1,5 @@
 function toggleWriteability(id_of_patient, checked) {
     document.getElementById(id_of_patient).disabled = checked;
-}
\ No newline at end of file
+}
+
+// vim: et sw=4 sts=4
index 9caf7e39a6ba76cb87e750304e0073ea7d137c3d..744dec6597361baa34328773bba6ec2a8516fd1e 100644 (file)
@@ -5,29 +5,29 @@
  */
 class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
 {
-    
+
     /**
      * Printers for specific fields
      */
     protected $fields = array();
-    
+
     /**
      * Documentation URL, can have fragment tagged on end
      */
     protected $docURL;
-    
+
     /**
      * Name of form element to stuff config in
      */
     protected $name;
-    
+
     /**
      * Whether or not to compress directive names, clipping them off
      * after a certain amount of letters. False to disable or integer letters
      * before clipping.
      */
     protected $compress = false;
-    
+
     /**
      * @param $name Form element name for directives to be stuffed into
      * @param $doc_url String documentation URL, will have fragment tagged on
@@ -44,7 +44,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
         $this->fields[0]    = new HTMLPurifier_Printer_ConfigForm_default();
         $this->fields[HTMLPurifier_VarParser::BOOL]       = new HTMLPurifier_Printer_ConfigForm_bool();
     }
-    
+
     /**
      * Sets default column and row size for textareas in sub-printers
      * @param $cols Integer columns of textarea, null to use default
@@ -54,21 +54,21 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
         if ($cols) $this->fields['default']->cols = $cols;
         if ($rows) $this->fields['default']->rows = $rows;
     }
-    
+
     /**
      * Retrieves styling, in case it is not accessible by webserver
      */
     public static function getCSS() {
         return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');
     }
-    
+
     /**
      * Retrieves JavaScript, in case it is not accessible by webserver
      */
     public static function getJavaScript() {
         return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.js');
     }
-    
+
     /**
      * Returns HTML output for a configuration form
      * @param $config Configuration object of current form state, or an array
@@ -82,18 +82,18 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
         } else {
             $gen_config = $config;
         }
-        
+
         $this->config = $config;
         $this->genConfig = $gen_config;
         $this->prepareGenerator($gen_config);
-        
+
         $allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $config->def);
         $all = array();
         foreach ($allowed as $key) {
             list($ns, $directive) = $key;
             $all[$ns][$directive] = $config->get($ns, $directive);
         }
-        
+
         $ret = '';
         $ret .= $this->start('table', array('class' => 'hp-config'));
         $ret .= $this->start('thead');
@@ -118,7 +118,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
         $ret .= $this->end('table');
         return $ret;
     }
-    
+
     /**
      * Renders a single namespace
      * @param $ns String namespace name
@@ -140,7 +140,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
                 $ret .= $this->start('a', array('href' => $url));
             }
                 $attr = array('for' => "{$this->name}:$ns.$directive");
-                
+
                 // crop directive name if it's too long
                 if (!$this->compress || (strlen($directive) < $this->compress)) {
                     $directive_disp = $directive;
@@ -148,7 +148,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
                     $directive_disp = substr($directive, 0, $this->compress - 2) . '...';
                     $attr['title'] = $directive;
                 }
-                
+
                 $ret .= $this->element(
                     'label',
                     $directive_disp,
@@ -157,7 +157,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
                 );
             if ($this->docURL) $ret .= $this->end('a');
             $ret .= $this->end('th');
-            
+
             $ret .= $this->start('td');
                 $def = $this->config->def->info[$ns][$directive];
                 if (is_int($def)) {
@@ -179,7 +179,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
         $ret .= $this->end('tbody');
         return $ret;
     }
-    
+
 }
 
 /**
@@ -205,7 +205,7 @@ class HTMLPurifier_Printer_ConfigForm_NullDecorator extends HTMLPurifier_Printer
             $gen_config = $config;
         }
         $this->prepareGenerator($gen_config);
-        
+
         $ret = '';
         $ret .= $this->start('label', array('for' => "$name:Null_$ns.$directive"));
         $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
@@ -328,12 +328,12 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
         $this->prepareGenerator($gen_config);
         $ret = '';
         $ret .= $this->start('div', array('id' => "$name:$ns.$directive"));
-        
+
         $ret .= $this->start('label', array('for' => "$name:Yes_$ns.$directive"));
         $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
         $ret .= $this->text(' Yes');
         $ret .= $this->end('label');
-        
+
         $attr = array(
             'type' => 'radio',
             'name' => "$name"."[$ns.$directive]",
@@ -343,12 +343,12 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
         if ($value === true) $attr['checked'] = 'checked';
         if ($value === null) $attr['disabled'] = 'disabled';
         $ret .= $this->elementEmpty('input', $attr);
-        
+
         $ret .= $this->start('label', array('for' => "$name:No_$ns.$directive"));
         $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose'));
         $ret .= $this->text(' No');
         $ret .= $this->end('label');
-        
+
         $attr = array(
             'type' => 'radio',
             'name' => "$name"."[$ns.$directive]",
@@ -358,10 +358,11 @@ class HTMLPurifier_Printer_ConfigForm_bool extends HTMLPurifier_Printer {
         if ($value === false) $attr['checked'] = 'checked';
         if ($value === null) $attr['disabled'] = 'disabled';
         $ret .= $this->elementEmpty('input', $attr);
-                
+
         $ret .= $this->end('div');
-        
+
         return $ret;
     }
 }
 
+// vim: et sw=4 sts=4
index a209b89821dea62310b968c18e7fddc7d7877a06..8a8f126b81f037cc4a2574e469f5ef0cded11eba 100644 (file)
@@ -2,30 +2,30 @@
 
 class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
 {
-    
+
     /**
      * Instance of HTMLPurifier_HTMLDefinition, for easy access
      */
     protected $def;
-    
+
     public function render($config) {
         $ret = '';
         $this->config =& $config;
-        
+
         $this->def = $config->getHTMLDefinition();
-        
+
         $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));
-        
+
         $ret .= $this->renderDoctype();
         $ret .= $this->renderEnvironment();
         $ret .= $this->renderContentSets();
         $ret .= $this->renderInfo();
-        
+
         $ret .= $this->end('div');
-        
+
         return $ret;
     }
-    
+
     /**
      * Renders the Doctype table
      */
@@ -41,28 +41,28 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         $ret .= $this->end('table');
         return $ret;
     }
-    
-    
+
+
     /**
      * Renders environment table, which is miscellaneous info
      */
     protected function renderEnvironment() {
         $def = $this->def;
-        
+
         $ret = '';
-        
+
         $ret .= $this->start('table');
         $ret .= $this->element('caption', 'Environment');
-        
+
         $ret .= $this->row('Parent of fragment', $def->info_parent);
         $ret .= $this->renderChildren($def->info_parent_def->child);
         $ret .= $this->row('Block wrap name', $def->info_block_wrapper);
-        
+
         $ret .= $this->start('tr');
             $ret .= $this->element('th', 'Global attributes');
             $ret .= $this->element('td', $this->listifyAttr($def->info_global_attr),0,0);
         $ret .= $this->end('tr');
-        
+
         $ret .= $this->start('tr');
             $ret .= $this->element('th', 'Tag transforms');
             $list = array();
@@ -72,21 +72,21 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
             }
             $ret .= $this->element('td', $this->listify($list));
         $ret .= $this->end('tr');
-        
+
         $ret .= $this->start('tr');
             $ret .= $this->element('th', 'Pre-AttrTransform');
             $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre));
         $ret .= $this->end('tr');
-        
+
         $ret .= $this->start('tr');
             $ret .= $this->element('th', 'Post-AttrTransform');
             $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post));
         $ret .= $this->end('tr');
-        
+
         $ret .= $this->end('table');
         return $ret;
     }
-    
+
     /**
      * Renders the Content Sets table
      */
@@ -103,7 +103,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         $ret .= $this->end('table');
         return $ret;
     }
-    
+
     /**
      * Renders the Elements ($info) table
      */
@@ -152,18 +152,18 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
                 $ret .= $this->element('th', 'Allowed attributes');
                 $ret .= $this->element('td',$this->listifyAttr($def->attr), array(), 0);
             $ret .= $this->end('tr');
-            
+
             if (!empty($def->required_attr)) {
                 $ret .= $this->row('Required attributes', $this->listify($def->required_attr));
             }
-            
+
             $ret .= $this->renderChildren($def->child);
         }
         $ret .= $this->end('table');
         return $ret;
     }
-    
-    /** 
+
+    /**
      * Renders a row describing the allowed children of an element
      * @param $def HTMLPurifier_ChildDef of pertinent element
      */
@@ -188,9 +188,9 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
                     'tfoot', 'tbody', 'tr'));
             }
             $ret .= $this->element('th', 'Allowed children', $attr);
-            
+
             if ($def->type == 'chameleon') {
-                
+
                 $ret .= $this->element('td',
                     '<em>Block</em>: ' .
                     $this->escape($this->listifyTagLookup($def->block->elements)),0,0);
@@ -199,12 +199,12 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
                 $ret .= $this->element('td',
                     '<em>Inline</em>: ' .
                     $this->escape($this->listifyTagLookup($def->inline->elements)),0,0);
-                
+
             } elseif ($def->type == 'custom') {
-                
+
                 $ret .= $this->element('td', '<em>'.ucfirst($def->type).'</em>: ' .
                     $def->dtd_regex);
-                
+
             } else {
                 $ret .= $this->element('td',
                     '<em>'.ucfirst($def->type).'</em>: ' .
@@ -213,8 +213,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         $ret .= $this->end('tr');
         return $ret;
     }
-    
-    /** 
+
+    /**
      * Listifies a tag lookup table.
      * @param $array Tag lookup array in form of array('tagname' => true)
      */
@@ -227,7 +227,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         }
         return $this->listify($list);
     }
-    
+
     /**
      * Listifies a list of objects by retrieving class names and internal state
      * @param $array List of objects
@@ -241,7 +241,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         }
         return $this->listify($list);
     }
-    
+
     /**
      * Listifies a hash of attributes to AttrDef classes
      * @param $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef)
@@ -255,7 +255,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         }
         return $this->listify($list);
     }
-    
+
     /**
      * Creates a heavy header row
      */
@@ -266,6 +266,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
         $ret .= $this->end('tr');
         return $ret;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/HTMLPurifier/PropertyList.php b/lib/htmlpurifier/HTMLPurifier/PropertyList.php
new file mode 100755 (executable)
index 0000000..2b99fb7
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+
+/**
+ * Generic property list implementation
+ */
+class HTMLPurifier_PropertyList
+{
+    /**
+     * Internal data-structure for properties
+     */
+    protected $data = array();
+
+    /**
+     * Parent plist
+     */
+    protected $parent;
+
+    protected $cache;
+
+    public function __construct($parent = null) {
+        $this->parent = $parent;
+    }
+
+    /**
+     * Recursively retrieves the value for a key
+     */
+    public function get($name) {
+        if ($this->has($name)) return $this->data[$name];
+        // possible performance bottleneck, convert to iterative if necessary
+        if ($this->parent) return $this->parent->get($name);
+        throw new HTMLPurifier_Exception("Key '$name' not found");
+    }
+
+    /**
+     * Sets the value of a key, for this plist
+     */
+    public function set($name, $value) {
+        $this->data[$name] = $value;
+    }
+
+    /**
+     * Returns true if a given key exists
+     */
+    public function has($name) {
+        return array_key_exists($name, $this->data);
+    }
+
+    /**
+     * Resets a value to the value of it's parent, usually the default. If
+     * no value is specified, the entire plist is reset.
+     */
+    public function reset($name = null) {
+        if ($name == null) $this->data = array();
+        else unset($this->data[$name]);
+    }
+
+    /**
+     * Squashes this property list and all of its property lists into a single
+     * array, and returns the array. This value is cached by default.
+     * @param $force If true, ignores the cache and regenerates the array.
+     */
+    public function squash($force = false) {
+        if ($this->cache !== null && !$force) return $this->cache;
+        if ($this->parent) {
+            return $this->cache = array_merge($this->parent->squash($force), $this->data);
+        } else {
+            return $this->cache = $this->data;
+        }
+    }
+
+    /**
+     * Returns the parent plist.
+     */
+    public function getParent() {
+        return $this->parent;
+    }
+
+    /**
+     * Sets the parent plist.
+     */
+    public function setParent($plist) {
+        $this->parent = $plist;
+    }
+}
+
+// vim: et sw=4 sts=4
diff --git a/lib/htmlpurifier/HTMLPurifier/PropertyListIterator.php b/lib/htmlpurifier/HTMLPurifier/PropertyListIterator.php
new file mode 100755 (executable)
index 0000000..8f25044
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Property list iterator. Do not instantiate this class directly.
+ */
+class HTMLPurifier_PropertyListIterator extends FilterIterator
+{
+
+    protected $l;
+    protected $filter;
+
+    /**
+     * @param $data Array of data to iterate over
+     * @param $filter Optional prefix to only allow values of
+     */
+    public function __construct(Iterator $iterator, $filter = null) {
+        parent::__construct($iterator);
+        $this->l = strlen($filter);
+        $this->filter = $filter;
+    }
+
+    public function accept() {
+        $key = $this->getInnerIterator()->key();
+        if( strncmp($key, $this->filter, $this->l) !== 0 ) {
+            return false;
+        }
+        return true;
+    }
+
+}
+
+// vim: et sw=4 sts=4
index db71fc565f84fdf4e3e705812328037ec36cc912..2462865210ce62d64b9d2a270fa55355708fd0aa 100644 (file)
@@ -2,24 +2,25 @@
 
 /**
  * Supertype for classes that define a strategy for modifying/purifying tokens.
- * 
- * While HTMLPurifier's core purpose is fixing HTML into something proper, 
+ *
+ * While HTMLPurifier's core purpose is fixing HTML into something proper,
  * strategies provide plug points for extra configuration or even extra
  * features, such as custom tags, custom parsing of text, etc.
  */
 
+
 abstract class HTMLPurifier_Strategy
 {
-    
+
     /**
      * Executes the strategy on the tokens.
-     * 
+     *
      * @param $tokens Array of HTMLPurifier_Token objects to be operated on.
      * @param $config Configuration options
      * @returns Processed array of token objects.
      */
     abstract public function execute($tokens, $config, $context);
-    
+
 }
 
+// vim: et sw=4 sts=4
index b4a2924932e84c1766bcbbdd0816d04d0f260774..816490b7996ade532876d42861524db931c7b1b9 100644 (file)
@@ -5,20 +5,21 @@
  */
 abstract class HTMLPurifier_Strategy_Composite extends HTMLPurifier_Strategy
 {
-    
+
     /**
      * List of strategies to run tokens through.
      */
     protected $strategies = array();
-    
+
     abstract public function __construct();
-    
+
     public function execute($tokens, $config, $context) {
         foreach ($this->strategies as $strategy) {
             $tokens = $strategy->execute($tokens, $config, $context);
         }
         return $tokens;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 53dfde32558f3e8e6209359d133e8bace470cf71..d90e15860640a437e14ecfba34ba2c46fabd9d51 100644 (file)
@@ -5,13 +5,14 @@
  */
 class HTMLPurifier_Strategy_Core extends HTMLPurifier_Strategy_Composite
 {
-    
+
     public function __construct() {
         $this->strategies[] = new HTMLPurifier_Strategy_RemoveForeignElements();
         $this->strategies[] = new HTMLPurifier_Strategy_MakeWellFormed();
         $this->strategies[] = new HTMLPurifier_Strategy_FixNesting();
         $this->strategies[] = new HTMLPurifier_Strategy_ValidateAttributes();
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 69a6b50393e2d328fdf1a24c768615ee6bdb25a8..f81802391bf64426a536335b310a81bdf07b849c 100644 (file)
@@ -2,89 +2,89 @@
 
 /**
  * Takes a well formed list of tokens and fixes their nesting.
- * 
+ *
  * HTML elements dictate which elements are allowed to be their children,
  * for example, you can't have a p tag in a span tag.  Other elements have
  * much more rigorous definitions: tables, for instance, require a specific
  * order for their elements.  There are also constraints not expressible by
  * document type definitions, such as the chameleon nature of ins/del
  * tags and global child exclusions.
- * 
+ *
  * The first major objective of this strategy is to iterate through all the
  * nodes (not tokens) of the list of tokens and determine whether or not
  * their children conform to the element's definition.  If they do not, the
  * child definition may optionally supply an amended list of elements that
  * is valid or require that the entire node be deleted (and the previous
  * node rescanned).
- * 
+ *
  * The second objective is to ensure that explicitly excluded elements of
  * an element do not appear in its children.  Code that accomplishes this
  * task is pervasive through the strategy, though the two are distinct tasks
  * and could, theoretically, be seperated (although it's not recommended).
- * 
+ *
  * @note Whether or not unrecognized children are silently dropped or
  *       translated into text depends on the child definitions.
- * 
+ *
  * @todo Enable nodes to be bubbled out of the structure.
  */
 
 class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
 {
-    
+
     public function execute($tokens, $config, $context) {
         //####################################################################//
         // Pre-processing
-        
+
         // get a copy of the HTML definition
         $definition = $config->getHTMLDefinition();
-        
+
         // insert implicit "parent" node, will be removed at end.
         // DEFINITION CALL
         $parent_name = $definition->info_parent;
         array_unshift($tokens, new HTMLPurifier_Token_Start($parent_name));
         $tokens[] = new HTMLPurifier_Token_End($parent_name);
-        
+
         // setup the context variable 'IsInline', for chameleon processing
         // is 'false' when we are not inline, 'true' when it must always
         // be inline, and an integer when it is inline for a certain
         // branch of the document tree
         $is_inline = $definition->info_parent_def->descendants_are_inline;
         $context->register('IsInline', $is_inline);
-        
+
         // setup error collector
         $e =& $context->get('ErrorCollector', true);
-        
+
         //####################################################################//
         // Loop initialization
-        
+
         // stack that contains the indexes of all parents,
         // $stack[count($stack)-1] being the current parent
         $stack = array();
-        
+
         // stack that contains all elements that are excluded
-        // it is organized by parent elements, similar to $stack, 
+        // it is organized by parent elements, similar to $stack,
         // but it is only populated when an element with exclusions is
         // processed, i.e. there won't be empty exclusions.
         $exclude_stack = array();
-        
+
         // variable that contains the start token while we are processing
         // nodes. This enables error reporting to do its job
         $start_token = false;
         $context->register('CurrentToken', $start_token);
-        
+
         //####################################################################//
         // Loop
-        
+
         // iterate through all start nodes. Determining the start node
         // is complicated so it has been omitted from the loop construct
         for ($i = 0, $size = count($tokens) ; $i < $size; ) {
-            
+
             //################################################################//
             // Gather information on children
-            
+
             // child token accumulator
             $child_tokens = array();
-            
+
             // scroll to the end of this node, report number, and collect
             // all children
             for ($j = $i, $depth = 0; ; $j++) {
@@ -101,15 +101,15 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                 }
                 $child_tokens[] = $tokens[$j];
             }
-            
+
             // $i is index of start token
             // $j is index of end token
-            
+
             $start_token = $tokens[$i]; // to make token available via CurrentToken
-            
+
             //################################################################//
             // Gather information on parent
-            
+
             // calculate parent information
             if ($count = count($stack)) {
                 $parent_index = $stack[$count-1];
@@ -122,11 +122,11 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
             } else {
                 // processing as if the parent were the "root" node
                 // unknown info, it won't be used anyway, in the future,
-                // we may want to enforce one element only (this is 
+                // we may want to enforce one element only (this is
                 // necessary for HTML Purifier to clean entire documents
                 $parent_index = $parent_name = $parent_def = null;
             }
-            
+
             // calculate context
             if ($is_inline === false) {
                 // check if conditions make it inline
@@ -139,10 +139,10 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                     $is_inline = false;
                 }
             }
-            
+
             //################################################################//
             // Determine whether element is explicitly excluded SGML-style
-            
+
             // determine whether or not element is excluded by checking all
             // parent exclusions. The array should not be very large, two
             // elements at most.
@@ -156,10 +156,10 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                     }
                 }
             }
-            
+
             //################################################################//
             // Perform child validation
-            
+
             if ($excluded) {
                 // there is an exclusion, remove the entire node
                 $result = false;
@@ -171,9 +171,9 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                     $def = $definition->info_parent_def;
                 } else {
                     $def = $definition->info[$tokens[$i]->name];
-                    
+
                 }
-                
+
                 if (!empty($def->child)) {
                     // have DTD child def validate children
                     $result = $def->child->validateChildren(
@@ -182,31 +182,31 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                     // weird, no child definition, get rid of everything
                     $result = false;
                 }
-                
+
                 // determine whether or not this element has any exclusions
                 $excludes = $def->excludes;
             }
-            
+
             // $result is now a bool or array
-            
+
             //################################################################//
             // Process result by interpreting $result
-            
+
             if ($result === true || $child_tokens === $result) {
                 // leave the node as is
-                
+
                 // register start token as a parental node start
                 $stack[] = $i;
-                
+
                 // register exclusions if there are any
                 if (!empty($excludes)) $exclude_stack[] = $excludes;
-                
+
                 // move cursor to next possible start node
                 $i++;
-                
+
             } elseif($result === false) {
                 // remove entire node
-                
+
                 if ($e) {
                     if ($excluded) {
                         $e->send(E_ERROR, 'Strategy_FixNesting: Node excluded');
@@ -214,20 +214,20 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                         $e->send(E_ERROR, 'Strategy_FixNesting: Node removed');
                     }
                 }
-                
+
                 // calculate length of inner tokens and current tokens
                 $length = $j - $i + 1;
-                
+
                 // perform removal
                 array_splice($tokens, $i, $length);
-                
+
                 // update size
                 $size -= $length;
-                
+
                 // there is no start token to register,
                 // current node is now the next possible start node
                 // unless it turns out that we need to do a double-check
-                
+
                 // this is a rought heuristic that covers 100% of HTML's
                 // cases and 99% of all other cases. A child definition
                 // that would be tricked by this would be something like:
@@ -239,16 +239,16 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                     $i = $parent_index;
                     array_pop($stack);
                 }
-                
+
                 // PROJECTED OPTIMIZATION: Process all children elements before
                 // reprocessing parent node.
-                
+
             } else {
                 // replace node with $result
-                
+
                 // calculate length of inner tokens
                 $length = $j - $i - 1;
-                
+
                 if ($e) {
                     if (empty($result) && $length) {
                         $e->send(E_ERROR, 'Strategy_FixNesting: Node contents removed');
@@ -256,31 +256,31 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                         $e->send(E_WARNING, 'Strategy_FixNesting: Node reorganized');
                     }
                 }
-                
+
                 // perform replacement
                 array_splice($tokens, $i + 1, $length, $result);
-                
+
                 // update size
                 $size -= $length;
                 $size += count($result);
-                
+
                 // register start token as a parental node start
                 $stack[] = $i;
-                
+
                 // register exclusions if there are any
                 if (!empty($excludes)) $exclude_stack[] = $excludes;
-                
+
                 // move cursor to next possible start node
                 $i++;
-                
+
             }
-            
+
             //################################################################//
             // Scroll to next start node
-            
+
             // We assume, at this point, that $i is the index of the token
             // that is the first possible new start point for a node.
-            
+
             // Test if the token indeed is a start tag, if not, move forward
             // and test again.
             $size = count($tokens);
@@ -302,27 +302,27 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy
                 }
                 $i++;
             }
-            
+
         }
-        
+
         //####################################################################//
         // Post-processing
-        
+
         // remove implicit parent tokens at the beginning and end
         array_shift($tokens);
         array_pop($tokens);
-        
+
         // remove context variables
         $context->destroy('IsInline');
         $context->destroy('CurrentToken');
-        
+
         //####################################################################//
         // Return
-        
+
         return $tokens;
-        
+
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index 0698c4e4577993b81b80fa6c7029afdcd682a286..0ec811f8ae2aa114526ecaf06ceae2e2bbfff47e 100644 (file)
@@ -5,41 +5,41 @@
  */
 class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
 {
-    
+
     /**
      * Array stream of tokens being processed.
      */
     protected $tokens;
-    
+
     /**
      * Current index in $tokens.
      */
     protected $t;
-    
+
     /**
      * Current nesting of elements.
      */
     protected $stack;
-    
+
     /**
      * Injectors active in this stream processing.
      */
     protected $injectors;
-    
+
     /**
      * Current instance of HTMLPurifier_Config.
      */
     protected $config;
-    
+
     /**
      * Current instance of HTMLPurifier_Context.
      */
     protected $context;
-    
+
     public function execute($tokens, $config, $context) {
-        
+
         $definition = $config->getHTMLDefinition();
-        
+
         // local variables
         $generator = new HTMLPurifier_Generator($config, $context);
         $escape_invalid_tags = $config->get('Core', 'EscapeInvalidTags');
@@ -49,24 +49,24 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
         $token      = false; // the current token
         $reprocess  = false; // whether or not to reprocess the same token
         $stack = array();
-        
+
         // member variables
         $this->stack   =& $stack;
         $this->t       =& $t;
         $this->tokens  =& $tokens;
         $this->config  = $config;
         $this->context = $context;
-        
+
         // context variables
         $context->register('CurrentNesting', $stack);
         $context->register('InputIndex',     $t);
         $context->register('InputTokens',    $tokens);
         $context->register('CurrentToken',   $token);
-        
+
         // -- begin INJECTOR --
-        
+
         $this->injectors = array();
-        
+
         $injectors = $config->getBatch('AutoFormat');
         $def_injectors = $definition->info_injector;
         $custom_injectors = $injectors['Custom'];
@@ -87,7 +87,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
             }
             $this->injectors[] = $injector;
         }
-        
+
         // give the injectors references to the definition and context
         // variables for performance reasons
         foreach ($this->injectors as $ix => $injector) {
@@ -96,9 +96,9 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
             array_splice($this->injectors, $ix, 1); // rm the injector
             trigger_error("Cannot enable {$injector->name} injector because $error is not allowed", E_USER_WARNING);
         }
-        
+
         // -- end INJECTOR --
-        
+
         // a note on punting:
         //      In order to reduce code duplication, whenever some code needs
         //      to make HTML changes in order to make things "correct", the
@@ -106,7 +106,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
         //      status. This means that if we add a start token, because it
         //      was totally necessary, we don't have to update nesting; we just
         //      punt ($reprocess = true; continue;) and it does that for us.
-        
+
         // isset is in loop because $tokens size changes during loop exec
         for (
             $t = 0;
@@ -114,7 +114,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
             // only increment if we don't need to reprocess
             $reprocess ? $reprocess = false : $t++
         ) {
-            
+
             // check for a rewind
             if (is_int($i) && $i >= 0) {
                 // possibility: disable rewinding if the current token has a
@@ -136,36 +136,33 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 }
                 $i = false;
             }
-            
+
             // handle case of document end
             if (!isset($tokens[$t])) {
                 // kill processing if stack is empty
                 if (empty($this->stack)) break;
-                
+
                 // peek
                 $top_nesting = array_pop($this->stack);
                 $this->stack[] = $top_nesting;
-                
+
                 // send error
                 if ($e && !isset($top_nesting->armor['MakeWellFormed_TagClosedError'])) {
                     $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by document end', $top_nesting);
                 }
-                
+
                 // append, don't splice, since this is the end
                 $tokens[] = new HTMLPurifier_Token_End($top_nesting->name);
-                
+
                 // punt!
                 $reprocess = true;
                 continue;
             }
-            
-            // if all goes well, this token will be passed through unharmed
+
             $token = $tokens[$t];
-            
-            //echo '<hr>';
-            //printTokens($tokens, $t);
-            //var_dump($this->stack);
-            
+
+            //echo '<br>'; printTokens($tokens, $t); printTokens($this->stack);
+
             // quick-check: if it's not a tag, no need to process
             if (empty($token->is_tag)) {
                 if ($token instanceof HTMLPurifier_Token_Text) {
@@ -181,13 +178,13 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 // another possibility is a comment
                 continue;
             }
-            
+
             if (isset($definition->info[$token->name])) {
                 $type = $definition->info[$token->name]->child->type;
             } else {
                 $type = false; // Type is unknown, treat accordingly
             }
-            
+
             // quick tag checks: anything that's *not* an end tag
             $ok = false;
             if ($type === 'empty' && $token instanceof HTMLPurifier_Token_Start) {
@@ -206,34 +203,52 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 $ok = true;
             } elseif ($token instanceof HTMLPurifier_Token_Start) {
                 // start tag
-                
+
                 // ...unless they also have to close their parent
                 if (!empty($this->stack)) {
-                    
+
                     $parent = array_pop($this->stack);
                     $this->stack[] = $parent;
-                    
+
                     if (isset($definition->info[$parent->name])) {
-                        $elements = $definition->info[$parent->name]->child->getNonAutoCloseElements($config);
+                        $elements = $definition->info[$parent->name]->child->getAllowedElements($config);
                         $autoclose = !isset($elements[$token->name]);
                     } else {
                         $autoclose = false;
                     }
-                    
+
+                    $carryover = false;
+                    if ($autoclose && $definition->info[$parent->name]->formatting) {
+                        $carryover = true;
+                    }
+
                     if ($autoclose) {
-                        if ($e) $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag auto closed', $parent);
-                        // insert parent end tag before this tag
+                        // errors need to be updated
                         $new_token = new HTMLPurifier_Token_End($parent->name);
                         $new_token->start = $parent;
-                        $this->insertBefore($new_token);
+                        if ($carryover) {
+                            $element = clone $parent;
+                            $element->armor['MakeWellFormed_TagClosedError'] = true;
+                            $element->carryover = true;
+                            $this->processToken(array($new_token, $token, $element));
+                        } else {
+                            $this->insertBefore($new_token);
+                        }
+                        if ($e && !isset($parent->armor['MakeWellFormed_TagClosedError'])) {
+                            if (!$carryover) {
+                                $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag auto closed', $parent);
+                            } else {
+                                $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag carryover', $parent);
+                            }
+                        }
                         $reprocess = true;
                         continue;
                     }
-                    
+
                 }
                 $ok = true;
             }
-            
+
             if ($ok) {
                 foreach ($this->injectors as $i => $injector) {
                     if (isset($token->skip[$i])) continue;
@@ -254,12 +269,12 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 }
                 continue;
             }
-            
+
             // sanity check: we should be dealing with a closing tag
             if (!$token instanceof HTMLPurifier_Token_End) {
                 throw new HTMLPurifier_Exception('Unaccounted for tag token in input stream, bug in HTML Purifier');
             }
-            
+
             // make sure that we have something open
             if (empty($this->stack)) {
                 if ($escape_invalid_tags) {
@@ -274,7 +289,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 $reprocess = true;
                 continue;
             }
-            
+
             // first, check for the simplest case: everything closes neatly.
             // Eventually, everything passes through here; if there are problems
             // we modify the input stream accordingly and then punt, so that
@@ -293,12 +308,12 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 }
                 continue;
             }
-            
+
             // okay, so we're trying to close the wrong tag
-            
+
             // undo the pop previous pop
             $this->stack[] = $current_parent;
-            
+
             // scroll back the entire nest, trying to find our tag.
             // (feature could be to specify how far you'd like to go)
             $size = count($this->stack);
@@ -310,7 +325,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                     break;
                 }
             }
-            
+
             // we didn't find the tag, so remove
             if ($skipped_tags === false) {
                 if ($escape_invalid_tags) {
@@ -325,7 +340,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 $reprocess = true;
                 continue;
             }
-            
+
             // do errors, in REVERSE $j order: a,b,c with </a></b></c>
             $c = count($skipped_tags);
             if ($e) {
@@ -337,49 +352,57 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                     }
                 }
             }
-            
+
             // insert tags, in FORWARD $j order: c,b,a with </a></b></c>
+            $replace = array($token);
             for ($j = 1; $j < $c; $j++) {
                 // ...as well as from the insertions
                 $new_token = new HTMLPurifier_Token_End($skipped_tags[$j]->name);
                 $new_token->start = $skipped_tags[$j];
-                $this->insertBefore($new_token);
+                array_unshift($replace, $new_token);
+                if (isset($definition->info[$new_token->name]) && $definition->info[$new_token->name]->formatting) {
+                    $element = clone $skipped_tags[$j];
+                    $element->carryover = true;
+                    $element->armor['MakeWellFormed_TagClosedError'] = true;
+                    $replace[] = $element;
+                }
             }
+            $this->processToken($replace);
             $reprocess = true;
             continue;
         }
-        
+
         $context->destroy('CurrentNesting');
         $context->destroy('InputTokens');
         $context->destroy('InputIndex');
         $context->destroy('CurrentToken');
-        
+
         unset($this->injectors, $this->stack, $this->tokens, $this->t);
         return $tokens;
     }
-    
+
     /**
      * Processes arbitrary token values for complicated substitution patterns.
      * In general:
-     * 
+     *
      * If $token is an array, it is a list of tokens to substitute for the
      * current token. These tokens then get individually processed. If there
      * is a leading integer in the list, that integer determines how many
      * tokens from the stream should be removed.
-     * 
+     *
      * If $token is a regular token, it is swapped with the current token.
-     * 
+     *
      * If $token is false, the current token is deleted.
-     * 
+     *
      * If $token is an integer, that number of tokens (with the first token
      * being the current one) will be deleted.
-     * 
+     *
      * @param $token Token substitution value
      * @param $injector Injector that performed the substitution; default is if
      *        this is not an injector related operation.
      */
     protected function processToken($token, $injector = -1) {
-        
+
         // normalize forms of token
         if (is_object($token)) $token = array(1, $token);
         if (is_int($token))    $token = array($token);
@@ -387,13 +410,13 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
         if (!is_array($token)) throw new HTMLPurifier_Exception('Invalid token type from injector');
         if (!is_int($token[0])) array_unshift($token, 1);
         if ($token[0] === 0) throw new HTMLPurifier_Exception('Deleting zero tokens is not valid');
-        
+
         // $token is now an array with the following form:
         // array(number nodes to delete, new node 1, new node 2, ...)
-        
+
         $delete = array_shift($token);
         $old = array_splice($this->tokens, $this->t, $delete, $token);
-        
+
         if ($injector > -1) {
             // determine appropriate skips
             $oldskip = isset($old[0]) ? $old[0]->skip : array();
@@ -402,9 +425,9 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
                 $object->skip[$injector] = true;
             }
         }
-        
+
     }
-    
+
     /**
      * Inserts a token before the current token. Cursor now points to this token
      */
@@ -419,13 +442,14 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
     private function remove() {
         array_splice($this->tokens, $this->t, 1);
     }
-    
+
     /**
      * Swap current token with new token. Cursor points to new token (no change).
      */
     private function swap($token) {
         $this->tokens[$this->t] = $token;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 6a6929904191b251fbcd1c744bbcc4c33f28ba4c..d30e456db3337a16d136e505c2aeeb67414764b9 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Removes all unrecognized tags from the list of tokens.
- * 
+ *
  * This strategy iterates through all the tokens and removes unrecognized
  * tokens. If a token is not recognized but a TagTransform is defined for
  * that element, the element will be transformed accordingly.
 
 class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
 {
-    
+
     public function execute($tokens, $config, $context) {
         $definition = $config->getHTMLDefinition();
         $generator = new HTMLPurifier_Generator($config, $context);
         $result = array();
-        
+
         $escape_invalid_tags = $config->get('Core', 'EscapeInvalidTags');
         $remove_invalid_img  = $config->get('Core', 'RemoveInvalidImg');
-        
+
         // currently only used to determine if comments should be kept
         $trusted = $config->get('HTML', 'Trusted');
-        
+
         $remove_script_contents = $config->get('Core', 'RemoveScriptContents');
         $hidden_elements     = $config->get('Core', 'HiddenElements');
-        
+
         // remove script contents compatibility
         if ($remove_script_contents === true) {
             $hidden_elements['script'] = true;
         } elseif ($remove_script_contents === false && isset($hidden_elements['script'])) {
             unset($hidden_elements['script']);
         }
-        
+
         $attr_validator = new HTMLPurifier_AttrValidator();
-        
+
         // removes tokens until it reaches a closing tag with its value
         $remove_until = false;
-        
+
         // converts comments into text tokens when this is equal to a tag name
         $textify_comments = false;
-        
+
         $token = false;
         $context->register('CurrentToken', $token);
-        
+
         $e = false;
         if ($config->get('Core', 'CollectErrors')) {
             $e =& $context->get('ErrorCollector');
         }
-        
+
         foreach($tokens as $token) {
             if ($remove_until) {
                 if (empty($token->is_tag) || $token->name !== $remove_until) {
@@ -56,7 +56,7 @@ class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
             }
             if (!empty( $token->is_tag )) {
                 // DEFINITION CALL
-                
+
                 // before any processing, try to transform the element
                 if (
                     isset($definition->info_tag_transform[$token->name])
@@ -69,9 +69,9 @@ class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
                                     transform($token, $config, $context);
                     if ($e) $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Tag transform', $original_name);
                 }
-                
+
                 if (isset($definition->info[$token->name])) {
-                    
+
                     // mostly everything's good, but
                     // we need to make sure required attributes are in order
                     if (
@@ -93,13 +93,13 @@ class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
                         }
                         $token->armor['ValidateAttributes'] = true;
                     }
-                    
+
                     if (isset($hidden_elements[$token->name]) && $token instanceof HTMLPurifier_Token_Start) {
                         $textify_comments = $token->name;
                     } elseif ($token->name === $textify_comments && $token instanceof HTMLPurifier_Token_End) {
                         $textify_comments = false;
                     }
-                    
+
                 } elseif ($escape_invalid_tags) {
                     // invalid tag, generate HTML representation and insert in
                     if ($e) $e->send(E_WARNING, 'Strategy_RemoveForeignElements: Foreign element to text');
@@ -160,11 +160,12 @@ class HTMLPurifier_Strategy_RemoveForeignElements extends HTMLPurifier_Strategy
             // we removed tokens until the end, throw error
             $e->send(E_ERROR, 'Strategy_RemoveForeignElements: Token removed to end', $remove_until);
         }
-        
+
         $context->destroy('CurrentToken');
-        
+
         return $result;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index d2273ee9259343d90391d16f09a587fdb2396238..c3328a9d44199d596371976e9da5209d0f8f52a3 100644 (file)
@@ -6,33 +6,34 @@
 
 class HTMLPurifier_Strategy_ValidateAttributes extends HTMLPurifier_Strategy
 {
-    
+
     public function execute($tokens, $config, $context) {
-        
+
         // setup validator
         $validator = new HTMLPurifier_AttrValidator();
-        
+
         $token = false;
         $context->register('CurrentToken', $token);
-        
+
         foreach ($tokens as $key => $token) {
-            
+
             // only process tokens that have attributes,
             //   namely start and empty tags
             if (!$token instanceof HTMLPurifier_Token_Start && !$token instanceof HTMLPurifier_Token_Empty) continue;
-            
+
             // skip tokens that are armored
             if (!empty($token->armor['ValidateAttributes'])) continue;
-            
+
             // note that we have no facilities here for removing tokens
             $validator->validateToken($token, $config, $context);
-            
+
             $tokens[$key] = $token; // for PHP 4
         }
         $context->destroy('CurrentToken');
-        
+
         return $tokens;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 86cda25ef6b6443bd772a8a0965c68cadbf64643..62085c5c2ffff64f770973190fbb0ad737a2c9d6 100644 (file)
@@ -11,7 +11,7 @@
 class HTMLPurifier_StringHash extends ArrayObject
 {
     protected $accessed = array();
-    
+
     /**
      * Retrieves a value, and logs the access.
      */
@@ -19,7 +19,7 @@ class HTMLPurifier_StringHash extends ArrayObject
         $this->accessed[$index] = true;
         return parent::offsetGet($index);
     }
-    
+
     /**
      * Returns a lookup array of all array indexes that have been accessed.
      * @return Array in form array($index => true).
@@ -27,7 +27,7 @@ class HTMLPurifier_StringHash extends ArrayObject
     public function getAccessed() {
         return $this->accessed;
     }
-    
+
     /**
      * Resets the access array.
      */
@@ -35,3 +35,5 @@ class HTMLPurifier_StringHash extends ArrayObject
         $this->accessed = array();
     }
 }
+
+// vim: et sw=4 sts=4
index e98271df485ab9d61bcab6a18dbf00fc41ab4522..f3e70c712f077cc2c3f0325df1075e1985647b15 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Parses string hash files. File format is as such:
- * 
+ *
  *      DefaultKeyValue
  *      KEY: Value
  *      KEY2: Value2
@@ -27,9 +27,9 @@
  */
 class HTMLPurifier_StringHashParser
 {
-    
+
     public $default = 'ID';
-    
+
     /**
      * Parses a file that contains a single string-hash.
      */
@@ -41,7 +41,7 @@ class HTMLPurifier_StringHashParser
         fclose($fh);
         return $ret;
     }
-    
+
     /**
      * Parses a file that contains multiple string-hashes delimited by '----'
      */
@@ -56,7 +56,7 @@ class HTMLPurifier_StringHashParser
         fclose($fh);
         return $ret;
     }
-    
+
     /**
      * Internal parser that acepts a file handle.
      * @note While it's possible to simulate in-memory parsing by using
@@ -75,7 +75,10 @@ class HTMLPurifier_StringHashParser
             $line = rtrim($line, "\n\r");
             if (!$state && $line === '') continue;
             if ($line === '----') break;
-            if (strncmp('--', $line, 2) === 0) {
+            if (strncmp('--#', $line, 3) === 0) {
+                // Comment
+                continue;
+            } elseif (strncmp('--', $line, 2) === 0) {
                 // Multiline declaration
                 $state = trim($line, '- ');
                 if (!isset($ret[$state])) $ret[$state] = '';
@@ -84,7 +87,8 @@ class HTMLPurifier_StringHashParser
                 $single = true;
                 if (strpos($line, ':') !== false) {
                     // Single-line declaration
-                    list($state, $line) = explode(': ', $line, 2);
+                    list($state, $line) = explode(':', $line, 2);
+                    $line = trim($line);
                 } else {
                     // Use default declaration
                     $state  = $this->default;
@@ -100,5 +104,7 @@ class HTMLPurifier_StringHashParser
         } while (!feof($fh));
         return $ret;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 6cdbdc1b50655f2fc47a2bcaf9cfb7be832b9fbf..210a44721769223bf25c9ec531874fc5de1eb5c2 100644 (file)
@@ -5,12 +5,12 @@
  */
 abstract class HTMLPurifier_TagTransform
 {
-    
+
     /**
      * Tag name to transform the tag to.
      */
     public $transform_to;
-    
+
     /**
      * Transforms the obsolete tag into the valid tag.
      * @param $tag Tag to be transformed.
@@ -18,7 +18,7 @@ abstract class HTMLPurifier_TagTransform
      * @param $context Mandatory HTMLPurifier_Context object
      */
     abstract public function transform($tag, $config, $context);
-    
+
     /**
      * Prepends CSS properties to the style attribute, creating the
      * attribute if it doesn't exist.
@@ -30,6 +30,7 @@ abstract class HTMLPurifier_TagTransform
         $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
         $attr['style'] = $css . $attr['style'];
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index a0603b86792ebd13adb58dd10dd95aa2d1ada206..ed2463786db064c1799d63945f066a335695c863 100644 (file)
@@ -2,21 +2,24 @@
 
 /**
  * Transforms FONT tags to the proper form (SPAN with CSS styling)
- * 
+ *
  * This transformation takes the three proprietary attributes of FONT and
  * transforms them into their corresponding CSS attributes.  These are color,
  * face, and size.
- * 
+ *
  * @note Size is an interesting case because it doesn't map cleanly to CSS.
  *       Thanks to
  *       http://style.cleverchimp.com/font_size_intervals/altintervals.html
  *       for reasonable mappings.
+ * @warning This doesn't work completely correctly; specifically, this
+ *          TagTransform operates before well-formedness is enforced, so
+ *          the "active formatting elements" algorithm doesn't get applied.
  */
 class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
 {
-    
+
     public $transform_to = 'span';
-    
+
     protected $_size_lookup = array(
         '0' => 'xx-small',
         '1' => 'xx-small',
@@ -33,30 +36,30 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
         '+3' => '200%',
         '+4' => '300%'
     );
-    
+
     public function transform($tag, $config, $context) {
-        
+
         if ($tag instanceof HTMLPurifier_Token_End) {
             $new_tag = clone $tag;
             $new_tag->name = $this->transform_to;
             return $new_tag;
         }
-        
+
         $attr = $tag->attr;
         $prepend_style = '';
-        
+
         // handle color transform
         if (isset($attr['color'])) {
             $prepend_style .= 'color:' . $attr['color'] . ';';
             unset($attr['color']);
         }
-        
+
         // handle face transform
         if (isset($attr['face'])) {
             $prepend_style .= 'font-family:' . $attr['face'] . ';';
             unset($attr['face']);
         }
-        
+
         // handle size transform
         if (isset($attr['size'])) {
             // normalize large numbers
@@ -74,19 +77,20 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
             }
             unset($attr['size']);
         }
-        
+
         if ($prepend_style) {
             $attr['style'] = isset($attr['style']) ?
                 $prepend_style . $attr['style'] :
                 $prepend_style;
         }
-        
+
         $new_tag = clone $tag;
         $new_tag->name = $this->transform_to;
         $new_tag->attr = $attr;
-        
+
         return $new_tag;
-        
+
     }
 }
 
+// vim: et sw=4 sts=4
index f68c6c281326f80188ff8b51c42b8bb2b840c83c..0e36130f2538be1990b71823a289bdeaf8ed0bc8 100644 (file)
@@ -7,9 +7,9 @@
  */
 class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform
 {
-    
+
     protected $style;
-    
+
     /**
      * @param $transform_to Tag name to transform to.
      * @param $style CSS style to add to the tag
@@ -18,7 +18,7 @@ class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform
         $this->transform_to = $transform_to;
         $this->style = $style;
     }
-    
+
     public function transform($tag, $config, $context) {
         $new_tag = clone $tag;
         $new_tag->name = $this->transform_to;
@@ -29,6 +29,7 @@ class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform
         }
         return $new_tag;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 942a61d129f69d75d8f156be93a93b8c30962641..7900e6cb10110ef4e9b6cec880c1a6d59c7beed1 100644 (file)
@@ -6,20 +6,21 @@
 class HTMLPurifier_Token {
     public $line; /**< Line number node was on in source document. Null if unknown. */
     public $col;  /**< Column of line node was on in source document. Null if unknown. */
-    
+
     /**
      * Lookup array of processing that this token is exempt from.
      * Currently, valid values are "ValidateAttributes" and
      * "MakeWellFormed_TagClosedError"
      */
     public $armor = array();
-    
+
     /**
      * Used during MakeWellFormed.
      */
     public $skip;
     public $rewind;
-    
+    public $carryover;
+
     public function __get($n) {
       if ($n === 'type') {
         trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE);
@@ -33,7 +34,7 @@ class HTMLPurifier_Token {
         }
       }
     }
-    
+
     /**
      * Sets the position of the token in the source document.
      */
@@ -41,7 +42,7 @@ class HTMLPurifier_Token {
         $this->line = $l;
         $this->col  = $c;
     }
-    
+
     /**
      * Convenience function for DirectLex settings line/col position.
      */
@@ -50,5 +51,7 @@ class HTMLPurifier_Token {
         $this->line = $l;
         $this->col  = $c;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 6717478095702708e9faf045cc536a9ebcee92c2..dc6bdcabb85952963cc48978bdce24253952e7d8 100644 (file)
@@ -6,9 +6,10 @@
 class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
 {
     public $data; /**< Character data within comment. */
+    public $is_whitespace = true;
     /**
      * Transparent constructor.
-     * 
+     *
      * @param $data String comment data.
      */
     public function __construct($data, $line = null, $col = null) {
@@ -18,3 +19,4 @@ class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
     }
 }
 
+// vim: et sw=4 sts=4
index 0623f7ac252b88479d11dfe8e3d534de8ba9a96f..2a82b47ad127036a1fe276a4b5308384f0599985 100644 (file)
@@ -5,5 +5,7 @@
  */
 class HTMLPurifier_Token_Empty extends HTMLPurifier_Token_Tag
 {
-    
+
 }
+
+// vim: et sw=4 sts=4
index 13cba031d9f19f72ea293bc12b6f6ce50240064f..353e79daf7357bdc55b5a1339558ac5838cf9a39 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Concrete end token class.
- * 
+ *
  * @warning This class accepts attributes even though end tags cannot. This
  * is for optimization reasons, as under normal circumstances, the Lexers
  * do not pass attributes.
@@ -15,3 +15,5 @@ class HTMLPurifier_Token_End extends HTMLPurifier_Token_Tag
      */
     public $start;
 }
+
+// vim: et sw=4 sts=4
index 18d5acb9e481a0d9d0b847518c5018782b737198..e0e14fc624ab6a4279d7595d7beb483da0a83a7f 100644 (file)
@@ -5,5 +5,7 @@
  */
 class HTMLPurifier_Token_Start extends HTMLPurifier_Token_Tag
 {
-    
+
 }
+
+// vim: et sw=4 sts=4
index 795c40f6653b184dfb9de3d8d61756c537a69ede..798be028ee6394ab904f9e67b2ba1e8f8a70ae24 100644 (file)
@@ -7,29 +7,29 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
 {
     /**
      * Static bool marker that indicates the class is a tag.
-     * 
+     *
      * This allows us to check objects with <tt>!empty($obj->is_tag)</tt>
      * without having to use a function call <tt>is_a()</tt>.
      */
     public $is_tag = true;
-    
+
     /**
      * The lower-case name of the tag, like 'a', 'b' or 'blockquote'.
-     * 
+     *
      * @note Strictly speaking, XML tags are case sensitive, so we shouldn't
      * be lower-casing them, but these tokens cater to HTML tags, which are
      * insensitive.
      */
     public $name;
-    
+
     /**
      * Associative array of the tag's attributes.
      */
     public $attr = array();
-    
+
     /**
      * Non-overloaded constructor, which lower-cases passed tag name.
-     * 
+     *
      * @param $name String name.
      * @param $attr Associative array of attributes.
      */
@@ -52,3 +52,5 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
         $this->col  = $col;
     }
 }
+
+// vim: et sw=4 sts=4
index 02b53e5c843e6b561ca3a26599b29f424f78d555..82efd823d6b60fd1be94f23159e0a4beb63b4953 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Concrete text token class.
- * 
+ *
  * Text tokens comprise of regular parsed character data (PCDATA) and raw
  * character data (from the CDATA sections). Internally, their
  * data is parsed with all entities expanded. Surprisingly, the text token
  */
 class HTMLPurifier_Token_Text extends HTMLPurifier_Token
 {
-    
+
     public $name = '#PCDATA'; /**< PCDATA tag name compatible with DTD. */
     public $data; /**< Parsed character data of text. */
     public $is_whitespace; /**< Bool indicating if node is whitespace. */
-    
+
     /**
      * Constructor, accepts data and determines if it is whitespace.
-     * 
+     *
      * @param $data String parsed character data.
      */
     public function __construct($data, $line = null, $col = null) {
@@ -27,5 +27,7 @@ class HTMLPurifier_Token_Text extends HTMLPurifier_Token
         $this->line = $line;
         $this->col  = $col;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index bff693f418371421587218b21a65aa8a09f4f595..7cf48fb41c1ee30b3d2a5f21a22579effb1d547d 100644 (file)
@@ -2,7 +2,7 @@
 
 /**
  * Factory for token generation.
- * 
+ *
  * @note Doing some benchmarking indicates that the new operator is much
  *       slower than the clone operator (even discounting the cost of the
  *       constructor).  This class is for that optimization.
  */
 class HTMLPurifier_TokenFactory
 {
-    
+
     /**
      * Prototypes that will be cloned.
      * @private
      */
     // p stands for prototype
     private $p_start, $p_end, $p_empty, $p_text, $p_comment;
-    
+
     /**
      * Generates blank prototypes for cloning.
      */
@@ -31,7 +31,7 @@ class HTMLPurifier_TokenFactory
         $this->p_text   = new HTMLPurifier_Token_Text('');
         $this->p_comment= new HTMLPurifier_Token_Comment('');
     }
-    
+
     /**
      * Creates a HTMLPurifier_Token_Start.
      * @param $name Tag name
@@ -43,7 +43,7 @@ class HTMLPurifier_TokenFactory
         $p->__construct($name, $attr);
         return $p;
     }
-    
+
     /**
      * Creates a HTMLPurifier_Token_End.
      * @param $name Tag name
@@ -54,7 +54,7 @@ class HTMLPurifier_TokenFactory
         $p->__construct($name);
         return $p;
     }
-    
+
     /**
      * Creates a HTMLPurifier_Token_Empty.
      * @param $name Tag name
@@ -66,7 +66,7 @@ class HTMLPurifier_TokenFactory
         $p->__construct($name, $attr);
         return $p;
     }
-    
+
     /**
      * Creates a HTMLPurifier_Token_Text.
      * @param $data Data of text token
@@ -77,7 +77,7 @@ class HTMLPurifier_TokenFactory
         $p->__construct($data);
         return $p;
     }
-    
+
     /**
      * Creates a HTMLPurifier_Token_Comment.
      * @param $data Data of comment token
@@ -88,6 +88,7 @@ class HTMLPurifier_TokenFactory
         $p->__construct($data);
         return $p;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index cab09bfbafb5b414f0cdb2fd3739f95e3226a58b..8b50d0d18d8510c0e6ea56598a5d7555c0ebb735 100644 (file)
@@ -10,9 +10,9 @@
  */
 class HTMLPurifier_URI
 {
-    
+
     public $scheme, $userinfo, $host, $port, $path, $query, $fragment;
-    
+
     /**
      * @note Automatically normalizes scheme and port
      */
@@ -25,7 +25,7 @@ class HTMLPurifier_URI
         $this->query = $query;
         $this->fragment = $fragment;
     }
-    
+
     /**
      * Retrieves a scheme object corresponding to the URI's scheme/default
      * @param $config Instance of HTMLPurifier_Config
@@ -52,7 +52,7 @@ class HTMLPurifier_URI
         }
         return $scheme_obj;
     }
-    
+
     /**
      * Generic validation method applicable for all schemes. May modify
      * this URI in order to get it into a compliant form.
@@ -61,12 +61,12 @@ class HTMLPurifier_URI
      * @return True if validation/filtering succeeds, false if failure
      */
     public function validate($config, $context) {
-        
+
         // ABNF definitions from RFC 3986
         $chars_sub_delims = '!$&\'()*+,;=';
         $chars_gen_delims = ':/?#[]@';
         $chars_pchar = $chars_sub_delims . ':@';
-        
+
         // validate scheme (MUST BE FIRST!)
         if (!is_null($this->scheme) && is_null($this->host)) {
             $def = $config->getDefinition('URI');
@@ -74,25 +74,25 @@ class HTMLPurifier_URI
                 $this->scheme = null;
             }
         }
-        
+
         // validate host
         if (!is_null($this->host)) {
             $host_def = new HTMLPurifier_AttrDef_URI_Host();
             $this->host = $host_def->validate($this->host, $config, $context);
             if ($this->host === false) $this->host = null;
         }
-        
+
         // validate username
         if (!is_null($this->userinfo)) {
             $encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims . ':');
             $this->userinfo = $encoder->encode($this->userinfo);
         }
-        
+
         // validate port
         if (!is_null($this->port)) {
             if ($this->port < 1 || $this->port > 65535) $this->port = null;
         }
-        
+
         // validate path
         $path_parts = array();
         $segments_encoder = new HTMLPurifier_PercentEncoder($chars_pchar . '/');
@@ -117,7 +117,7 @@ class HTMLPurifier_URI
             $segment_nc_encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims . '@');
             $c = strpos($this->path, '/');
             if ($c !== false) {
-                $this->path = 
+                $this->path =
                     $segment_nc_encoder->encode(substr($this->path, 0, $c)) .
                     $segments_encoder->encode(substr($this->path, $c));
             } else {
@@ -127,22 +127,22 @@ class HTMLPurifier_URI
             // path-empty (hier and relative)
             $this->path = ''; // just to be safe
         }
-        
+
         // qf = query and fragment
         $qf_encoder = new HTMLPurifier_PercentEncoder($chars_pchar . '/?');
-        
+
         if (!is_null($this->query)) {
             $this->query = $qf_encoder->encode($this->query);
         }
-        
+
         if (!is_null($this->fragment)) {
             $this->fragment = $qf_encoder->encode($this->fragment);
         }
-        
+
         return true;
-        
+
     }
-    
+
     /**
      * Convert URI back to string
      * @return String URI appropriate for output
@@ -156,7 +156,7 @@ class HTMLPurifier_URI
             $authority .= $this->host;
             if(!is_null($this->port))     $authority .= ':' . $this->port;
         }
-        
+
         // reconstruct the result
         $result = '';
         if (!is_null($this->scheme))    $result .= $this->scheme . ':';
@@ -164,9 +164,10 @@ class HTMLPurifier_URI
         $result .= $this->path;
         if (!is_null($this->query))     $result .= '?' . $this->query;
         if (!is_null($this->fragment))  $result .= '#' . $this->fragment;
-        
+
         return $result;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 6977338ae10c5ee4d22f64c33bfcbaa07b965368..183fcfc7e749acfa10d8a89b09a5e82eed2a20a5 100644 (file)
@@ -2,27 +2,27 @@
 
 class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
 {
-    
+
     public $type = 'URI';
     protected $filters = array();
     protected $postFilters = array();
     protected $registeredFilters = array();
-    
+
     /**
      * HTMLPurifier_URI object of the base specified at %URI.Base
      */
     public $base;
-    
+
     /**
      * String host to consider "home" base, derived off of $base
      */
     public $host;
-    
+
     /**
      * Name of default scheme based on %URI.DefaultScheme and %URI.Base
      */
     public $defaultScheme;
-    
+
     public function __construct() {
         $this->registerFilter(new HTMLPurifier_URIFilter_DisableExternal());
         $this->registerFilter(new HTMLPurifier_URIFilter_DisableExternalResources());
@@ -30,11 +30,11 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
         $this->registerFilter(new HTMLPurifier_URIFilter_MakeAbsolute());
         $this->registerFilter(new HTMLPurifier_URIFilter_Munge());
     }
-    
+
     public function registerFilter($filter) {
         $this->registeredFilters[$filter->name] = $filter;
     }
-    
+
     public function addFilter($filter, $config) {
         $r = $filter->prepare($config);
         if ($r === false) return; // null is ok, for backwards compat
@@ -44,12 +44,12 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
             $this->filters[$filter->name] = $filter;
         }
     }
-    
+
     protected function doSetup($config) {
         $this->setupMemberVariables($config);
         $this->setupFilters($config);
     }
-    
+
     protected function setupFilters($config) {
         foreach ($this->registeredFilters as $name => $filter) {
             $conf = $config->get('URI', $name);
@@ -59,7 +59,7 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
         }
         unset($this->registeredFilters);
     }
-    
+
     protected function setupMemberVariables($config) {
         $this->host = $config->get('URI', 'Host');
         $base_uri = $config->get('URI', 'Base');
@@ -71,7 +71,7 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
         }
         if (is_null($this->defaultScheme)) $this->defaultScheme = $config->get('URI', 'DefaultScheme');
     }
-    
+
     public function filter(&$uri, $config, $context) {
         foreach ($this->filters as $name => $f) {
             $result = $f->filter($uri, $config, $context);
@@ -79,7 +79,7 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
         }
         return true;
     }
-    
+
     public function postFilter(&$uri, $config, $context) {
         foreach ($this->postFilters as $name => $f) {
             $result = $f->filter($uri, $config, $context);
@@ -87,5 +87,7 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
         }
         return true;
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 6953ed43da5b386e69bb24003d1377ce3cadc5b0..c116f93dffc02a198a97ffcc3454147d3e5e9c1c 100644 (file)
@@ -2,10 +2,10 @@
 
 /**
  * Chainable filters for custom URI processing.
- * 
+ *
  * These filters can perform custom actions on a URI filter object,
  * including transformation or blacklisting.
- * 
+ *
  * @warning This filter is called before scheme object validation occurs.
  *          Make sure, if you require a specific scheme object, you
  *          you check that it exists. This allows filters to convert
  */
 abstract class HTMLPurifier_URIFilter
 {
-    
+
     /**
      * Unique identifier of filter
      */
     public $name;
-    
+
     /**
      * True if this filter should be run after scheme validation.
      */
     public $post = false;
-    
+
     /**
      * Performs initialization for the filter
      */
     public function prepare($config) {return true;}
-    
+
     /**
      * Filter a URI object
      * @param $uri Reference to URI object variable
@@ -39,5 +39,7 @@ abstract class HTMLPurifier_URIFilter
      *         all changes are committed directly on the URI object
      */
     abstract public function filter(&$uri, $config, $context);
-    
+
 }
+
+// vim: et sw=4 sts=4
index 960e2b9b5a46d13b61c9015a99e4a04892087d54..d8a39a5011120d663e92a3ab22d4dab1e9826116 100644 (file)
@@ -20,3 +20,4 @@ class HTMLPurifier_URIFilter_DisableExternal extends HTMLPurifier_URIFilter
     }
 }
 
+// vim: et sw=4 sts=4
index 9e4e7bdd2ab5a8b597b5be3498e2a691bc41edf8..881abc43cfa2533027109ca74e7052be9a273ff6 100644 (file)
@@ -9,3 +9,4 @@ class HTMLPurifier_URIFilter_DisableExternalResources extends HTMLPurifier_URIFi
     }
 }
 
+// vim: et sw=4 sts=4
index 013204796229c0b6bc7dd7c230f530c95eb6e3e4..bac56e8b8e4b7a0ac88b35f2c858ef870dd69c2a 100644 (file)
@@ -17,3 +17,5 @@ class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter
         return true;
     }
 }
+
+// vim: et sw=4 sts=4
index 89998267442baafb4c23ad848bb739962002ae54..f46ab2630d443bf990ec42dab7ab37cfacb163ab 100644 (file)
@@ -71,7 +71,7 @@ class HTMLPurifier_URIFilter_MakeAbsolute extends HTMLPurifier_URIFilter
         if (is_null($uri->port))     $uri->port     = $this->base->port;
         return true;
     }
-    
+
     /**
      * Resolve dots and double-dots in a path stack
      */
@@ -111,3 +111,4 @@ class HTMLPurifier_URIFilter_MakeAbsolute extends HTMLPurifier_URIFilter
     }
 }
 
+// vim: et sw=4 sts=4
index d82d2b920351b302cb47fadacad84402be19fe4a..29ed0ed1f27c9575273613e449044342367c59de 100644 (file)
@@ -5,9 +5,9 @@ class HTMLPurifier_URIFilter_Munge extends HTMLPurifier_URIFilter
     public $name = 'Munge';
     public $post = true;
     private $target, $parser, $doEmbed, $secretKey;
-    
+
     protected $replace = array();
-    
+
     public function prepare($config) {
         $this->target    = $config->get('URI', $this->name);
         $this->parser    = new HTMLPurifier_URIParser();
@@ -17,25 +17,25 @@ class HTMLPurifier_URIFilter_Munge extends HTMLPurifier_URIFilter
     }
     public function filter(&$uri, $config, $context) {
         if ($context->get('EmbeddedURI', true) && !$this->doEmbed) return true;
-        
+
         $scheme_obj = $uri->getSchemeObj($config, $context);
         if (!$scheme_obj) return true; // ignore unknown schemes, maybe another postfilter did it
         if (is_null($uri->host) || empty($scheme_obj->browsable)) {
             return true;
         }
-        
+
         $this->makeReplace($uri, $config, $context);
         $this->replace = array_map('rawurlencode', $this->replace);
-        
+
         $new_uri = strtr($this->target, $this->replace);
         $new_uri = $this->parser->parse($new_uri);
-        // don't redirect if the target host is the same as the 
+        // don't redirect if the target host is the same as the
         // starting host
         if ($uri->host === $new_uri->host) return true;
         $uri = $new_uri; // overwrite
         return true;
     }
-    
+
     protected function makeReplace($uri, $config, $context) {
         $string = $uri->toString();
         // always available
@@ -48,5 +48,7 @@ class HTMLPurifier_URIFilter_Munge extends HTMLPurifier_URIFilter
         // not always available
         if ($this->secretKey) $this->replace['%t'] = sha1($this->secretKey . ':' . $string);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 0ea51762b8eef5ce7dcff439843dee0550a86d9b..7179e4ab8991077aa2ff4b3a4fca0a4eafd416e0 100644 (file)
@@ -6,16 +6,16 @@
  */
 class HTMLPurifier_URIParser
 {
-    
+
     /**
      * Instance of HTMLPurifier_PercentEncoder to do normalization with.
      */
     protected $percentEncoder;
-    
+
     public function __construct() {
         $this->percentEncoder = new HTMLPurifier_PercentEncoder();
     }
-    
+
     /**
      * Parses a URI.
      * @param $uri string URI to parse
@@ -23,11 +23,11 @@ class HTMLPurifier_URIParser
      *         not been validated yet and may not conform to RFC.
      */
     public function parse($uri) {
-        
+
         $uri = $this->percentEncoder->normalize($uri);
-        
+
         // Regexp is as per Appendix B.
-        // Note that ["<>] are an addition to the RFC's recommended 
+        // Note that ["<>] are an addition to the RFC's recommended
         // characters, because they represent external delimeters.
         $r_URI = '!'.
             '(([^:/?#"<>]+):)?'. // 2. Scheme
@@ -36,19 +36,19 @@ class HTMLPurifier_URIParser
             '(\?([^#"<>]*))?'.   // 7. Query
             '(#([^"<>]*))?'.     // 8. Fragment
             '!';
-        
+
         $matches = array();
         $result = preg_match($r_URI, $uri, $matches);
-        
+
         if (!$result) return false; // *really* invalid URI
-        
+
         // seperate out parts
         $scheme     = !empty($matches[1]) ? $matches[2] : null;
         $authority  = !empty($matches[3]) ? $matches[4] : null;
         $path       = $matches[5]; // always present, can be empty
         $query      = !empty($matches[6]) ? $matches[7] : null;
         $fragment   = !empty($matches[8]) ? $matches[9] : null;
-        
+
         // further parse authority
         if ($authority !== null) {
             $r_authority = "/^((.+?)@)?(\[[^\]]+\]|[^:]*)(:(\d*))?/";
@@ -60,10 +60,11 @@ class HTMLPurifier_URIParser
         } else {
             $port = $host = $userinfo = null;
         }
-        
+
         return new HTMLPurifier_URI(
             $scheme, $userinfo, $host, $port, $path, $query, $fragment);
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index fada38700f80493fbabcce47f9881621c323208c..039710fd1586bf525394d06b8d2b4fe1863ac191 100644 (file)
@@ -5,24 +5,24 @@
  */
 class HTMLPurifier_URIScheme
 {
-    
+
     /**
      * Scheme's default port (integer)
      */
     public $default_port = null;
-    
+
     /**
      * Whether or not URIs of this schem are locatable by a browser
      * http and ftp are accessible, while mailto and news are not.
      */
     public $browsable = false;
-    
+
     /**
      * Whether or not the URI always uses <hier_part>, resolves edge cases
      * with making relative URIs absolute
      */
     public $hierarchical = false;
-    
+
     /**
      * Validates the components of a URI
      * @note This implementation should be called by children if they define
@@ -36,6 +36,7 @@ class HTMLPurifier_URIScheme
         if ($this->default_port == $uri->port) $uri->port = null;
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 2d7580f33cf24960d4471043f01dce97ae0ba271..5849bf7ff056b4e99fd8b90cfc8566c364dde8f7 100644 (file)
@@ -4,15 +4,15 @@
  * Validates ftp (File Transfer Protocol) URIs as defined by generic RFC 1738.
  */
 class HTMLPurifier_URIScheme_ftp extends HTMLPurifier_URIScheme {
-    
+
     public $default_port = 21;
     public $browsable = true; // usually
     public $hierarchical = true;
-    
+
     public function validate(&$uri, $config, $context) {
         parent::validate($uri, $config, $context);
         $uri->query    = null;
-        
+
         // typecode check
         $semicolon_pos = strrpos($uri->path, ';'); // reverse
         if ($semicolon_pos !== false) {
@@ -34,9 +34,10 @@ class HTMLPurifier_URIScheme_ftp extends HTMLPurifier_URIScheme {
             $uri->path = str_replace(';', '%3B', $uri->path);
             $uri->path .= $type_ret;
         }
-        
+
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 10d89c0ffe85f660f6d9edea6e05f0e2e1d5816d..b097a31d6a329a54645a82cd97600c80961bc442 100644 (file)
@@ -4,16 +4,17 @@
  * Validates http (HyperText Transfer Protocol) as defined by RFC 2616
  */
 class HTMLPurifier_URIScheme_http extends HTMLPurifier_URIScheme {
-    
+
     public $default_port = 80;
     public $browsable = true;
     public $hierarchical = true;
-    
+
     public function validate(&$uri, $config, $context) {
         parent::validate($uri, $config, $context);
         $uri->userinfo = null;
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index bd670401b9751370dea7f7b17b0ead9418b09248..29e380919f0d746e2e7d41c27002f2582b9a4826 100644 (file)
@@ -4,8 +4,9 @@
  * Validates https (Secure HTTP) according to http scheme.
  */
 class HTMLPurifier_URIScheme_https extends HTMLPurifier_URIScheme_http {
-    
+
     public $default_port = 443;
-    
+
 }
 
+// vim: et sw=4 sts=4
index b8a4aef40ff23023efcfac699ae6d74cf1efdc71..c1e2cd5aae16eb3a37619b139c19246539c602c4 100644 (file)
@@ -10,9 +10,9 @@
  */
 
 class HTMLPurifier_URIScheme_mailto extends HTMLPurifier_URIScheme {
-    
+
     public $browsable = false;
-    
+
     public function validate(&$uri, $config, $context) {
         parent::validate($uri, $config, $context);
         $uri->userinfo = null;
@@ -21,6 +21,7 @@ class HTMLPurifier_URIScheme_mailto extends HTMLPurifier_URIScheme {
         // we need to validate path against RFC 2368's addr-spec
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index d862e2e13e29822203dd41c6ddfc4131cabf76a2..f5f54f4f56ffad336482d1cbf1b8151f3fff69b4 100644 (file)
@@ -4,9 +4,9 @@
  * Validates news (Usenet) as defined by generic RFC 1738
  */
 class HTMLPurifier_URIScheme_news extends HTMLPurifier_URIScheme {
-    
+
     public $browsable = false;
-    
+
     public function validate(&$uri, $config, $context) {
         parent::validate($uri, $config, $context);
         $uri->userinfo = null;
@@ -16,6 +16,7 @@ class HTMLPurifier_URIScheme_news extends HTMLPurifier_URIScheme {
         // typecode check needed on path
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 88b613b6aefa318be97b255eba2ed792aa05de14..5bf93ea7849c2dc3709df9f5eada4e0dc42ffa24 100644 (file)
@@ -4,16 +4,17 @@
  * Validates nntp (Network News Transfer Protocol) as defined by generic RFC 1738
  */
 class HTMLPurifier_URIScheme_nntp extends HTMLPurifier_URIScheme {
-    
+
     public $default_port = 119;
     public $browsable = false;
-    
+
     public function validate(&$uri, $config, $context) {
         parent::validate($uri, $config, $context);
         $uri->userinfo = null;
         $uri->query    = null;
         return true;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index 349fa0f6f72f64e60ad2aa8b5485ff43aa29bec4..d24732c1829b894e0c43c24e2382974f3ce722f3 100644 (file)
@@ -5,7 +5,7 @@
  */
 class HTMLPurifier_URISchemeRegistry
 {
-    
+
     /**
      * Retrieve sole instance of the registry.
      * @param $prototype Optional prototype to overload sole instance with,
@@ -22,12 +22,12 @@ class HTMLPurifier_URISchemeRegistry
         }
         return $instance;
     }
-    
+
     /**
      * Cache of retrieved schemes.
      */
     protected $schemes = array();
-    
+
     /**
      * Retrieves a scheme validator object
      * @param $scheme String scheme name like http or mailto
@@ -37,7 +37,7 @@ class HTMLPurifier_URISchemeRegistry
     public function getScheme($scheme, $config, $context) {
         if (!$config) $config = HTMLPurifier_Config::createDefault();
         $null = null; // for the sake of passing by reference
-        
+
         // important, otherwise attacker could include arbitrary file
         $allowed_schemes = $config->get('URI', 'AllowedSchemes');
         if (!$config->get('URI', 'OverrideAllowedSchemes') &&
@@ -45,16 +45,16 @@ class HTMLPurifier_URISchemeRegistry
         ) {
             return $null;
         }
-        
+
         if (isset($this->schemes[$scheme])) return $this->schemes[$scheme];
         if (!isset($allowed_schemes[$scheme])) return $null;
-        
+
         $class = 'HTMLPurifier_URIScheme_' . $scheme;
         if (!class_exists($class)) return $null;
         $this->schemes[$scheme] = new $class();
         return $this->schemes[$scheme];
     }
-    
+
     /**
      * Registers a custom scheme to the cache, bypassing reflection.
      * @param $scheme Scheme name
@@ -63,7 +63,7 @@ class HTMLPurifier_URISchemeRegistry
     public function register($scheme, $scheme_obj) {
         $this->schemes[$scheme] = $scheme_obj;
     }
-    
-}
 
+}
 
+// vim: et sw=4 sts=4
index d69a132b26a40c94e787770bf07556300bfc5c3f..545d426220665b2c661d9068db1930e0eeac2ff0 100644 (file)
@@ -6,11 +6,11 @@
  */
 class HTMLPurifier_UnitConverter
 {
-    
+
     const ENGLISH = 1;
     const METRIC = 2;
     const DIGITAL = 3;
-    
+
     /**
      * Units information array. Units are grouped into measuring systems
      * (English, Metric), and are assigned an integer representing
@@ -34,28 +34,28 @@ class HTMLPurifier_UnitConverter
             self::ENGLISH => array('mm', '2.83464567', 'pt'),
         ),
     );
-    
+
     /**
      * Minimum bcmath precision for output.
      */
     protected $outputPrecision;
-    
+
     /**
      * Bcmath precision for internal calculations.
      */
     protected $internalPrecision;
-    
+
     /**
      * Whether or not BCMath is available
      */
     private $bcmath;
-    
+
     public function __construct($output_precision = 4, $internal_precision = 10, $force_no_bcmath = false) {
         $this->outputPrecision = $output_precision;
         $this->internalPrecision = $internal_precision;
         $this->bcmath = !$force_no_bcmath && function_exists('bcmul');
     }
-    
+
     /**
      * Converts a length object of one unit into another unit.
      * @param HTMLPurifier_Length $length
@@ -75,37 +75,37 @@ class HTMLPurifier_UnitConverter
      *            decimals will be added on.
      */
     public function convert($length, $to_unit) {
-        
+
         if (!$length->isValid()) return false;
-        
+
         $n    = $length->getN();
         $unit = $length->getUnit();
-        
+
         if ($n === '0' || $unit === false) {
             return new HTMLPurifier_Length('0', false);
         }
-        
+
         $state = $dest_state = false;
         foreach (self::$units as $k => $x) {
             if (isset($x[$unit])) $state = $k;
             if (isset($x[$to_unit])) $dest_state = $k;
         }
         if (!$state || !$dest_state) return false;
-        
+
         // Some calculations about the initial precision of the number;
         // this will be useful when we need to do final rounding.
         $sigfigs = $this->getSigFigs($n);
         if ($sigfigs < $this->outputPrecision) $sigfigs = $this->outputPrecision;
-        
+
         // BCMath's internal precision deals only with decimals. Use
         // our default if the initial number has no decimals, or increase
         // it by how ever many decimals, thus, the number of guard digits
         // will always be greater than or equal to internalPrecision.
         $log = (int) floor(log(abs($n), 10));
         $cp = ($log < 0) ? $this->internalPrecision - $log : $this->internalPrecision; // internal precision
-        
+
         for ($i = 0; $i < 2; $i++) {
-            
+
             // Determine what unit IN THIS SYSTEM we need to convert to
             if ($dest_state === $state) {
                 // Simple conversion
@@ -114,57 +114,57 @@ class HTMLPurifier_UnitConverter
                 // Convert to the smallest unit, pending a system shift
                 $dest_unit = self::$units[$state][$dest_state][0];
             }
-            
+
             // Do the conversion if necessary
             if ($dest_unit !== $unit) {
                 $factor = $this->div(self::$units[$state][$unit], self::$units[$state][$dest_unit], $cp);
                 $n = $this->mul($n, $factor, $cp);
                 $unit = $dest_unit;
             }
-            
+
             // Output was zero, so bail out early. Shouldn't ever happen.
             if ($n === '') {
                 $n = '0';
                 $unit = $to_unit;
                 break;
             }
-            
+
             // It was a simple conversion, so bail out
             if ($dest_state === $state) {
                 break;
             }
-            
+
             if ($i !== 0) {
                 // Conversion failed! Apparently, the system we forwarded
                 // to didn't have this unit. This should never happen!
                 return false;
             }
-            
+
             // Pre-condition: $i == 0
-            
+
             // Perform conversion to next system of units
             $n = $this->mul($n, self::$units[$state][$dest_state][1], $cp);
             $unit = self::$units[$state][$dest_state][2];
             $state = $dest_state;
-            
+
             // One more loop around to convert the unit in the new system.
-            
+
         }
-        
+
         // Post-condition: $unit == $to_unit
         if ($unit !== $to_unit) return false;
-        
+
         // Useful for debugging:
         //echo "<pre>n";
         //echo "$n\nsigfigs = $sigfigs\nnew_log = $new_log\nlog = $log\nrp = $rp\n</pre>\n";
-        
+
         $n = $this->round($n, $sigfigs);
         if (strpos($n, '.') !== false) $n = rtrim($n, '0');
         $n = rtrim($n, '.');
-        
+
         return new HTMLPurifier_Length($n, $unit);
     }
-    
+
     /**
      * Returns the number of significant figures in a string number.
      * @param string $n Decimal number
@@ -181,7 +181,7 @@ class HTMLPurifier_UnitConverter
         }
         return $sigfigs;
     }
-    
+
     /**
      * Adds two numbers, using arbitrary precision when available.
      */
@@ -189,7 +189,7 @@ class HTMLPurifier_UnitConverter
         if ($this->bcmath) return bcadd($s1, $s2, $scale);
         else return $this->scale($s1 + $s2, $scale);
     }
-    
+
     /**
      * Multiples two numbers, using arbitrary precision when available.
      */
@@ -197,7 +197,7 @@ class HTMLPurifier_UnitConverter
         if ($this->bcmath) return bcmul($s1, $s2, $scale);
         else return $this->scale($s1 * $s2, $scale);
     }
-    
+
     /**
      * Divides two numbers, using arbitrary precision when available.
      */
@@ -205,7 +205,7 @@ class HTMLPurifier_UnitConverter
         if ($this->bcmath) return bcdiv($s1, $s2, $scale);
         else return $this->scale($s1 / $s2, $scale);
     }
-    
+
     /**
      * Rounds a number according to the number of sigfigs it should have,
      * using arbitrary precision when available.
@@ -229,7 +229,7 @@ class HTMLPurifier_UnitConverter
             return $this->scale(round($n, $sigfigs - $new_log - 1), $rp + 1);
         }
     }
-    
+
     /**
      * Scales a float to $scale digits right of decimal point, like BCMath.
      */
@@ -248,5 +248,7 @@ class HTMLPurifier_UnitConverter
         }
         return sprintf('%.' . $scale . 'f', (float) $r);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index f9dfd84a76d06fcdde6b97f421d432b7964766d4..68e72ae86959619de36bc15d6875e7aaefd57dee 100644 (file)
@@ -6,7 +6,7 @@
  */
 class HTMLPurifier_VarParser
 {
-    
+
     const STRING    = 1;
     const ISTRING   = 2;
     const TEXT      = 3;
@@ -18,7 +18,7 @@ class HTMLPurifier_VarParser
     const ALIST     = 9;
     const HASH      = 10;
     const MIXED     = 11;
-    
+
     /**
      * Lookup table of allowed types. Mainly for backwards compatibility, but
      * also convenient for transforming string type names to the integer constants.
@@ -36,7 +36,7 @@ class HTMLPurifier_VarParser
         'hash'      => self::HASH,
         'mixed'     => self::MIXED
     );
-    
+
     /**
      * Lookup table of types that are string, and can have aliases or
      * allowed value lists.
@@ -47,7 +47,7 @@ class HTMLPurifier_VarParser
         self::TEXT      => true,
         self::ITEXT     => true,
     );
-    
+
     /**
      * Validate a variable according to type. Throws
      * HTMLPurifier_VarParserException if invalid.
@@ -105,7 +105,7 @@ class HTMLPurifier_VarParser
         }
         $this->errorGeneric($var, $type);
     }
-    
+
     /**
      * Actually implements the parsing. Base implementation is to not
      * do anything to $var. Subclasses should overload this!
@@ -113,14 +113,14 @@ class HTMLPurifier_VarParser
     protected function parseImplementation($var, $type, $allow_null) {
         return $var;
     }
-    
+
     /**
      * Throws an exception.
      */
     protected function error($msg) {
         throw new HTMLPurifier_VarParserException($msg);
     }
-    
+
     /**
      * Throws an inconsistency exception.
      * @note This should not ever be called. It would be called if we
@@ -130,7 +130,7 @@ class HTMLPurifier_VarParser
     protected function errorInconsistent($class, $type) {
         throw new HTMLPurifier_Exception("Inconsistency in $class: ".HTMLPurifier_VarParser::getTypeName($type)." not implemented");
     }
-    
+
     /**
      * Generic error for if a type didn't work.
      */
@@ -138,7 +138,7 @@ class HTMLPurifier_VarParser
         $vtype = gettype($var);
         $this->error("Expected type ".HTMLPurifier_VarParser::getTypeName($type).", got $vtype");
     }
-    
+
     static public function getTypeName($type) {
         static $lookup;
         if (!$lookup) {
@@ -148,5 +148,7 @@ class HTMLPurifier_VarParser
         if (!isset($lookup[$type])) return 'unknown';
         return $lookup[$type];
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index ec2c90f4504a3b07d41840347ce2ce73e127865d..c954250e9f001f7be6079b80aa472e0e6c759168 100644 (file)
@@ -7,7 +7,7 @@
  */
 class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser
 {
-    
+
     protected function parseImplementation($var, $type, $allow_null) {
         if ($allow_null && $var === null) return null;
         switch ($type) {
@@ -90,5 +90,7 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser
         }
         $this->errorGeneric($var, $type);
     }
-    
+
 }
+
+// vim: et sw=4 sts=4
index 3bfa90ae5c6d177d84b51d76be112608256ff898..b02a6de54ca269f744ab60a9d6ba1374894a9d43 100644 (file)
@@ -7,11 +7,11 @@
  */
 class HTMLPurifier_VarParser_Native extends HTMLPurifier_VarParser
 {
-    
+
     protected function parseImplementation($var, $type, $allow_null) {
         return $this->evalExpression($var);
     }
-    
+
     protected function evalExpression($expr) {
         $var = null;
         $result = eval("\$var = $expr;");
@@ -20,6 +20,7 @@ class HTMLPurifier_VarParser_Native extends HTMLPurifier_VarParser
         }
         return $var;
     }
-    
+
 }
 
+// vim: et sw=4 sts=4
index fc415d463727b7edcde6abf433f10ee7eccc3b45..5df3414959b9e8d231315269301317b38acb6eb0 100644 (file)
@@ -5,5 +5,7 @@
  */
 class HTMLPurifier_VarParserException extends HTMLPurifier_Exception
 {
-    
+
 }
+
+// vim: et sw=4 sts=4
index c9708ae0cd8fcaf81acce8900dbea41cab840468..517f11f1f9e76f0a239a810796d3bc4d4dec8547 100644 (file)
@@ -1,4 +1,4 @@
-Description of HTML Purifier v3.2.0 library import into Moodle
+Description of HTML Purifier v3.3.0 library import into Moodle
 
 Changes:
  * HMLTModule/Text.php - added  <nolink>, <tex>, <lang> and <algebra> tags