You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.3 KiB

* html2bbcode
function html2bbcode($s) {
// Tags to Find
$htmltags = array(
'/\<img(.*?) src=\"(.*?)\" (.*?)\>/is',
'/\<a href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is',
'/\<span style=\"color:(.*?)\"\>(.*?)\<\/span\>/is',
'/\<video(.*?) src=\"(.*?)\" (.*?)\>(.*?)\<\/video\>/is',
'/\<audio(.*?) src=\"(.*?)\" (.*?)\>(.*?)\<\/audio\>/is',
// Replace with
$bbtags = array(
// Replace $htmltags in $text with $bbtags
$text = preg_replace ($htmltags, $bbtags, $s);
call_hooks('html2bbcode', $text);
// Strip all other HTML tags
$text = strip_tags($text);
return $text;