milesj / decoda

A lightweight lexical string parser for BBCode styled markup.
MIT License
196 stars 52 forks source link

addFilter Extensibility #10

Closed slider closed 12 years ago

slider commented 12 years ago

I'd like to create my own Filter which is placed somewhere in my symfony2 structure while decoda is imported via the deps file.

So I tried to simply extend DecodaFilter, placed the filter in my bundle and called addFilter, which then doesn't work because Decoda is extracting the classname and later for some reason tries to require_once this file. This of course fails because my Custom Filter is located outside the decoda directory structure.

It there a way to work around this issue which I'm currently missing?

milesj commented 12 years ago

Might be a few ways. You can add the directory that your Filter is located in into the include path or you can try including the file ahead of time.

If neither of those work, I can probably tweak the class a bit to handle dependency loading better.

slider commented 12 years ago

Putting it there doesn't work in the environment we use since I cant access those vendor directories in the production environment at all for various reasons (I can't even put a symlink there).

If you already have an idea on how to change the interface I might be able to lend you a hand, just let me know.

milesj commented 12 years ago

So you can't include your filter manually? include 'path/to/my/CustomFilter.php' ?

This should bring it into scope. I should add a class_exists check however.

slider commented 12 years ago

This might work I think. Adding the class_exists check is probably a good idea in general.

milesj commented 12 years ago

3.3 is now available: https://github.com/milesj/php-decoda/tags