Skip to content

Commit b6890f1

Browse files
committed
PHPCS updates
1 parent 50c4abe commit b6890f1

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

class.json-api-endpoints.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,36 +1533,39 @@ function format_date( $date_gmt, $date = null ) {
15331533
* relative to now and will convert it to local time using either the
15341534
* timezone set in the options table for the blog or the GMT offset.
15351535
*
1536-
* @param datetime string
1536+
* @param datetime string $date_string Date to parse.
15371537
*
15381538
* @return array( $local_time_string, $gmt_time_string )
15391539
*/
1540-
function parse_date( $date_string ) {
1540+
public function parse_date( $date_string ) {
15411541
$date_string_info = date_parse( $date_string );
15421542
if ( is_array( $date_string_info ) && 0 === $date_string_info['error_count'] ) {
15431543
// Check if it's already localized. Can't just check is_localtime because date_parse('oppossum') returns true; WTF, PHP.
15441544
if ( isset( $date_string_info['zone'] ) && true === $date_string_info['is_localtime'] ) {
1545-
$dt_local = clone $dt_utc = new DateTime( $date_string );
1545+
$dt_utc = new DateTime( $date_string );
1546+
$dt_local = $dt_utc;
15461547
$dt_utc->setTimezone( new DateTimeZone( 'UTC' ) );
15471548
return array(
15481549
(string) $dt_local->format( 'Y-m-d H:i:s' ),
15491550
(string) $dt_utc->format( 'Y-m-d H:i:s' ),
15501551
);
15511552
}
15521553

1553-
// It's parseable but no TZ info so assume UTC
1554-
$dt_local = clone $dt_utc = new DateTime( $date_string, new DateTimeZone( 'UTC' ) );
1554+
// It's parseable but no TZ info so assume UTC.
1555+
$dt_utc = new DateTime( $date_string, new DateTimeZone( 'UTC' ) );
1556+
$dt_local = new DateTime( $date_string, new DateTimeZone( 'UTC' ) );
15551557
} else {
1556-
// Could not parse time, use now in UTC
1557-
$dt_local = clone $dt_utc = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
1558+
// Could not parse time, use now in UTC.
1559+
$dt_utc = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
1560+
$dt_local = $dt_utc;
15581561
}
15591562

15601563
$dt_local->setTimezone( wp_timezone() );
15611564

15621565
return array(
15631566
(string) $dt_local->format( 'Y-m-d H:i:s' ),
15641567
(string) $dt_utc->format( 'Y-m-d H:i:s' ),
1565-
);
1568+
);
15661569
}
15671570

15681571
// Load the functions.php file for the current theme to get its post formats, CPTs, etc.

functions.global.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
exit;
2020
}
2121

22-
if ( ! function_exists( wp_timezone ) ) {
22+
if ( ! function_exists( 'wp_timezone' ) ) {
2323
/**
2424
* Shim for WordPress 5.3's wp_timezone() function.
2525
*

0 commit comments

Comments
 (0)