If I only have one function, it seems like overkill.
Yep. Unless you're using global variables for state. In that case, a class is better style, since you can store the state as member variables.
Also, on edit, do what ita said. Although I wonder if it's worthwhile to keep it as a separate class/function, in order to keep the post class from growing too complex.
Aha, that makes more sense. [edit: ita that is, not that Rob didn't make sense too...] So you can just bung it in with all the other functions and call it.
I don't know what my block is with the OO thing. I just don't
see
it in my head.
I owe John: 1 proselytizing message on OOP.
Did you just give him an OOP FYI I.O.U.?
OK have a look at this page: [link]
Which tags is this supposed to check? Because it's not closing a
t table
tags.
it's not closing a table tags.
It is now.
You tell me what tags, I'll add them -- does it actually make sense to tell it to close TABLE, TR and TDs?
You tell me what tags, I'll add them
Since I'm 3000 miles from home, I can't check the code and give you the list, but didn't I post a list upthread somewhere?
Ahh! I found it:
<a>
<b>
<i>
<u>
<ul>
<ol>
<li>
<p>
<br>
<strike>
<table>
<tr>
<td>
<th>
<font>
<pre>
<code>
does it actually make sense to tell it to close TABLE, TR and TDs?
Yes, but tables are tricky. As I pointed out a while back, the mere
existence
of a
t td
t /td
pair within a post, without a
t table
t /table
pair around them, causes havoc with the tables on this page. So even if you close an open
t td
tag, we'll still have problems.
I still think we should disallow table tags altogether (sorry, ita).
didn't I post a list upthread somewhere?
The list I'm using is exactly that, with the table tags taken out.
The only way to reliably check table code would be with a proper parser, that checked syntax, not a brute-force method like mine.
Thinking about my function, why would it need to return an error.
There are only two kinds of strings in the world. Those with unclosed HTML tags and those without. The string "" is a member of the second group.
So the array returned by it should just be ([true|false], content), right? The empty post thing would be handled elsewhere already.
I still think we should disallow table tags altogether (sorry, ita).
I think we should ignore the problem until we see it happening once a week. When it starts happening that frequently, we should make the board either fix or reject such posts.
Thinking about my function, why would it need to return an error.
Right now, maybe not, but perhaps it will need to in the future. How about we change the boolean to an integer, where zero is success without change, 1 means success and the message was changes, and anything negative is an error?