Advertisement
Guest User

Untitled

a guest
Feb 24th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. function parse_message($text)
  2. {
  3. global $pun_config, $lang_common, $pun_user;
  4. $text = pun_htmlspecialchars($text);
  5. if ($pun_config['o_censoring'] == '1')
  6. $text = censor_words($text);
  7.  
  8. // Convert applicable characters to HTML entities
  9.  
  10.  
  11. // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched)
  12. if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false)
  13. list($inside, $text) = extract_blocks($text, '[code]', '[/code]');
  14.  
  15. // Deal with newlines, tabs and multiple spaces
  16. $pattern = array("\n", "\t", ' ', ' ');
  17. $replace = array('<br />', '&#160; &#160; ', '&#160; ', ' &#160;');
  18. $text = str_replace($pattern, $replace, $text);
  19. $text = preg_replace( "#\[img\](.+?)\[/img\]#ie" , "\\regex_check_image('\\1')" , $text );
  20. //end Dirties
  21.  
  22. return clean_paragraphs($text);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement