X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;h=43a8a2dd413682f9e99ab28a38d28a1debdfe3c8;hb=c483b6d8ab1f6aa89c0b5b82d44cc76d29e99a62;hp=f5c1e249e6c6b496fdacfe557ce6a651f8273faf;hpb=c39c09f1cbea5b19fea3b49adbe9b6dc311a1057;p=wfpl.git diff --git a/encode.php b/encode.php index f5c1e24..43a8a2d 100644 --- a/encode.php +++ b/encode.php @@ -1,19 +1,9 @@ . +# This program is in the public domain within the United States. Additionally, +# we waive copyright and related rights in the work worldwide through the CC0 +# 1.0 Universal public domain dedication, which can be found at +# http://creativecommons.org/publicdomain/zero/1.0/ # This file contains basic encodings. These are used by the encoder. You can @@ -74,7 +64,7 @@ function enc_htmlbr($str) { # Example:

~foo htmlbrtab~

function enc_htmlbrtab($str) { $str = enc_htmlbr($str); - $whitespace_to_nbsp = create_function('$matches', '$count = 0; $chars = str_split($matches[0]); foreach ($chars as $c) { if ($c == " ") { $count += 2; } else if ($c == "\t") { $count += 8; } } return str_repeat(" ", $count);'); + $whitespace_to_nbsp = create_function('$matches', '$count = 0; $chars = str_split($matches[0]); foreach ($chars as $c) { if ($c == " ") { $count += 1; } else if ($c == "\t") { $count += 8; } } return str_repeat(" ", $count);'); $str = preg_replace_callback("|^[ \t]+|m", $whitespace_to_nbsp, $str); return $str; } @@ -268,12 +258,12 @@ function pulldown($name, $in_options, $multiple = false) { # output a bunch of