Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Parses [code] [/code] in a post, private message or signature.
- *
- * @since version 2.0
- * @param string $text The text to parse.
- * @return string Returns the parsed string.
- */
- function parse_code($text)
- {
- $ubb = array('[code]', '[/code]');
- $html = array('<pre>', '</pre>');
- $text = str_ireplace($ubb, $html, $text);
- preg_match_all('`\<pre\>(.+?)\<\/pre\>`', $text, $matches);
- foreach($matches[0] as $x => $value)
- {
- $temp = str_replace("<br />", "", $value);
- $temp = str_replace("\t", " ", $temp);
- $text = str_replace($value, $temp, $text);
- }
- return $text;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement