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:
5ee58fc
)
added: enc_cap(), enc_htmlbrtab()
author
Jason Woofenden
<jason283@herkamire.com>
Tue, 9 Dec 2008 19:05:40 +0000
(14:05 -0500)
committer
Jason Woofenden
<jason283@herkamire.com>
Tue, 9 Dec 2008 19:05:40 +0000
(14:05 -0500)
encode.php
patch
|
blob
|
history
diff --git
a/encode.php
b/encode.php
index
db0cde3
..
11d60db
100644
(file)
--- a/
encode.php
+++ b/
encode.php
@@
-23,6
+23,10
@@
# will encode foo (using enc_html()) before displaying it, so that characters
# such as < will display properly.
# will encode foo (using enc_html()) before displaying it, so that characters
# such as < will display properly.
+function enc_cap($str) {
+ $str = ucfirst($str);
+ return $str;
+}
function enc_jsdq($str) {
$str = enc_sql($str);
function enc_jsdq($str) {
$str = enc_sql($str);
@@
-49,13
+53,24
@@
function enc_html($str) {
# Encode for output in html. Convert newlines to <br />
#
# Encode for output in html. Convert newlines to <br />
#
-# Example: <p>~foo.html~</p>
+# Example: <p>~foo.htmlbr~</p>
function enc_htmlbr($str) {
$str = enc_html($str);
$str = str_replace("\n", "<br />\n", $str);
return $str;
}
function enc_htmlbr($str) {
$str = enc_html($str);
$str = str_replace("\n", "<br />\n", $str);
return $str;
}
+# Encode for output in html. Preserves newlines and indentation by converting
+# newlines to <br /> and spaces at the begining of lines to
+#
+# Example: <p>~foo.htmlbrtab~</p>
+function enc_htmlbrtab($str) {
+ $str = enc_htmlbr($str);
+ $space_to_nbsp = create_function('$matches', 'return str_repeat(\' \', strlen($matches[0]) * 2);');
+ $str = preg_replace_callback("|^ *|m", $space_to_nbsp, $str);
+ return $str;
+}
+
# Encode for output in html. Spaces converted to
#
# Example: <option value="12">~foo.htmlnbsp~</option>
# Encode for output in html. Spaces converted to
#
# Example: <option value="12">~foo.htmlnbsp~</option>