JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
metaform capitalizes default captions, added tem::load_str()
[wfpl.git] / format.php
index a513722..8979b26 100644 (file)
 
 # This file contains basic encodings
 
+function format_caption($str) {
+       $str = ucwords($str);
+       return str_replace('Email', 'E-mail', $str);
+}
+
 function format_int($str) {
        $str = ereg_replace('[^0-9]', '', $str);
        return ereg_replace('^0*([1-9])', '\1', $str);
@@ -32,8 +37,8 @@ function format_zip($str) {
 
 function format_filename($str) {
        $str = strtolower($str);
-       $str = ereg_replace('[^a-z0-9_.]', '_', $str);
-       return ereg_replace('^[.]*', '', $str);
+       $str = ereg_replace('[^a-z0-9_.-]', '_', $str);
+       return ereg_replace('^[.-]', '_', $str);
 }
 
 function format_varname($str) {
@@ -52,10 +57,10 @@ function format_unix($str) {
 }
 
 function format_yesno($str) {
-       if($str) {
-               return "Yes";
+       if($str && $str != 'No') {
+               return 'Yes';
        } else {
-               return "No";
+               return 'No';
        }
 }