forked from jdorn/php-reports
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote logic for creating list of chart rows
- Loading branch information
Showing
4 changed files
with
86 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
<?php | ||
class geoipFilter extends FilterBase { | ||
public static function filter($value, $options = array(), $report=null) { | ||
$record = @geoip_record_by_name($value); | ||
$record = geoip_record_by_name($value['raw_value']); | ||
|
||
if($record) { | ||
$value = $record['city']; | ||
$value['value'] = $record['city']; | ||
if($record['country_code'] !== 'US') { | ||
$value .= ' '.$record['country_name']; | ||
$value['value'] .= ' '.$record['country_name']; | ||
} | ||
else { | ||
$value .= ', '.$record['region']; | ||
$value['value'] .= ', '.$record['region']; | ||
} | ||
$value['chartval'] = array('Latitude'=>$record['latitude'],'Longitude'=>$record['longitude'],'Location'=>$value['value']); | ||
} | ||
else { | ||
$value['chartval'] = array('Latitude'=>0, 'Longitude'=>0, 'Location'=>'Unknown'); | ||
} | ||
|
||
return trim($value); | ||
|
||
$value['value'] = trim($value['value']); | ||
|
||
return $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters