As usual when I'm writing a plugin I have issues with converting HTML code back to BBcode when quoted/edited
Finally got the hang of regex just need to get the hang of this
Any idea what I require to change from the code below to get a proper HTML -> BBCode. Probably something obvious, it works fine as far as embedding the video just doesn't work when quoting/editing and you end up with HTML.
<?php
// Initialize plugin
plugin_add_hook("BBCODE2HTML", "plugin_zshare_tag_to_html");
plugin_add_hook("HTML2BBCODE", "plugin_zshare_html_to_tag");
// Convert [zshare] to html code (post message)
function plugin_zshare_tag_to_html($array) {
list($bbcode) = $array;
$bbcode = preg_replace('#\[zshare\]([a-zA-Z0-9%_=.&(?!amp;)-]+)\[/zshare\]#si', '<iframe src="http://www.zshare.net/videoplayer/player.php?\\1&iframewidth=530&iframeheight=435&width=480&height=385&H=1&ISL=1" height="435" width="530" border=0 frameborder=0 scrolling=no id="videoframe" name="videoframe"></iframe>', $bbcode);
return array($bbcode);
}
// Convert html to [zshare] tag (edit message)
function plugin_zshare_html_to_tag($array) {
list($bbcode) = $array;
$bbcode = preg_replace('#<iframe src="<iframe src="http://www.zshare.net/videoplayer/player.php?([a-zA-Z0-9%_=.&(?!amp;)-]+)&iframewidth=530&iframeheight=435&width=480&height=385&H=1&ISL=1" height="435" width="530" border=0 frameborder=0 scrolling=no id="videoframe" name="videoframe"></iframe>#si', '[zshare]\\1[/zshare]', $bbcode);
return array($bbcode);
}