Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r12508 r12412  
    33943394    static $mo_loaded = false;
    33953395
    3396     $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
     3396    $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc' );
    33973397
    33983398    // Load translations for continents and cities
     
    34083408        $zone = explode( '/', $zone );
    34093409        if ( !in_array( $zone[0], $continents ) ) {
     3410            continue;
     3411        }
     3412        if ( 'Etc' === $zone[0] && in_array( $zone[1], array( 'UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu' ) ) ) {
    34103413            continue;
    34113414        }
     
    34503453            // Continent optgroup
    34513454            if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
    3452                 $label = $zone['t_continent'];
     3455                $label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
    34533456                $structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
    34543457            }
     
    34563459            // Add the city to the value
    34573460            $value[] = $zone['city'];
    3458 
    3459             $display = $zone['t_city'];
    3460             if ( !empty( $zone['subcity'] ) ) {
    3461                 // Add the subcity to the value
    3462                 $value[] = $zone['subcity'];
    3463                 $display .= ' - ' . $zone['t_subcity'];
     3461            if ( 'Etc' === $zone['continent'] ) {
     3462                if ( 'UTC' === $zone['city'] ) {
     3463                    $display = '';
     3464                } else {
     3465                    $display = str_replace( 'GMT', '', $zone['city'] );
     3466                    $display = strtr( $display, '+-', '-+' ) . ':00';
     3467                }
     3468                $display = sprintf( __( 'UTC %s' ), $display );
     3469            } else {
     3470                $display = $zone['t_city'];
     3471                if ( !empty( $zone['subcity'] ) ) {
     3472                    // Add the subcity to the value
     3473                    $value[] = $zone['subcity'];
     3474                    $display .= ' - ' . $zone['t_subcity'];
     3475                }
    34643476            }
    34653477        }
     
    34793491    }
    34803492
    3481     // Do UTC
    3482     $structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
    3483     $selected = '';
    3484     if ( 'UTC' === $selected_zone )
    3485         $selected = 'selected="selected" ';
    3486     $structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
    3487     $structure[] = '</optgroup>';
    3488 
    3489     // Do manual UTC offsets
    3490     $structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">';
    3491     $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
    3492         0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
    3493     foreach ( $offset_range as $offset ) {
    3494         if ( 0 <= $offset )
    3495             $offset_name = '+' . $offset;
    3496         else
    3497             $offset_name = (string) $offset;
    3498 
    3499         $offset_value = $offset_name;
    3500         $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
    3501         $offset_name = 'UTC' . $offset_name;
    3502         $offset_value = 'UTC' . $offset_value;
    3503         $selected = '';
    3504         if ( $offset_value === $selected_zone )
    3505             $selected = 'selected="selected" ';
    3506         $structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
    3507        
    3508     }
    3509     $structure[] = '</optgroup>';
    3510 
    35113493    return join( "\n", $structure );
    35123494}
Note: See TracChangeset for help on using the changeset viewer.