JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
make unit test results look good
[wfpl.git] / format.php
index 0058a44..0fbc88f 100644 (file)
@@ -24,27 +24,12 @@ function format_caption($str) {
        return str_replace('Email', 'E-mail', $str);
 }
 
-# This function makes sure that $str is in the list of options, and returns "" otherwise
-function format_options($str, $name) {
-       if(!isset($GLOBALS[$name . '_options'])) {
-               die("Couldn't find options for \"$name\". Be sure to call pulldown().");
-       }
-
-       foreach($GLOBALS[$name . '_options']['options'] as $keyval) {
-               list($key, $value) = $keyval;
-               if($str == $key) {
-                       return $str;
-               }
-       }
-
-       return $str;
-}
-
 function format_int($str) {
        $str = ereg_replace('[^0-9]', '', $str);
        return ereg_replace('^0*([0-9])', '\1', $str);
 }
 
+# format the digits after the decimal point
 function format_decimals($str) {
        $str = ereg_replace('[^0-9]', '', $str);
        if(strlen($str)) {
@@ -99,6 +84,7 @@ function format_int_0($str) {
        return $str;
 }
 
+# USA zip codes
 function format_zip($str) {
        $str = ereg_replace('[^0-9]', '', $str);
        if(strlen($str) > 5) {
@@ -290,6 +276,7 @@ function format_dollars($str) {
 
 # date is edited as mm/dd/yyyy but stored as yyyy-mm-dd
 function format_mdy_to_ymd($str) {
+       if($str == '') return '';
        require_once('code/wfpl/time.php');
        return mdy_to_ymd(format_oneline($str));
 }