We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Download the distribution. Save in Application/helpers directory. Create file and name to htmlpurifier_helper.php
[b]Author: Thorpe Obazee Updated for 2.0.x: Coccodrillo The original HTML Purifier package http://htmlpurifier.org/[/b]
htmlpurifier_helper.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); function purify($dirty_html) { if (is_array($dirty_html)) { foreach ($dirty_html as $key => $val) { $dirty_html[$key] = purify($val); } return $dirty_html; } if (trim($dirty_html) === '') { return $dirty_html; } require_once(APPPATH."helpers/library/htmlpurifier/HTMLPurifier.auto.php"); require_once(APPPATH."helpers/library/htmlpurifier/HTMLPurifier.func.php"); $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.Doctype', 'XHTML 1.0 Strict'); return HTMLPurifier($dirty_html, $config); } ?>
From the controller:
<?php public function cleanmyhtml() { $this->load->helper('htmlpurifier'); $dirty_html = '<a >ds</a><p>test<br /><img src="noalt.jpg">'; $clean_html = purify($dirty_html); echo $clean_html; } ?>