Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Comment Filter Hook

edited August 2005 in Vanilla 1.0 Help

There seems to be a lot of clammor for this, how did that one guy put it? Chew off his arm or something...anyway, if you look under the Smilies discussion, the SmartyPants thread, and so on, a lot of people are interested in writing extensions that filter comments after a formatter has done its thing.

I can think of several good reasons to want to do this:

  • Comment spam -- filter URLs in links to viagra/gambling/porn sites.
  • Filter language -- what if my site is rated G?

Smilies and Smartypants are two more good examples.

Help Mr. Vanilla Guru, help!

Comments

  • Options
    MarkMark Vanilla Staff
    edited August 2005
    Right now you'd have to write your own extended formatters to accomplish this. for example: 1. Write a smiley formatter. 2. Write a markdown formatter. 3. Include those two formatters in a new file - a la include_once("path/to/your/formatters/smileys.php"); 4. Write a new "base" formatter like a text or html formatter. 5. Instantiate your other two formatters (smiley and markdown) and add them to your base formatter's formatters collection. 6. Make sure that your base formatter's parse method loops through those extra formatters when it's finished it's own parsing methods.
  • Options
    i think it'd be much better in general if all formatters were called when parsing comments unless they were told not to. that way you could mix and match. assuming this would work.
  • Options

    Whoa! I guess then I was correct after studying your code Mark, I really thought I was missing some simple way of doing this.

    Oh well, too much work for a universal comment filter. Perhaps as you develop the system some more you'll come up with an easier way to do this sort of thing.

    Thanks.

  • Options

    BTW, my favorite feature so far is the external style URL. I can come here and it's formatted exactly the same way as it is on my own site. That rocks.

  • Options
    i would say it would be really great if you could extend the core so that it would be easier to do such an extention... i think there may be many fancy extentions coming.. for example editing usual amazon links to amazon links with your amazon partner id and similar stuff...and yeah of course smilies and spam protection and smpartypants and such stuff..
  • Options
    MarkMark Vanilla Staff
    edited August 2005
    It doesn't get much easier than it already is.
    If you want to chain together text, html, and markdown formatting, take the code that is already written and include them all into one formatter. It's EASY.
  • Options

    A comment filter should be independant of whatever formatter the user chooses to use.

This discussion has been closed.