I have a WYSIWYG editor on my site. It creates only a few html tags (p, br, b, i, strike, img, a).
I would like to wrap all texts in <p> tags, so there will be no text without a wrapping <p>.
From this:
<p>Some text here. This is ok.</p>
Some text here. This is NOT ok.
<p>Some text here. This is ok.</p>
I would like to get this:
<p>Some text here. This is ok.</p>
<p>Some text here. This is NOW ok.</p>
<p>Some text here. This is ok.</p>
What would be the best method to do this?
Thank you in advance.
EDIT:
I would like to do this server-side with PHP.
I managed to do this with phpQuery.