Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
wfpl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d03e855
)
added enc_url_val() UNTESTED
author
Jason Woofenden
<jason183@herkamire.com>
Thu, 1 Mar 2007 06:00:50 +0000
(
01:00
-0500)
committer
Jason Woofenden
<jason183@herkamire.com>
Thu, 1 Mar 2007 06:00:50 +0000
(
01:00
-0500)
encode.php
patch
|
blob
|
history
diff --git
a/encode.php
b/encode.php
index
7d4700f
..
ab2c271
100644
(file)
--- a/
encode.php
+++ b/
encode.php
@@
-34,7
+34,9
@@
function enc_sql($str) {
return $str;
}
return $str;
}
-# encode for output in html. does nothing with whitespace
+# Encode for output in html. does nothing with whitespace
+#
+# Example: <p>~foo.html~</p>
function enc_html($str) {
$str = str_replace('&', '&', $str);
$str = str_replace('<', '<', $str);
function enc_html($str) {
$str = str_replace('&', '&', $str);
$str = str_replace('<', '<', $str);
@@
-43,14
+45,27
@@
function enc_html($str) {
}
}
-# html attributes (eg <input value="...."
+# HTML attribute.
+#
+# Example: <input name="foo" value="~foo.attr~">
function enc_attr($str) {
$str = str_replace('&', '&', $str);
$str = str_replace('"', '"', $str);
return $str;
}
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: <a href="http://example.com?foo=~foo.url_val.attr~">http://example.com?foo=~foo.url_val~</a>
+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: <input type="checkbox" name="foo~foo.checked~">
function enc_checked($str) {
if($str == 'Yes') {
return '" checked="checked';
function enc_checked($str) {
if($str == 'Yes') {
return '" checked="checked';