JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fixed conflict
[wfpl.git] / format.php
index a0e2f85..cf59504 100644 (file)
@@ -26,10 +26,14 @@ function format_int($str) {
        return ereg_replace('^0*([1-9])', '\1', $str);
 }
 
+function format_zip($str) {
+       return ereg_replace('[^0-9]', '', $str);
+}
+
 function format_filename($str) {
        $str = strtolower($str);
-       $str = ereg_replace('[^a-z0-9_.-]', '_', $str);
-       return ereg_replace('^[0-9.-]*', '', $str);
+       $str = ereg_replace('[^a-z0-9_.]', '_', $str);
+       return ereg_replace('^[.]*', '', $str);
 }
 
 function format_varname($str) {
@@ -48,10 +52,10 @@ function format_unix($str) {
 }
 
 function format_yesno($str) {
-       if($str) {
-               return "Yes";
+       if($str && $str != 'No') {
+               return 'Yes';
        } else {
-               return "No";
+               return 'No';
        }
 }