X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;h=fd282b75af7754ebc62e98f93927f17239791c08;hb=414082e3e11cee010f869633733eccb4f2161153;hp=c09de2aaed042b8b81556230107ad09236db88e8;hpb=196deb2416748b09200f620247a344563dff4c38;p=wfpl.git diff --git a/encode.php b/encode.php index c09de2a..fd282b7 100644 --- a/encode.php +++ b/encode.php @@ -74,7 +74,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; } @@ -444,12 +444,12 @@ function wfpl_nth_word($str, $n) { # encoding is a space separated list of: # image_filename width height thumb_filename thumb_width thumb_height -function enc_image_src($str) { wfpl_nth_word($str, 0); } -function enc_image_width($str) { wfpl_nth_word($str, 1); } -function enc_image_height($str) { wfpl_nth_word($str, 2); } -function enc_thumb_src($str) { wfpl_nth_word($str, 3); } -function enc_thumb_width($str) { wfpl_nth_word($str, 4); } -function enc_thumb_height($str) { wfpl_nth_word($str, 5); } +function enc_image_src($str) { return wfpl_nth_word($str, 0); } +function enc_image_width($str) { return wfpl_nth_word($str, 1); } +function enc_image_height($str) { return wfpl_nth_word($str, 2); } +function enc_thumb_src($str) { return wfpl_nth_word($str, 3); } +function enc_thumb_width($str) { return wfpl_nth_word($str, 4); } +function enc_thumb_height($str) { return wfpl_nth_word($str, 5); } # example template: Length: ~length html~ day~length s~ function enc_s($str) {