HTMLBBCodeParser patch

From: Date: Sat, 16 Aug 2003 13:21:28 +0000
Subject: HTMLBBCodeParser patch
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-19889@lists.php.net to get a copy of this message
Hey everyone, I've attached a patch for HTML_BBCodeParser. I've contacted Stij (the author) in regards to the patch, however, he seems to be rather busy so I figured I'd just send the code out. If the higher ups give a go I'd be more then happy to commit this code. None of the changes code in the patch is a major change, everything is very minor. Here's a brief summary of what I did: - In the current release you are not allowed to use numbers in tags, and this is both undocumented, and I believe unintended. Essentially if I created a tag called [h1] I would receive bad formatting problems because the current release does not parse the tag correctly at all. The output is rather ugly. I fixed the portion of the code which didn't account for numbers being included. Now it parses BBCode tags with numbers with no problems. - Currently the tag [b] and [B] are different, even though the average developer will want both to output <strong> Now I realized this may be by design so what I did was first created an option called "strict" and if toggled true it [b] and [B] are different, if toggled false [b] and [B} are the same. - I added two very small features, one called strip_tags and the other called nl2br (very original, I know) these features allow for the getText() method to return text which has had <br /> added, and/or remaining HTML tags stripped. This is beneficial for various security reasons and if you don't want output to run together the nl2br item is nice. (Note: I need to alter the methods in the list filter to clean up <br /> tags that have been added. This is not essential, but what it is, is a friendly "cleaner" utility. I had code started, just not finished.) They are not ridiculously major changes, but they are definitely beneficial. I will in the upcoming days also be releasing a patch to update and elaborate on the current phpdoc that exists in HTML_BBCodeParser. I would also like to receive some type of a go to develop a series of loadTag(), loadTags(), removeTag(), and removeTags() methods. Currently you have to develop a filter in order to add tags. This is nice for large sets of tags for a predefined filter, however, at the same time if I want to load a single tag I have to create a whole new filter in order to do so. There is a much easier way of handling this, and there is also an easy way to remove tags from the current set tags (e.g. Say I want to load the list filter but only allow for unordered lists instead of ordered list, I'd have to redo the entire class, rather then just running a removeTags("list"); type function. A patch for the above methods will be out shortly before my documentation patch. Anyhow, please take a look at my patch and try it out. Any input would be appreciated. Thanks. - Stan Lemon

« previous php.pear.dev (#19889) next »