Use get_comment() instead of a global in touch_time().

See #33638.

Built from https://develop.svn.wordpress.org/trunk@33965


git-svn-id: http://core.svn.wordpress.org/trunk@33934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-09 03:05:24 +00:00
parent 71f955dc84
commit 246f2a6bd9
2 changed files with 4 additions and 5 deletions

View File

@ -756,7 +756,6 @@ function meta_form( $post = null ) {
* @since 0.71 * @since 0.71
* *
* @global WP_Locale $wp_locale * @global WP_Locale $wp_locale
* @global WP_Comment $comment
* *
* @param int|bool $edit Accepts 1|true for editing the date, 0|false for adding the date. * @param int|bool $edit Accepts 1|true for editing the date, 0|false for adding the date.
* @param int|bool $for_post Accepts 1|true for applying the date to a post, 0|false for a comment. * @param int|bool $for_post Accepts 1|true for applying the date to a post, 0|false for a comment.
@ -765,9 +764,9 @@ function meta_form( $post = null ) {
* Default 0|false. * Default 0|false.
*/ */
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
global $wp_locale, $comment; global $wp_locale;
$post = get_post(); $post = get_post();
if ( $for_post ) if ( $for_post )
$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
@ -779,7 +778,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />'; // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
$time_adj = current_time('timestamp'); $time_adj = current_time('timestamp');
$post_date = ($for_post) ? $post->post_date : $comment->comment_date; $post_date = ($for_post) ? $post->post_date : get_comment()->comment_date;
$jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj ); $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
$mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj ); $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
$aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj ); $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-33964'; $wp_version = '4.4-alpha-33965';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.