daviskrex Posted April 25, 2010 Report Share Posted April 25, 2010 Sveiki, esmu man ir problēma ar bbcode. Itkā viss iet, bet, protams, līdz tam brīdim, kad bbkods ir pa 2 rindām, piemēram: [b]pirmā rinda otrā rinda[/b] Varbūt kāds var palīdzēt, dot padomu, kas nogājis greizi? function clean($value,$v=0,$w=96) { $bb_replace = array( //'/(\www.)(.+)(\.)(.+)/', '/(\[url=)(.+)(\])(.+)(\[\/url\])/', '/(\[url])(.+)(\[\/url\])/', '/(\[img])(.+)(\[\/img\])/', '/(\[quote=)(.+)(\])(.+)(\[\/quote\])/iU', '/(\[quote])(.+)(\[\/quote\])/', '/(\[yt])(.+)(\[\/yt\])/', '/(\[center])(.+)(\[\/center\])/', '/(\[color=)(.+)(\])(.+)(\[\/color\])/', '/(\[size=)(.+)(\])(.+)(\[\/size\])/', '/(\[h])(.+)(\[\/h\])/', '/(\[b])(.+)(\[\/b\])/', '/(\[u])(.+)(\[\/u\])/', '/(\[i])(.+)(\[\/i\])/', '/(\[s])(.+)(\[\/s\])/', '/(\[skype=)(.+)(\])/', '/(\[mail=)(.+)(\])/' ); $bb_replacements = array( //'<a href="http://www.\\2.\\4" target="_blank" style="color:#987654;">www.\\2.\\4</a>', '<a href="\\2" target="_blank" style="color:#987654;">\\4</a>', '<a href="\\2" target="_blank" style="color:#987654;">\\2</a>', '<img src="\\2" style="" alt="image" border="0" >', '<div class="quoted_text"><span><b>\\2 rakstīja:</b></span><br>\\4</div>', '<div class="quoted_text"><span><b>Citāts.</b></span><br>\\4</div>', '<center style="margin:5px;"><object width="430" height="245"><param name="movie" value="http://www.youtube.com/v/\\2&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/\\2&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="430" height="245"></embed></object></center><br >', '<center>\\2</center>', '<font style="color:\\2;">\\4</font>', '<font style="font-size:\\2;">\\4</font>', '<font style="background-color:#E2E200;padding:1px;">\\2</font>', '<b>\\2</b>', '<u>\\2</u>', '<i>\\2</i>', '<s>\\2</s>', '<a href="skype:\\2?chat">\\2</a>', '<a href="mailto:\\2">\\2</a>' ); $value = preg_replace($bb_replace, $bb_replacements, $value); if($v == 0) { $i = 0; $quotes = substr_count(strtolower($value),'[quote='); if($quotes == 1) { return preg_replace($bb_replace, $bb_replacements, $value); } else { while($i != $quotes) { if($i > 0) { $w-=2; } $value = clean($value,1,$w); $i++; } return $value; } } else { $value = preg_replace($bb_replace, $bb_replacements, $value); return $value; } } Quote Link to comment Share on other sites More sharing options...
chizijs Posted April 25, 2010 Report Share Posted April 25, 2010 (edited) nl2br(); Edited April 25, 2010 by chizijs Quote Link to comment Share on other sites More sharing options...
emsy Posted April 25, 2010 Report Share Posted April 25, 2010 '/(\[color=)(.+?)(\])(.*)(\[\/color\])/isU' tipa tavo :) Quote Link to comment Share on other sites More sharing options...
reGative Posted April 25, 2010 Report Share Posted April 25, 2010 hmm, paņēmu no tevīm kodu, bet kā te iekļaut smaidiņus? Mēģināju, bet nekas neizdevās. Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted April 25, 2010 Report Share Posted April 25, 2010 OMFG - http://uk2.php.net/bbcode Quote Link to comment Share on other sites More sharing options...
marcis Posted April 25, 2010 Report Share Posted April 25, 2010 Plus vēl šīs nedēļas laikā šajā forumā ir bijušas vairākas tēmas par bb kodu, kur tika atbildēts uz tevis uzdotajiem jautājumiem. Quote Link to comment Share on other sites More sharing options...
emsy Posted April 25, 2010 Report Share Posted April 25, 2010 Plus vēl šīs nedēļas laikā šajā forumā ir bijušas vairākas tēmas par bb kodu, kur tika atbildēts uz tevis uzdotajiem jautājumiem. Manis veidotas tēmas xD Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.