X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;h=d37d1fa561b137e842093357f9484769a5d124c8;hb=4592989440cf123fa19dcadbe3e89015f48545e5;hp=123fcc9c47af4b0b45b89a1dc2257f52e7e38d0b;hpb=6c27f346217f7b4b8b24064371f2461cf57c6167;p=wfpl.git diff --git a/encode.php b/encode.php index 123fcc9..d37d1fa 100644 --- a/encode.php +++ b/encode.php @@ -50,7 +50,7 @@ function enc_html($str) { return $str; } -# Encode for output in html. converts \n to
+# Encode for output in html. Convert newlines to
# # Example:

~foo.html~

function enc_htmlbr($str) { @@ -59,6 +59,15 @@ function enc_htmlbr($str) { return $str; } +# Encode for output in html. Spaces converted to   +# +# Example: +function enc_htmlnbsp($str) { + $str = enc_html($str); + $str = str_replace(' ', ' ', $str); + return $str; +} + # HTML attribute. # @@ -116,43 +125,45 @@ function enc_upper($str) { return strtoupper($str); } -function enc_ddmmyyyyhhmm($seconds) { +# pass date in the form 2008-05-23 +# ercodes date as 05/23/2008 +function enc_mmddyyyy($yyyy_mm_dd) { + if(strlen($yyyy_mm_dd) != 10) { + return date('m/d/Y'); + } + return substr($yyyy_mm_dd, 5, 2) . '/' . substr($yyyy_mm_dd, 8, 2) . '/' . substr($yyyy_mm_dd, 0, 4); +} + +function enc_mmddyyyyhhmm($seconds) { return date('m/d/Y g:ia', (int)$seconds); } -# display