From: Jason Woofenden Date: Thu, 1 Mar 2007 06:00:50 +0000 (-0500) Subject: added enc_url_val() UNTESTED X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=409b78be52f7a934a0cbfe0d927b7e0b42d60ec4 added enc_url_val() UNTESTED --- diff --git a/encode.php b/encode.php index 7d4700f..ab2c271 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';