- $zonen[$i]['continent'] = isset($zone[0]) ? $zone[0] : '';
- $zonen[$i]['city'] = isset($zone[1]) ? $zone[1] : '';
- $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
- $i++;
- }
-
- usort($zonen, create_function(
- '$a, $b', '
- $t = create_function(\'$s\', \'return translate(str_replace("_", " ", $s), "continents-cities");\');
- $a_continent = $t($a["continent"]);
- $b_continent = $t($b["continent"]);
- $a_city = $t($a["city"]);
- $b_city = $t($b["city"]);
- $a_subcity = $t($a["subcity"]);
- $b_subcity = $t($b["subcity"]);
- if ( $a_continent == $b_continent && $a_city == $b_city )
- return strnatcasecmp($a_subcity, $b_subcity);
- elseif ( $a_continent == $b_continent )
- return strnatcasecmp($a_city, $b_city);
- else
- return strnatcasecmp($a_continent, $b_continent);
- '));
-
- $structure = '';
- $pad = ' ';
-
- if ( empty($selectedzone) )
- $structure .= '<option selected="selected" value="">' . __('Select a city') . "</option>\n";
- foreach ( $zonen as $zone ) {
- extract($zone);
- if ( empty($selectcontinent) && !empty($city) ) {
- $selectcontinent = $continent;
- $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
- } elseif ( !empty($selectcontinent) && $selectcontinent != $continent ) {
- $structure .= "</optgroup>\n";
- $selectcontinent = '';
- if ( !empty($city) ) {
- $selectcontinent = $continent;
- $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
- }