cotonti.com : Function sed_cutpost? https://www.cotonti.com Останні повідомлення в темі Cotonti en Mon, 02 Feb 2026 16:24:59 -0000 musiconly # Trustmaster : Dirty trick:
else
{
    $text = preg_replace('#\[[^\]]+?\](.*?)\[/[^\]]+?\]#', '', $text);
    $text = preg_replace('#\[[^\]]+?\]#', '', $text);
}

Perfect! Thanks Trustmaster! :-)]]>
Thu, 30 Кві 2009 16:14:19 -0000
Trustmaster
else
{
    $text = preg_replace('#\[[^\]]+?\](.*?)\[/[^\]]+?\]#', '', $text);
    $text = preg_replace('#\[[^\]]+?\]#', '', $text);
}
]]>
Thu, 30 Кві 2009 12:18:48 -0000
TwistedGA Thu, 30 Кві 2009 06:35:57 -0000 musiconly
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 more
but
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;
}
]]>
Thu, 30 Кві 2009 01:48:05 -0000