rokorolov / yii2-purifier-behavior
This package is abandoned and no longer maintained.
The author suggests using the abandoned/yii2-purifier-behavior package instead.
Purifier provides an ability to clean up HTML from any harmful code.
Package info
github.com/rokorolov/yii2-purifier-behavior
Type:yii2-extension
pkg:composer/rokorolov/yii2-purifier-behavior
v1.0.0
2016-01-25 09:20 UTC
Requires
- yiisoft/yii2: >=2.0.6
This package is not auto-updated.
Last update: 2022-09-22 19:24:26 UTC
README
Purifier provides an ability to clean up HTML from any harmful code.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist rokorolov/yii2-purifier-behavior "*"
or add
"rokorolov/yii2-purifier-behavior": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
Attach a behavior to model and configure.
use rokorolov\purifier\PurifierBehavior; public function behaviors() { return [ // ... 'purifierBehavior' => [ 'class' => PurifierBehavior::className(), 'attributes' => [ self::EVENT_BEFORE_UPDATE => ['description'], self::EVENT_BEFORE_INSERT => ['description'], ], 'textAttributes' => [ self::EVENT_BEFORE_UPDATE => ['title', 'slug'], self::EVENT_BEFORE_INSERT => ['title', 'slug'] ] ], ]; }