4536 | | // Do manual UTC offsets |
4537 | | $structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">'; |
4538 | | $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, |
4539 | | 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); |
4540 | | foreach ( $offset_range as $offset ) { |
4541 | | if ( 0 <= $offset ) |
4542 | | $offset_name = '+' . $offset; |
4543 | | else |
4544 | | $offset_name = (string) $offset; |
| 4551 | /** |
| 4552 | * Filters if the UTC option are shown in the timezone dropdown. |
| 4553 | * |
| 4554 | * @since 4.6 |
| 4555 | * |
| 4556 | * @param Bool true to show. |
| 4557 | */ |
| 4558 | if( true === apply_filters( 'show_utc_offsets', empty( get_option('timezone_string') ) ) ) { |
| 4559 | // Do manual UTC offsets |
| 4560 | $structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">'; |
| 4561 | $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, |
| 4562 | 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); |
| 4563 | foreach ( $offset_range as $offset ) { |
| 4564 | if ( 0 <= $offset ) |
| 4565 | $offset_name = '+' . $offset; |
| 4566 | else |
| 4567 | $offset_name = (string) $offset; |
4546 | | $offset_value = $offset_name; |
4547 | | $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name); |
4548 | | $offset_name = 'UTC' . $offset_name; |
4549 | | $offset_value = 'UTC' . $offset_value; |
4550 | | $selected = ''; |
4551 | | if ( $offset_value === $selected_zone ) |
4552 | | $selected = 'selected="selected" '; |
4553 | | $structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>"; |
| 4569 | $offset_value = $offset_name; |
| 4570 | $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name); |
| 4571 | $offset_name = 'UTC' . $offset_name; |
| 4572 | $offset_value = 'UTC' . $offset_value; |
| 4573 | $selected = ''; |
| 4574 | if ( $offset_value === $selected_zone ) |
| 4575 | $selected = 'selected="selected" '; |