Guest User

Untitled

a guest
Oct 17th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.04 KB | None | 0 0
  1.  function umwandeln($content, $br = 0)
  2.  
  3. {
  4.  
  5. $content = mb_convert_encoding($content, "ISO-8859-1");
  6.  
  7. $content = str_replace("Ãœ","Ü",$content);
  8.  
  9. $content = str_replace("ü","ü",$content);
  10.  
  11. $content = str_replace("Ä","Ä",$content);
  12.  
  13. $content = str_replace("ä","ä",$content);
  14.  
  15. $content = str_replace("ö","ö",$content);
  16.  
  17. $content = str_replace("Ö","Ö",$content);
  18.  
  19. $content = str_replace("ß","ß",$content);
  20.  
  21. $content = str_replace("Ãœ","Ü",$content);
  22.  
  23. $content = str_replace("ü","ü",$content);
  24.  
  25. $content = str_replace("Ä","Ä",$content);
  26.  
  27. $content = str_replace("ä","ä",$content);
  28.  
  29. $content = str_replace("ö","ö",$content);
  30.  
  31. $content = str_replace("Ã","Ö",$content);
  32.  
  33. $content = str_replace("ß","ß",$content);
  34.  
  35. $content = str_replace("ÖŸ","ß",$content);
  36.  
  37. $content = str_replace("§","§",$content);
  38. $content = str_replace("Ä","Ä",$content);
  39. $content = str_replace("ä","ä",$content);
  40. $content = str_replace("ö","ö",$content);
  41. $content = str_replace("Ö","Ö",$content);
  42. $content = str_replace("ü","ü",$content);
  43. $content = str_replace("Ü","Ü",$content);
  44. $content = str_replace("ß","ß",$content);
  45.  
  46. //BB-Codes in verschiedenen Variationen
  47.  
  48.  
  49.  
  50.   $pattern = '&<code>(.*)</code>&isU';
  51.  
  52.   $result = preg_match_all($pattern, $content, $subpattern);
  53.  
  54. $i = 0;
  55.  
  56.  
  57.  
  58. while($subpattern["1"][$i] != "")
  59.  
  60. { $subpattern["1"][$i] = str_replace("\r\n","\n",$subpattern["1"][$i]);
  61.  
  62.    $subpattern["1"][$i] = str_replace("\r","\n",$subpattern["1"][$i]);
  63.  
  64.  
  65.  
  66.     $zeilen = explode("\n",$subpattern["1"][$i]);
  67.  
  68.     $count = count($zeilen);
  69.  
  70. $subpattern["1"][$i] = nl2br($subpattern["1"][$i]);
  71.  
  72. $count = $count - 1;
  73.  
  74. $c = 0;
  75.  
  76. while($count >= $c)
  77.  
  78. { $c++;
  79.  
  80. $lines = $lines."$c <br />";
  81.  
  82. }
  83.  
  84. $end = '<div id="quellcode">
  85.  
  86.  
  87.  
  88.  <div id="lines">     '.$lines.' </div> <div id="code">';
  89.  
  90. $end = $end.$subpattern["1"][$i].'</div></div><div id="nofloat"></div>';
  91.  
  92. $end = str_replace("EndSub","<b>EndSub</b>",$end);
  93.  
  94. $end = str_replace("EndFor","<b>EndFor</b>",$end);
  95.  
  96. $end = str_replace("EndWhile","<b>EndWhile</b>",$end);
  97.  
  98. $end = str_replace("while","<b>while</b>",$end);
  99.  
  100. $end = str_replace("if","<b>if</b>",$end);
  101.  
  102. $end = str_replace("EndIf","<b>EndWhile</b>",$end);
  103.  
  104. $end = str_replace("Then","<b>Then</b>",$end);
  105.  
  106. $end = str_replace("Else","<b>Else</b>",$end);
  107.  
  108. $end = str_replace("For","<b>For</b>",$end);
  109.  
  110. $end = str_replace("To","<b>To</b>",$end);
  111.  
  112. $end = str_replace("Goto","<b>Goto</b>",$end);
  113.  
  114. $end = str_replace("Sub","<b>Sub</b>",$end);
  115.  
  116. $content = str_replace($subpattern["0"][$i],$end,$content);
  117.  
  118. $lines = "";
  119.  
  120. $i++;
  121.  
  122. }
  123.  
  124. $content=preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $content);
  125.  
  126. $content=preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $content);
  127.  
  128. $content=preg_replace("/\[s\](.*?)\[\/s\]/si", "<s>\\1</s>", $content);
  129.  
  130. $content=preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>", $content);
  131.  
  132. $content=preg_replace("/\[link\](.*?)\[\/link\]/si", "<a href='\\1'>\\1</a>", $content);
  133.  
  134. $content=preg_replace("/\[url\](.*?)\[\/url\]/si", "<a href='\\1'>\\1</a>", $content);
  135.  
  136. $content=preg_replace("/\[url=(.*?)/si", "<a href=\"\\1", $content);
  137.  
  138. $content=preg_replace("/\](.*?)\[\/url\]/si", "\">\\1</a>", $content);
  139.  
  140. $content=preg_replace("/\[link=(.*?)/si", "<a href=\"\\1", $content);
  141.  
  142. $content=preg_replace("/\](.*?)\[\/link\]/si", "\">\\1</a>", $content);
  143.  
  144. $content=preg_replace("/\[img\](.*?)\[\/img\]/si", "<img src=\"\\1\" />", $content);
  145.  
  146. //Messageboxen
  147.  
  148. $content=preg_replace("/\[message=red\](.*?)\[\/message\]/si",$this->message("\\1", "red"), $content);
  149.  
  150. $content=preg_replace("/\[message=yellow\](.*?)\[\/message\]/si",$this->message("\\1", "yellow"), $content);
  151.  
  152. $content=preg_replace("/\[message=green\](.*?)\[\/message\]/si",$this->message("\\1", "green"), $content);
  153.  
  154. //n in br konverten
  155.  
  156. if($br == "1")
  157.  
  158. {
  159.  
  160. $content = nl2br($content);
  161.  
  162. }
  163.  
  164.  
  165.  
  166.  
  167.  
  168. return $content;
  169.  
  170. }
Add Comment
Please, Sign In to add comment