forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
htmlpurifier
World Wide Web Server edited this page Jul 4, 2012
·
10 revisions
Download the distribution. Look for the 'library' folder. Save in Application/plugins directory. Create file and name to htmlpurifier_pi.php
[h4]CREDITS:[/h4] [b]Author: [url=http://pinoytech.org/]Thorpe Obazee[/url]
The original HTML Purifier package [url=http://htmlpurifier.org/]http://htmlpurifier.org/[/url][/b]
htmlpurifier_pi.php
[code] <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function purify($dirty_html) {
require_once(APPPATH.plugins/htmlpurifier/HTMLPurifier.auto.php)';
$config = HTMLPurifier_Config::createDefault();
$config->set('Core', 'Encoding', 'ISO-8859-1');
$config->set('HTML', 'Doctype', 'HTML 4.01 Transitional');
$purifier = new HTMLPurifier($config);
return $purifier->purify($dirty_html);
} ?> [/code] From the controller:
[code] <?php public function save() { $this->load->plugin('htmlpurifier'); $clean_html = purify($this->input->post('html_content', TRUE)); $this->content_model->save($clean_html); }
?> [/code]