WackoWiki: Usage of SafeHTML

https://wackowiki.org/doc     Version: 2 (03.01.2019 05:33)

Usage of SafeHTML


1. Simple usage


Simple usage is really simple:
<?php
require_once 'class/safehtml.php';

$parser = new SafeHTML;
$result = $parser->parse($doc);
?>


2. Advanced usage

2.1. Blacklist

<?php
require_once 'class/safehtml.php';

$parser = new SafeHTML;
$parser->protocolFiltering = 'black'; // 'white' (default)
$result = $parser->parse($doc);
?>

2.2. Set Allow Tags

<?php
require_once 'class/safehtml.php';

$parser = new SafeHTML;
$parser->setAllowTags(['body']);
$result = $parser->parse($doc);
?>