wp/wp-includes/blocks/comment-date.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    26 	}
    26 	}
    27 
    27 
    28 	$classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
    28 	$classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
    29 
    29 
    30 	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
    30 	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
    31 	$formatted_date     = get_comment_date(
    31 	if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) {
    32 		isset( $attributes['format'] ) ? $attributes['format'] : '',
    32 		// translators: %s: human-readable time difference.
    33 		$comment
    33 		$formatted_date = sprintf( __( '%s ago' ), human_time_diff( get_comment_date( 'U', $comment ) ) );
    34 	);
    34 	} else {
    35 	$link               = get_comment_link( $comment );
    35 		$formatted_date = get_comment_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $comment );
       
    36 	}
       
    37 	$link = get_comment_link( $comment );
    36 
    38 
    37 	if ( ! empty( $attributes['isLink'] ) ) {
    39 	if ( ! empty( $attributes['isLink'] ) ) {
    38 		$formatted_date = sprintf( '<a href="%1s">%2s</a>', esc_url( $link ), $formatted_date );
    40 		$formatted_date = sprintf( '<a href="%1s">%2s</a>', esc_url( $link ), $formatted_date );
    39 	}
    41 	}
    40 
    42