X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;fp=encode.php;h=4ef72aea5bde49e26a6f01e066b1d17b0254215d;hb=58634c046869454b074417a80cf5e35761ec9e8e;hp=7afae37c5508e304900ae035d7f241ddcf12ead2;hpb=cd68b6037f8558fd98e07486282e2a25f9c4626b;p=wfpl.git diff --git a/encode.php b/encode.php index 7afae37..4ef72ae 100644 --- a/encode.php +++ b/encode.php @@ -138,19 +138,12 @@ function enc_yesno($str) { } -# add a tab at the begining of each non-empty line +# add a tab at the begining of each line function enc_tab($str) { - $lines = explode("\n", $str); - $out = ''; - foreach($lines as $line) { - if($line) { - $out .= "\t$line"; - } - $out .= "\n"; + if('' . $str === '') { + return ''; } - - # remove the extra newline added above - return substr($out, 0, -1); + return "\t" . implode("\n\t", explode("\n", $str)); } function enc_upper($str) {