Configuration Documentation
Table of Contents
- Attr
- AutoFormat
- CSS
- Cache
-
Core
- AggressivelyFixLt
- AggressivelyRemoveScript
- AllowHostnameUnderscore
- AllowParseManyTags
- CollectErrors
- ColorKeywords
- ConvertDocumentToFragment
- DirectLexLineNumberSyncInterval
- DisableExcludes
- EnableIDNA
- Encoding
- EscapeInvalidChildren
- EscapeInvalidTags
- EscapeNonASCIICharacters
- HiddenElements
- Language
- LegacyEntityDecoder
- LexerImpl
- MaintainLineNumbers
- NormalizeNewlines
- RemoveBlanks
- RemoveInvalidImg
- RemoveProcessingInstructions
- Filter
-
HTML
- Allowed
- AllowedAttributes
- AllowedComments
- AllowedCommentsRegexp
- AllowedElements
- AllowedModules
- Attr.Name.UseCDATA
- BlockWrapper
- CoreModules
- CustomDoctype
- DefinitionID
- DefinitionRev
- Doctype
- FlashAllowFullScreen
- ForbiddenAttributes
- ForbiddenElements
- Forms
- MaxImgLength
- Nofollow
- Parent
- Proprietary
- SafeEmbed
- SafeIframe
- SafeObject
- SafeScripting
- TargetBlank
- TargetNoopener
- TargetNoreferrer
- TidyAdd
- TidyLevel
- TidyRemove
- Trusted
- Output
- Test
- URI
Types
string: String
istring: Case-insensitive string
text: Text
itext: Case-insensitive text
int: Integer
(int).
float: Float
is_numeric()), which will be
cast to a float using (float).
bool: Boolean
0
or 1 (other integers are not permitted) or a string
"on", "true" or "1" for
true, and "off", "false" or
"0" for false.
lookup: Lookup array
true, e.g. array('key'
=> true, 'key2' => true). You are alternatively
permitted to pass an array list of the keys array('key',
'key2') or a comma-separated string of keys "key,
key2". If you pass an array list of values, ensure that your
values are strictly numerically indexed: array('key1', 2
=> 'key2') will not do what you expect and emits a
warning.
list: Array list
array('val1', 'val2'). You are alternatively permitted
to pass a comma-separated string of keys "val1, val2".
If your array is not in this form, array_values is run
on the array and a warning is emitted.
hash: Associative array
array('key1' => 'val1', 'key2' => 'val2'). You
are alternatively permitted to pass a comma-separated string of
key-colon-value strings, e.g. "key1: val1, key2:
val2".
mixed: Mixed
Attr
Attr.AllowedClasses
| Version added | 4.0.0 |
|---|---|
| Type | Lookup array (or null) |
| Default |
NULL |
| Used in |
|
Attr.AllowedFrameTargets
| Type | Lookup array |
|---|---|
| Default |
array() |
| Used in |
|
Attr.AllowedRel
| Version added | 1.6.0 |
|---|---|
| Type | Lookup array |
| Default |
array() |
Attr.AllowedRev
| Version added | 1.6.0 |
|---|---|
| Type | Lookup array |
| Default |
array() |
Attr.ClassUseCDATA
| Version added | 4.0.0 |
|---|---|
| Type | Boolean (or null) |
| Default |
NULL |
Attr.DefaultImageAlt
| Version added | 3.2.0 |
|---|---|
| Type | String (or null) |
| Default |
NULL |
| Used in |
|
Attr.DefaultInvalidImage
| Type | String |
|---|---|
| Default |
'' |
| Used in |
|
Attr.DefaultInvalidImageAlt
| Type | String |
|---|---|
| Default |
'Invalid image' |
| Used in |
|
Attr.DefaultTextDir
| Type | String |
|---|---|
| Allowed values | "ltr", "rtl" |
| Default |
'ltr' |
| Used in |
|
Attr.EnableID
| Version added | 1.2.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Aliases | HTML.EnableAttrID |
| Used in |
|
Attr.ForbiddenClasses
| Version added | 4.0.0 |
|---|---|
| Type | Lookup array |
| Default |
array() |
| Used in |
|
Attr.ID.HTML5
| Version added | 4.8.0 |
|---|---|
| Type | Boolean (or null) |
| Default |
NULL |
| Used in |
|
Attr.IDBlacklist
| Type | Array list |
|---|---|
| Default |
array() |
| Used in |
|
Attr.IDBlacklistRegexp
| Version added | 1.6.0 |
|---|---|
| Type | String (or null) |
| Default |
NULL |
| Used in |
|
Attr.IDPrefix
| Version added | 1.2.0 |
|---|---|
| Type | String |
| Default |
'' |
| Used in |
|
Attr.IDPrefixLocal
| Version added | 1.2.0 |
|---|---|
| Type | String |
| Default |
'' |
| Used in |
|
AutoFormat
AutoFormat.AutoParagraph
| Version added | 2.0.1 |
|---|---|
| Type | Boolean |
| Default |
false |
This directive turns on auto-paragraphing, where double newlines are converted in to paragraphs whenever possible. Auto-paragraphing:
- Always applies to inline elements or text in the root node,
- Applies to inline elements or text with double newlines in nodes that allow paragraph tags,
- Applies to double newlines in paragraph tags
p tags must be allowed for this directive to take
effect. We do not use br tags for paragraphing, as
that is semantically incorrect.
To prevent auto-paragraphing as a content-producer, refrain from
using double-newlines except to specify a new paragraph or in
contexts where it has special meaning (whitespace usually has no
meaning except in tags like pre, so this should not
be difficult.) To prevent the paragraphing of inline text
adjacent to block elements, wrap them in div tags
(the behavior is slightly different outside of the root node.)
AutoFormat.Custom
| Version added | 2.0.1 |
|---|---|
| Type | Array list |
| Default |
array() |
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.
AutoFormat.DisplayLinkURI
| Version added | 3.2.0 |
|---|---|
| Type | Boolean |
| Default |
false |
This directive turns on the in-text display of URIs in <a> tags, and disables those links. For example, example becomes example (http://example.com).
AutoFormat.Linkify
| Version added | 2.0.1 |
|---|---|
| Type | Boolean |
| Default |
false |
This directive turns on linkification, auto-linking http, ftp and
https URLs. a tags with the href
attribute must be allowed.
AutoFormat.PurifierLinkify.DocURL
| Version added | 2.0.1 |
|---|---|
| Type | String |
| Default |
'#%s' |
| Aliases | AutoFormatParam.PurifierLinkifyDocURL |
| Used in |
|
Location of configuration documentation to link to, let %s substitute into the configuration's namespace and directive names sans the percent sign.
AutoFormat.PurifierLinkify
| Version added | 2.0.1 |
|---|---|
| Type | Boolean |
| Default |
false |
Internal auto-formatter that converts configuration directives in
syntax %Namespace.Directive to links. a tags
with the href attribute must be allowed.
AutoFormat.RemoveEmpty.Predicate
| Version added | 4.7.0 |
|---|---|
| Type | Associative array |
| Default |
array (
'colgroup' =>
array (
),
'th' =>
array (
),
'td' =>
array (
),
'iframe' =>
array (
0 => 'src',
),
)
|
| Used in |
|
Given that an element has no contents, it will be removed by
default, unless this predicate dictates otherwise. The predicate
can either be an associative map from tag name to list of
attributes that must be present for the element to be considered
preserved: thus, the default always preserves
colgroup, th and td, and
also iframe if it has a src.
AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions
| Version added | 4.0.0 |
|---|---|
| Type | Lookup array |
| Default |
array ( 'td' => true, 'th' => true, ) |
| Used in |
|
When %AutoFormat.RemoveEmpty and %AutoFormat.RemoveEmpty.RemoveNbsp are enabled, this directive defines what HTML elements should not be removede if they have only a non-breaking space in them.
AutoFormat.RemoveEmpty.RemoveNbsp
| Version added | 4.0.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
When enabled, HTML Purifier will treat any elements that contain only non-breaking spaces as well as regular whitespace as empty, and remove them when %AutoFormat.RemoveEmpty is enabled.
See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements that don't have this behavior applied to them.
AutoFormat.RemoveEmpty
| Version added | 3.2.0 |
|---|---|
| Type | Boolean |
| Default |
false |
When enabled, HTML Purifier will attempt to remove empty elements that contribute no semantic information to the document. The following types of nodes will be removed:
- Tags with no attributes and no content, and that are not
empty elements (remove
<a></a>but not<br />), and - Tags with no content, except for:
- The
colgroupelement, or - Elements with the
idornameattribute, when those attributes are permitted on those elements.
- The
Please be very careful when using this functionality; while it may not seem that empty elements contain useful information, they can alter the layout of a document given appropriate styling. This directive is most useful when you are processing machine-generated HTML, please avoid using it on regular user HTML.
Elements that contain only whitespace will be treated as empty. Non-breaking spaces, however, do not count as whitespace. See %AutoFormat.RemoveEmpty.RemoveNbsp for alternate behavior.
This algorithm is not perfect; you may still notice some empty tags, particularly if a node had elements, but those elements were later removed because they were not permitted in that context, or tags that, after being auto-closed by another tag, where empty. This is for safety reasons to prevent clever code from breaking validation. The general rule of thumb: if a tag looked empty on the way in, it will get removed; if HTML Purifier made it empty, it will stay.
AutoFormat.RemoveSpansWithoutAttributes
| Version added | 4.0.1 |
|---|---|
| Type | Boolean |
| Default |
false |
This directive causes span tags without any
attributes to be removed. It will also remove spans that had all
attributes removed during processing.
CSS
CSS.AllowDuplicates
| Version added | 4.8.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
By default, HTML Purifier removes duplicate CSS properties, like
color:red; color:blue. If this is set to true,
duplicate properties are allowed.
CSS.AllowImportant
| Version added | 3.1.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
CSS.AllowTricky
| Version added | 3.1.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
display:none; is considered a tricky property that
will only be allowed if this directive is set to true.
CSS.AllowedFonts
| Version added | 4.3.0 |
|---|---|
| Type | Lookup array (or null) |
| Default |
NULL |
| Used in |
|
Allows you to manually specify a set of allowed fonts. If
NULL, all fonts are allowed. This directive affects
generic names (serif, sans-serif, monospace, cursive, fantasy) as
well as specific font families.
CSS.AllowedProperties
| Version added | 3.1.0 |
|---|---|
| Type | Lookup array (or null) |
| Default |
NULL |
| Used in |
|
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.
Warning: If another directive conflicts with the elements here, that directive will win and override.
CSS.DefinitionRev
| Version added | 2.0.0 |
|---|---|
| Type | Integer |
| Default |
1 |
Revision identifier for your custom definition. See %HTML.DefinitionRev for details.
CSS.ForbiddenProperties
| Version added | 4.2.0 |
|---|---|
| Type | Lookup array |
| Default |
array() |
| Used in |
|
This is the logical inverse of %CSS.AllowedProperties, and it will override that directive or any other directive. If possible, %CSS.AllowedProperties is recommended over this directive, because it can sometimes be difficult to tell whether or not you've forbidden all of the CSS properties you truly would like to disallow.
CSS.MaxImgLength
| Version added | 3.1.1 |
|---|---|
| Type | String (or null) |
| Default |
'1200px' |
| Used in |
|
This parameter sets the maximum allowed length on
img tags, effectively the width and
height properties. Only absolute units of
measurement (in, pt, pc, mm, cm) and pixels (px) are allowed.
This is in place to prevent imagecrash attacks, disable with null
at your own risk. This directive is similar to %HTML.MaxImgLength, and both should be
concurrently edited, although there are subtle differences in the
input format (the CSS max is a number with a unit).
CSS.Proprietary
| Version added | 3.0.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
Whether or not to allow safe, proprietary CSS values.
CSS.Trusted
| Version added | 4.2.1 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
Cache
Cache.DefinitionImpl
| Version added | 2.0.0 |
|---|---|
| Type | String (or null) |
| Default |
'Serializer' |
| Aliases | Core.DefinitionCache |
| Used in |
|
Cache.SerializerPath
| Version added | 2.0.0 |
|---|---|
| Type | String (or null) |
| Default |
NULL |
| Used in |
|
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.
Cache.SerializerPermissions
| Version added | 4.3.0 |
|---|---|
| Type | Integer (or null) |
| Default |
493 |
| Used in |
|
Directory permissions of the files and directories created inside the DefinitionCache/Serializer or other custom serializer path.
In HTML Purifier 4.8.0, this also supports NULL,
which means that no chmod'ing or directory creation shall occur.
Core
Core.AggressivelyFixLt
| Version added | 2.1.0 |
|---|---|
| Type | Boolean |
| Default |
true |
| Used in |
|
This directive enables aggressive pre-filter fixes HTML Purifier can perform in order to ensure that open angled-brackets do not get killed during parsing stage. Enabling this will result in two preg_replace_callback calls and at least two preg_replace calls for every HTML document parsed; if your users make very well-formed HTML, you can set this directive false. This has no effect when DirectLex is used.
Notice: This directive's default turned from false to true in HTML Purifier 3.2.0.
Core.AggressivelyRemoveScript
| Version added | 4.9.0 |
|---|---|
| Type | Boolean |
| Default |
true |
| Used in |
|
This directive enables aggressive pre-filter removal of script tags. This is not necessary for security, but it can help work around a bug in libxml where embedded HTML elements inside script sections cause the parser to choke. To revert to pre-4.9.0 behavior, set this to false. This directive has no effect if %Core.Trusted is true, %Core.RemoveScriptContents is false, or %Core.HiddenElements does not contain script.
Core.AllowHostnameUnderscore
| Version added | 4.6.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
By RFC 1123, underscores are not permitted in host names. (This is in contrast to the specification for DNS, RFC 2181, which allows underscores.) However, most browsers do the right thing when faced with an underscore in the host name, and so some poorly written websites are written with the expectation this should work. Setting this parameter to true relaxes our allowed character check so that underscores are permitted.
Core.AllowParseManyTags
| Version added | 4.10.1 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
This directive allows parsing of many nested tags. If you set true, relaxes any hardcoded limit from the parser. However, in that case it may cause a Dos attack. Be careful when enabling it.
Core.CollectErrors
| Version added | 2.0.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
Core.ColorKeywords
| Version added | 2.0.0 |
|---|---|
| Type | Associative array |
| Default |
array ( 'aliceblue' => '#F0F8FF', 'antiquewhite' => '#FAEBD7', 'aqua' => '#00FFFF', 'aquamarine' => '#7FFFD4', 'azure' => '#F0FFFF', 'beige' => '#F5F5DC', 'bisque' => '#FFE4C4', 'black' => '#000000', 'blanchedalmond' => '#FFEBCD', 'blue' => '#0000FF', 'blueviolet' => '#8A2BE2', 'brown' => '#A52A2A', 'burlywood' => '#DEB887', 'cadetblue' => '#5F9EA0', 'chartreuse' => '#7FFF00', 'chocolate' => '#D2691E', 'coral' => '#FF7F50', 'cornflowerblue' => '#6495ED', 'cornsilk' => '#FFF8DC', 'crimson' => '#DC143C', 'cyan' => '#00FFFF', 'darkblue' => '#00008B', 'darkcyan' => '#008B8B', 'darkgoldenrod' => '#B8860B', 'darkgray' => '#A9A9A9', 'darkgrey' => '#A9A9A9', 'darkgreen' => '#006400', 'darkkhaki' => '#BDB76B', 'darkmagenta' => '#8B008B', 'darkolivegreen' => '#556B2F', 'darkorange' => '#FF8C00', 'darkorchid' => '#9932CC', 'darkred' => '#8B0000', 'darksalmon' => '#E9967A', 'darkseagreen' => '#8FBC8F', 'darkslateblue' => '#483D8B', 'darkslategray' => '#2F4F4F', 'darkslategrey' => '#2F4F4F', 'darkturquoise' => '#00CED1', 'darkviolet' => '#9400D3', 'deeppink' => '#FF1493', 'deepskyblue' => '#00BFFF', 'dimgray' => '#696969', 'dimgrey' => '#696969', 'dodgerblue' => '#1E90FF', 'firebrick' => '#B22222', 'floralwhite' => '#FFFAF0', 'forestgreen' => '#228B22', 'fuchsia' => '#FF00FF', 'gainsboro' => '#DCDCDC', 'ghostwhite' => '#F8F8FF', 'gold' => '#FFD700', 'goldenrod' => '#DAA520', 'gray' => '#808080', 'grey' => '#808080', 'green' => '#008000', 'greenyellow' => '#ADFF2F', 'honeydew' => '#F0FFF0', 'hotpink' => '#FF69B4', 'indianred' => '#CD5C5C', 'indigo' => '#4B0082', 'ivory' => '#FFFFF0', 'khaki' => '#F0E68C', 'lavender' => '#E6E6FA', 'lavenderblush' => '#FFF0F5', 'lawngreen' => '#7CFC00', 'lemonchiffon' => '#FFFACD', 'lightblue' => '#ADD8E6', 'lightcoral' => '#F08080', 'lightcyan' => '#E0FFFF', 'lightgoldenrodyellow' => '#FAFAD2', 'lightgray' => '#D3D3D3', 'lightgrey' => '#D3D3D3', 'lightgreen' => '#90EE90', 'lightpink' => '#FFB6C1', 'lightsalmon' => '#FFA07A', 'lightseagreen' => '#20B2AA', 'lightskyblue' => '#87CEFA', 'lightslategray' => '#778899', 'lightslategrey' => '#778899', 'lightsteelblue' => '#B0C4DE', 'lightyellow' => '#FFFFE0', 'lime' => '#00FF00', 'limegreen' => '#32CD32', 'linen' => '#FAF0E6', 'magenta' => '#FF00FF', 'maroon' => '#800000', 'mediumaquamarine' => '#66CDAA', 'mediumblue' => '#0000CD', 'mediumorchid' => '#BA55D3', 'mediumpurple' => '#9370DB', 'mediumseagreen' => '#3CB371', 'mediumslateblue' => '#7B68EE', 'mediumspringgreen' => '#00FA9A', 'mediumturquoise' => '#48D1CC', 'mediumvioletred' => '#C71585', 'midnightblue' => '#191970', 'mintcream' => '#F5FFFA', 'mistyrose' => '#FFE4E1', 'moccasin' => '#FFE4B5', 'navajowhite' => '#FFDEAD', 'navy' => '#000080', 'oldlace' => '#FDF5E6', 'olive' => '#808000', 'olivedrab' => '#6B8E23', 'orange' => '#FFA500', 'orangered' => '#FF4500', 'orchid' => '#DA70D6', 'palegoldenrod' => '#EEE8AA', 'palegreen' => '#98FB98', 'paleturquoise' => '#AFEEEE', 'palevioletred' => '#DB7093', 'papayawhip' => '#FFEFD5', 'peachpuff' => '#FFDAB9', 'peru' => '#CD853F', 'pink' => '#FFC0CB', 'plum' => '#DDA0DD', 'powderblue' => '#B0E0E6', 'purple' => '#800080', 'rebeccapurple' => '#663399', 'red' => '#FF0000', 'rosybrown' => '#BC8F8F', 'royalblue' => '#4169E1', 'saddlebrown' => '#8B4513', 'salmon' => '#FA8072', 'sandybrown' => '#F4A460', 'seagreen' => '#2E8B57', 'seashell' => '#FFF5EE', 'sienna' => '#A0522D', 'silver' => '#C0C0C0', 'skyblue' => '#87CEEB', 'slateblue' => '#6A5ACD', 'slategray' => '#708090', 'slategrey' => '#708090', 'snow' => '#FFFAFA', 'springgreen' => '#00FF7F', 'steelblue' => '#4682B4', 'tan' => '#D2B48C', 'teal' => '#008080', 'thistle' => '#D8BFD8', 'tomato' => '#FF6347', 'turquoise' => '#40E0D0', 'violet' => '#EE82EE', 'wheat' => '#F5DEB3', 'white' => '#FFFFFF', 'whitesmoke' => '#F5F5F5', 'yellow' => '#FFFF00', 'yellowgreen' => '#9ACD32', ) |
| Used in |
|
Core.ConvertDocumentToFragment
| Type | Boolean |
|---|---|
| Default |
true |
| Aliases | Core.AcceptFullDocuments |
| Used in |
|
Core.DirectLexLineNumberSyncInterval
| Version added | 2.0.0 |
|---|---|
| Type | Integer |
| Default |
0 |
| Used in |
|
Specifies the number of tokens the DirectLex line number tracking implementations should process before attempting to resyncronize the current line count by manually counting all previous new-lines. When at 0, this functionality is disabled. Lower values will decrease performance, and this is only strictly necessary if the counting algorithm is buggy (in which case you should report it as a bug). This has no effect when %Core.MaintainLineNumbers is disabled or DirectLex is not being used.
Core.DisableExcludes
| Version added | 4.5.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
This directive disables SGML-style exclusions, e.g. the exclusion
of <object> in any descendant of a
<pre> tag. Disabling excludes will allow some
invalid documents to pass through HTML Purifier, but HTML
Purifier will also be less likely to accidentally remove large
documents during processing.
Core.EnableIDNA
| Version added | 4.4.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
Core.Encoding
| Type | Case-insensitive string |
|---|---|
| Default |
'utf-8' |
| Used in |
|
Core.EscapeInvalidChildren
| Type | Boolean |
|---|---|
| Default |
false |
Warning: this configuration option is no longer does anything as of 4.6.0.
When true, a child is found that is not allowed in the context of the parent element will be transformed into text as if it were ASCII. When false, that element and all internal tags will be dropped, though text will be preserved. There is no option for dropping the element but preserving child nodes.
Core.EscapeInvalidTags
| Type | Boolean |
|---|---|
| Default |
false |
| Used in |
|
Core.EscapeNonASCIICharacters
| Version added | 1.4.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
Core.HiddenElements
| Type | Lookup array |
|---|---|
| Default |
array ( 'script' => true, 'style' => true, ) |
| Used in |
|
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 script
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 b tag, which defines some
presentational changes but does not hide its contents.
Core.Language
| Version added | 2.0.0 |
|---|---|
| Type | String |
| Default |
'en' |
| Used in |
|
Core.LegacyEntityDecoder
| Version added | 4.9.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
Prior to HTML Purifier 4.9.0, entities were decoded by performing a global search replace for all entities whose decoded versions did not have special meanings under HTML, and replaced them with their decoded versions. We would match all entities, even if they did not have a trailing semicolon, but only if there weren't any trailing alphanumeric characters.
| Original | Text | Attribute |
|---|---|---|
| ¥ | ¥ | ¥ |
| ¥ | ¥ | ¥ |
| ¥a | ¥a | ¥a |
| ¥= | ¥= | ¥= |
In HTML Purifier 4.9.0, we changed the behavior of entity parsing to match entities that had missing trailing semicolons in less cases, to more closely match HTML5 parsing behavior:
| Original | Text | Attribute |
|---|---|---|
| ¥ | ¥ | ¥ |
| ¥ | ¥ | ¥ |
| ¥a | ¥a | ¥a |
| ¥= | ¥= | ¥= |
This flag reverts back to pre-HTML Purifier 4.9.0 behavior.
Core.LexerImpl
| Version added | 2.0.0 |
|---|---|
| Type | Mixed (or null) |
| Default |
NULL |
| Used in |
|
This parameter determines what lexer implementation can be used. The valid values are:
- null
- Recommended, the lexer implementation will be auto-detected based on your PHP-version and configuration.
- string lexer identifier
- This is a slim way of manually overridding the implementation. Currently recognized values are: DOMLex (the default PHP5 implementation) and DirectLex (the default PHP4 implementation). Only use this if you know what you are doing: usually, the auto-detection will manage things for cases you aren't even aware of.
- object lexer instance
-
Super-advanced: you can specify your own, custom,
implementation that implements the interface defined by
HTMLPurifier_Lexer. I may remove this option simply because I don't expect anyone to use it.
Core.MaintainLineNumbers
| Version added | 2.0.0 |
|---|---|
| Type | Boolean (or null) |
| Default |
NULL |
| Used in |
|
If true, HTML Purifier will add line number information to all tokens. This is useful when error reporting is turned on, but can result in significant performance degradation and should not be used when unnecessary. This directive must be used with the DirectLex lexer, as the DOMLex lexer does not (yet) support this functionality. If the value is null, an appropriate value will be selected based on other configuration.
Core.NormalizeNewlines
| Version added | 4.2.0 |
|---|---|
| Type | Boolean |
| Default |
true |
| Used in |
|
Whether or not to normalize newlines to the operating system
default. When false, HTML Purifier will attempt to
preserve mixed newline files.
Core.RemoveBlanks
| Version added | 4.18 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
If set to true, blank nodes will be removed. This can be useful for maintaining backwards compatibility when upgrading from previous versions of PHP.
Core.RemoveInvalidImg
| Version added | 1.3.0 |
|---|---|
| Type | Boolean |
| Default |
true |
| Used in |
|
This directive enables pre-emptive URI checking in
img 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.
Core.RemoveProcessingInstructions
| Version added | 4.2.0 |
|---|---|
| Type | Boolean |
| Default |
false |
| Used in |
|
<?
... ?>, remove it out-right. This may be useful if the
HTML you are validating contains XML processing instruction gunk,
however, it can also be user-unfriendly for people attempting to
post PHP snippets.
Core.RemoveScriptContents
| Version added | 2.0.0 |
|---|---|
| Type | Boolean (or null) |
| Default |
NULL |
| Used in |
|
This directive enables HTML Purifier to remove not only script tags but all of their contents.
Filter
Filter.Custom
| Version added | 3.1.0 |
|---|---|
| Type | Array list |
| Default |
array() |
This directive can be used to add custom filters; it is nearly
the equivalent of the now deprecated
HTMLPurifier->addFilter() method. Specify an
array of concrete implementations.
Filter.ExtractStyleBlocks.Escaping
| Version added | 3.0.0 |
|---|---|
| Type | Boolean |
| Default |
true |
| Aliases | Filter.ExtractStyleBlocksEscaping, FilterParam.ExtractStyleBlocksEscaping |
| Used in |
|
Whether or not to escape the dangerous characters <, > and & 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.
Filter.ExtractStyleBlocks.Scope
| Version added | 3.0.0 |
|---|---|
| Type | String (or null) |
| Default |
NULL |
| Aliases | Filter.ExtractStyleBlocksScope, FilterParam.ExtractStyleBlocksScope |
| Used in |
|
If you would like users to be able to define external
stylesheets, but only allow them to specify CSS declarations for
a specific node and prevent them from fiddling with other
elements, use this directive. It accepts any valid CSS selector,
and will prepend this to any CSS declaration extracted from the
document. For example, if this directive is set to
#user-content and a user uses the selector
a:hover, the final selector will be
#user-content a:hover.
The comma shorthand may be used; consider the above example, with
#user-content, #user-content2, the final selector
will be #user-content a:hover, #user-content2
a:hover.
Warning: It is possible for users to bypass this measure using a naughty + selector. This is a bug in CSS Tidy 1.3, not HTML Purifier, and I am working to get it fixed. Until then