Make WordPress Core

Ticket #10292: 10292.patch

File 10292.patch, 2.5 KB (added by hakre, 17 years ago)
  • wp-includes/functions.php

     
    32223222/**
    32233223 * Gives a nicely formatted list of timezone strings // temporary! Not in final
    32243224 *
    3225  * @param string $selectedzone - which zone should be the selected one
     3225 * @param $selected_zone string Selected Zone
    32263226 *
    32273227 */
    32283228function wp_timezone_choice( $selected_zone ) {
     
    32383238                $mo_loaded = true;
    32393239        }
    32403240
    3241         $zonen = array();
     3241        $zones = array();
    32423242        foreach ( timezone_identifiers_list() as $zone ) {
    32433243                $zone = explode( '/', $zone );
    32443244                if ( !in_array( $zone[0], $continents ) ) {
     
    32583258                $exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
    32593259                $exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
    32603260
    3261                 $zonen[] = array(
     3261                $zones[] = array(
    32623262                        'continent'   => ( $exists[0] ? $zone[0] : '' ),
    32633263                        'city'        => ( $exists[1] ? $zone[1] : '' ),
    32643264                        'subcity'     => ( $exists[2] ? $zone[2] : '' ),
     
    32673267                        't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
    32683268                );
    32693269        }
    3270         usort( $zonen, '_wp_timezone_choice_usort_callback' );
     3270        usort( $zones, '_wp_timezone_choice_usort_callback' );
    32713271
    32723272        $structure = array();
    32733273
     
    32753275                $structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
    32763276        }
    32773277
    3278         foreach ( $zonen as $key => $zone ) {
     3278        foreach ( $zones as $key => $zone ) {
    32793279                // Build value in an array to join later
    32803280                $value = array( $zone['continent'] );
    32813281
     
    32863286                        // It's inside a continent group
    32873287                       
    32883288                        // Continent optgroup
    3289                         if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
     3289                        if ( !isset( $zones[$key - 1] ) || $zones[$key - 1]['continent'] !== $zone['continent'] ) {
    32903290                                $label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
    32913291                                $structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
    32923292                        }
     
    33203320                $structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
    33213321               
    33223322                // Close continent optgroup
    3323                 if ( !empty( $zone['city'] ) && isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent'] ) {
     3323                if ( !empty( $zone['city'] ) && ( !isset($zones[$key + 1]) || (isset( $zones[$key + 1] ) && $zones[$key + 1]['continent'] !== $zone['continent']) ) ) {
    33243324                        $structure[] = '</optgroup>';
    33253325                }
    33263326        }