This commit is contained in:
Jared Johnson 2015-01-14 16:17:04 -06:00
parent 029db84771
commit 9450c21c06

View File

@ -350,10 +350,10 @@ sub set_country_code {
sub get_country_code {
my $self = shift;
my $ip = shift || $self->qp->connection->remote_ip;
if ( $self->{_geoip_city} ) {
if ($self->{_geoip_city}) {
return $self->get_country_code_gc($ip);
}
if ( $self->{_geoip} ) {
if ($self->{_geoip}) {
return $self->{_geoip}->country_code_by_addr($ip);
}
return undef;
@ -378,10 +378,10 @@ sub set_country_name {
sub get_country_name {
my $self = shift;
my $ip = shift || $self->qp->connection->remote_ip;
if ( $self->{_geoip_city} ) {
if ($self->{_geoip_city}) {
return $self->get_country_name_gc($ip);
}
if ( $self->{_geoip} ) {
if ($self->{_geoip}) {
return $self->{_geoip}->country_name_by_addr($ip);
}
return undef;
@ -395,19 +395,19 @@ sub get_country_name_gc {
sub set_continent {
my ($self, $country_code) = @_;
return if ! $country_code;
return if !$country_code;
my $continent = $self->get_continent($country_code) or return;
$self->qp->connection->notes('geoip_continent', $continent);
return $continent;
}
sub get_continent {
my ( $self, $country_code ) = @_;
return if ! $country_code;
if ( $self->{_geoip_city} ) {
my ($self, $country_code) = @_;
return if !$country_code;
if ($self->{_geoip_city}) {
return $self->get_continent_gc();
}
if ( $self->{_geoip} ) {
if ($self->{_geoip}) {
return $self->{_geoip}->continent_code_by_country_code($country_code);
}
return undef;