Skip to content

Commit

Permalink
feat: update scripts to add nationality
Browse files Browse the repository at this point in the history
  • Loading branch information
dr5hn committed Aug 11, 2023
1 parent 27d48b8 commit 3e728d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions scripts/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$countriesArray[$m]['native'] = $row['native'];
$countriesArray[$m]['region'] = $row['region'];
$countriesArray[$m]['subregion'] = $row['subregion'];
$countriesArray[$m]['nationality'] = $row['nationality'];
$countriesArray[$m]['timezones'] = json_decode($row['timezones'], true);
$countriesArray[$m]['translations'] = json_decode($row['translations'], true);
$countriesArray[$m]['latitude'] = $row['latitude'];
Expand Down Expand Up @@ -68,6 +69,7 @@
$countryStateCityArray[$k]['native'] = $country['native'];
$countryStateCityArray[$k]['region'] = $country['region'];
$countryStateCityArray[$k]['subregion'] = $country['subregion'];
$countryStateCityArray[$k]['nationality'] = $country['nationality'];
$countryStateCityArray[$k]['timezones'] = $country['timezones'];
$countryStateCityArray[$k]['translations'] = $country['translations'];
$countryStateCityArray[$k]['latitude'] = $country['latitude'];
Expand Down Expand Up @@ -182,6 +184,7 @@
$countryStateArray[$k]['native'] = $country['native'];
$countryStateArray[$k]['region'] = $country['region'];
$countryStateArray[$k]['subregion'] = $country['subregion'];
$countryStateArray[$k]['nationality'] = $country['nationality'];
$countryStateArray[$k]['timezones'] = $country['timezones'];
$countryStateArray[$k]['translations'] = $country['translations'];
$countryStateArray[$k]['latitude'] = $country['latitude'];
Expand Down
2 changes: 1 addition & 1 deletion scripts/export_csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// Loop through the associative array.
foreach ($csc as $row) :
// Update timezones to make readable
if(is_array($row['timezones']) && !empty($row['timezones'])) {
if(!empty($row['timezones'])) {
$row['timezones'] = json_encode($row['timezones']);
$row['timezones'] = preg_replace('/"/', "'", $row['timezones']);
$row['timezones'] = preg_replace("/'([a-zA-Z]+[a-zA-Z0-9_]*)':/", '$1:', $row['timezones']);
Expand Down

0 comments on commit 3e728d2

Please sign in to comment.