Nov 12
Okay, "FIXED" is a bit of an over-statement; the plugin did exactly as it was supposed to, it called PHP's nl2br() function on all input prior to output. Unfortunately, that's not always the desired result, so I've made it "smarter", not exactly "fixed" it...

With help from some members on the SitePoint forums, I've modified the serendipity_event_plugin_nl2br to work with HTML textarea, pre, and the BBCode GeSHi modifiers so that those ugly <br /> tags aren't added when they aren't wanted.

The updates are now live on this site, so I don't have to go back and update anything. Cool!

Here's what I did:
- Open up pluginsserendipity_event_nl2brserendipity_event_nl2br.php in your serendipity folder
- add two new functions (within the class, but order of where they go is unimportant, I placed them before the event_hook function) as shown below:

- find the following line in the event_hook function: $eventData[$element] = nl2br($eventData[$element]); and replace it with the following:


That should be it. (YAY, I can finally post code snippets now!) I eventually plan on updating this a bit more to allow for user submitted tags to be ignored by the nl2br function within this event. Any help on that would be appreciated since I don't entirely understand the plugin system, even after speed-reading through the example documentation. :-)

Posted by Brendon Kozlowski

0 Trackbacks

  1. No Trackbacks

1 Comments

Display comments as(Linear | Threaded)
  1. Brendon says:

    This is only valuable to people running Serendipity versions older than 1.0.4 (for the 1.0 branch) or 1.1. The changes have been made to the SVN source for this plugin on the main package.

Add Comment


Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

BBCode format allowed