Exposed user and url fields to shop vendors.

This commit is contained in:
JT Smith 2008-08-07 17:18:59 +00:00
parent ab1c20fa8f
commit 93a6dc0568
5 changed files with 38 additions and 19 deletions

View file

@ -90,16 +90,24 @@ sub getValue {
my $self = shift;
my $value = $self->SUPER::getValue(@_);
$value =~ tr/\r\n//d;
if ($value =~ /mailto:/) {
return $value;
}
elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
return "mailto:".$value;
}
elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
return $value;
}
return "http://".$value;
# empty
if ($value eq "" || $value =~ m{^http://$}i) {
return undef;
}
# proper email url
elsif ($value =~ /mailto:/) {
return $value;
}
# improper email url
elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
return "mailto:".$value;
}
# proper web url
elsif ($value =~ /^\// || $value =~ /:\/\// || $value =~ /^\^/) {
return $value;
}
# improper web url
return "http://".$value;
}
#-------------------------------------------------------------------