WordPress.org

Make WordPress Core

Ticket #20987: 20987.4.patch

File 20987.4.patch, 29.5 KB (added by SergeyBiryukov, 6 years ago)
  • wp-admin/credits.php

     
    3030                if ( ! is_array( $results ) )
    3131                        return false;
    3232
    33                 set_site_transient( 'wordpress_credits_' . $locale, $results, 86400 ); // One day
     33                set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
    3434        }
    3535
    3636        return $results;
  • wp-admin/includes/class-wp-comments-list-table.php

     
    330330                $the_comment_status = wp_get_comment_status( $comment->comment_ID );
    331331
    332332                $ptime = date( 'G', strtotime( $comment->comment_date ) );
    333                 if ( ( abs( time() - $ptime ) ) < 86400 )
     333                if ( ( abs( time() - $ptime ) ) < DAY_IN_SECONDS )
    334334                        $ptime = sprintf( __( '%s ago' ), human_time_diff( $ptime ) );
    335335                else
    336336                        $ptime = mysql2date( __( 'Y/m/d \a\t g:i A' ), $comment->comment_date );
  • wp-admin/includes/class-wp-media-list-table.php

     
    279279                        $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
    280280                        $m_time = $post->post_date;
    281281                        $time = get_post_time( 'G', true, $post, false );
    282                         if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) {
     282                        if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
    283283                                if ( $t_diff < 0 )
    284284                                        $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
    285285                                else
  • wp-admin/includes/class-wp-plugins-list-table.php

     
    6969                        }
    7070                }
    7171
    72                 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), 86400 );
     72                set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
    7373
    7474                if ( ! $screen->is_network ) {
    7575                        $recently_activated = get_option( 'recently_activated', array() );
    7676
    77                         $one_week = 7*24*60*60;
    7877                        foreach ( $recently_activated as $key => $time )
    79                                 if ( $time + $one_week < time() )
     78                                if ( $time + WEEK_IN_SECONDS < time() )
    8079                                        unset( $recently_activated[$key] );
    8180                        update_option( 'recently_activated', $recently_activated );
    8281                }
  • wp-admin/includes/class-wp-posts-list-table.php

     
    573573
    574574                                        $time_diff = time() - $time;
    575575
    576                                         if ( $time_diff > 0 && $time_diff < 24*60*60 )
     576                                        if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
    577577                                                $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    578578                                        else
    579579                                                $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
  • wp-admin/includes/dashboard.php

     
    913913
    914914        if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
    915915                $plugin_slugs = array_keys( get_plugins() );
    916                 set_transient( 'plugin_slugs', $plugin_slugs, 86400 );
     916                set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
    917917        }
    918918
    919919        foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins') ) as $feed => $label ) {
     
    10211021                array_unshift( $args, $widget_id );
    10221022                ob_start();
    10231023                call_user_func_array( $callback, $args );
    1024                 set_transient( $cache_key, ob_get_flush(), 43200); // Default lifetime in cache of 12 hours (same as the feeds)
     1024                set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds)
    10251025        }
    10261026
    10271027        return true;
     
    12121212                if ( ! is_array( $response ) )
    12131213                        return false;
    12141214
    1215                 set_site_transient( 'browser_' . $key, $response, 604800 ); // cache for 1 week
     1215                set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
    12161216        }
    12171217
    12181218        return $response;
  • wp-admin/includes/import.php

     
    8989        $id = wp_insert_attachment( $object, $file );
    9090
    9191        // schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call
    92         wp_schedule_single_event( time() + 86400, 'importer_scheduled_cleanup', array( $id ) );
     92        wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );
    9393
    9494        return array( 'file' => $file, 'id' => $id );
    9595}
  • wp-admin/includes/nav-menu.php

     
    11501150 */
    11511151function _wp_delete_orphaned_draft_menu_items() {
    11521152        global $wpdb;
    1153         $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
     1153        $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
    11541154
    11551155        // delete orphaned draft menu items
    11561156        $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
  • wp-admin/includes/plugin-install.php

     
    7474        if ( is_wp_error($tags) )
    7575                return $tags;
    7676
    77         set_site_transient('poptags_' . $key, $tags, 10800); // 3 * 60 * 60 = 10800
     77        set_site_transient( 'poptags_' . $key, $tags, 3 * HOUR_IN_SECONDS );
    7878
    7979        return $tags;
    8080}
  • wp-admin/includes/upgrade.php

     
    567567        $time_difference = $all_options->time_difference;
    568568
    569569                $server_time = time()+date('Z');
    570         $weblogger_time = $server_time + $time_difference*3600;
     570        $weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
    571571        $gmt_time = time();
    572572
    573         $diff_gmt_server = ($gmt_time - $server_time) / 3600;
    574         $diff_weblogger_server = ($weblogger_time - $server_time) / 3600;
     573        $diff_gmt_server = ($gmt_time - $server_time) / HOUR_IN_SECONDS;
     574        $diff_weblogger_server = ($weblogger_time - $server_time) / HOUR_IN_SECONDS;
    575575        $diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server;
    576576        $gmt_offset = -$diff_gmt_weblogger;
    577577
  • wp-admin/load-scripts.php

     
    125125
    126126$compress = ( isset($_GET['c']) && $_GET['c'] );
    127127$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
    128 $expires_offset = 31536000;
     128$expires_offset = YEAR_IN_SECONDS;
    129129$out = '';
    130130
    131131$wp_scripts = new WP_Scripts();
  • wp-admin/load-styles.php

     
    104104$compress = ( isset($_GET['c']) && $_GET['c'] );
    105105$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
    106106$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
    107 $expires_offset = 31536000;
     107$expires_offset = YEAR_IN_SECONDS;
    108108$out = '';
    109109
    110110$wp_styles = new WP_Styles();
  • wp-includes/bookmark-template.php

     
    7979                if ( $show_updated )
    8080                        if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) {
    8181                                $title .= ' (';
    82                                 $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600)));
     82                                $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)));
    8383                                $title .= ')';
    8484                        }
    8585
  • wp-includes/class-feed.php

     
    1818class WP_Feed_Cache_Transient {
    1919        var $name;
    2020        var $mod_name;
    21         var $lifetime = 43200; //Default lifetime in cache of 12 hours
     21        var $lifetime = 12 * HOUR_IN_SECONDS; //Default lifetime in cache of 12 hours
    2222
    2323        function __construct($location, $filename, $extension) {
    2424                $this->name = 'feed_' . $filename;
  • wp-includes/class-http.php

     
    808808                if ( ! function_exists( 'fsockopen' ) )
    809809                        return false;
    810810
    811                 if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
     811                if ( false !== ( $option = get_option( 'disable_fsockopen' ) ) && time() - $option < 12 * HOUR_IN_SECONDS )
    812812                        return false;
    813813
    814814                $is_ssl = isset( $args['ssl'] ) && $args['ssl'];
  • wp-includes/comment.php

     
    694694        global $wpdb;
    695695        if ( current_user_can( 'manage_options' ) )
    696696                return; // don't throttle admins
    697         $hour_ago = gmdate( 'Y-m-d H:i:s', time() - 3600 );
     697        $hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS );
    698698        if ( $lasttime = $wpdb->get_var( $wpdb->prepare( "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( `comment_author_IP` = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", $hour_ago, $ip, $email ) ) ) {
    699699                $time_lastcomment = mysql2date('U', $lasttime, false);
    700700                $time_newcomment  = mysql2date('U', $date, false);
     
    19761976        if ( ! $days_old )
    19771977                return $posts;
    19781978
    1979         if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) {
     1979        if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
    19801980                $posts[0]->comment_status = 'closed';
    19811981                $posts[0]->ping_status = 'closed';
    19821982        }
     
    20112011        if ( ! in_array( $post->post_type, $post_types ) )
    20122012                return $open;
    20132013
    2014         if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) )
     2014        if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) )
    20152015                return false;
    20162016
    20172017        return $open;
  • wp-includes/cron.php

     
    206206        */
    207207        $lock = get_transient('doing_cron');
    208208
    209         if ( $lock > $local_time + 10*60 )
     209        if ( $lock > $local_time + 10 * MINUTE_IN_SECONDS )
    210210                $lock = 0;
    211211
    212212        // don't run if another process is currently running it or more than once every 60 sec.
     
    313313 */
    314314function wp_get_schedules() {
    315315        $schedules = array(
    316                 'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
    317                 'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ),
    318                 'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ),
     316                'hourly' => array( 'interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly') ),
     317                'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily') ),
     318                'daily' => array( 'interval' => DAY_IN_SECONDS, 'display' => __('Once Daily') ),
    319319        );
    320320        return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
    321321}
  • wp-includes/default-constants.php

     
    299299                define( 'WP_DEFAULT_THEME', 'twentyeleven' );
    300300
    301301}
     302
     303/**
     304 * Defines time-related WordPress constants
     305 *
     306 * @since 3.5.0
     307 */
     308function wp_time_constants( ) {
     309        /**
     310         * Constants for expressing human-interval intervals in their
     311         * respective number of seconds
     312         */
     313        define( 'MINUTE_IN_SECONDS', 60 );
     314        define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS );
     315        define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS );
     316        define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS );
     317        define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
     318}
  • wp-includes/deprecated.php

     
    984984
    985985                if ( $show_updated )
    986986                        if (substr($row->link_updated_f, 0, 2) != '00')
    987                                 $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')';
     987                                $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
    988988
    989989                if ( '' != $title )
    990990                        $title = ' title="' . $title . '"';
  • wp-includes/feed.php

     
    534534        $feed->set_feed_url($url);
    535535        $feed->set_cache_class('WP_Feed_Cache');
    536536        $feed->set_file_class('WP_SimplePie_File');
    537         $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url));
     537        $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
    538538        do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
    539539        $feed->init();
    540540        $feed->handle_content_type();
  • wp-includes/formatting.php

     
    18721872                $datetime = new DateTime( $string );
    18731873                $datetime->setTimezone( new DateTimeZone('UTC') );
    18741874                $offset = $datetime->getOffset();
    1875                 $datetime->modify( '+' . $offset / 3600 . ' hours');
     1875                $datetime->modify( '+' . $offset / HOUR_IN_SECONDS . ' hours');
    18761876                $string_gmt = gmdate($format, $datetime->format('U'));
    18771877
    18781878                date_default_timezone_set('UTC');
    18791879        } else {
    18801880                $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
    1881                 $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * 3600);
     1881                $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * HOUR_IN_SECONDS);
    18821882        }
    18831883        return $string_gmt;
    18841884}
     
    18981898function get_date_from_gmt($string, $format = 'Y-m-d H:i:s') {
    18991899        preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
    19001900        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
    1901         $string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600);
     1901        $string_localtime = gmdate($format, $string_time + get_option('gmt_offset') * HOUR_IN_SECONDS);
    19021902        return $string_localtime;
    19031903}
    19041904
     
    19181918                $sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1;
    19191919                $hours   = intval(substr($timezone, 1, 2));
    19201920                $minutes = intval(substr($timezone, 3, 4)) / 60;
    1921                 $offset  = $sign * 3600 * ($hours + $minutes);
     1921                $offset  = $sign * HOUR_IN_SECONDS * ($hours + $minutes);
    19221922        }
    19231923        return $offset;
    19241924}
     
    19421942                if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
    19431943                        $offset = iso8601_timezone_to_offset($date_bits[7]);
    19441944                } else { // we don't have a timezone, so we assume user local timezone (not server's!)
    1945                         $offset = 3600 * get_option('gmt_offset');
     1945                        $offset = HOUR_IN_SECONDS * get_option('gmt_offset');
    19461946                }
    19471947
    19481948                $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
     
    20672067 * @return string Human readable time difference.
    20682068 */
    20692069function human_time_diff( $from, $to = '' ) {
    2070         if ( empty($to) )
     2070        if ( empty( $to ) )
    20712071                $to = time();
    2072         $diff = (int) abs($to - $from);
    2073         if ($diff <= 3600) {
    2074                 $mins = round($diff / 60);
    2075                 if ($mins <= 1) {
     2072        $diff = (int) abs( $to - $from );
     2073        if ( $diff <= HOUR_IN_SECONDS ) {
     2074                $mins = round( $diff / 60 );
     2075                if ( $mins <= 1 ) {
    20762076                        $mins = 1;
    20772077                }
    20782078                /* translators: min=minute */
    2079                 $since = sprintf(_n('%s min', '%s mins', $mins), $mins);
    2080         } else if (($diff <= 86400) && ($diff > 3600)) {
    2081                 $hours = round($diff / 3600);
    2082                 if ($hours <= 1) {
     2079                $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
     2080        } elseif ( ( $diff <= DAY_IN_SECONDS ) && ( $diff > HOUR_IN_SECONDS ) ) {
     2081                $hours = round( $diff / HOUR_IN_SECONDS );
     2082                if ( $hours <= 1 ) {
    20832083                        $hours = 1;
    20842084                }
    2085                 $since = sprintf(_n('%s hour', '%s hours', $hours), $hours);
    2086         } elseif ($diff >= 86400) {
    2087                 $days = round($diff / 86400);
    2088                 if ($days <= 1) {
     2085                $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
     2086        } elseif ( $diff >= DAY_IN_SECONDS ) {
     2087                $days = round( $diff / DAY_IN_SECONDS );
     2088                if ( $days <= 1 ) {
    20892089                        $days = 1;
    20902090                }
    2091                 $since = sprintf(_n('%s day', '%s days', $days), $days);
     2091                $since = sprintf( _n( '%s day', '%s days', $days ), $days );
    20922092        }
    20932093        return $since;
    20942094}
  • wp-includes/functions.php

     
    5959function current_time( $type, $gmt = 0 ) {
    6060        switch ( $type ) {
    6161                case 'mysql':
    62                         return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );
     62                        return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
    6363                        break;
    6464                case 'timestamp':
    65                         return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * 3600 );
     65                        return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    6666                        break;
    6767        }
    6868}
     
    214214        if ( $weekday < $start_of_week )
    215215                $weekday += 7;
    216216
    217         $start = $day - 86400 * ( $weekday - $start_of_week ); // The most recent week start day on or before $day
    218         $end = $start + 604799; // $start + 7 days - 1 second
     217        $start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week ); // The most recent week start day on or before $day
     218        $end = $start + 7 * DAY_IN_SECONDS - 1; // $start + 7 days - 1 second
    219219        return compact( 'start', 'end' );
    220220}
    221221
     
    930930 * @since 2.1.0
    931931 */
    932932function cache_javascript_headers() {
    933         $expiresOffset = 864000; // 10 days
     933        $expiresOffset = 10 * DAY_IN_SECONDS;
    934934        header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
    935935        header( "Vary: Accept-Encoding" ); // Handle proxies
    936936        header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
     
    30203020        if ( false === $timezone_object || false === $datetime_object ) {
    30213021                return false;
    30223022        }
    3023         return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 );
     3023        return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
    30243024}
    30253025
    30263026/**
     
    32203220function wp_scheduled_delete() {
    32213221        global $wpdb;
    32223222
    3223         $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
     3223        $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
    32243224
    32253225        $posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
    32263226
  • wp-includes/js/tinymce/wp-tinymce.php

     
    1919        return @file_get_contents($path);
    2020}
    2121
    22 $expires_offset = 31536000;
     22$expires_offset = YEAR_IN_SECONDS;
    2323
    2424header('Content-Type: application/x-javascript; charset=UTF-8');
    2525header('Vary: Accept-Encoding'); // Handle proxies
  • wp-includes/ms-functions.php

     
    14171417
    14181418        $dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );
    14191419
    1420         set_transient( 'dirsize_cache', $dirsize, 3600 );
     1420        set_transient( 'dirsize_cache', $dirsize, HOUR_IN_SECONDS );
    14211421        return $dirsize[ $directory ][ 'size' ];
    14221422}
    14231423
  • wp-includes/option.php

     
    560560                }
    561561        }
    562562
    563         setcookie( 'wp-settings-' . $user->ID, $settings, time() + 31536000, SITECOOKIEPATH );
    564         setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH );
     563        setcookie( 'wp-settings-' . $user->ID, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
     564        setcookie( 'wp-settings-time-' . $user->ID, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
    565565        $_COOKIE['wp-settings-' . $user->ID] = $settings;
    566566}
    567567
     
    724724                return;
    725725
    726726        update_user_option( $user->ID, 'user-settings', '', false );
    727         setcookie('wp-settings-' . $user->ID, ' ', time() - 31536000, SITECOOKIEPATH);
     727        setcookie('wp-settings-' . $user->ID, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH);
    728728}
    729729
    730730/**
  • wp-includes/pluggable.php

     
    529529
    530530        // Allow a grace period for POST and AJAX requests
    531531        if ( defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD'] )
    532                 $expired += 3600;
     532                $expired += HOUR_IN_SECONDS;
    533533
    534534        // Quick check to see if an honest cookie has expired
    535535        if ( $expired < time() ) {
     
    694694function wp_clear_auth_cookie() {
    695695        do_action('clear_auth_cookie');
    696696
    697         setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
    698         setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
    699         setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
    700         setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
    701         setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    702         setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
     697        setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
     698        setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
     699        setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
     700        setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
     701        setcookie(LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
     702        setcookie(LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
    703703
    704704        // Old cookies
    705         setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    706         setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
    707         setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    708         setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
     705        setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
     706        setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
     707        setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
     708        setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
    709709
    710710        // Even older cookies
    711         setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    712         setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
    713         setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
    714         setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
     711        setcookie(USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
     712        setcookie(PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
     713        setcookie(USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
     714        setcookie(PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
    715715}
    716716endif;
    717717
     
    12341234 * @return int
    12351235 */
    12361236function wp_nonce_tick() {
    1237         $nonce_life = apply_filters('nonce_life', 86400);
     1237        $nonce_life = apply_filters('nonce_life', DAY_IN_SECONDS);
    12381238
    12391239        return ceil(time() / ( $nonce_life / 2 ));
    12401240}
  • wp-includes/taxonomy.php

     
    13841384        }
    13851385
    13861386        if ( empty($terms) ) {
    1387                 wp_cache_add( $cache_key, array(), 'terms', 86400 ); // one day
     1387                wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
    13881388                $terms = apply_filters('get_terms', array(), $taxonomies, $args);
    13891389                return $terms;
    13901390        }
     
    14351435                $terms = array_slice($terms, $offset, $number);
    14361436        }
    14371437
    1438         wp_cache_add( $cache_key, $terms, 'terms', 86400 ); // one day
     1438        wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
    14391439
    14401440        $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
    14411441        return $terms;
  • wp-includes/update.php

     
    155155        // Check for update on a different schedule, depending on the page.
    156156        switch ( current_filter() ) {
    157157                case 'load-update-core.php' :
    158                         $timeout = 60; // 1 min
     158                        $timeout = MINUTE_IN_SECONDS;
    159159                        break;
    160160                case 'load-plugins.php' :
    161161                case 'load-update.php' :
    162                         $timeout = 3600; // 1 hour
     162                        $timeout = HOUR_IN_SECONDS;
    163163                        break;
    164164                default :
    165                         $timeout = 43200; // 12 hours
     165                        $timeout = 12 * HOUR_IN_SECONDS;
    166166        }
    167167
    168168        $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
     
    264264        // Check for update on a different schedule, depending on the page.
    265265        switch ( current_filter() ) {
    266266                case 'load-update-core.php' :
    267                         $timeout = 60; // 1 min
     267                        $timeout = MINUTE_IN_SECONDS;
    268268                        break;
    269269                case 'load-themes.php' :
    270270                case 'load-update.php' :
    271                         $timeout = 3600; // 1 hour
     271                        $timeout = HOUR_IN_SECONDS;
    272272                        break;
    273273                default :
    274                         $timeout = 43200; // 12 hours
     274                        $timeout = 12 * HOUR_IN_SECONDS;
    275275        }
    276276
    277277        $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time( ) - $last_update->last_checked );
     
    371371        $current = get_site_transient( 'update_core' );
    372372
    373373        if ( isset( $current->last_checked ) &&
    374                 43200 > ( time() - $current->last_checked ) &&
     374                12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) &&
    375375                isset( $current->version_checked ) &&
    376376                $current->version_checked == $wp_version )
    377377                return;
     
    390390 */
    391391function _maybe_update_plugins() {
    392392        $current = get_site_transient( 'update_plugins' );
    393         if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
     393        if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) )
    394394                return;
    395395        wp_update_plugins();
    396396}
     
    406406 */
    407407function _maybe_update_themes( ) {
    408408        $current = get_site_transient( 'update_themes' );
    409         if ( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
     409        if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time( ) - $current->last_checked ) )
    410410                return;
    411411
    412412        wp_update_themes();
  • wp-login.php

     
    390390        }
    391391
    392392        // 10 days
    393         setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 864000, COOKIEPATH );
     393        setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );
    394394
    395395        wp_safe_redirect( wp_get_referer() );
    396396        exit();
  • wp-mail.php

     
    3030
    3131set_transient('mailserver_last_checked', true, WP_MAIL_INTERVAL);
    3232
    33 $time_difference = get_option('gmt_offset') * 3600;
     33$time_difference = get_option('gmt_offset') * HOUR_IN_SECONDS;
    3434
    3535$phone_delim = '::';
    3636
  • wp-settings.php

     
    2323require( ABSPATH . WPINC . '/version.php' );
    2424
    2525// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    26 wp_initial_constants( );
     26wp_initial_constants();
     27// Define time-related constants.
     28wp_time_constants();
    2729
    2830// Check for the required PHP version and for the MySQL extension or a database drop-in.
    2931wp_check_php_mysql_versions();