Пример #1
6
 protected function comment($comment, $depth, $args)
 {
     // each comment markup, without </li>!
     $classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : '');
     // get typical wp comment classes and if comment belong post autor add "author-comment" class
     echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n";
     // parent tag with classes and uniq id
     echo '<div id="comment-' . get_comment_ID() . '">' . "\n";
     // anchor element with this id need to anchor links on comments works
     echo get_avatar($comment, 64) . "\n";
     // show avatar with size 64x64 px
     echo '<p class="meta">Posted by: ' . get_comment_author() . "\n";
     // comment autor name
     echo ' ' . get_comment_author_email();
     // comment autor email
     echo ' ' . get_comment_author_url();
     // comment autor url
     echo ' On ' . get_comment_date('F j, Y') . ' at ' . get_comment_time() . '</p>' . "\n";
     // date and time of comment creating
     if ('0' == $comment->comment_approved) {
         echo '<em class="comment-awaiting-moderation">Your comment is awaiting moderation</em>' . "\n";
     }
     // if comment is not approved notify of it
     comment_text() . "\n";
     // display comment text
     $reply_link_args = array('depth' => $depth, 'reply_text' => 'Reply on it', 'login_text' => 'You must be logged to post comments');
     echo get_comment_reply_link(array_merge($args, $reply_link_args));
     // display reply link
     echo '</div>' . "\n";
     // anchor element end
 }
Пример #2
1
 protected function comment($comment, $depth, $args)
 {
     // разметка каждого комментария, без закрывающего </li>!
     $classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : '');
     // берем стандартные классы комментария и если коммент пренадлежит автору поста добавляем класс author-comment
     echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n";
     // родительский тэг комментария с классами выше и уникальным id
     echo '<div id="comment-' . get_comment_ID() . '">' . "\n";
     // элемент с таким id нужен для якорных ссылок на коммент
     echo get_avatar($comment, 64) . "\n";
     // покажем аватар с размером 64х64
     echo '<p class="meta">Автор: ' . get_comment_author() . "\n";
     // имя автора коммента
     //echo ' '.get_comment_author_email(); // email автора коммента
     echo ' ' . get_comment_author_url();
     // url автора коммента
     echo ' <br>Добавлено ' . get_comment_date('F j, Y') . ' в ' . get_comment_time() . "\n";
     // дата и время комментирования
     if ('0' == $comment->comment_approved) {
         echo '<em class="comment-awaiting-moderation">Ваш комментарий будет опубликован после проверки модератором.</em>' . "\n";
     }
     // если комментарий должен пройти проверку
     comment_text() . "\n";
     // текст коммента
     $reply_link_args = array('depth' => $depth, 'reply_text' => 'Ответить', 'login_text' => 'Вы должны быть залогинены');
     echo get_comment_reply_link(array_merge($args, $reply_link_args));
     // выводим ссылку ответить
     echo '</div>' . "\n";
     // закрываем див
 }
Пример #3
0
 public function get_fields_for_render()
 {
     $entry_id = $this->comment->comment_ID;
     $post_id = $this->comment->comment_post_ID;
     $avatar_size = apply_filters('liveblog_entry_avatar_size', self::default_avatar_size);
     $comment_text = get_comment_text($entry_id);
     $css_classes = implode(' ', get_comment_class('', $entry_id, $post_id));
     $entry = array('entry_id' => $entry_id, 'post_id' => $post_id, 'css_classes' => $css_classes, 'content' => self::render_content($comment_text, $this->comment), 'original_content' => apply_filters('liveblog_before_edit_entry', $comment_text), 'avatar_size' => $avatar_size, 'avatar_img' => get_avatar($this->comment->comment_author_email, $avatar_size), 'author_link' => get_comment_author_link($entry_id), 'entry_date' => get_comment_date(get_option('date_format'), $entry_id), 'entry_time' => get_comment_date(get_option('time_format'), $entry_id), 'timestamp' => $this->get_timestamp(), 'is_liveblog_editable' => WPCOM_Liveblog::is_liveblog_editable());
     return $entry;
 }
Пример #4
0
 private function commentClass()
 {
     $classes = get_comment_class();
     $comment_class = 'class="';
     foreach ($classes as $class) {
         // print_r($class . '<br>');
         $comment_class .= $class . ' ';
     }
     $comment_class .= '"';
     return $comment_class;
 }
 public static function render($comment, $args, $depth)
 {
     self::set_context($comment);
     // Note that WordPress closes the div for you, do not close it here!
     // https://codex.wordpress.org/Function_Reference/wp_list_comments
     printf('<div class="%s">', implode(' ', get_comment_class(self::base_classes($comment), $comment, $comment->comment_post_ID)));
     $comment_actions = '';
     if (comments_open($comment->comment_post_ID)) {
         $comment_actions = html('a', array('class' => 'reply-link', 'href' => sprintf('mailto:{{{reply_to_comment_%s}}}?subject=%s', $comment->comment_ID, rawurlencode(sprintf(__('Reply to %s', 'Postmatic'), $comment->comment_author)))), html('img', array('src' => 'https://s3-us-west-2.amazonaws.com/postmatic/assets/icons/reply.png', 'width' => '13', 'height' => '8')), __('Reply', 'Postmatic'));
     }
     echo html('div class="comment-header"', get_avatar($comment), html('div class="author-name"', get_comment_author_link($comment->comment_ID)), html('div class="comment-body"', apply_filters('comment_text', get_comment_text($comment->comment_ID), $comment), $comment_actions));
 }
