Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Creating HTMLPurifier package for Fuel
  • Hello, I've been trying to create Fuel package of HTMLPurifier. Unfortunately, whatever I try I get 'Class [something] not found' or 'Cannor override class'.
    I have no idea what to do next, here is whole folder with all package files I've made: http://www.sendspace.com/file/zaiehh PKGPATH/purifier/classes/purifier.php: http://scrp.at/aMe
    PKGPATH/purifier/bootstrap.php: http://scrp.at/aMf If someone can look at it I will be thankful.
  • Jaroslav Petrusevic wrote on Monday 28th of November 2011:
    So I did. I also modified this package (add config etc.). There might be few features to add but I think it's at last as good as package at link you've posted ;)
  • HTMLPurifier contains an enormous list of classes. You will have to either setup a specific autoloader for those classes so they can be autoloaded in the global namespace, or edit each and every one, add the namespace to them, and then list them ALL in the bootstrap.php.
  • There is no file called packages/purifier/vendor/HTMLPurifier.standalone.php in your zipfile? I've seen though that HTMLpurifier does deliver it's own autoloader, in HTMLPurifier/Bootstrap.php, which is activated through HTMLPurifier.autoload.php. So you have to add that functionality to your HTMLPurifier _init method to activate the autoloader.
  • I made it work by using standalone version and adding every class from standalone file to bootstrap. Also I added namespaces to every file in standalone directory (dunno if that was needed ).
    My bootstrap: http://scrp.at/aMk If I will use standard version (not standalone) will it be faster somehow (one class = one file in bootstrap)? I've been trying to use HTMLPurifier autoloader. I read almost every doc about installation and initialization and I wasn't able to get it work.
  • You also could have searched for it. Then you would have found http://fuelphp.com/forums/topics/view/193 (which I did just now). It gets even better, there's a standard package for it in the Fuel packages repo: https://github.com/fuel-packages/fuel-htmlpurifier.
  • Oh damn, I didn't saw it...
    Anyway I modified it a little bit and it works the same way as my version of this package, except it's not using standalone version anymore.
    Now it works more like package (config, no need to create object inside controller...): http://scrp.at/aMl
    If someone wants to look at it: http://www.sendspace.com/file/vb6k2l
    Doesn't it look nicer?

Howdy, Stranger!

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

In this Discussion