/**
* Attempts to convert $s to vB code.
*
* Attempts to convert $s (HTML) to vB code and returns the result. The translation is achieved by
* translating common elements such as <b> to [b], <a href=""> to [url], etc. Unknown tags are
* deleted but the contents within them will remain with the exception of scripting tags (<script>).
*
* CSS conversions are not made; for example, <span style="color:red">this is red</span> will not
* translate over to [color=red]this is red[/color]. This may be done in a future version.
*
* @param s string to convert (should contain HTML)
*
* @return vB code version of $s
*/
function vbms_html2bbcode($s)
{
// do the one-letter tags
$onelettertags = array("b", "i", "u");
foreach ($onelettertags as $tag)
{
$s = preg_replace("/<$tag.*>(.*)<\/$tag>/siU", "[$tag]\\1[/$tag]", $s);
}