TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
Forums are in read-only mode while we transition to new software.
kohana 3 with htmlpurifier 4?
  • Hi. I want use htmlpurifier4.1.1 next days in my project too and founded this link http://htmlpurifier.org/phorum/read.php?2,1101
    It says htmlpurifier is part of download but where is htmlpurifier in kohana?
    So i have downloaded http://htmlpurifier.org/releases/htmlpurifier-4.1.1-lite.zip is here a tutorialfor making htmlpurifier as a part of kohana3 and a example for use it? I would be happy about help.
  • download
    http://github.com/shadowhand/purifier module
    enable in bootstrap.php
    then download htmlpurifier to modules/purifier/vendor/htmlpurifier/library

    and use

    Security::xss_clean($_POST);


    that's all
  • Kohana 3 doesn't include it, but you can easily integrate them. There were some posts here discussing it, but for a quick answer, place it to: application/vendor/htmlpurifier and when you want to use it, do something like this, to include all the required files:

    require_once Kohana::find_file('vendor', 'htmlpurifier/library/HTMLPurifier.auto');

    You may also want to set cache path to Kohana cache dir, so you could add something like this before creating HTMLPurifier instance:

    $config = HTMLPurifier_Config::createDefault();
    $config->set('Cache.SerializerPath', Kohana::$cache_dir . '/.html_purifier');
    $htmlpurifier = new HTMLPurifier($config);


    EDIT: either that, or as crazzyDemon suggested :)
  • great help! I will try it. thank you both! :)
  • Fatal error: Purifier_Security::htmlpurifier() [function.require]: Failed opening required '' (include_path='.;C:\xampp\xampp\php\PEAR') in C:\xampp\xampp\htdocs\kohana\application\classes\purifier\security.php on line 0

    Why do I get this error?

    Many thanks :)
  • You probably did not follow the installation instructions.

  • Its working fine. Thanks!

    Is here a little example for the config and what I can do with it?
  • Hmm, no... as the docs say, you can set any of the HTML Purifier options in the configuration file.

  • Awesome. Works like a charm. Thanks for sharing this. Setup couldn't be easier.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion