1 | <?php
|
---|
2 | class Walker_Comment2 extends Walker {
|
---|
3 | /**
|
---|
4 | * @see Walker::$tree_type
|
---|
5 | * @since unknown
|
---|
6 | * @var string
|
---|
7 | */
|
---|
8 | var $tree_type = 'comment';
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * @see Walker::$db_fields
|
---|
12 | * @since unknown
|
---|
13 | * @var array
|
---|
14 | */
|
---|
15 | var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * @see Walker::start_lvl()
|
---|
19 | * @since unknown
|
---|
20 | *
|
---|
21 | * @param string $output Passed by reference. Used to append additional content.
|
---|
22 | * @param int $depth Depth of comment.
|
---|
23 | * @param array $args Uses 'style' argument for type of HTML list.
|
---|
24 | */
|
---|
25 | function start_lvl(&$output, $depth, $args) {
|
---|
26 | $GLOBALS['comment_depth'] = $depth + 1;
|
---|
27 |
|
---|
28 | switch ( $args['style'] ) {
|
---|
29 | case 'div':
|
---|
30 | break;
|
---|
31 | case 'ol':
|
---|
32 | echo "<ol class='children'>\n";
|
---|
33 | break;
|
---|
34 | default:
|
---|
35 | case 'ul':
|
---|
36 | echo "<ul class='children'>\n";
|
---|
37 | break;
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * @see Walker::end_lvl()
|
---|
43 | * @since unknown
|
---|
44 | *
|
---|
45 | * @param string $output Passed by reference. Used to append additional content.
|
---|
46 | * @param int $depth Depth of comment.
|
---|
47 | * @param array $args Will only append content if style argument value is 'ol' or 'ul'.
|
---|
48 | */
|
---|
49 | function end_lvl(&$output, $depth, $args) {
|
---|
50 | $GLOBALS['comment_depth'] = $depth + 1;
|
---|
51 |
|
---|
52 | switch ( $args['style'] ) {
|
---|
53 | case 'div':
|
---|
54 | break;
|
---|
55 | case 'ol':
|
---|
56 | echo "</ol>\n";
|
---|
57 | break;
|
---|
58 | default:
|
---|
59 | case 'ul':
|
---|
60 | echo "</ul>\n";
|
---|
61 | break;
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * @see Walker::start_el()
|
---|
67 | * @since unknown
|
---|
68 | *
|
---|
69 | * @param string $output Passed by reference. Used to append additional content.
|
---|
70 | * @param object $comment Comment data object.
|
---|
71 | * @param int $depth Depth of comment in reference to parents.
|
---|
72 | * @param array $args
|
---|
73 | */
|
---|
74 | function start_el(&$output, $comment, $depth, $args) {
|
---|
75 | $depth++;
|
---|
76 | $GLOBALS['comment_depth'] = $depth;
|
---|
77 |
|
---|
78 | if ( !empty($args['callback']) ) {
|
---|
79 | call_user_func($args['callback'], $comment, $args, $depth);
|
---|
80 | return;
|
---|
81 | }
|
---|
82 |
|
---|
83 | $GLOBALS['comment'] = $comment;
|
---|
84 | extract($args, EXTR_SKIP);
|
---|
85 |
|
---|
86 | if ( 'div' == $args['style'] ) {
|
---|
87 | $tag = 'div';
|
---|
88 | $add_below = 'comment';
|
---|
89 | } else {
|
---|
90 | $tag = 'li';
|
---|
91 | $add_below = 'div-comment';
|
---|
92 | }
|
---|
93 | ?>
|
---|
94 | <<?php echo $tag ?> <?php comment_class($class='clearfix') ?> id="comment-<?php comment_ID() ?>">
|
---|
95 | <?php if ( 'ul' == $args['style'] ) : ?>
|
---|
96 | <div id="div-comment-<?php comment_ID() ?>" class="clearfix comment-container
|
---|
97 | <?php
|
---|
98 | $comment = get_comment($comment_id);
|
---|
99 | if ( $post = get_post($post_id) ) {
|
---|
100 | if ( $comment->user_id === $post->post_author )
|
---|
101 | echo ' bypostauthor';
|
---|
102 | } ?>">
|
---|
103 | <?php endif; ?>
|
---|
104 | <div class="comment-author vcard">
|
---|
105 | <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
|
---|
106 | <span class="authorname"><?php printf(__('%s'), get_comment_author_link()) ?></span>
|
---|
107 | </div>
|
---|
108 | <?php if ($comment->comment_approved == '0') : ?>
|
---|
109 | <em><?php _e('Your comment is awaiting moderation.','atahualpa'); ?></em>
|
---|
110 | <br />
|
---|
111 | <?php endif; ?>
|
---|
112 | <div class="comment-meta commentmetadata">
|
---|
113 | <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID, $page ) ) ?>">
|
---|
114 | <?php printf(__('%1$s at %2$s'), get_comment_date(__('F jS, Y','atahualpa')), get_comment_time()) ?>
|
---|
115 | </a><?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
|
---|
116 | <?php edit_comment_link(__(' · Edit','atahualpa'),'','') ?>
|
---|
117 | </div>
|
---|
118 | <?php comment_text() ?>
|
---|
119 | <?php if ( 'ul' == $args['style'] ) : ?>
|
---|
120 | </div>
|
---|
121 | <?php endif; ?>
|
---|
122 | <?php
|
---|
123 | }
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * @see Walker::end_el()
|
---|
127 | * @since unknown
|
---|
128 | *
|
---|
129 | * @param string $output Passed by reference. Used to append additional content.
|
---|
130 | * @param object $comment
|
---|
131 | * @param int $depth Depth of comment.
|
---|
132 | * @param array $args
|
---|
133 | */
|
---|
134 | function end_el(&$output, $comment, $depth, $args) {
|
---|
135 | if ( !empty($args['end-callback']) ) {
|
---|
136 | call_user_func($args['end-callback'], $comment, $args, $depth);
|
---|
137 | return;
|
---|
138 | }
|
---|
139 | if ( 'div' == $args['style'] )
|
---|
140 | echo "</div>\n";
|
---|
141 | else
|
---|
142 | echo "</li>\n";
|
---|
143 | }
|
---|
144 |
|
---|
145 | }
|
---|
146 | ?> |
---|