Пример #6
0
function mystique_comment_class($class = '')
{
    global $post, $comment;
    $classes = get_comment_class();
    if (get_option('show_avatars')) {
        $classes[] = 'withAvatars';
    }
    if ($comment->user_id > 0) {
        $user = new WP_User($comment->user_id);
        if (is_array($user->roles)) {
            foreach ($user->roles as $role) {
                $classes[] = "role-{$role}";
            }
        }
        $classes[] = 'user-' . sanitize_html_class($user->user_nicename, $user->user_id);
    } else {
        $classes[] = 'reader name-' . get_comment_author();
    }
    // user classes
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    }
    echo join(' ', apply_filters("comment_class", $classes));
}
Пример #7
0
/**
 * Sets a class for each comment. Sets alt, odd/even, and author/user classes. Adds author, user, 
 * and reader classes. Needs more work because WP, by default, assigns even/odd backwards 
 * (Odd should come first, even second).
 *
 * @since 0.2.0
 * @global $wpdb WordPress DB access object.
 * @global $comment The current comment's DB object.
 */
function hybrid_comment_class($class = '')
{
    global $post, $comment, $hybrid;
    /* Gets default WP comment classes. */
    $classes = get_comment_class($class);
    /* Get the comment type. */
    $classes[] = get_comment_type();
    /* User classes to match user role and user. */
    if ($comment->user_id > 0) {
        /* Create new user object. */
        $user = new WP_User($comment->user_id);
        /* Set a class with the user's role. */
        if (is_array($user->roles)) {
            foreach ($user->roles as $role) {
                $classes[] = "role-{$role}";
            }
        }
        /* Set a class with the user's name. */
        $classes[] = 'user-' . sanitize_html_class($user->user_nicename, $user->ID);
    } else {
        $classes[] = 'reader';
    }
    /* Comment by the entry/post author. */
    if ($post = get_post($post_id)) {
        if ($comment->user_id === $post->post_author) {
            $classes[] = 'entry-author';
        }
    }
    /* Get comment types that are allowed to have an avatar. */
    $avatar_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
    /* If avatars are enabled and the comment types can display avatars, add the 'has-avatar' class. */
    if (get_option('show_avatars') && in_array($comment->comment_type, $avatar_comment_types)) {
        $classes[] = 'has-avatar';
    }
    /* Join all the classes into one string and echo them. */
    $class = join(' ', $classes);
    echo apply_filters("{$hybrid->prefix}_comment_class", $class);
}
 /**
  * @global WP_Post $post
  *
  * @param object $comment
  */
 public function single_row($comment)
 {
     global $post;
     $the_comment_class = wp_get_comment_status($comment);
     if (!$the_comment_class) {
         $the_comment_class = '';
     }
     $the_comment_class = join(' ', get_comment_class($the_comment_class, $comment, $comment->comment_post_ID));
     if ($comment->comment_post_ID > 0) {
         $post = get_post($comment->comment_post_ID);
     }
     $this->user_can = current_user_can('edit_comment', $comment->comment_ID);
     echo "<tr id='comment-{$comment->comment_ID}' class='{$the_comment_class}'>";
     $this->single_row_columns($comment);
     echo "</tr>\n";
     $post = null;
 }
 /**
  * @ticket 33947
  */
 public function test_should_return_an_empty_array_for_invalid_comment_id()
 {
     $this->assertSame(array(), get_comment_class('foo', 12345));
 }
 function single_row($a_comment)
 {
     global $post, $comment;
     $comment = $a_comment;
     $the_comment_class = join(' ', get_comment_class(wp_get_comment_status($comment->comment_ID)));
     $post = get_post($comment->comment_post_ID);
     $this->user_can = current_user_can('edit_comment', $comment->comment_ID);
     echo "<tr id='comment-{$comment->comment_ID}' class='{$the_comment_class}'>";
     echo $this->single_row_columns($comment);
     echo "</tr>\n";
 }
Пример #11
0
function qb_comments($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    //$avatar 			= get_avatar( $comment, 48 );
    $comment_author_id = get_comment(get_comment_ID())->user_id;
    $comment_author_url = get_comment_author_url();
    if (has_wp_user_avatar($comment_author_id)) {
        //$avatar	= get_wp_user_avatar_src( $comment_author_id, 48 );
        $avatar = get_wp_user_avatar($comment_author_id, 48);
    } else {
        //$avatar = get_bloginfo( 'template_url' ) . '/images/default/48.png';
        // temporary: this is the same for now, for testing; eventually, it should fall back to default image or Facebook image or smt else
        //$avatar	= get_wp_user_avatar_src( $comment_author_id, 48 );
        $avatar = get_wp_user_avatar($comment_author_id, 48);
    }
    ?>

	<li <?php 
    get_comment_class();
    ?>
><?php 
    if ($comment_author_url) {
        echo '<a href="' . $comment_author_url . '">' . $avatar . get_comment_author() . '</a>';
    } else {
        echo $avatar . get_comment_author();
    }
    echo '<time class="timeago" datetime="' . get_comment_date('c') . '">' . get_comment_date('F j, Y') . '</time>';
    comment_text();
    //edit_comment_link( 'Edit', '<span class="edit">', '</span>' );
    if ($comment->comment_approved == '0') {
        echo '<em class="moderate">Your comment is awaiting moderation.</em>';
    }
    /*comment_reply_link(
    			array_merge(
    				$args,
    				array(
    					'reply_text'	=> 'Reply',
    					'depth' 		=> $depth,
    					'max_depth' 	=> $args['max_depth']
    				)
    			)
    		);*/
    echo '</li>';
}
Пример #12
0
/**
 * Add attributes for the comment element.
 *
 * @return array
 * @since 1.3
 */
function momtaz_atts_comment($atts)
{
    $comment_id = get_comment_ID();
    if (empty($comment_id)) {
        return $atts;
    }
    $atts['id'] = "comment-{$comment_id}";
    $atts['class'] = get_comment_class();
    $atts['itemprop'] = 'comment';
    $atts['itemscope'] = 'itemscope';
    $atts['itemtype'] = 'http://schema.org/UserComments';
    return $atts;
}
Пример #13
0
 /**
  * Comment renderer function.
  *
  * @param  Comment $comment comment instance.
  * @param  array   $args    array of options.
  * @param  int     $depth   current depth level.
  * @return void
  */
 function adventure_tours_comment_renderer($comment, $args, $depth)
 {
     $commentHtml = get_avatar($comment, 90) . '<div class="comments__item__info">' . '<div class="comments__item__name">' . get_comment_author_link() . '</div>' . '<div class="comments__item__reply-link">' . get_comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => esc_html__('Reply', 'adventure-tours'), 'login_text' => '')) . '</div>' . '</div>' . '<div class="comments__item__date">' . get_comment_date() . '</div>' . '<div class="comments__item__text">' . get_comment_text() . '</div>';
     printf('<div class="%s" id="comment-%s">%s%s', implode(' ', get_comment_class('comments__item')), get_comment_ID(), $commentHtml, !empty($args['has_children']) ? '</div><div class="comments__item__reply">' : '');
 }
Пример #14
0
/**
 * Sets a class for each comment. Sets alt, odd/even, and author/user classes. Adds author, user, 
 * and reader classes. Needs more work because WP, by default, assigns even/odd backwards 
 * (Odd should come first, even second).
 *
 * @since  1.6.0
 * @access public
 * @global $comment The current comment's DB object
 * @return void
 */
function hybrid_get_comment_class($class = '')
{
    global $comment;
    /* Gets default WP comment classes. */
    $classes = get_comment_class($class);
    /* Get the comment type. */
    $comment_type = get_comment_type();
    /* If the comment type is 'pingback' or 'trackback', add the 'ping' comment class. */
    if ('pingback' == $comment_type || 'trackback' == $comment_type) {
        $classes[] = 'ping';
    }
    /* User classes to match user role and user. */
    if ($comment->user_id > 0) {
        /* Create new user object. */
        $user = new WP_User($comment->user_id);
        /* Set a class with the user's role(s). */
        if (is_array($user->roles)) {
            foreach ($user->roles as $role) {
                $classes[] = sanitize_html_class("role-{$role}");
            }
        }
        /* Set a class with the user's name. */
        $classes[] = sanitize_html_class("user-{$user->user_nicename}", "user-{$user->ID}");
    } else {
        $classes[] = 'reader';
    }
    /* Comment by the entry/post author. */
    if ($post = get_post(get_the_ID())) {
        if ($comment->user_id == $post->post_author) {
            $classes[] = 'entry-author';
        }
    }
    /* Get comment types that are allowed to have an avatar. */
    $avatar_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
    /* If avatars are enabled and the comment types can display avatars, add the 'has-avatar' class. */
    if (get_option('show_avatars') && in_array($comment->comment_type, $avatar_comment_types)) {
        $classes[] = 'has-avatar';
    }
    /* Make sure comment classes doesn't have any duplicates. */
    return array_unique($classes);
}
Пример #15
0
function enlightenment_comment($comment, $args, $depth)
{
    $defaults = array('comment_class' => 'comment-body' . (empty($args['has_children']) ? '' : ' parent'), 'comment_id' => 'comment-' . get_comment_ID(), 'comment_extra_atts' => '', 'header_tag' => current_theme_supports('html5', 'comment-list') ? 'header' : 'div', 'header_class' => 'comment-header', 'comment_content_tag' => 'div', 'comment_content_class' => 'comment-content', 'comment_content_extra_atts' => '', 'echo' => true);
    $defaults = apply_filters('enlightenment_comment_args', $defaults);
    $comment_reply_link_defaults = array('add_below' => 'comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '<div class="reply">', 'after' => '</div>');
    $comment_reply_link_defaults = apply_filters('enlightenment_comment_reply_link_args', $comment_reply_link_defaults);
    $defaults = wp_parse_args($comment_reply_link_defaults, $defaults);
    $args = wp_parse_args($args, $defaults);
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);
    if ('ul' == $args['style'] || 'ol' == $args['style']) {
        $args['style'] = 'li';
    } else {
        $args['style'] = current_theme_supports('html5', 'comment-list') ? 'article' : 'div';
    }
    do_action('enlightenment_before_comment', $comment, $args);
    echo enlightenment_open_tag($args['style'], join(' ', get_comment_class($args['comment_class'])), $args['comment_id'], $args['comment_extra_atts']);
    do_action('enlightenment_before_comment_header', $comment, $args);
    if (has_action('enlightenment_comment_header')) {
        echo enlightenment_open_tag($args['header_tag'], $args['header_class']);
        do_action('enlightenment_comment_header', $comment, $args);
        echo enlightenment_close_tag($args['header_tag']);
    }
    do_action('enlightenment_after_comment_header', $comment, $args);
    do_action('enlightenment_before_comment_content', $comment, $args);
    if (has_action('enlightenment_comment_content')) {
        echo enlightenment_open_tag($args['comment_content_tag'], $args['comment_content_class'], '', $args['comment_content_extra_atts']);
        do_action('enlightenment_comment_content', $comment, $args);
        echo enlightenment_close_tag($args['comment_content_tag']);
    }
    do_action('enlightenment_after_comment_content', $args, $comment);
}
Пример #16
0
 public function start($comment, $args, $depth)
 {
     global $thesis;
     $GLOBALS['comment'] = $comment;
     echo str_repeat("\t", $this->tab_depth + 1), "<{$this->child_html} class=\"", esc_attr(implode(' ', get_comment_class())), "\" id=\"comment-", get_comment_ID(), "\">\n";
     $this->rotator(array('depth' => $this->tab_depth + 2));
 }
