htmlpurifier

12:02 AM 0 Comments


Download the distribution. Look for the ‘library’ folder. Save in Application/plugins directory. Create file and name to htmlpurifier_pi.php

CREDITS:

Author: Thorpe Obazee
doc: HTMLPurifier Plugin for CodeIgniter
The original HTML Purifier package http://htmlpurifier.org/
htmlpurifier_pi.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."plugins/htmlpurifier/HTMLPurifier.auto.php");
    require_once(
APPPATH."plugins/htmlpurifier/HTMLPurifier.func.php");

    
$config HTMLPurifier_Config::createDefault();

    
$config->set('HTML''Doctype''XHTML 1.0 Strict');

    return 
HTMLPurifier($dirty_html$config);
}
?> 
From the controller:
    public function save()
    
{
           $this
->load->plugin('htmlpurifier');
           
$clean_html purify($this->input->post('html_content'TRUE));
           
$this->content_model->save($clean_html);
    
}

?> 

Install Server Networking Programming

Support you how to install server, networking and Programming Easy

0 comments:

You can post comment with english language or indonesia language.
Anda bisa memberikan komentar dalam bahasa inggris atau bahasa indonesia.