REST API - Fix fatal error due to missing get_timezone function
This commit is contained in:
parent
922406b67b
commit
df5929093d
|
@ -469,6 +469,31 @@ class WC_API_Server {
|
|||
return apply_filters( 'woocommerce_api_index', $available );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the timezone from the db
|
||||
* @since 2.1
|
||||
* @return string timezone
|
||||
*/
|
||||
public function get_timezone() {
|
||||
$current_offset = get_option('gmt_offset');
|
||||
$tzstring = get_option('timezone_string');
|
||||
|
||||
// Remove old Etc mappings. Fallback to gmt_offset.
|
||||
if ( false !== strpos( $tzstring,'Etc/GMT' ) )
|
||||
$tzstring = '';
|
||||
|
||||
if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists
|
||||
$check_zone_info = false;
|
||||
if ( 0 == $current_offset )
|
||||
$tzstring = 'UTC+0';
|
||||
elseif ($current_offset < 0)
|
||||
$tzstring = 'UTC' . $current_offset;
|
||||
else
|
||||
$tzstring = 'UTC+' . $current_offset;
|
||||
}
|
||||
return $tzstring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a HTTP status code
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue