JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Merge branch 'master' of /home/jason/dev/git/wfpl
authorJason <jason@parth.(none)>
Mon, 15 Sep 2008 21:45:31 +0000 (17:45 -0400)
committerJason <jason@parth.(none)>
Mon, 15 Sep 2008 21:45:31 +0000 (17:45 -0400)
1  2 
encode.php

diff --combined encode.php
@@@ -99,13 -99,25 +99,25 @@@ function enc_url_path($str) 
  #
  # Example: <input type="checkbox" name="foo~foo.checked~">
  function enc_checked($str) {
 -      if($str == 'Yes') {
 +      if($str && $str !== 'No' && $str !== 'False' && $str !== 'false') {
                return '" checked="checked';
        } else {
                return '';
        }
  }
  
+ # checkboxe values are stored in the db and handled in php as 0 or 1. When you
+ # want it displayed as "Yes" or "No" use this:
+ # Example: (displaying values from a form submission)  Over 60?: ~over_60.yesno~
+ function enc_yesno($str) {
+       if($str && $str !== 'No' && $str !== 'False' && $str !== 'false') {
+               return 'Yes';
+       } else {
+               return 'No';
+       }
+ }
  # add a tab at the begining of each non-empty line
  function enc_tab($str) {
        $lines = explode("\n", $str);