Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webchemistry/html-purifier
simple html-purifier
https://github.com/webchemistry/html-purifier
Last synced: about 1 month ago
JSON representation
simple html-purifier
- Host: GitHub
- URL: https://github.com/webchemistry/html-purifier
- Owner: WebChemistry
- Created: 2019-03-13T17:44:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-13T17:54:07.000Z (almost 6 years ago)
- Last Synced: 2024-04-24T21:01:21.190Z (8 months ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Simple html purifier
Usage:
```php
$rules = new Rules();$rules->addMulti(
ElementRule::create('i'),
ElementRule::create('div'),
ElementRule::create('strong')
->addAttributeRule(
AttributeRule::create('class')
->allowValue('italic')
),
ElementRule::create('script')
->discard(),
ElementRule::create('span')
->addAttributeRule(
AttributeStyleRule::create()
->addRule('color', ['white', '#fff', '#fffff'])
)
);$purifier = new Purifier($rules);
$purifier->purify('
Lorem ipsum is simply
alert("dummy text!")white and red
');
```output:
```html
Lorem ipsum is simply
white and red
```