Re: Help Wanted - Adding Multiple Vars To Bbcode.php
As you have told so many times... if you need a better support, try vBulletin!
I were (and I'm still) on holiday... I have been away for some days and I'll be away for another couple of days...
Regarding your issue, if you need a control panel where you can add your own customized BBCode, then may be worth trying to integrate phpBB 3 BBCodes... it should not be tough! And I think I will also take a look at that sooner or later.
Currently I'm really happy on how Icy Phoenix BBCodes work and even if the class is quite big now, I think I will still use that for a while, unless I will find the time to recode that.
The best thing you can do now is lookin at how GRADIENT BBCode work which is one of the tag which natively supports many parameters:
[gradient cols=#FF8866 cole=#336699 iterations=8]Text[/gradient]
This is the part of
bbcode.php which is relevant for parameters parsing:
// GRADIENT
if($tag === 'gradient')
{
/*
if($this->is_sig && !$board_config['allow_all_bbcode'])
{
return $error;
}
*/
$default_color1 = '#000080';
$color1 = $this->valid_color((isset($item['params']['param']) ? $item['params']['param'] : (isset($item['params']['cols']) ? $item['params']['cols'] : $default_color1)), true);
$color1 = (($color1 === false) ? $default_color1 : $color1);
$default_color2 = '#aaccee';
$color2 = $this->valid_color((isset($item['params']['cole']) ? $item['params']['cole'] : $default_color2), true);
$color2 = (($color2 === false) ? $default_color2 : $color2);
$mode = $this->process_text((isset($item['params']['mode']) ? $item['params']['mode'] : ''));
$default_iterations = 10;
$iterations = intval(isset($item['params']['iterations']) ? $item['params']['iterations'] : $default_iterations);
$iterations = ((($iterations < 10) || ($iterations > 100)) ? $default_iterations : $iterations);
$html = $this->gradient($content, $color1, $color2, $mode, $iterations);
return array(
'valid' => true,
'html' => $html,
'allow_nested' => false,
);
}
As you can see you can pass how many parameters you like to the BBCode parsing function... but only the ones you want to be processed will!
Make sure you correctly process text strings, because malicious users may pass "unwanted" scripts and tags using parameters... there was a couple of buggy BBCodes in older versions... luckily almost nobody discovered them.