Download the PHP package vanilla/htmlawed without Composer
On this page you can find all versions of the php package vanilla/htmlawed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vanilla/htmlawed
More information about vanilla/htmlawed
Files in vanilla/htmlawed
Package htmlawed
Short Description A composer wrapper for the htmLawed library to purify & filter HTML. Tested with PHPUnit and PhantomJS!
License LGPL-3.0
Informations about the package htmlawed
htmLawed
A composer wrapper for the htmLawed library to purify & filter HTML. Tested with PHPUnit and PhantomJS.
Why use htmLawed?
If your website has any user-generated content then you need to worry about cross-site scripting (XSS). htmLawed will take a piece of potentially malicious html and remove the malicious code, leaving the rest of html behind.
Beyond the base htmLawed library, this package makes htmLawed a composer package and wraps it in an object so that it can be autoloaded.
Installation
htmLawed requres PHP 5.4 or higher
htmLawed is PSR-4 compliant and can be installed using composer. Just add vanilla/htmlawed
to your composer.json.
Example
Configs and Specs
The htmLawed filter takes two optional parameters: $config
and $spec
. This library provides sensible defaults to these parameters, but you can override them in Htmlawed::filter()
.
See the htmLawed documentation for the full list of options.
Differences in Vanilla's version of Htmlawed
We try and use the most recent version of htmLawed with as few changes as possible so that bug fixes and security releases can be merged from the main project. However, We've made a few changes in the source code.
- Balance tags (hl_bal) before validating tags (hl_tag). We found some cases where an unbalanced script tag would not get removed and this addresses that issue.
- Don't add an extra
<div>
inside of<blockquote>
tags. - Remove naked
<span>
. - Change indentation from 1 space to 4 spaces.
If the original author of htmLawed wants to make any of these changes upstream please get in contact with [email protected].