Ich habe mich an die Arbeit gemacht und erstmal, wie es beim quote-tag auch ist, "]" erlaubt.
Code: Alles auswählen
// Grab everything until the first "]"...
$possible_start = substr($text, $curr_pos, strpos($text, ']', $curr_pos + 1) - $curr_pos + 1);
//
// We're going to try and catch usernames with "[' characters.
//
if( preg_match('#\[quote=\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\"(.*?)\\\"\]#si', $possible_start) )
{
// OK we are in a quote tag that probably contains a ] bracket.
// Grab a bit more of the string to hopefully get all of it..
if ($close_pos = strpos($text, '"]', $curr_pos + 9))
{
if (strpos(substr($text, $curr_pos + 9, $close_pos - ($curr_pos + 9)), '[quote') === false)
{
$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2);
}
}
}
//
// We're going to try and catch showhide-texts with "[' characters.
//
if( preg_match('#\[showhide=\\\"#si', $possible_start, $match) && !preg_match('#\[showhide=\\\"(.*?)\\\"\]#si', $possible_start) )
{
if ($close_pos = strpos($text, '"]', $curr_pos + 9))
{
if (strpos(substr($text, $curr_pos + 9, $close_pos - ($curr_pos + 9)), '[showhide') === false)
{
$possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2);
}
}
}
PS: Link zur aktuellen Version, die noch einige Sonderzeichen blockiert.