func printTag1(tag, src, dest)
if(tag)
println('$tx = preg_replace(' + replace(src, '¦', tag) + ', ' + dest + ', $tx);')
end
end
func printTag2(tag, src, dest)
if(tag)
println('$tx = str_replace(' + replace(src, '¦', tag) + ', ' + dest + ', $tx);')
end
end
func doBbCodeCreate(_data)
fvar(old)
old = block.select(BLK_HEAD)
println('function ' + code(Name) + '($text) {')
block.inclvl()
println('$tarray = explode("\r", " ".htmlspecialchars($text));')
println('$_text = "";')
println('$code = 0;')
if(TableTag)
println('$table = 0;')
println('$inc = 0;')
println('$cs = 0;')
end
println('for($i = 0; $i < count($tarray); $i++) {')
println(' $tx = $tarray[$i];')
println(' if (strpos($tx,"[' + code(CodeTag) + ']")) {')
println(' $code++;')
println(' $tx = str_replace("[' + code(CodeTag) + ']", "
", $tx);')
println(' }')
println(' if ($code > 0) {')
println(' $tx = str_replace(" "," ",$tx);')
println(' if (strpos($tx," ") === 1)')
println(' $tx = " ".$tx;')
println(' $tx .= "
";')
println(' }')
println(' else {')
if(TableTag)
println(' if (strpos($tx,"[' + code(TableTag) + '"))')
println(' $table++;')
println(' if (strpos($tx,"[/' + code(TableTag) + ']"))')
println(' $table--;')
end
printTag1(Bold, "#\[¦\](.*?)\[/¦\]#is", "
\\\\1")
printTag1(Italic, "#\[¦\](.*?)\[/¦\]#is", "
\\\\1")
printTag1(Underline, "#\[¦\](.*?)\[/¦\]#is", "
\\\\1")
printTag2(Line, "[¦]", "
")
printTag2(Tab, "[¦]", " ")
printTag2(SimpleList, "[¦]", "
")
printTag2(SimpleList, "[/¦]", "
")
printTag2(NumericList, "[¦]", "
")
printTag2(NumericList, "[/¦]", "
")
printTag2(Item, "[¦]", "
")
// $tx = preg_replace("/\[form=(.*?)\]/si", "", $tx);
printTag2(IP, "[¦]", 'getenv("REMOTE_ADDR")')
printTag1(Image, "#\[¦\]([a-zA-Z\.\/\-:]+)\[/¦\]#is", "
")
printTag1(QuoteTag, "/\[¦=(.*?)\]/si", "