X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fhtml2bbcode.php;h=65cbcec41f66835acca21810cfe64200d43b87dd;hb=e2544abd503ddcbd98a31c75b528aac0c980df35;hp=2ae0df8f688123077eca1b070b2ae749247de254;hpb=bc9e175ced0c7a0b4f51456c9ab3ffb8bf89dd4d;p=friendica.git diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 2ae0df8f68..65cbcec41f 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -1,50 +1,68 @@ (.*?)\<\/pre\>/is', + '/\/is', + '/\<\/p\>/is', + '/\(.*?)\<\/b\>/is', + '/\(.*?)\<\/i\>/is', + '/\(.*?)\<\/u\>/is', + '/\(.*?)\<\/ul\>/is', + '/\(.*?)\<\/li\>/is', + '/\/is', + '/\(.*?)\<\/div\>/is', + '/\/is', + '/\(.*?)\<\/strong\>/is', + '/\(.*?)\<\/a\>/is', + '/\(.*?)\<\/code\>/is', + '/\(.*?)\<\/span\>/is', + '/\(.*?)\<\/blockquote\>/is', + '/\(.*?)\<\/video\>/is', + '/\(.*?)\<\/audio\>/is', + + ); + + // Replace with + + $bbtags = array( + '', + '[code]$1[/code]', + '', + "\n", + '[b]$1[/b]', + '[i]$1[/i]', + '[u]$1[/u]', + '[list]$1[/list]', + '[*]$1', + '[img]$2[/img]', + '$2', + "\n", + '[b]$1[/b]', + '[url=$1]$3[/url]', + '[code]$1[/code]', + '[color="$1"]$2[/color]', + '[quote]$1[/quote]', + '[video]$1[/video]', + '[audio]$1[/audio]', + ); + + // 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; +} -// Tags to Find -$htmltags = array( - '/\(.*?)\<\/b\>/is', - '/\(.*?)\<\/i\>/is', - '/\(.*?)\<\/u\>/is', - '/\(.*?)\<\/ul\>/is', - '/\(.*?)\<\/li\>/is', - '/\/is', - '/\(.*?)\<\/div\>/is', - '/\/is', - '/\(.*?)\<\/strong\>/is', - '/\(.*?)\<\/a\>/is', - '/\(.*?)\<\/code\>/is', - '/\(.*?)\<\/font\>', - '/\(.*?)\<\/font\>', - '/\(.*?)\<\/blockquote\>/is', - - ); - -// Replace with -$bbtags = array( - '[b]$1[/b]', - '[i]$1[/i]', - '[u]$1[/u]', - '[list]$1[/list]', - '[*]$1', - '[img]$2[/img]', - '$2', - '\n', - '[b]$1[/b]', - '[url=$1]$3[/url]', - '[code]$1[/code]', - '[color="$1"]$2[/color]', - '[color="$1"]$2[/color]', - '[quote]$1[/quote]', - ); - -// Replace $htmltags in $text with $bbtags -$text = preg_replace ($htmltags, $bbtags, $s); - -// Strip all other HTML tags -$text = strip_tags($text); -return $text; -} \ No newline at end of file