Ticket #9588: 9588.19.diff
File 9588.19.diff, 6.5 KB (added by , 16 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/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') ) { 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. 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 … … 91 104 if ( ! $gmt ) 92 105 $i = current_time( 'timestamp' ); 93 106 else 94 $i = time();107 $i = current_time( 'timestamp', true ); 95 108 // we should not let date() interfere with our 96 109 // specially computed timestamp 97 $gmt = true; 110 if ( !function_exists('date_default_timezone_set') ) 111 $gmt = true; 98 112 } 99 113 100 114 // store original value for language with untypical grammars 101 115 // see http://core.trac.wordpress.org/ticket/9396 102 116 $req_format = $dateformatstring; 103 117 104 $datefunc = $gmt ? 'gmdate' : 'date';118 $datefunc = $gmt ? 'gmdate' : 'date'; 105 119 106 120 if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { 107 121 $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) ); … … 127 141 } 128 142 129 143 /** 144 * WP wrapper for date() that hides differences between PHP4 and PHP 5 date and time support. 145 * 146 * @since 3.0 147 * 148 * @param string $format Format to display the date. 149 * @param int $timestamp Optional. Unix timestamp. 150 * @return string The formatted date 151 */ 152 function compat_date($format, $timestamp = false) { 153 if ( function_exists('date_default_timezone_set') ) 154 return date($format, $timestamp); 155 else 156 return gmdate($format, $timestamp); 157 } 158 159 /** 130 160 * Convert number to format based on the locale. 131 161 * 132 162 * @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(ini_get('date.timezone') ? ini_get('date.timezone') : '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 error_log($date); 169 170 } 170 171 171 172 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> -
wp-admin/includes/template.php
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 ) {