musiconly |
|
---|---|
I'm using this function for cutting down some stuff on my site, like bio previews and stuff like that.
And I'm using it as parse_bbcodes=false, but this function only removes [bbcode][/bbcode] while still outputting the data that was between that two codes. For example, using sed_cutpost function, parse_bbcodes=false: [img]someimage.jpg[/img]Lorem ipsum at something more of this and more and more after it passes the function, it will be someimage.jpgLorem ipsum at something more of this and more and more Is there any way to remove whole bbcodes, along with text that is using them. So I don't get someimage.jpgLorem ipsum at something more of this and more and morebut Lorem ipsum at something more of this and more and more // Cutpost
function sed_cutpost($text, $max_chars, $parse_bbcodes = true)
{
$text = $max_chars == 0 ? $text : sed_cutstring(strip_tags($text), $max_chars);
// Fix partial cuttoff
$text = preg_replace('#\[[^\]]*?$#', '...', $text);
// Parse the BB-codes or skip them
if($parse_bbcodes)
{
// Parse it
$text = sed_parse($text);
}
else $text = preg_replace('#\[[^\]]+?\]#', '', $text);
return $text;
} |