@@ -43,13 +43,15 @@ discard block |
||
43 | 43 | $notes = trim(mb_substr($lines[$x], 1)); |
44 | 44 | $codes = []; |
45 | 45 | $area = explode(',', $area); |
46 | - foreach ($area as $each_area) |
|
47 | - if (trim($each_area) != '' && trim($each_area) != '- no codes -') |
|
46 | + foreach ($area as $each_area) { |
|
47 | + if (trim($each_area) != '' && trim($each_area) != '- no codes -') |
|
48 | 48 | $codes[] = "'".trim($each_area)."'"; |
49 | + } |
|
49 | 50 | $street = explode(',', $street); |
50 | - foreach ($street as $each_street) |
|
51 | - if (trim($each_street) != '') |
|
51 | + foreach ($street as $each_street) { |
|
52 | + if (trim($each_street) != '') |
|
52 | 53 | $codes[] = "'".trim($each_street)."'"; |
54 | + } |
|
53 | 55 | $found[] = $iso; |
54 | 56 | echo " '$iso' => [" . str_replace(['N','A'], ['#', '@'], implode(", ", $codes)) . "]," . (sizeof($codes) == 0 ? ' ' : '') . " // $country" . (trim($notes) != '' ? ', Notes: '.$notes : '') . "\n"; |
55 | 57 | } |
@@ -57,9 +59,10 @@ discard block |
||
57 | 59 | $db = $GLOBALS['tf']->db; |
58 | 60 | $db->query("select * from country_t order by iso2;"); |
59 | 61 | while ($db->next_record(MYSQL_ASSOC)) { |
60 | - if (!in_array($db->Record['iso2'], $found)) |
|
61 | - echo " '{$db->Record['iso2']}' => [], // {$db->Record['short_name']}\n"; |
|
62 | -} |
|
62 | + if (!in_array($db->Record['iso2'], $found)) { |
|
63 | + echo " '{$db->Record['iso2']}' => [], // {$db->Record['short_name']}\n"; |
|
64 | + } |
|
65 | + } |
|
63 | 66 | exit; |
64 | 67 | |
65 | 68 | |
@@ -73,13 +76,15 @@ discard block |
||
73 | 76 | $notes = $matches['notes'][$idx]; |
74 | 77 | $codes = []; |
75 | 78 | $area = explode(',', $area); |
76 | - foreach ($area as $each_area) |
|
77 | - if (trim($each_area) != '' && trim($each_area) != '- no codes -') |
|
79 | + foreach ($area as $each_area) { |
|
80 | + if (trim($each_area) != '' && trim($each_area) != '- no codes -') |
|
78 | 81 | $codes[] = "'".trim($each_area)."'"; |
82 | + } |
|
79 | 83 | $street = explode(',', $street); |
80 | - foreach ($street as $each_street) |
|
81 | - if (trim($each_street) != '') |
|
84 | + foreach ($street as $each_street) { |
|
85 | + if (trim($each_street) != '') |
|
82 | 86 | $codes[] = "'".trim($each_street)."'"; |
87 | + } |
|
83 | 88 | echo " '$iso' => [" . implode(", ", $codes) . "] // $country" . (trim($notes) != '' ? ', Notes: '.$notes : '') . "\n"; |
84 | 89 | } |
85 | 90 | //$page = getcurlpage('https://en.wikipedia.org/wiki/List_of_postal_codes'); |
@@ -340,10 +340,11 @@ |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | public function getZipName($countryCode) { |
343 | - if (isset($this->zip_names[$countryCode])) |
|
344 | - $name = $this->zip_names[$countryCode]['name']; |
|
345 | - else |
|
346 | - $name = 'Postal Code'; |
|
343 | + if (isset($this->zip_names[$countryCode])) { |
|
344 | + $name = $this->zip_names[$countryCode]['name']; |
|
345 | + } else { |
|
346 | + $name = 'Postal Code'; |
|
347 | + } |
|
347 | 348 | return $name; |
348 | 349 | } |
349 | 350 | } |