There’s a post here about getting it to work, but it’s old. Since then, the include statements for HTML Purifier were moved to their own file. In a normal script you would include the HTMLPurifier.includes.php file, but this isn’t in line with how CodeIgniter loads libraries, so it requires some hacking to get working.

  1. Download HTML Purifier and put the contents of the library folder into your codeigniter /system/application/libraries folder.
  2. Open HTMLPurifier.includes.php and change
    require 'HTMLPurifier.php';

    to

    //require 'HTMLPurifier.php';
  3. Open HTMLPurifier.php and add this just under <?php
    require_once('HTMLPurifier.includes.php');

And that’s all! Load with

$this->load->library('HTMLPurifier');

HTML Purifier

HTML Purifier Docs


Kick It on DotNetKicks.com
Share and Enjoy:
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Live
  • StumbleUpon
  • TwitThis

4 Responses to “Making HTML Purifier Work With CodeIgniter”

  1. d3ptzzNo Gravatar Says:

    thanks!

  2. Bug Tracker: ?????????? ??????? ? ???????????? (????? ???????) Says:

    [...] HTML Purifier ? CodeIgniter. ? ??????????? ??? ??? ??????????. ??????, ? ?????? ??? ?????????? ????????? ????? [...]

  3. Tanketorsken… » Mulighed for at bruge HTMLPurifier som et bibliotek i Codeigniter Says:

    [...] Tror jeg selv ville lure den, men er i top tidspres, så alle små detaljer jeg ikke selv skal bruge tid på er velkommen… Så her er et link til hvordan man nemt får HTMLPurifier til at fungere som et bibliotek i Codeigniter. Link [...]

  4. John DunlapNo Gravatar Says:

    Works like a charm. Thanks!

Leave a Reply