Ticket #9588: 9588.21.diff
File 9588.21.diff, 8.7 KB (added by , 15 years ago) |
---|
-
wp-includes/post-template.php
1210 1210 /* translators: 1: date */ 1211 1211 $currentf = __( '%1$s [Current Revision]' ); 1212 1212 1213 $date = date_i18n( $datef, strtotime( $revision->post_modified _gmt . ' +0000') );1213 $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); 1214 1214 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) 1215 1215 $date = "<a href='$link'>$date</a>"; 1216 1216 -
wp-includes/post.php
1974 1974 1975 1975 $time = strtotime( $post->post_date_gmt . ' GMT' ); 1976 1976 1977 if ( $time > time() ) { // Uh oh, someone jumped the gun!1977 if ( $time > current_time('timestamp', true) ) { // Uh oh, someone jumped the gun! 1978 1978 wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system 1979 1979 wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) ); 1980 1980 return; -
wp-includes/functions.php
59 59 * @return int|string String if $type is 'gmt', int if $type is 'timestamp'. 60 60 */ 61 61 function current_time( $type, $gmt = 0 ) { 62 switch ( $type ) { 63 case 'mysql': 64 return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) ); 65 break; 66 case 'timestamp': 67 return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * 3600 ); 68 break; 62 if ( function_exists('date_default_timezone_set') && '' != get_option('timezone_string') ) { 63 // Use the PHP5 DateTime support. The timezone is already correctly set. 64 switch ( $type ) { 65 case 'mysql': 66 return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : date( 'Y-m-d H:i:s' ); 67 break; 68 case 'timestamp': 69 return ( $gmt ) ? gmdate('U') : time(); 70 break; 71 } 72 } else { 73 // No PHP5 DateTime support or timezone not set. Add in gmt_offset. 74 switch ( $type ) { 75 case 'mysql': 76 return ( $gmt ) ? gmdate( 'Y-m-d H:i:s') : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) ); 77 break; 78 case 'timestamp': 79 return ( $gmt ) ? time() : ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ); 80 break; 81 } 69 82 } 70 83 } 71 84 … … 88 101 $i = $unixtimestamp; 89 102 // Sanity check for PHP 5.1.0- 90 103 if ( false === $i || intval($i) < 0 ) { 91 if ( ! $gmt ) 92 $i = current_time( 'timestamp' ); 93 else 94 $i = time(); 104 $i = current_time( 'timestamp', $gmt ); 95 105 // we should not let date() interfere with our 96 106 // specially computed timestamp 97 $gmt = true; 107 if ( !function_exists('date_default_timezone_set') ) 108 $gmt = true; 98 109 } 99 110 100 111 // store original value for language with untypical grammars 101 112 // see http://core.trac.wordpress.org/ticket/9396 102 113 $req_format = $dateformatstring; 103 114 104 $datefunc = $gmt ? 'gmdate' : 'date';115 $datefunc = $gmt ? 'gmdate' : 'date'; 105 116 106 117 if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { 107 118 $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) ); … … 127 138 } 128 139 129 140 /** 141 * WP wrapper for date() that hides differences between PHP4 and PHP 5 date and time support. 142 * 143 * @since 3.0 144 * 145 * @param string $format Format to display the date. 146 * @param int $timestamp Optional. Unix timestamp. 147 * @return string The formatted date 148 */ 149 function compat_date($format, $timestamp = false) { 150 if ( function_exists('date_default_timezone_set') ) 151 return date($format, $timestamp); 152 else 153 return gmdate($format, $timestamp); 154 } 155 156 /** 130 157 * Convert number to format based on the locale. 131 158 * 132 159 * @since 2.3.0 -
wp-settings.php
18 18 set_magic_quotes_runtime(0); 19 19 @ini_set('magic_quotes_sybase', 0); 20 20 21 if ( function_exists('date_default_timezone_set') )22 date_default_timezone_set('UTC');23 24 21 /** 25 22 * Turn register globals off. 26 23 * … … 719 716 // Load in support for template functions which the theme supports 720 717 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); 721 718 719 // Set the timezone 720 if ( function_exists('date_default_timezone_set') ) { 721 if ( $timezone_string = get_option( 'timezone_string' ) ) 722 @date_default_timezone_set( $timezone_string ); 723 else 724 @date_default_timezone_set('UTC'); 725 } 726 722 727 /** 723 728 * Runs just before PHP shuts down execution. 724 729 * -
wp-admin/includes/meta-boxes.php
165 165 $date = date_i18n( $datef, strtotime( $post->post_date ) ); 166 166 } else { // draft (no saves, and thus no date specified) 167 167 $stamp = __('Publish <b>immediately</b>'); 168 $date = date_i18n( $datef, strtotime( current_time('mysql')) );168 $date = date_i18n( $datef, current_time('timestamp') ); 169 169 } 170 170 171 171 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> -
wp-admin/includes/template.php
1408 1408 $m_time = $post->post_date; 1409 1409 $time = get_post_time('G', true, $post); 1410 1410 1411 $time_diff = time() - $time;1411 $time_diff = current_time('timestamp', true) - $time; 1412 1412 1413 1413 if ( $time_diff > 0 && $time_diff < 24*60*60 ) 1414 1414 $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); … … 1635 1635 $m_time = $page->post_date; 1636 1636 $time = get_post_time('G', true); 1637 1637 1638 $time_diff = time() - $time;1638 $time_diff = current_time('timestamp', true) - $time; 1639 1639 1640 1640 if ( $time_diff > 0 && $time_diff < 24*60*60 ) 1641 1641 $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); … … 2105 2105 $author_url_display = substr($author_url_display, 0, 49) . '...'; 2106 2106 2107 2107 $ptime = date('G', strtotime( $comment->comment_date ) ); 2108 if ( ( abs( time() - $ptime) ) < 86400 )2108 if ( ( abs(current_time('timestamp') - $ptime) ) < 86400 ) 2109 2109 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); 2110 2110 else 2111 2111 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date ); … … 2612 2612 2613 2613 $time_adj = current_time('timestamp'); 2614 2614 $post_date = ($for_post) ? $post->post_date : $comment->comment_date; 2615 $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );2616 $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );2617 $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );2618 $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );2619 $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );2620 $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );2615 $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : compat_date( 'd', $time_adj ); 2616 $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : compat_date( 'm', $time_adj ); 2617 $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : compat_date( 'Y', $time_adj ); 2618 $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : compat_date( 'H', $time_adj ); 2619 $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : compat_date( 'i', $time_adj ); 2620 $ss = ($edit) ? mysql2date( 's', $post_date, false ) : compat_date( 's', $time_adj ); 2621 2621 2622 $cur_jj = gmdate( 'd', $time_adj );2623 $cur_mm = gmdate( 'm', $time_adj );2624 $cur_aa = gmdate( 'Y', $time_adj );2625 $cur_hh = gmdate( 'H', $time_adj );2626 $cur_mn = gmdate( 'i', $time_adj );2622 $cur_jj = compat_date( 'd', $time_adj ); 2623 $cur_mm = compat_date( 'm', $time_adj ); 2624 $cur_aa = compat_date( 'Y', $time_adj ); 2625 $cur_hh = compat_date( 'H', $time_adj ); 2626 $cur_mn = compat_date( 'i', $time_adj ); 2627 2627 2628 2628 $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n"; 2629 2629 for ( $i = 1; $i < 13; $i = $i +1 ) { -
wp-admin/upload.php
417 417 $t_time = get_the_time(__('Y/m/d g:i:s A')); 418 418 $m_time = $post->post_date; 419 419 $time = get_post_time( 'G', true ); 420 if ( ( abs($t_diff = time() - $time) ) < 86400 ) {420 if ( ( abs($t_diff = current_time('timestamp', true) - $time) ) < 86400 ) { 421 421 if ( $t_diff < 0 ) 422 422 $h_time = sprintf( __('%s from now'), human_time_diff( $time ) ); 423 423 else