Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function nl2pX($string) {
- $paragraphs = "";
- $pattern = array('<div class="row">', '<div>', '</div>', '<h1>', '</h1>', '<h2>', '</h2>', '<h3>', '</h3>', '<h4>', '</h4>', '<strong>', '</strong>', '<table class="center">', '<table>', '</table>', '<th>', '</th>', '<tr>', '</tr>', '<td>', '</td>', '<pre>', '</pre>', '<script>', '</script>', '<link>', '<code>', '</code>' );
- foreach (explode("\n", $string) as $line) {
- if (trim($line)) {
- $match = (str_replace($pattern, '', $line) != $line);
- if ($match == "1") {
- $paragraphs .= "{$line}\n";
- } else {
- $paragraphs .= "{$line}<br>\n";
- }
- }
- }
- return $paragraphs;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement