PDA

View Full Version : BBCode Parse?


Neo
01-24-2003, 12:03 AM
What code in the BBCode function parses the code from the database? (turns it into the code specified in the db?)

Thanks
- Neo

Neo
01-30-2003, 04:05 PM
We got some 1337 hackers here...

Xenon
02-01-2003, 10:44 AM
it's that part:
$bbcodes=$DB_site->query("SELECT bbcodetag,bbcodereplacement,twoparams FROM bbcode");

while($bbregex=$DB_site->fetch_array($bbcodes)) {
if ($bbregex[twoparams]) {
$regex=sprintf($doubleRegex, $bbregex[bbcodetag], $bbregex[bbcodetag]);
} else {
$regex=sprintf($singleRegex, $bbregex[bbcodetag], $bbregex[bbcodetag]);
}
$searcharray[] = $regex;
$replacearray[] = $bbregex[bbcodereplacement];
// and get nested ones:
$searcharray[] = $regex;
$replacearray[] = $bbregex[bbcodereplacement];
$searcharray[] = $regex;
$replacearray[] = $bbregex[bbcodereplacement];
}

and shortly after that the whole array parser:

$bbcode=preg_replace($searcharray, $replacearray, $bbcode);