| @@ -203,44 +203,4 @@ | ||
| 203 | 203 | $randomString .= $characters[rand(0, $charactersLength - 1)]; |
| 204 | 204 | } |
| 205 | 205 | return $randomString; |
| 206 | 206 | } |
| 207 | - | |
| 208 | -/** | |
| 209 | - * Converts a UTC date string to the WordPress site's timezone. | |
| 210 | - */ | |
| 211 | -function notifier_convert_date_from_utc($utc_date, $format = 'Y-m-d H:i:s') { | |
| 212 | - if ($utc_date === '') { | |
| 213 | - return current_time('mysql'); | |
| 214 | - } | |
| 215 | - | |
| 216 | - try { | |
| 217 | - $timezone_string = wp_timezone_string() ?: 'UTC'; | |
| 218 | - $site_timezone = new DateTimeZone($timezone_string); | |
| 219 | - $date = new DateTime($utc_date, new DateTimeZone('UTC')); | |
| 220 | - $date->setTimezone($site_timezone); | |
| 221 | - return $date->format($format); | |
| 222 | - } catch (Exception $e) { | |
| 223 | - error_log('Error converting UTC date to WordPress timezone: ' . $e->getMessage()); | |
| 224 | - return ''; | |
| 225 | - } | |
| 226 | -} | |
| 227 | - | |
| 228 | -/** | |
| 229 | - * Converts a date string from the WordPress site's timezone to UTC. | |
| 230 | - */ | |
| 231 | -function notifier_convert_date_to_utc($wp_date, $format = 'Y-m-d H:i:s') { | |
| 232 | - if ($wp_date === '') { | |
| 233 | - return current_time('mysql'); | |
| 234 | - } | |
| 235 | - | |
| 236 | - try { | |
| 237 | - $timezone_string = wp_timezone_string() ?: 'UTC'; | |
| 238 | - $site_timezone = new DateTimeZone($timezone_string); | |
| 239 | - $date = new DateTime($wp_date, $site_timezone); | |
| 240 | - $date->setTimezone(new DateTimeZone('UTC')); | |
| 241 | - return $date->format($format); | |
| 242 | - } catch (Exception $e) { | |
| 243 | - error_log('Error converting date from WordPress timezone to UTC: ' . $e->getMessage()); | |
| 244 | - return ''; | |
| 245 | - } | |
| 246 | -} | |