WordPress.org

Make WordPress Core

Changeset 21996


Ignore:
Timestamp:
09/25/12 05:26:19 (5 years ago)
Author:
nacin
Message:

Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987.

Location:
trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/credits.php

    r21021 r21996  
    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 
  • trunk/wp-admin/includes/class-wp-comments-list-table.php

    r21985 r21996  
    336336 
    337337        $ptime = date( 'G', strtotime( $comment->comment_date ) ); 
    338         if ( ( abs( time() - $ptime ) ) < 86400 ) 
     338        if ( ( abs( time() - $ptime ) ) < DAY_IN_SECONDS ) 
    339339            $ptime = sprintf( __( '%s ago' ), human_time_diff( $ptime ) ); 
    340340        else 
  • trunk/wp-admin/includes/class-wp-media-list-table.php

    r21948 r21996  
    283283            $m_time = $post->post_date; 
    284284            $time = get_post_time( 'G', true, $post, false ); 
    285             if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) { 
     285            if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) { 
    286286                if ( $t_diff < 0 ) 
    287287                    $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); 
  • trunk/wp-admin/includes/class-wp-plugins-list-table.php

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

    r21974 r21996  
    581581                    $time_diff = time() - $time; 
    582582 
    583                     if ( $time_diff > 0 && $time_diff < 24*60*60 ) 
     583                    if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) 
    584584                        $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); 
    585585                    else 
  • trunk/wp-admin/includes/dashboard.php

    r21944 r21996  
    917917    if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { 
    918918        $plugin_slugs = array_keys( get_plugins() ); 
    919         set_transient( 'plugin_slugs', $plugin_slugs, 86400 ); 
     919        set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); 
    920920    } 
    921921 
     
    10251025        ob_start(); 
    10261026        call_user_func_array( $callback, $args ); 
    1027         set_transient( $cache_key, ob_get_flush(), 43200); // Default lifetime in cache of 12 hours (same as the feeds) 
     1027        set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds) 
    10281028    } 
    10291029 
     
    12161216            return false; 
    12171217 
    1218         set_site_transient( 'browser_' . $key, $response, 604800 ); // cache for 1 week 
     1218        set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); 
    12191219    } 
    12201220 
  • trunk/wp-admin/includes/import.php

    r19712 r21996  
    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 ); 
  • trunk/wp-admin/includes/nav-menu.php

    r21944 r21996  
    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 
  • trunk/wp-admin/includes/plugin-install.php

    r21944 r21996  
    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; 
  • trunk/wp-admin/includes/upgrade.php

    r21823 r21996  
    512512 
    513513        $server_time = time()+date('Z'); 
    514     $weblogger_time = $server_time + $time_difference*3600; 
     514    $weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS; 
    515515    $gmt_time = time(); 
    516516 
    517     $diff_gmt_server = ($gmt_time - $server_time) / 3600; 
    518     $diff_weblogger_server = ($weblogger_time - $server_time) / 3600; 
     517    $diff_gmt_server = ($gmt_time - $server_time) / HOUR_IN_SECONDS; 
     518    $diff_weblogger_server = ($weblogger_time - $server_time) / HOUR_IN_SECONDS; 
    519519    $diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server; 
    520520    $gmt_offset = -$diff_gmt_weblogger; 
  • trunk/wp-admin/load-scripts.php

    r21132 r21996  
    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 
  • trunk/wp-admin/load-styles.php

    r19684 r21996  
    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 
  • trunk/wp-includes/bookmark-template.php

    r21241 r21996  
    7979            if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) { 
    8080                $title .= ' ('; 
    81                 $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600))); 
     81                $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS))); 
    8282                $title .= ')'; 
    8383            } 
  • trunk/wp-includes/class-http.php

    r21290 r21996  
    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 
  • trunk/wp-includes/comment.php

    r21938 r21996  
    700700    if ( current_user_can( 'manage_options' ) ) 
    701701        return; // don't throttle admins 
    702     $hour_ago = gmdate( 'Y-m-d H:i:s', time() - 3600 ); 
     702    $hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS ); 
    703703    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 ) ) ) { 
    704704        $time_lastcomment = mysql2date('U', $lasttime, false); 
     
    19821982        return $posts; 
    19831983 
    1984     if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) { 
     1984    if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { 
    19851985        $posts[0]->comment_status = 'closed'; 
    19861986        $posts[0]->ping_status = 'closed'; 
     
    20172017        return $open; 
    20182018 
    2019     if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) 
     2019    if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) 
    20202020        return false; 
    20212021 
  • trunk/wp-includes/cron.php

    r21954 r21996  
    2323    // don't schedule a duplicate if there's already an identical event due in the next 10 minutes 
    2424    $next = wp_next_scheduled($hook, $args); 
    25     if ( $next && $next <= $timestamp + 600 ) 
     25    if ( $next && $next <= $timestamp + 10 * MINUTE_IN_SECONDS ) 
    2626        return; 
    2727 
     
    207207    $lock = get_transient('doing_cron'); 
    208208 
    209     if ( $lock > $gmt_time + 10*60 ) 
     209    if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS ) 
    210210        $lock = 0; 
    211211 
     
    319319function wp_get_schedules() { 
    320320    $schedules = array( 
    321         'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ), 
    322         'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ), 
    323         'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ), 
     321        'hourly'     => array( 'interval' => HOUR_IN_SECONDS,      'display' => __( 'Once Hourly' ) ), 
     322        'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ) ), 
     323        'daily'      => array( 'interval' => DAY_IN_SECONDS,       'display' => __( 'Once Daily' ) ), 
    324324    ); 
    325325    return array_merge( apply_filters( 'cron_schedules', array() ), $schedules ); 
  • trunk/wp-includes/default-constants.php

    r21809 r21996  
    7373    if ( !defined('SHORTINIT') ) 
    7474        define('SHORTINIT', false); 
     75 
     76    // Constants for expressing human-interval intervals 
     77    // in their respective number of seconds. 
     78    define( 'MINUTE_IN_SECONDS', 60 ); 
     79    define( 'HOUR_IN_SECONDS',   60 * MINUTE_IN_SECONDS ); 
     80    define( 'DAY_IN_SECONDS',    24 * HOUR_IN_SECONDS   ); 
     81    define( 'WEEK_IN_SECONDS',    7 * DAY_IN_SECONDS    ); 
     82    define( 'YEAR_IN_SECONDS',  365 * DAY_IN_SECONDS    ); 
    7583} 
    7684 
  • trunk/wp-includes/deprecated.php

    r21943 r21996  
    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 ) 
  • trunk/wp-includes/feed.php

    r21664 r21996  
    539539 
    540540    $feed->set_feed_url($url); 
    541     $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url)); 
     541    $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); 
    542542    do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); 
    543543    $feed->init(); 
  • trunk/wp-includes/formatting.php

    r21993 r21996  
    18991899        $datetime->setTimezone( new DateTimeZone('UTC') ); 
    19001900        $offset = $datetime->getOffset(); 
    1901         $datetime->modify( '+' . $offset / 3600 . ' hours'); 
     1901        $datetime->modify( '+' . $offset / HOUR_IN_SECONDS . ' hours'); 
    19021902        $string_gmt = gmdate($format, $datetime->format('U')); 
    19031903 
     
    19051905    } else { 
    19061906        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
    1907         $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * 3600); 
     1907        $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * HOUR_IN_SECONDS); 
    19081908    } 
    19091909    return $string_gmt; 
     
    19251925    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); 
    19261926    $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
    1927     $string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600); 
     1927    $string_localtime = gmdate($format, $string_time + get_option('gmt_offset') * HOUR_IN_SECONDS); 
    19281928    return $string_localtime; 
    19291929} 
     
    19451945        $hours   = intval(substr($timezone, 1, 2)); 
    19461946        $minutes = intval(substr($timezone, 3, 4)) / 60; 
    1947         $offset  = $sign * 3600 * ($hours + $minutes); 
     1947        $offset  = $sign * HOUR_IN_SECONDS * ($hours + $minutes); 
    19481948    } 
    19491949    return $offset; 
     
    19691969            $offset = iso8601_timezone_to_offset($date_bits[7]); 
    19701970        } else { // we don't have a timezone, so we assume user local timezone (not server's!) 
    1971             $offset = 3600 * get_option('gmt_offset'); 
     1971            $offset = HOUR_IN_SECONDS * get_option('gmt_offset'); 
    19721972        } 
    19731973 
     
    20942094 */ 
    20952095function human_time_diff( $from, $to = '' ) { 
    2096     if ( empty($to) ) 
     2096    if ( empty( $to ) ) 
    20972097        $to = time(); 
    2098     $diff = (int) abs($to - $from); 
    2099     if ($diff <= 3600) { 
    2100         $mins = round($diff / 60); 
    2101         if ($mins <= 1) { 
     2098    $diff = (int) abs( $to - $from ); 
     2099    if ( $diff <= HOUR_IN_SECONDS ) { 
     2100        $mins = round( $diff / MINUTE_IN_SECONDS ); 
     2101        if ( $mins <= 1 ) { 
    21022102            $mins = 1; 
    21032103        } 
    21042104        /* translators: min=minute */ 
    2105         $since = sprintf(_n('%s min', '%s mins', $mins), $mins); 
    2106     } else if (($diff <= 86400) && ($diff > 3600)) { 
    2107         $hours = round($diff / 3600); 
    2108         if ($hours <= 1) { 
     2105        $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins ); 
     2106    } elseif ( ( $diff <= DAY_IN_SECONDS ) && ( $diff > HOUR_IN_SECONDS ) ) { 
     2107        $hours = round( $diff / HOUR_IN_SECONDS ); 
     2108        if ( $hours <= 1 ) { 
    21092109            $hours = 1; 
    21102110        } 
    2111         $since = sprintf(_n('%s hour', '%s hours', $hours), $hours); 
    2112     } elseif ($diff >= 86400) { 
    2113         $days = round($diff / 86400); 
    2114         if ($days <= 1) { 
     2111        $since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours ); 
     2112    } elseif ( $diff >= DAY_IN_SECONDS ) { 
     2113        $days = round( $diff / DAY_IN_SECONDS ); 
     2114        if ( $days <= 1 ) { 
    21152115            $days = 1; 
    21162116        } 
    2117         $since = sprintf(_n('%s day', '%s days', $days), $days); 
     2117        $since = sprintf( _n( '%s day', '%s days', $days ), $days ); 
    21182118    } 
    21192119    return $since; 
  • trunk/wp-includes/functions.php

    r21922 r21996  
    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    } 
     
    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} 
     
    935935 */ 
    936936function cache_javascript_headers() { 
    937     $expiresOffset = 864000; // 10 days 
     937    $expiresOffset = 10 * DAY_IN_SECONDS; 
    938938    header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) ); 
    939939    header( "Vary: Accept-Encoding" ); // Handle proxies 
     
    31183118        return false; 
    31193119    } 
    3120     return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 ); 
     3120    return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 ); 
    31213121} 
    31223122 
     
    33183318    global $wpdb; 
    33193319 
    3320     $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS); 
     3320    $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); 
    33213321 
    33223322    $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); 
  • trunk/wp-includes/js/tinymce/wp-tinymce.php

    r17630 r21996  
    2020} 
    2121 
    22 $expires_offset = 31536000; 
     22$expires_offset = YEAR_IN_SECONDS; 
    2323 
    2424header('Content-Type: application/x-javascript; charset=UTF-8'); 
  • trunk/wp-includes/ms-functions.php

    r21924 r21996  
    14091409    $dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory ); 
    14101410 
    1411     set_transient( 'dirsize_cache', $dirsize, 3600 ); 
     1411    set_transient( 'dirsize_cache', $dirsize, HOUR_IN_SECONDS ); 
    14121412    return $dirsize[ $directory ][ 'size' ]; 
    14131413} 
  • trunk/wp-includes/option.php

    r21823 r21996  
    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} 
     
    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 
  • trunk/wp-includes/pluggable.php

    r21917 r21996  
    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 
     
    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; 
     
    12301230 */ 
    12311231function wp_nonce_tick() { 
    1232     $nonce_life = apply_filters('nonce_life', 86400); 
     1232    $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS ); 
    12331233 
    12341234    return ceil(time() / ( $nonce_life / 2 )); 
  • trunk/wp-includes/taxonomy.php

    r21951 r21996  
    14001400 
    14011401    if ( empty($terms) ) { 
    1402         wp_cache_add( $cache_key, array(), 'terms', 86400 ); // one day 
     1402        wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); 
    14031403        $terms = apply_filters('get_terms', array(), $taxonomies, $args); 
    14041404        return $terms; 
     
    14511451    } 
    14521452 
    1453     wp_cache_add( $cache_key, $terms, 'terms', 86400 ); // one day 
     1453    wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); 
    14541454 
    14551455    $terms = apply_filters('get_terms', $terms, $taxonomies, $args); 
  • trunk/wp-includes/update.php

    r21874 r21996  
    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 
     
    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 
     
    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 ) 
     
    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(); 
     
    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 
  • trunk/wp-login.php

    r21923 r21996  
    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() ); 
  • trunk/wp-mail.php

    r20682 r21996  
    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 = '::'; 
Note: See TracChangeset for help on using the changeset viewer.