set_filename('bbcode_bar', dirname(__FILE__).'/bbcode_bar.tpl');
if ($conf_bbcode_bar[0] == 1) $template->assign('BBCode_bar_button_00',true);
if ($conf_bbcode_bar[1] == 1) $template->assign('BBCode_bar_button_01',true);
if ($conf_bbcode_bar[2] == 1) $template->assign('BBCode_bar_button_02',true);
if ($conf_bbcode_bar[3] == 1) $template->assign('BBCode_bar_button_03',true);
if ($conf_bbcode_bar[4] == 1) $template->assign('BBCode_bar_button_04',true);
if ($conf_bbcode_bar[5] == 1) $template->assign('BBCode_bar_button_05',true);
if ($conf_bbcode_bar[6] == 1) $template->assign('BBCode_bar_button_06',true);
if ($conf_bbcode_bar[7] == 1) $template->assign('BBCode_bar_button_07',true);
if ($conf_bbcode_bar[8] == 1) $template->assign('BBCode_bar_button_08',true);
if ($conf_bbcode_bar[9] == 1) $template->assign('BBCode_bar_button_09',true);
if ($conf_bbcode_bar[10] == 1) $template->assign('BBCode_bar_button_10',true);
if ($conf_bbcode_bar[11] == 1) $template->assign('BBCode_bar_button_11',true);
if ($conf_bbcode_bar[12] == 1) $template->assign('BBCode_bar_button_12',true);
if ($conf_bbcode_bar[13] == 1) $template->assign('BBCode_bar_button_13',true);
if ($conf_bbcode_bar[14] == 1) $template->assign('BBCode_bar_button_14',true);
if ($conf_bbcode_bar[15] == 1) $template->assign('BBCode_bar_button_15',true);
$template->assign('repicon', $conf_bbcode_bar[17]);
if (isset($pwg_loaded_plugins['SmiliesSupport']))
{
$template->assign('BBCode_bar_SmiliesSupport', array('SMILIESSUPPORT_PAGE' => SmiliesTable()));
}
$lang['comment'] .= $template->parse('bbcode_bar', true);
}
//Check tags and eventually close malformed tags, return BBCoded String
function CheckTags($str)
{
//array of known tags
$known = array('p','b','i','u','s','center','right','ol','ul','li','quote', 'img','url','email','color', 'size');
//storage stack
$tags = array();
for ($pos = 0; $pos
\\1
'; } if ( $conf_bbcode_bar[6] == 1 ) { //Right $patterns[] = '#\[right\](.*?)\[/right\]#is'; $replacements[] = '
\\1
'; } if ( $conf_bbcode_bar[7] == 1 ) { //Olist $patterns[] = '#\[ol\](.*?)\[/ol\]#is'; $replacements[] = '
\\1
'; //Quotes with "user" $patterns[] = "#\[quote="(.*?)"\](.*?)\[/quote\]#is"; $replacements[] = '
\\1 :
\\2
'; //Quotes with user $patterns[] = "#\[quote=(.*?)\](.*?)\[/quote\]#is"; $replacements[] = '
\\1 :
\\2
'; } if ( $conf_bbcode_bar[10] == 1 ) { //Images $patterns[] = "#\[img\](.*?)\[/img\]#si"; $replacements[] = ""; } if ( $conf_bbcode_bar[11] == 1 ) { //[url]xxxx://www.zzzz.yyy[/url] $patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is"; $replacements[] = '\\1'; //[url]www.zzzzz.yyy[/url] $patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is"; $replacements[] = '\\1'; //[url=xxxx://www.zzzzz.yyy]ZzZzZ[/url] /*No I ain't sleeping yet*/ $patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; $replacements[] = '\\2'; // [url=www.zzzzz.yyy]zZzZz[/url] /*But I'm thinking about*/ $patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is"; $replacements[] = '\\2'; // [url="www.zzzzz.yyy"]zZzZz[/url] /* It's nearly 2 am now */ $patterns[] = "#\[url="((www|ftp)\.[^ \n\r\t<]*?)"\](.*?)\[/url\]#is"; $replacements[] = '\\3'; //[url="http://www.zzzzz.yyy"]zZzZz[/url] /*I really dislike commenting code*/ $patterns[] = "#\[url="([\w]+?://[^ \n\r\t<]*?)"\](.*?)\[/url\]#is"; $replacements[] = '\\2'; } if ( $conf_bbcode_bar[12] == 1 ) { //[email]samvure@gmail.com[/email] $patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#is"; $replacements[] = '\\1'; } if ( $conf_bbcode_bar[13] == 1 ) { //Size $patterns[] = "#\[size=([1-2]?[0-9])\](.*?)\[/size\]#si"; $replacements[] = '\\2'; } if ( $conf_bbcode_bar[14] == 1 ) { //Colours $patterns[] = "#\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*?)\[/color\]#si"; $replacements[] = '\\2'; } return preg_replace($patterns, $replacements, $str); } ?>