Пример #17
0
    /**
     * Template for comments and pingbacks.
     *
     * Used as a callback by wp_list_comments() for displaying the comments.
     *
     * @since Acid 1.0
     */
    function village_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        if (in_array("bypostauthor", get_comment_class())) {
            $is_author = true;
        } else {
            $is_author = false;
        }
        switch ($comment->comment_type) {
            case 'pingback':
            case 'trackback':
                ?>
	<li class="post pingback">
		<p><?php 
                _e('Pingback:', 'themevillage');
                ?>
 <?php 
                comment_author_link();
                edit_comment_link(__('(Edit)', 'themevillage'), ' ');
                ?>
</p>
	<?php 
                break;
            default:
                ?>
	<li <?php 
                comment_class();
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">
		<article id="comment-<?php 
                comment_ID();
                ?>
" class="comment">
			<div class="comment__container cf">

				<footer class="comment-author g one-sixth lap-one-fifth palm-one-whole">
						
						<div class="avatar-container">
							<?php 
                echo get_avatar($comment, 125);
                ?>
						</div>



					<div class="comment-meta commentmetadata">						
						<?php 
                edit_comment_link(__('(Edit)', 'themevillage'), ' ');
                ?>

					</div><!-- .comment-meta .commentmetadata -->

				</footer>

				<div class="comment-content g five-sixths lap-four-fifths palm-one-whole">
					<div class="name">
						<?php 
                echo get_comment_author_link();
                ?>
					</div>

						<?php 
                // Currently Disable is_author
                $is_author = false;
                if (true === $is_author) {
                    ?>
							<span class="is-author">
								<?php 
                    _e("Author", 'themevillage');
                    ?>
 </span>
							<br>						
							<?php 
                }
                ?>
					<time class="comment-meta" pubdate datetime="<?php 
                comment_time('c');
                ?>
">
							<?php 
                echo get_comment_time();
                ?>
							<?php 
                echo get_comment_date();
                ?>
 &colon; 
					</time><br>

					<?php 
                if ($comment->comment_approved == '0') {
                    ?>
						<em><?php 
                    _e('Your comment is awaiting moderation.', 'themevillage');
                    ?>
</em>
						<br />
					<?php 
                }
                ?>
					<?php 
                comment_text();
                ?>
</div>
			</div><!--  .comment__container -->

			<div class="reply batch">
				<?php 
                comment_reply_link(array_merge($args, array('reply_text' => '&#xF158;', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
                ?>
			</div><!-- .reply -->
		</article><!-- #comment-## -->

	<?php 
                break;
        }
    }
Пример #18
0
 function novusopress_comment($comment, $args, $depth)
 {
     $tab = '    ';
     $indent = $depth == 1 ? 5 + $depth : 4 + $depth * 2;
     $output = [];
     switch ($comment->comment_type) {
         case 'pingback':
         case 'trackback':
             $output[] = sprintf('%s<li id="li-comment-%s" class="post pingback">%s', str_repeat($tab, $indent), get_comment_ID(), PHP_EOL);
             $output[] = sprintf('%s<p>%s: %s', str_repeat($tab, $indent + 1), __('Pingback', 'novusopress'), get_comment_author_link());
             if (current_user_can('edit_comment', $comment->comment_ID)) {
                 $output[] = sprintf(' <span class="edit-link"><a href="%s">%s</a></span>', get_edit_comment_link(), __('Edit', 'novusopress'));
             }
             $output[] = sprintf('</p>%s', PHP_EOL);
             break;
         default:
             $output[] = sprintf('%s<li id="li-comment-%s" class="%s">%s', str_repeat($tab, $indent), get_comment_ID(), implode(' ', get_comment_class()), PHP_EOL);
             $output[] = sprintf('%s<div id="comment-%s" class="comment-body">%s', str_repeat($tab, $indent + 1), get_comment_ID(), PHP_EOL);
             $output[] = sprintf('%s<footer class="comment-meta">%s', str_repeat($tab, $indent + 2), PHP_EOL);
             $output[] = sprintf('%s<div class="comment-author vcard pad-bottom clearfix">%s', str_repeat($tab, $indent + 3), PHP_EOL);
             if (current_user_can('edit_comment', $comment->comment_ID)) {
                 $output[] = str_repeat($tab, $indent + 4);
                 $output[] = sprintf('<span class="edit-link"><a href="%s" class="btn btn-xs btn-default align-right">%s</a></span>', get_edit_comment_link(), __('Edit', 'novusopress'));
                 $output[] = PHP_EOL;
             }
             $size = 64;
             if ('0' != $comment->comment_parent) {
                 $size = 38;
             }
             $output[] = str_repeat($tab, $indent + 4);
             $output[] = '<div class="thumbnail inline-box align-left">';
             $output[] = get_avatar($comment, $size);
             $output[] = '</div>';
             $output[] = PHP_EOL;
             $output[] = str_repeat($tab, $indent + 4);
             $output[] = sprintf(__('%1$s on %2$s', 'novusopress'), sprintf('<span class="fn">%s</span>', get_comment_author_link()), sprintf('<a href="%1$s" class="comment-datetime"><time datetime="%2$s">%3$s</time></a>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf(__('%1$s at %2$s', 'novusopress'), get_comment_date(), get_comment_time())));
             $output[] = PHP_EOL;
             $output[] = sprintf('%s</div><!-- .comment-author -->%s', str_repeat($tab, $indent + 3), PHP_EOL);
             if ($comment->comment_approved == '0') {
                 $output[] = PHP_EOL;
                 $output[] = str_repeat($tab, $indent + 3);
                 $output[] = sprintf('<div class="alert alert-info comment-awaiting-moderation">%s</div>', __('Your comment is awaiting moderation', 'novusopress'));
             }
             $output[] = sprintf('%s</footer><!-- .comment-meta -->%s', str_repeat($tab, $indent + 2), PHP_EOL);
             $output[] = str_repeat($tab, $indent + 2);
             $output[] = '<div class="comment-content">';
             $output[] = PHP_EOL;
             $output[] = str_repeat($tab, $indent + 3);
             ob_start();
             comment_text();
             $output[] = ob_get_clean();
             $output[] = str_repeat($tab, $indent + 2);
             $output[] = '</div>';
             $output[] = PHP_EOL;
             $output[] = str_repeat($tab, $indent + 2);
             $output[] = '<div class="reply">';
             $output[] = PHP_EOL;
             $output[] = str_repeat($tab, $indent + 3);
             $output[] = get_comment_reply_link(array_merge($args, ['reply_text' => __('Reply &darr;', 'novusopress'), 'depth' => $depth, 'max_depth' => $args['max_depth']]));
             $output[] = PHP_EOL;
             $output[] = str_repeat($tab, $indent + 2);
             $output[] = '</div>';
             $output[] = PHP_EOL;
             $output[] = sprintf('%s</div><!-- #comment-%s -->%s', str_repeat($tab, $indent + 1), get_comment_ID(), PHP_EOL);
             break;
     }
     if ($args['has_children'] && (int) $args['max_depth'] > $depth) {
         $output[] = str_repeat($tab, $indent + 1);
     }
     $output = apply_filters('novusopress_comment_output', implode('', $output));
     echo $output;
 }
Пример #19
0
    function nextgen_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        switch ($comment->comment_type) {
            case 'pingback':
            case 'trackback':
                break;
            default:
                // Proceed with normal comments.
                global $post;
                $class = 'nggpl-' . implode(' nggpl-', get_comment_class());
                ?>
                <li class="<?php 
                echo $class;
                ?>
" id="nggpl-li-comment-<?php 
                comment_ID();
                ?>
">
                    <article id="nggpl-comment-<?php 
                comment_ID();
                ?>
" class="nggpl-comment">
                        <div class="nggpl-comment-meta nggpl-comment-author nggpl-vcard">
                            <?php 
                printf('<cite>%1$s</cite>', get_comment_author_link());
                ?>
                            |
                            <?php 
                printf('<time datetime="%1$s">%2$s</time>', get_comment_time('c'), sprintf(__('%1$s'), get_comment_date('F jS, Y')));
                ?>
                            <?php 
                if ($depth <= $args['max_depth']) {
                    ?>
                                |
                                <span class="nggpl-reply">
                                <a href='javascript:void(0)'
                                   class='nggpl-reply-to-comment'
                                   data-comment-id='<?php 
                    comment_ID();
                    ?>
'
                                   data-user-name='<?php 
                    echo get_comment_author();
                    ?>
'>
                                    <?php 
                    print __('Reply');
                    ?>
                                </a>
                            </span>
                            <?php 
                }
                ?>
                        </div>
                        <section class="nggpl-comment-content nggpl-comment">
                            <?php 
                echo get_avatar($comment, 40);
                ?>
                            <?php 
                comment_text();
                ?>

                            <?php 
                if ('0' == $comment->comment_approved) {
                    ?>
                                <p class="nggpl-comment-awaiting-moderation">
                                    <?php 
                    _e('Your comment is awaiting moderation.');
                    ?>
                                </p>
                            <?php 
                }
                ?>
                        </section>
                    </article>
                </li>
                <?php 
                break;
        }
    }
Пример #20
0
/**
 * @since      1.6.0
 * @deprecated 2.0.0
 */
function hybrid_get_comment_class($class = '')
{
    _deprecated_function(__FUNCTION__, '2.0.0', 'get_comment_class');
    return get_comment_class($class);
}
Пример #21
0
/**
 * Comment wrapper attributes.
 *
 * @since  1.0.0
 * @access public
 * @param  array $attr Existing attributes.
 * @return array
 */
function carelib_attr_comment($attr)
{
    $attr['id'] = 'comment-' . get_comment_ID();
    $attr['class'] = join(' ', get_comment_class());
    return $attr;
}
Пример #22
0
/**
 * Sets a class for each comment. Sets alt, odd/even, and author/user classes. Adds author, user, 
 * and reader classes. Needs more work because WP, by default, assigns even/odd backwards 
 * (Odd should come first, even second).
 *
 * @since 0.2.0
 * @global $wpdb WordPress DB access object.
 * @global $comment The current comment's DB object.
 */
function hybrid_comment_class( $class = '' ) {
	global $post, $comment, $hybrid;

	/* Gets default WP comment classes. */
	$classes = get_comment_class( $class );

	/* Get the comment type. */
	$classes[] = get_comment_type();

	/* User classes to match user role and user. */
	if ( $comment->user_id > 0 ) {

		/* Create new user object. */
		$user = new WP_User( $comment->user_id );

		/* Set a class with the user's role. */
		if ( is_array( $user->roles ) ) {
			foreach ( $user->roles as $role )
				$classes[] = "role-{$role}";
		}

		/* Set a class with the user's name. */
		$classes[] = 'user-' . sanitize_html_class( $user->user_nicename, $user->ID );
	}

	/* If not a registered user */
	else {
		$classes[] = 'reader';
	}

	/* Comment by the entry/post author. */
	if ( $post = get_post( $post_id ) ) {
		if ( $comment->user_id === $post->post_author )
			$classes[] = 'entry-author';
	}

	/* Join all the classes into one string and echo them. */
	$class = join( ' ', $classes );

	echo apply_filters( "{$hybrid->prefix}_comment_class", $class );
}
Пример #23
0
/**
 * Comment wrapper attributes.
 *
 * @since  2.0.0
 * @access public
 * @param  array   $attr
 * @return array
 */
function hybrid_attr_comment($attr)
{
    $attr['id'] = 'comment-' . get_comment_ID();
    $attr['class'] = join(' ', get_comment_class());
    if (in_array(get_comment_type(), array('', 'comment'))) {
        $attr['itemprop'] = 'comment';
        $attr['itemscope'] = 'itemscope';
        $attr['itemtype'] = 'http://schema.org/UserComments';
    }
    return $attr;
}
Пример #24
0
# Default attributes
# [id] is for jumps (not CSS)
\call_user_func(function () {
    foreach (array('@header' => 'id="header" class="site-header" role="banner"', '@footer' => 'id="footer" class="site-footer"', '@branding' => 'class="site-branding"', '@main' => 'id="main" role="main"', '@loop' => 'class="loop hfeed"', '@entry' => function () {
        $class = \implode(' ', get_post_class());
        return $class ? "class='{$class}'" : '';
    }, '@comments' => function () {
        $able = comments_open() ? 'open' : 'closed';
        $some = have_comments() ? 'has' : 'lacks';
        $used = 'open' == $able || 'has' == $some ? 'used' : 'unused';
        $atts = "class='comments comments-{$able} {$some}-comments {$used}'";
        return is_singular() ? "id='comments' {$atts}" : $atts;
    }, '@comment' => function () {
        $id = get_comment_ID();
        $atts = is_singular() ? array("id='comment-{$id}'") : array();
        $class = \implode(' ', get_comment_class('', $id));
        $class and $atts[] = "class='{$class}'";
        return \implode(' ', $atts);
    }) as $hook => $atts) {
        add_filter($hook . '_atts', \is_scalar($atts) ? function () use($atts) {
            return $atts;
        } : $atts, 0);
    }
});
add_filter('post_class', function ($arr = array()) {
    # This compares using the format from: Settings > General > Date Format
    # Maybe we should use Y-m-d or provide a filter like:
    # $format = apply_filters('@time_compare_format', '');
    $arr = (array) $arr;
    $arr[] = get_the_date() === get_the_modified_date() ? 'unrevised' : 'revised';
    $arr[] = has_post_thumbnail() ? 'has-thumbnail' : 'lacks-thumbnail';
/**
 * Generates semantic classes for each comment element.
 *
 * @since 2.7.0
 *
 * @param string|array $class Optional. One or more classes to add to the class list.
 *                                 Default empty.
 * @param int $comment_id Comment ID. Default current comment.
 * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
 * @param bool $echo Optional. Whether to cho or return the output.
 *                                 Default true.
 * @return string|void
 */
function comment_class($class = '', $comment_id = null, $post_id = null, $echo = true)
{
    // Separates classes with a single space, collates classes for comment DIV
    $class = 'class="' . join(' ', get_comment_class($class, $comment_id, $post_id)) . '"';
    if ($echo) {
        echo $class;
    } else {
        return $class;
    }
}
function hocwp_theme_translation_comments_list_callback($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    $comment_id = $comment->comment_ID;
    $style = isset($args['style']) ? $args['style'] : 'ol';
    $avatar_size = isset($args['avatar_size']) ? absint($args['avatar_size']) : 64;
    $avatar_size = apply_filters('hocwp_comment_avatar_size', $avatar_size);
    $max_depth = isset($args['max_depth']) ? absint($args['max_depth']) : '';
    $comment_permalink = get_comment_link($comment);
    if ('div' == $style) {
        $tag = 'div';
        $add_below = 'comment';
    } else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
    $comment_date = get_comment_date('Y-m-d H:i:s', $comment_id);
    $comment_author = '<div class="comment-author vcard">' . get_avatar($comment, $avatar_size) . '<b class="fn">' . get_comment_author_link() . '</b> <span class="says">nói:</span></div>';
    $comment_metadata = '<div class="comment-metadata"><a href="' . $comment_permalink . '"><time datetime="' . get_comment_time('c') . '">' . hocwp_human_time_diff_to_now($comment_date) . ' ' . 'trước' . '</time></a> <a class="comment-edit-link" href="' . get_edit_comment_link($comment_id) . '">(' . 'Sửa' . ')</a></div>';
    if ($comment->comment_approved == '0') {
        $comment_metadata .= '<p class="comment-awaiting-moderation">' . 'Bình luận của bạn đang được chờ để xét duyệt.' . '</p>';
    }
    $footer = new HOCWP_HTML('footer');
    $footer->set_class('comment-meta');
    $footer->set_text($comment_author . $comment_metadata);
    $comment_text = get_comment_text($comment_id);
    $comment_text = apply_filters('comment_text', $comment_text, $comment);
    $comment_content = '<div class="comment-content">' . $comment_text . '</div>';
    $reply = '<div class="reply comment-tools">';
    $reply .= get_comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $max_depth)));
    $comment_tools_enabled = apply_filters('hocwp_comment_tools_enabled', true);
    if ($comment_tools_enabled) {
        $class = 'comment-like comment-likes';
        $session_comment_liked_key = 'comment_' . $comment_id . '_likes';
        $liked = intval(isset($_SESSION[$session_comment_liked_key]) ? $_SESSION[$session_comment_liked_key] : '');
        if ($liked == 1) {
            hocwp_add_string_with_space_before($class, 'disabled');
        }
        $a = new HOCWP_HTML('a');
        $a->set_class($class);
        $a->set_attribute('href', 'javascript:;');
        $a->set_attribute('data-session-likes-key', $session_comment_liked_key);
        $likes = hocwp_get_comment_likes($comment_id);
        $a->set_attribute('data-likes', $likes);
        $a->set_text('<span class="text">' . 'Thích' . '</span> <i class="fa fa-thumbs-o-up"></i><span class="sep-dot">.</span> <span class="count">' . $likes . '</span>');
        $reply .= $a->build();
        $a->set_class('comment-report');
        $a->remove_attribute('data-session-liked-key');
        $a->set_text('Báo cáo vi phạm' . '<i class="fa fa-flag"></i>');
        $reply .= $a->build();
        $a->set_class('comment-share');
        $share_text = '<span class="text">' . 'Chia sẻ' . '<i class="fa fa-angle-down"></i></span>';
        $share_text .= '<span class="list-share">';
        $share_text .= '<i class="fa fa-facebook facebook" data-url="' . hocwp_get_social_share_url(array('social_name' => 'facebook', 'permalink' => $comment_permalink)) . '"></i>';
        $share_text .= '<i class="fa fa-google-plus google" data-url="' . hocwp_get_social_share_url(array('social_name' => 'googleplus', 'permalink' => $comment_permalink)) . '"></i>';
        $share_text .= '<i class="fa fa-twitter twitter" data-url="' . hocwp_get_social_share_url(array('social_name' => 'twitter', 'permalink' => $comment_permalink)) . '"></i>';
        $share_text .= '</span>';
        $a->set_text($share_text);
        $reply .= $a->build();
    }
    $reply .= '</div>';
    $article = new HOCWP_HTML('article');
    $article->set_attribute('id', 'div-comment-' . $comment_id);
    $article->set_class('comment-body');
    $article_text = $footer->build();
    $article_text .= $comment_content;
    $article_text .= $reply;
    $article->set_text($article_text);
    $html = new HOCWP_HTML($tag);
    $comment_class = get_comment_class(empty($args['has_children']) ? '' : 'parent');
    $comment_class = implode(' ', $comment_class);
    $html_atts = array('class' => $comment_class, 'id' => 'comment-' . $comment_id, 'data-comment-id' => $comment_id);
    $html->set_attribute_array($html_atts);
    $html->set_text($article->build());
    $html->set_close(false);
    $html->output();
}
function single_comment($comment_ID)
{
    $commentdata = get_comment($comment_ID, ARRAY_A);
    ?>
	<li id="comment-<?php 
    echo $commentdata['comment_ID'];
    ?>
" class="<?php 
    echo join(' ', get_comment_class('', $commentdata['comment_ID'], $commentdata['comment_post_ID']));
    ?>
">
		<article id="div-comment-<?php 
    echo $commentdata['comment_ID'];
    ?>
" class="comment-body">

			<footer class="comment-meta">
				<div class="comment-author vcard">
					<?php 
    echo get_avatar($commentdata['comment_author_email'], 32);
    ?>
					<b class="fn"><?php 
    echo $commentdata['comment_author'];
    ?>
</b> 
					<span class="says">says:</span>					
				</div><!-- .comment-author -->
				<div class="comment-metadata">
					<a href="<?php 
    echo get_comment_link($commentdata['comment_ID']);
    ?>
">
						<time datetime="<?php 
    echo $commentdata['comment_date_gmt'];
    ?>
+00:00">
							<?php 
    echo get_comment_date('F j, Y \\a\\t g:i a', $commentdata['comment_ID']);
    ?>
						</time>
					</a>
					<?php 
    if (is_user_logged_in()) {
        ?>
					<span class="edit-link">
						<a class="comment-edit-link" href="<?php 
        echo home_url();
        ?>
/wp-admin/comment.php?action=editcomment&#038;c=<?php 
        echo $commentdata['comment_content'];
        ?>
">
							Edit
						</a>
					</span>
					<?php 
    }
    ?>
				</div><!-- .comment-metadata -->
			</footer><!-- .comment-meta -->

			<div class="comment-content">
				<p>
					<?php 
    echo $commentdata['comment_content'];
    ?>
				</p>
			</div><!-- .comment-content -->

			<div class="reply">
				<?php 
    // echo get_comment_reply_link(array(), $commentdata['comment_ID'], $commentdata['comment_post_ID'] ); // I don't know why this doesn't work
    ?>
				<a rel="nofollow" 
				   class="comment-reply-link" 
				   href="<?php 
    echo get_permalink($commentdata['comment_post_ID']);
    ?>
?replytocom=<?php 
    echo $commentdata['comment_ID'];
    ?>
#respond" 
				   onclick="return addComment.moveForm( 'div-comment-<?php 
    echo $commentdata['comment_ID'];
    ?>
', '<?php 
    echo $commentdata['comment_ID'];
    ?>
', 'respond', '12' )"  
				   aria-label="Reply to <?php 
    echo $commentdata['comment_author'];
    ?>
"
				   >
					Reply
				</a>
			</div>

		</article><!-- .comment-body -->
	</li><!-- #comment-## -->
	<?php 
    return;
}
Пример #28
0
 public function __construct($comment, $args, $depth)
 {
     $this->id = (int) $comment->comment_ID;
     $this->postId = (int) $comment->comment_post_ID;
     $this->parent = (int) $comment->comment_parent;
     $this->date = $comment->comment_date;
     $this->dateGmt = $comment->comment_date_gmt;
     $this->content = apply_filters('comment_text', $comment->comment_content);
     // htmlfy!
     $this->karma = (int) $comment->comment_karma;
     $this->approved = (bool) $comment->comment_approved;
     $this->browser = $comment->comment_agent;
     $this->type = $comment->comment_type;
     $this->userId = (int) $comment->user_id;
     $this->author = new WpLatteCommentAuthorEntity($comment);
     $this->classes = implode(' ', get_comment_class());
     $this->args = $args;
     $this->depth = $depth;
     $this->url = null;
     unset($comment);
 }
Пример #29
0
/**
* Sets a class for each comment
* Sets alt, odd/even, and author/user classes
* Adds author, user, and reader classes
*
* @since 0.2
*/
function hybrid_comment_class()
{
    global $comment;
    static $comment_alt;
    $classes = array();
    if (function_exists('get_comment_class')) {
        $classes = get_comment_class();
    }
    $classes[] = get_comment_type();
    /*
     * User classes
     */
    if ($comment->user_id > 0 && ($user = get_userdata($comment->user_id))) {
        $classes[] = 'user user-' . $user->user_nicename;
        if ($post = get_post($post_id)) {
            if ($comment->user_id === $post->post_author) {
                $classes[] = 'author author-' . $user->user_nicename;
            }
        }
    } else {
        $classes[] = 'reader';
    }
    /*
     * Alt classes
     */
    if ($comment_alt++ % 2) {
        $classes[] = 'even';
        $classes[] = 'alt';
    } else {
        $classes[] = 'odd';
    }
    /*
     * http://microid.org
     */
    $email = get_comment_author_email();
    $url = get_comment_author_url();
    if (!empty($email) && !empty($url)) {
        $microid = 'microid-mailto+http:sha1:' . sha1(sha1('mailto:' . $email) . sha1($url));
        $classes[] = $microid;
    }
    $classes = join(' ', $classes);
    echo $classes;
}
    esc_html_e('No logs found.', 'pronamic_ideal');
    ?>
				</td>
			</tr>

		<?php 
} else {
    ?>

			<?php 
    foreach ($comments as $comment) {
        ?>

				<?php 
        $html_id = 'comment-' . $comment->comment_ID;
        $html_class = join(' ', get_comment_class(wp_get_comment_status($comment->comment_ID)));
        ?>
				<tr id="<?php 
        esc_attr($html_id);
        ?>
" class="<?php 
        esc_attr($html_class);
        ?>
">
					<td>
						<?php 
        printf(esc_html__('%1$s at %2$s', 'pronamic_ideal'), esc_html(get_comment_date(__('Y/m/d', 'pronamic_ideal'), $comment->comment_ID)), esc_html(get_comment_date(get_option('time_format'), $comment->comment_ID)));
        ?>
					</td>
					<td>
						<?php