Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
install/convertors/functions_phpbb20.php
#
#-----[ FIND ]------------------------------------------
#
if (isset($convert->row['old_bbcode_uid']) && $convert->row['old_bbcode_uid'] != '')
{
// Adjust size...
if (strpos($message, '[size=') !== false)
{
$message = preg_replace_callback('/\[size=(\d*):(' . $convert->row['old_bbcode_uid'] . ')\]/', 'phpbb_replace_size', $message);
}
#
#-----[ AFTER, ADD ]------------------------------------
#
$message = preg_replace(
'#(\[(?:mrow|mcol|row|col(?!or)|/table)[^\]]*\])#e',
"table_callback(str_replace('\\\"','\"','$1'))",
$message
);
#
#-----[ FIND ]------------------------------------------
#
/**
* Return the bitfield calculated by the previous function
*/
function get_bbcode_bitfield()
{
#
#-----[ BEFORE, ADD ]-----------------------------------
#
/**
* Convert the Table BBCode MOD to a more phpBB3 friendly format
* (c) MMVIII by TerraFrost (http://www.frostjedi.com/terra/)
*/
function table_callback($long_tag)
{
static $stack = array();
static $subtag = array('mrow' => 'mcol', 'row' => 'col');
preg_match('#^\[(/?\w+)#', $long_tag, $matches);
$short_tag = $matches[1];
switch ($short_tag)
{
case 'mrow':
case 'row':
$temp = '';
while (count($stack))
{
$top = array_pop($stack);
$temp.= '[/' . $top . ']';
}
$stack[] = $short_tag;
$stack[] = $subtag[$short_tag];
return $temp . $long_tag . '[' . $subtag[$short_tag] . ']';
case 'mcol':
case 'col':
$top = array_pop($stack);
$stack[] = $short_tag;
return '[/' . $short_tag . ']' . $long_tag;
case '/table':
$temp = '';
while (count($stack))
{
$top = array_pop($stack);
$temp.= '[/' . $top . ']';
}
return $temp . '[/table]';
}
}
Code: Select all
[table]{TEXT}[/table]
Code: Select all
<table align="top" cellpadding="2" cellspacing="0" border="1" bgcolor="#FFFFFF">{TEXT}</table>
Code: Select all
[mrow]{TEXT}[/mrow]
Code: Select all
<tr>{TEXT}</tr>
Code: Select all
[row]{TEXT}[/row]
Code: Select all
<tr>{TEXT}</tr>
Code: Select all
[mcol]{TEXT}[/mcol]
Code: Select all
<td style="font-weight: bold; text-align: center;">{TEXT}</td>
Code: Select all
[col]{TEXT}[/col]
Code: Select all
<td>{TEXT}</td>
Code: Select all
[table][row]a[col]b[col]c[/table]
Code: Select all
[table][row][col]a[/col][col]b[/col][col]c[/col][/row][/table]
Code: Select all
function bbcode_nl2br($text)
{
// custom BBCodes might contain carriage returns so they
// are not converted into <br /> so now revert that
$text = str_replace(array("tr>\n", "tr>\r", "\n", "\r",), array('tr>', 'tr>', '<br />', "\n"), $text);
return $text;
}
This is the support topic for a phpBB2 mod, not a topic for phpbb3 custom bbcodes.mikeel100 wrote: if I posted in the wrong place, my apologies.