Update string.utils.php

This commit is contained in:
Namhyeon Go 2020-02-21 13:53:12 +09:00 committed by GitHub
parent 6ccdb2d1b5
commit adcfbd2e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,9 +60,9 @@ if(!is_fn("get_converted_string")) {
} }
if(!is_fn("nl2p")) { if(!is_fn("nl2p")) {
function nl2p($string) { function nl2p($str) {
$paragraphs = ''; $paragraphs = "";
foreach (explode("\n", $string) as $line) { foreach(explode_by_line($str) as $line) {
if(trim($line)) { if(trim($line)) {
$paragraphs .= '<p>' . $line . '</p>'; $paragraphs .= '<p>' . $line . '</p>';
} }
@ -73,7 +73,7 @@ if(!is_fn("nl2p")) {
if(!is_fn("br2nl")) { if(!is_fn("br2nl")) {
function br2nl($string) { function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string); return preg_replace('/\<br(\s*)?\/?\>/i', DOC_EOL, $string);
} }
} }