Make WordPress Core

Changeset 54870


Ignore:
Timestamp:
11/24/2022 02:16:18 PM (17 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use HOUR_IN_SECONDS where appropriate.

This aims to clarify the time units for some time offset values.

Follow-up to [21996], [23823], [40108], [41626].

See #56791.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php

    r52355 r54870  
    235235            if ( $tz ) {
    236236                $now                   = new DateTime( 'now', $tz );
    237                 $formatted_gmt_offset  = $this->format_gmt_offset( $tz->getOffset( $now ) / 3600 );
     237                $formatted_gmt_offset  = $this->format_gmt_offset( $tz->getOffset( $now ) / HOUR_IN_SECONDS );
    238238                $tz_name               = str_replace( '_', ' ', $tz->getName() );
    239239                $timezone_info['abbr'] = $now->format( 'T' );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r54855 r54870  
    17981798             */
    17991799            if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) {
    1800                 $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     1800                $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
    18011801            } else {
    18021802                $post_modified_gmt = $post->post_modified_gmt;
  • trunk/src/wp-includes/revision.php

    r54347 r54870  
    860860        }
    861861
    862         if ( $locked > $now - 3600 ) {
     862        if ( $locked > $now - HOUR_IN_SECONDS ) {
    863863            // Lock is not too old: some other process may be upgrading this post. Bail.
    864864            return false;
Note: See TracChangeset for help on using the changeset viewer.