die("Couldn't find options for \"$name\". Be sure to call pulldown().");
}
- if(!in_array($str, array_keys($GLOBALS[$name . '_options']['options']))) {
- return '';
+ 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*([1-9])', '\1', $str);
+ return ereg_replace('^0*([0-9])', '\1', $str);
}
function format_decimal($str) {
function format_email($str) {
# FIXME
- return format_oneline($str);
+ return trim(format_oneline($str));
}
function format_url($str) {
return format_money($str, false);
}
+# date is edited as mm/dd/yyyy but stored as yyyy-mm-dd
+function format_mdy_to_ymd($str) {
+ return mdy_to_ymd(format_oneline($str));
+}
+
function format_phone($str) {
$str = ereg_replace('[^0-9]', '', $str);
$str = ereg_replace('^1*', '', $str);