X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;h=a4c458758e5c010e7c0c06081b5a34ce4f3105b0;hb=74fac1cb550d6a337c67cabdcfae4ad26e34f422;hp=7d4700f7dcac0045f59adc71fcbfbbb3d01e04a9;hpb=22d5fb7ab7d4ee86bd59e194387dca268bd577a1;p=wfpl.git diff --git a/encode.php b/encode.php index 7d4700f..a4c4587 100644 --- a/encode.php +++ b/encode.php @@ -34,7 +34,9 @@ function enc_sql($str) { return $str; } -# encode for output in html. does nothing with whitespace +# Encode for output in html. does nothing with whitespace +# +# Example:

~foo.html~

function enc_html($str) { $str = str_replace('&', '&', $str); $str = str_replace('<', '<', $str); @@ -43,14 +45,27 @@ function enc_html($str) { } -# html attributes (eg function enc_attr($str) { $str = str_replace('&', '&', $str); $str = str_replace('"', '"', $str); return $str; } -# this is a stupid hack to work around html's stupid syntax for checkboxes +# URI agument value. +# +# Example: http://example.com?foo=~foo.url_val~ +function enc_url_val($str) { + return rawurlencode($str); +} + +# This is a hack to work around html's stupid syntax for checkboxes. +# +# Place the template marker just before a " somewhere. +# +# Example: function enc_checked($str) { if($str == 'Yes') { return '" checked="checked'; @@ -74,4 +89,20 @@ function enc_tab($str) { return substr($out, 0, -1); } + +# display