Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jak poprawić zamienianie na emotikony tekstu?
Saki
post
Post #1





Grupa: Zarejestrowani
Postów: 240
Pomógł: 2
Dołączył: 5.12.2010
Skąd: Fulda

Ostrzeżenie: (0%)
-----


Ta funkcja zamienia grzecznie wszystko na emotikony, ale jest mały problem.


") zamiania na : )
>>")<< zamiania na >>: )<<
>>"P<< zamiania na >>: P<<
znak >>"<< traktuje jak >>:<<
Jak to naprawić?

  1. function emotkikony($text) {
  2.  
  3. $emotikony = array(
  4. '!!' => 'emoty/att.gif',
  5. ':|' => 'emoty/ehm.gif',
  6. ':limo:' => 'emoty/limo.gif',
  7. '(IMG:style_emoticons/default/tongue.gif) ' => 'emoty/psmile.gif',
  8. '(IMG:style_emoticons/default/tongue.gif) ' => 'emoty/psmile.gif',
  9. ';p' => 'emoty/psmile.gif',
  10. ';P' => 'emoty/psmile.gif',
  11. ':TROLL:' => 'emoty/troll.gif',
  12. '(IMG:style_emoticons/default/biggrin.gif) ' => 'emoty/bigsmile.gif',
  13. ';d' => 'emoty/bigsmile.gif',
  14. ';D' => 'emoty/bigsmile.gif',
  15. ':emo:' => 'emoty/emo.gif',
  16. '(IMG:style_emoticons/default/haha.gif) ' => 'emoty/lol.gif',
  17. '(IMG:style_emoticons/default/questionmark.gif) ' => 'emoty/question.gif',
  18. 'o.O' => 'emoty/wtf.gif',
  19. ':*' => 'emoty/cmok.gif',
  20. ';)' => 'emoty/eyesmile.gif',
  21. '(IMG:style_emoticons/default/sleep.gif) ' => 'emoty/neu.gif',
  22. ':(' => 'emoty/sad.gif',
  23. ':F' => 'emoty/zab.gif',
  24. ':\'(' => 'emoty/dry.jpg',
  25. '^.^' => 'emoty/hih.gif',
  26. '(IMG:style_emoticons/default/ohmy.gif) ' => 'emoty/olaboga.gif',
  27. ':)' => 'emoty/smile.gif'
  28. );
  29.  
  30.  
  31.  
  32.  
  33. foreach($emotikony as $tekst => $grafika) {
  34. $text = str_replace($tekst,'<img src="'.$grafika.'" />',$text);
  35. }
  36.  
  37. return $text;
  38.  
  39. }


Ten post edytował Saki 3.06.2012, 13:41:35
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 19:40