ok i finally got a good fix for that.
it was easy to find an already made function to add word wrap everywhere *outside html tags (<>) here:
http://php.net/manual/en/function.wordwrap.php
but then i realized that i really didnt want long words to be broken inside of
code:
it has been *corrected by someone from the php team according to the little note under the comment that shows the function
quote[NOTE BY danbrown AT php DOT net: Contains a bug fix provided by (jaw AT condidact DOT dk) on 02-APR-09 to address an issue where "the last word in a non-html-wrapped string will be omitted."] | |
so it sounded trustworthy at least that it wont do an infinite loop on my server and kill my entire buziness!!
to make it skip the code that i removed all i had about the code tag (just commented it out for now) in my bbcode function and instead i went to remove all the contents from the quote tag at the beginning of the function. so it makes it skip that nl2br() the rendering of other bbcode tags and well that wordwrap... and put the stuff back in the code tags at the end of the function... a bit like i also do with html and quote tags already...
and thats it, it now works.. long words in the text are cut off at 60 chars and continue on the next line, but code is not touched
and that fix will be available in 1.034, which will be available sometime today.
|