| | 1355 | /** |
| | 1356 | * Test if the site is using timezones relative to their location, or by using an offset value. |
| | 1357 | * |
| | 1358 | * Daylight Savings Time (DST) may affect the times used and shown by your site, and using an UTC offset, |
| | 1359 | * instead of a localized timezone, means that the site does not get automatic DST updates. |
| | 1360 | * |
| | 1361 | * This check looks for default or UTC values and recommends changing to a fixed location. |
| | 1362 | * |
| | 1363 | * @since 5.3.1 |
| | 1364 | * |
| | 1365 | * @return array The test results. |
| | 1366 | */ |
| | 1367 | public function get_test_timezone_not_utc() { |
| | 1368 | $result = array( |
| | 1369 | 'label' => __( 'Your site uses localized timezones' ), |
| | 1370 | 'status' => 'good', |
| | 1371 | 'badge' => array( |
| | 1372 | 'label' => __( 'Performance' ), |
| | 1373 | 'color' => 'blue', |
| | 1374 | ), |
| | 1375 | 'description' => sprintf( |
| | 1376 | '<p>%s</p>', |
| | 1377 | __( 'Daylight Savings Time (DST) may affect the times used and shown by your site, and using an UTC offset, instead of a localized timezone, means that the site does not get automatic DST updates.' ) |
| | 1378 | ), |
| | 1379 | 'actions' => '', |
| | 1380 | 'test' => 'timezone_not_utc', |
| | 1381 | ); |
| | 1382 | |
| | 1383 | $timezone = get_option( 'timezone_string', null ); |
| | 1384 | |
| | 1385 | if ( empty( $timezone ) || 'UTC' === substr( $timezone, 0, 3 ) ) { |
| | 1386 | $result['status'] = 'recommended'; |
| | 1387 | $result['label'] = __( 'Your site is not using localized timezones' ); |
| | 1388 | $result['actions'] .= sprintf( |
| | 1389 | '<p><a href="%s">%s</a></p>', |
| | 1390 | esc_url( admin_url( 'options-general.php' ) ), |
| | 1391 | __( 'Update your site timezone' ) |
| | 1392 | ); |
| | 1393 | } |
| | 1394 | |
| | 1395 | return $result; |
| | 1396 | } |
| | 1397 | |