elkarte/Elkarte — pull request #811 by Spuds (2013-09-08 20:14:19+00:00)
Title: First pass at an html to bbc class for review

This is a first pass at a html to bbc conversion class discussed in #625. It follows a similar tack as the html2MD (html to markdown) that is in place for PBE

In a nutshell ... it uses either the internal DOMDocument functions or the external library simple_html_dom to parse the supplied HTML. Using that it traverses each branch of HTML to its terminus, and then begins to swap out html tags for their bbc equivalent(s) as it reverses back up the branch to its root.

Some html -> bbc is a simple swap out, others take a bit more work if they support attributes (img, anchors, div, etc you know the drill)

I'd suggest providing this in subs, I'd also suggest moving html2MD.class to subs and not in ext since it is our code and not an external code. I can also make use of this class in the PBE functions so the core can be using it as well.

to use:
$html = 'some html, as much or as little as ya like';
$bbc_converter = new Convert_BBC($html);
$bbc = $bbc_converter->get_bbc();