| @@ 581-605 (lines=25) @@ | ||
| 578 | return false; |
|
| 579 | } |
|
| 580 | ||
| 581 | public static function geoip2_country_record( $ip_address ) { |
|
| 582 | try { |
|
| 583 | $reader = self::geoip2_country_reader(); |
|
| 584 | ||
| 585 | if ( $reader ) { |
|
| 586 | $record = $reader->country( $ip_address ); |
|
| 587 | ||
| 588 | if ( !empty( $record->country->isoCode ) ) { |
|
| 589 | return $record; |
|
| 590 | } |
|
| 591 | } |
|
| 592 | } catch(\InvalidArgumentException $e) { |
|
| 593 | wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' ); |
|
| 594 | ||
| 595 | return false; |
|
| 596 | } catch(\GeoIp2\Exception\AddressNotFoundException $e) { |
|
| 597 | wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' ); |
|
| 598 | ||
| 599 | return false; |
|
| 600 | } catch( Exception $e ) { |
|
| 601 | return false; |
|
| 602 | } |
|
| 603 | ||
| 604 | return false; |
|
| 605 | } |
|
| 606 | ||
| 607 | public static function geoip2_city_record( $ip_address ) { |
|
| 608 | try { |
|
| @@ 607-631 (lines=25) @@ | ||
| 604 | return false; |
|
| 605 | } |
|
| 606 | ||
| 607 | public static function geoip2_city_record( $ip_address ) { |
|
| 608 | try { |
|
| 609 | $reader = self::geoip2_city_reader(); |
|
| 610 | ||
| 611 | if ( $reader ) { |
|
| 612 | $record = $reader->city( $ip_address ); |
|
| 613 | ||
| 614 | if ( !empty( $record->country->isoCode ) ) { |
|
| 615 | return $record; |
|
| 616 | } |
|
| 617 | } |
|
| 618 | } catch(\InvalidArgumentException $e) { |
|
| 619 | wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' ); |
|
| 620 | ||
| 621 | return false; |
|
| 622 | } catch(\GeoIp2\Exception\AddressNotFoundException $e) { |
|
| 623 | wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' ); |
|
| 624 | ||
| 625 | return false; |
|
| 626 | } catch( Exception $e ) { |
|
| 627 | return false; |
|
| 628 | } |
|
| 629 | ||
| 630 | return false; |
|
| 631 | } |
|
| 632 | ||
| 633 | public static function geoip2_country_code( $ip_address ) { |
|
| 634 | $record = self::geoip2_country_record( $ip_address ); |
|