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.

Overwriting StringManipulator's Parse() method

peapea New
edited August 2005 in Vanilla 1.0 Help
I've been trying to overwrite the StringManipulator's Parse() method using an Extension, with the aim to render smilies after all the parsing has happened.

This doesn't work:

$Context->ObjectFactory->SetReference("StringManipulator", "RenderEmo"); class RenderEmo extends StringManipulator { function Parse($String, $Object, $Format, $FormatPurpose) { // this code never gets executed it seems print 'hello.'; } }


  • edited August 2005
    I know squat about PHP but don't you have to implement the constructor? Ah, I guess looks optional... /me goes back to work
  • MarkMark Vanilla Staff
    Order of Execution strikes again. Any object contained within the context object cannot be overridden using the object factory because the context object is instantiated before extensions are loaded. You're not the first person to have a problem with this: It's a necessity of the model to make it work this way.
  • Ah, I was thinking it must have been the ol' OoE. Thanks mark. /me ponders....
  • Well, I ended up editing the HTMLFormatter and Markdown Extensions. Just added some stuff to render smilies. And that works fine.
  • MarkMark Vanilla Staff
    what exactly were you trying to do?
  • ..render smilies?
  • jonezyjonezy New
    edited August 2005
    rofl @ RenderEmo
  • but the question is jonezy, did you actually rofl? This is where the truth comes out!
  • holy fuck that was a bit emo never mind.
  • lechlech Chicagoland
    pwnd. mini = 1, jonzey = 0
  • peapea New
    edited August 2005
    Mark: Well, I'm trying to add some default text formatting after the Markdown and HTML formatting, or before it.
  • So I ended up editing those extensions directly. Of course I'd rather find a way to work alongside of those extensions.

    Basically something to parse all the text of a post when it gets displayed, optionally with the ability to check for the type of text (Text, HTML, Markdown, etc.)
  • Also, I'm a Vanilla n00b!
  • Yeah, this has sort of been discussed in regards to chaining together formatters, Mark didnt like the idea but i believe he's gonna implement it anyway because so many people want it. I dont think he's looking forward to the bug reports though.
  • MarkMark Vanilla Staff
    Yeah - along with the comment "formatters", a bunch of people have requested a cross-formatter "filter" that all comments get passed through after the filters have had their turn (or before, I can't remember). You can find it listed on the enhancement list of the wiki (on the bug page). It will be in the next rev.
  • Thanks. :')
This discussion has been closed.