-
Notifications
You must be signed in to change notification settings - Fork 3
Allowing or Blocking Elements
Ricardo Lopes edited this page Jan 16, 2015
·
2 revisions
php-htmlfilter removes not allowed elements. Only <script> is not allowed by default. The usage of this filter may be done by either passing the pertaining configuration into the [__construct()] (#using-constructor) or by using [Parser::configureElements($elements)] (#using-configureElements) method
##Using Constructor##
<?php
//prepare our configuration
$config = array(
'configureElements' => array(
array('name'=>'script', 'permission' => 0),
array('name'=>'aside', 'permission' => 1),
)
);
//create a new instance of the filter,
//while passing configs into the construct
$htmlFilter = new \HtmlFilter\Filter($config);<?php
$filter = new HtmlFilter\Filter();
$elementConfiguration = array(
array('name'=>'script', 'permission' => 0),
array('name'=>'aside', 'permission' => 1),
);
$filter->configureElements($elementConfiguration);