1

我的论坛没有关注 bbcode。Apostorphies 和 break 尤其不起作用。我知道这不是包含问题,因为我的笑脸页面工作正常。只是这一页。

此外,nl2br 也不起作用。

有人可以告诉我我的代码是否正确吗?

<?
function forumbb($content){ //define the function of bbcode 
$content = nl2br($content); //replaces returns with br's 
$match = array( 
'#\[sup\]#se', 
'#\[\/sup\]#se', 
'#rnrn#se', 
'#\[p\]#se', 
'#\[\/p\]#se', 
'#\[br\]#se', 
'#\[\br\]#se', 
'#\[b\]#se', 
'#\[\/b\]#se', 
'#\[i\]#se', 
'#\[\/i\]#se', 
'#\[u\]#se', 
'#\[\/u\]#se', 
'#\[left\]#se', 
'#\[\/left\]#se', 
'#\[right\]#se', 
'#\[\/right\]#se', 
'#\[center\]#se', 
'#\[\/center\]#se', 
'#\[\/font\]#se', 
'#\[fontc\=(.*?)s\=(.*?)f\=(.*?)\]#se', 
'#\[fontc\=(.*?)f\=(.*?)s\=(.*?)\]#se', 
'#\[fonts\=(.*?)c\=(.*?)f\=(.*?)\]#se', 
'#\[fonts\=(.*?)f\=(.*?)c\=(.*?)\]#se', 
'#\[fontf\=(.*?)c\=(.*?)s\=(.*?)\]#se', 
'#\[fontf\=(.*?)s\=(.*?)c\=(.*?)\]#se', 
'#\[fontc\=(.*?)f\=(.*?)\]#se', 
'#\[fontc\=(.*?)s\=(.*?)\]#se', 
'#\[fonts\=(.*?)f\=(.*?)\]#se', 
'#\[fonts\=(.*?)c\=(.*?)\]#se', 
'#\[fonts\=(.*?)\]#se', 
'#\[fontf\=(.*?)\]#se', 
'#\[fontc\=(.*?)\]#se', 
'#\[#se', 
'#\]#se', 
'#neoHTML#se', 
'#\*acara\*#se', 
'#\*aisha\*#se', 
'#\*blumaroo\*#se', 
'#\*bori\*#se', 
'#\*bruce\*#se', 
'#\*buzz\*#se', 
'#\*chia\*#se', 
'#\*cybunny\*#se', 
'#\*draik\*#se', 
'#\*eyrie\*#se', 
'#\*flotsam\*#se', 
'#\*gelert\*#se', 
'#\*gnorbu\*#se', 
'#\*grundo\*#se', 
'#\*hissi\*#se', 
'#\*jubjub\*#se', 
'#\*kacheek\*#se', 
'#\*kau\*#se', 
'#\*kiko\*#se', 
'#\*korbat\*#se', 
'#\*kougra\*#se', 
'#\*krawk\*#se', 
'#\*kyrii\*#se', 
'#\*lenny\*#se', 
'#\*lupe\*#se', 
'#\*SketchedNeo\*#se', 
'#\*meerca\*#se', 
'#\*ogrin\*#se', 
'#\*poogle\*#se', 
'#\*pteri\*#se', 
'#\*ruki\*#se', 
'#\*scorchio\*#se', 
'#\*shoyru\*#se', 
'#\*techo\*#se', 
'#\*tonu\*#se', 
'#\*usul\*#se', 
'#\*wocky\*#se', 
'#\*xweetok\*#se', 
'#\*yurble\*#se', 
'#\*zafara\*#se', 
'#\*candycane\*#se', 
'#\*aaa\*#se',
'#\*abigail\*#se',
'#\*boatswain\*#se',
'#\*cabinboy\*#se',
'#\*coltzan\*#se',
'#\*cook\*#se',
'#\*gunner\*#se',
'#\*hanso\*#se',
'#\*happiness\*#se',
'#\*illusen\*#se',
'#\*jazan\*#se',
'#\*jhudora\*#se',
'#\*lulu\*#se',
'#\*mate\*#se',
'#\*mrcoconut\*#se',
'#\*nox\*#se',
'#\*quartermaster\*#se',
'#\*rigger\*#se',
'#\*rower\*#se',
'#\*sloth\*#se',
'#\*swabbie\*#se',
'#\*angelpuss\*#se',
'#\*feepit\*#se',
'#\*jinjah\*#se',
'#\*kadoatery\*#se',
'#\*kadoatie\*#se',
'#\*larnikin\*#se',
'#\*meepit\*#se',
'#\*mootix\*#se',
'#\*pinchit\*#se',
'#\*slorg\*#se',
'#\*warf\*#se',
'#\*weewoo\*#se',
'#\*babypb\*#se',
'#\*baf\*#se',
'#\*bdf\*#se',
'#\*bef\*#se',
'#\*bff\*#se',
'#\*bgc\*#se',
'#\*blf\*#se',
'#\*bwf\*#se',
'#\*carrot\*#se',
'#\*codestone\*#se',
'#\*dariganpb\*#se',
'#\*dubloon\*#se',
'#\*dung\*#se',
'#\*faeriepb\*#se',
'#\*mspp\*#se',
'#\*piratepb\*#se',
'#\*sock\*#se',
'#\*suap\*#se',
'#\*catfish\*#se',
'#\*star\*#se',
'#\*swagbag\*#se',
'#\*0.o.0\*#se',
'#\*bauble\*#se',
'#\*flower\*#se',
'#\*ghost\*#se',
'#\*holly\*#se',
'#\*mistletoe\*#se',
'#\*present\*#se',
'#\*pumpkin\*#se',
'#\*rednose\*#se',
'#\*santa\*#se',
'#\*snowflake\*#se',
'#\*snowman\*#se',
'#\*tombstone\*#se',
'#\*witch\*#se',
'#\*xmastree\*#se',
'#\*altador\*#se',
'#\*brightvale\*#se',
'#\*darigan\*#se',
'#\*faerieland\*#se',
'#\*hauntedwoods\*#se',
'#\*kikolake\*#se',
'#\*krawkisland\*#se',
'#\*kreludor\*#se',
'#\*lostdesert\*#se',
'#\*maraqua\*#se',
'#\*meridell\*#se',
'#\*moltara\*#se',
'#\*mysteryisland\*#se',
'#\*rooisland\*#se',
'#\*shenkuu\*#se',
'#\*terrormountain\*#se',
'#\*tyrannia\*#se',
'#\*virtupets\*#se',
'#\*angry\*#se',
'#\*clap\*#se',
'#\*complain\*#se',
'#\*cough\*#se',
'#\*cry\*#se',
'#\*facepalm\*#se',
'#\*lol\*#se',
'#\*unsure\*#se',
'#\*violin\*#se',
'#\*yarr\*#se',
'#:\)#se',
'#;\)#se',
'#:\(#se',
'#:\*#se',
'#:D#se',
'#:K#se',
'#:o#se',
'#:P#se',
'#B\)#se',
'#0:\-\)#se',
'#\*snowager\*#se',
'#\*turmaculus\*#se',
); //codes used in posts 
$replace = array( 
"'<sup>'", 
"'</sup>'", 
"''", 
"'<p>'", 
"'</p>'", 
"'<br>'", 
"'</br>'", 
"'<b>'", 
"'</b>'", 
"'<i>'", 
"'</i>'", 
"'<u>'", 
"'</u>'", 
"'<p style=\"text-align:left;\">'", 
"'</p>'", 
"'<p style=\"text-align:right;\">'", 
"'</p>'", 
"'<center>'", 
"'</center>'", 
"'</font>'", 
"'<font color=\'\\1\' size=\'\\2\' face=\'\\3\'>'",
"'<font color=\'\\1\' face=\'\\2\' size=\'\\3\'>'",
"'<font size=\'\\1\' color=\'\\2\' face=\'\\3\'>'",
"'<font size=\'\\1\' face=\'\\2\' color=\'\\3\'>'",
"'<font face=\'\\1\' color=\'\\2\' size=\'\\3\'>'",
"'<font face=\'\\1\' size=\'\\2\' color=\'\\3\'>'",
"'<font color=\'\\1\' face=\'\\2\'>'",
"'<font color=\'\\1\' size=\'\\2\'>'",
"'<font size=\'\\1\' face=\'\\2\'>'",
"'<font size=\'\\1\' color=\'\\2\'>'",
"'<font size=\'\\1\'>'",
"'<font face=\'\\1\'>'",
"'<font color=\'\\1\'>'",
"' '",
"' '",
"'This is how your post will look on the Neoboards.'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/acara.gif\' >'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/aisha.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/blumaroo.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bori.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bruce.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/buzz.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/chia.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/cybunny.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/draik.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/eyrie.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/flotsam.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/gelert.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/gnorbu.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/grundo.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/hissi.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/jubjub.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kacheek.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kau.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kiko.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/korbat.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kougra.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/krawk.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kyrii.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/lenny.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/lupe.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/SketchedNeo.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/meerca.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/ogrin.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/poogle.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/pteri.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/ruki.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/scorchio.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/shoyru.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/techo.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/tonu.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/usul.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/wocky.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/xweetok.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/yurble.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/zafara.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/candycane.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/aaa.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/abigail.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/boatswain.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/cabinboy.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/coltzan.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/cook.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/gunner.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/hanso.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/happinessfaerie.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/illusen.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/jazan.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/jhudora.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/lulu.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/mate.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/mrcoconut.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/nox.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/quartermaster.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/rigger.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/rower.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/sloth.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/swabbie.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/angelpuss.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/feepit.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/jinjah.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kadoatery.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kadoatie.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/larnikin.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/meepit.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/mootix.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/pinchit.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/slorg.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/warf.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/weewoo.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/babypb.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/baf.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bdf.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bef.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bff.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bgc.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/blf.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bwf.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/carrot.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/codestone.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/dariganpb.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/dubloon.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/dung.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/faeriepb.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/mspp.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/piratepb.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/sock.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/suap.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/catfish.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/star.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/swagbag.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/0.o.0.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/bauble.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/flower.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/ghost.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/holly.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/mistletoe.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/present.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/pumpkin.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/rednose.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/santa.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/snowflake.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/snowman.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/tombstone.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/witchhat.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/xmastree.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/altador.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/brightvale.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/darigan.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/faerieland.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/hauntedwoods.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kikolake.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/krawkisland.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kreludor.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/lostdesert.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/maraqua.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/meridell.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/moltara.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/mysteryisland.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/rooisland.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/shenkuu.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/terrormountain.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/tyrannia.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/virtupets.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/angry.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/clap.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/complain.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/cough.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/cry.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/facepalm.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/lol.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/unsure.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/violin.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/yarr.gif\' \>'",
"'<img src=\'http://images.neopets.com/smileys/smiley.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/winking.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/sad.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/kisskiss.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/grin.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/vampire.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/oh.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/tongue.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/sunglasses.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/angel.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/snowager.gif\' \>'",
"'<img src=\'http://images.neopets.com/neoboards/smilies/turmaculus.gif\' \>'",
); //replacements 
return preg_replace($match, $replace, $content); //match, and replace 
} //end the function 
?> 
4

0 回答 0