Changeset 7330 for sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/class-plugin.php
- Timestamp:
- 06/23/2018 11:27:35 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/class-plugin.php
r6174 r7330 98 98 */ 99 99 $offset_or_tz = _x( '0', 'default GMT offset or timezone string', 'rosetta' ); 100 if ( $offset_or_tz && ! is_numeric( $offset_or_tz ) && in_array( $offset_or_tz, timezone_identifiers_list() ) ) {100 if ( $offset_or_tz && ! is_numeric( $offset_or_tz ) && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) { 101 101 return $offset_or_tz; 102 102 } else { … … 104 104 } 105 105 } ) 106 ->set_priority( 9 ) // Before `wp_timezone_override_offset()`107 106 ); 108 107 … … 111 110 ->set_name( 'gmt_offset' ) 112 111 ->set_callback( function() { 112 // Do the smart timezone handling like `wp_timezone_override_offset()`. 113 $timezone_string = get_option( 'timezone_string' ); 114 if ( $timezone_string ) { 115 $timezone_object = timezone_open( $timezone_string ); 116 $datetime_object = date_create(); 117 if ( false !== $timezone_object && false !== $datetime_object ) { 118 return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 ); 119 } 120 } 121 113 122 /* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14) 114 123 * or a valid timezone string (America/New_York). See https://secure.php.net/manual/timezones.php … … 117 126 $offset_or_tz = _x( '0', 'default GMT offset or timezone string', 'rosetta' ); 118 127 if ( $offset_or_tz && is_numeric( $offset_or_tz ) ) { 119 return $offset_or_tz;128 return (int) $offset_or_tz; 120 129 } else { 121 130 return 0; 122 131 } 123 132 } ) 124 ->set_priority( 9 ) // Before `wp_timezone_override_offset()`133 ->set_priority( 11 ) // After `wp_timezone_override_offset()`. 125 134 ); 126 135
Note: See TracChangeset
for help on using the changeset viewer.