diff --git a/system/base.php b/system/base.php index 332994f..6399a2c 100644 --- a/system/base.php +++ b/system/base.php @@ -54,7 +54,7 @@ if(!function_exists("cut_str")) { } } -if(!function_exists('read_file_by_line')) { +if(!function_exists("read_file_by_line")) { function read_file_by_line($filename) { $lines = array(); $handle = fopen($filename, "r"); @@ -69,3 +69,15 @@ if(!function_exists('read_file_by_line')) { return $lines; } } + +if(!function_exists("nl2p")) { + function nl2p($string) { + $paragraphs = ''; + foreach (explode("\n", $string) as $line) { + if (trim($line)) { + $paragraphs .= '
' . $line . '
'; + } + } + return $paragraphs; + } +}