Functionubb2xhtml ($ ubb) {$ flashENDobjectclasscodebasedownload. macromedia. compubshockwavecabsflashswflash. cab # version6, 0, 0, 0 paramnamemovievalue % function ubb2xhtml ($ ubb)
{
$ Flash = < Codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width = "% 1 \ $ d" height = "% 2 \ $ d">
END;
$ Match = array
(
'% \ [Url = ([^ \ s]) \] (. *?) \ [/Url \] % s ',
'% \ [Email = ([^ \ s]) \] (. *?) \ [/Email \] % I ',
'% \ [Img width = (\ d) height = (\ d) \] (. *?) \ [/Img \] % s ',
'% \ [Img = ([^ \ s]) \/\] % s ',
'% \ [Flash width = (\ d) height = (\ d) \] (. *?) \ [/Flash \] % se ',
'% \ [(B | I | u | strike | sup | sub) \] (. *?) \ [/\ 1 \] % s ',
'% \ [H ([1-6]) \] (. *?) \ [/H \ 1 \] % s ',
'% \ [Hr \/\] % s ',
'% \ [Color = ([^ \ s]) \] (. *?) \ [/Color \] % s ',
'% \ [Font = ([^ \ "]) \] (. *?) \ [/Font \] % s ',
'% \ [Size = ([^ \ s]) \] (. *?) \ [/Size \] % s ',
'% \ [Align = (center | right | left) \] (. *?) \ [/Align \] % s ',
'% \ [Valign = (middle | top | bottom) \] (. *?) \ [/Valign \] % s ',
/*
'% \ [Ul \] (. *?) \ [/Ul \] % s ',
'% \ [Ul = (circle | disc | square) \] (. *?) \ [/Ul \] % s ',
'% \ [Ol \] (. *?) \ [/Ol \] % s ',
'% \ [Ol type = ([aAiI1]) start = ([a-zA-Z1-9]) \] (. *?) \ [/Ol \] % s ',
'% \ [Li \] (. *?) \ [/Li \] % s ',
*/
'% \ [Table = ([^ \ s]?) \] (. *?) \ [/Table \] % s ',
'% \ [Caption \] (. *?) \ [/Caption \] % s ',
'% \ [Tr = ([^ \ s]?) \] (. *?) \ [/Tr \] % s ',
'% \ [Th \] (. *?) \ [/Th \] % s ',
'% \ [Td \] (. *?) \ [/Td \] % s ',
'% \ [Note \] (. *?) \ [/Note \] % s ',
'% \ [Quote = (.*?) \] (. *?) \ [/Quote \] % s ',
'% \ [Code \] (. *?) \ [/Code \] % s ',
'% [] {2} % s', // make double-spaces truly double-spaces!
);
$ Replace = array
(
'\ 2 ',
'\ 2 ',
'',
'',
'Sprintf ("$ flash", "\ 1", "\ 2", "\ 3 ")',
'<\ 1> \ 2 ',
' \ 2 ',
'\ N ',
'\ 2 ',
'\ 2 ',
'\ 2 ',
'
\ 2 ',
'
\ 2 ',
/*
'
',
'
',
'
\ 1
',
'
\ 3
',
'
\ 1',
*/
"
",
"\ T$1\ N ",
"\ T\ N $2 \ t\ N ",
"\ T$1\ N ",
"\ T$1\ N ",
'
Publisher remarks
\ 1
',
'
Reference (source: \ 1)
\ 2
',
'Code
\ 1
',
'',
);
If (preg_match ('% \ [table = (.*?) \/Table \] % s', $ ubb, $ tablecells) // if a table exists, remove unnecessary spaces between cells.
{
$ Bb = preg_replace ('% \] ([\ r \ n \ s] *) \ [% Si','] [', $ tablecells [1]);
$ Ubb = str_replace ($ tablecells [1], $ bb, $ ubb );
}
$ Html = preg_replace ($ match, $ replace, nl2br (htmlspecialchars ($ ubb )));
$ Html = preg_replace ('/
\ S * <(td | th | tr | table | ul | ol | li)/M', "\ n". '<\ 1', $ html );
Return $ html;
}