Esempio n. 1
0
function p2_comments( $comment, $args ) {
	$GLOBALS['comment'] = $comment;

	if ( !is_single() && get_comment_type() != 'comment' )
		return;

	$depth          = prologue_get_comment_depth( get_comment_ID() );
	$can_edit_post  = current_user_can( 'edit_post', $comment->comment_post_ID );

	$reply_link     = prologue_get_comment_reply_link(
		array( 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ', 'reply_text' => __( 'Reply', 'p2' ) ),
		$comment->comment_ID, $comment->comment_post_ID );

	$content_class  = 'commentcontent';
	if ( $can_edit_post )
		$content_class .= ' comment-edit';

	?>
	<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
		<?php do_action( 'p2_comment' ); ?>

		<?php echo get_avatar( $comment, 32 ); ?>
		<h4>
			<?php echo get_comment_author_link(); ?>
			<span class="meta">
				<?php echo p2_date_time_with_microformat( 'comment' ); ?>
				<span class="actions">
					<a class="thepermalink" href="<?php echo esc_url( get_comment_link() ); ?>" title="<?php esc_attr_e( 'Permalink', 'p2' ); ?>"><?php _e( 'Permalink', 'p2' ); ?></a>
					<?php
					echo $reply_link;

					if ( $can_edit_post )
						edit_comment_link( __( 'Edit', 'p2' ), ' | ' );

					?>
				</span>
			</span>
		</h4>
		<div id="commentcontent-<?php comment_ID(); ?>" class="<?php echo esc_attr( $content_class ); ?>"><?php
				echo apply_filters( 'comment_text', $comment->comment_content, $comment );

				if ( $comment->comment_approved == '0' ): ?>
					<p><em><?php esc_html_e( 'Your comment is awaiting moderation.', 'p2' ); ?></em></p>
				<?php endif; ?>
		</div>
	<?php
}
Esempio n. 2
0
    echo esc_attr($author_posts_url);
    ?>
" title="<?php 
    echo esc_attr($posts_by_title);
    ?>
"><?php 
    the_author();
    ?>
</a>
		<?php 
}
?>
		<span class="meta">
			<?php 
if (!is_page()) {
    echo p2_date_time_with_microformat();
}
?>
			<span class="actions">
				<a href="<?php 
the_permalink();
?>
" class="thepermalink<?php 
if (is_singular()) {
    ?>
 printer-only<?php 
}
?>
" title="<?php 
esc_attr_e('Permalink', 'p2');
?>
Esempio n. 3
0
function p2_comments($comment, $args, $echo = true)
{
    $GLOBALS['comment'] = $comment;
    $depth = prologue_get_comment_depth(get_comment_ID());
    $comment_text = apply_filters('comment_text', $comment->comment_content);
    $comment_class = comment_class('', null, null, false);
    $comment_time = get_comment_time();
    $comment_date = get_comment_date();
    $id = get_comment_ID();
    $avatar = get_avatar($comment, 32);
    $author_link = get_comment_author_link();
    $reply_link = prologue_get_comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ', 'reply_text' => __('Reply', 'p2')), $comment->comment_ID, $comment->comment_post_ID);
    $can_edit = current_user_can('edit_post', $comment->comment_post_ID);
    $edit_comment_url = get_edit_comment_link($comment->comment_ID);
    $edit_link = $can_edit ? " | <a class='comment-edit-link' href='{$edit_comment_url}' title='" . esc_attr__('Edit comment', 'p2') . "'>" . __('Edit', 'p2') . "</a>" : '';
    $content_class = $can_edit ? 'commentcontent comment-edit' : 'commentcontent';
    $awaiting_message = $comment->comment_approved == '0' ? '<p><em>' . __('Your comment is awaiting moderation.', 'p2') . '</em></p>' : '';
    $permalink = esc_url(get_comment_link());
    $permalink_text = __('Permalink', 'p2');
    $date_time = p2_date_time_with_microformat('comment');
    $html = <<<HTML
<li {$comment_class} id="comment-{$id}">
\t\t{$avatar}
\t\t<h4>
\t\t\t\t{$author_link}
\t\t\t\t<span class="meta">
\t\t\t\t\t\t{$date_time}
\t\t\t\t\t\t<span class="actions"><a href="{$permalink}">{$permalink_text}</a> {$reply_link} {$edit_link}</span>
\t\t\t\t</span>
\t\t</h4>
\t\t<div class="{$content_class}" id="commentcontent-{$id}">
\t\t\t\t{$comment_text}
\t\t</div>
HTML;
    if (!is_single() && get_comment_type() != 'comment') {
        return false;
    }
    if ($echo) {
        echo $html;
    } else {
        return $html;
    }
}