-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_item_comment.inc.php
executable file
·189 lines (161 loc) · 6.11 KB
/
_item_comment.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
/**
* This is the template that displays a single comment
*
* This file is not meant to be called directly.
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/gnu-gpl-license}
* @copyright (c)2003-2016 by Francois Planque - {@link http://fplanque.com/}
*
* @package evoskins
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
global $comment_template_counter;
// Default params:
$params = array_merge( array(
'comment_start' => '<article class="evo_comment panel panel-default">',
'comment_end' => '</article>',
'comment_post_display' => false, // Do we want ot display the title of the post we're referring to?
'comment_post_before' => '<h3 class="evo_comment_post_title">',
'comment_post_after' => '</h3>',
'comment_title_before' => '<div class="panel-heading"><h4 class="evo_comment_title panel-title">',
'comment_title_after' => '</h4></div><div class="panel-body">',
'comment_avatar_before' => '<span class="evo_comment_avatar">',
'comment_avatar_after' => '</span>',
'comment_rating_before' => '<div class="evo_comment_rating">',
'comment_rating_after' => '</div>',
'comment_text_before' => '<div class="evo_comment_text">',
'comment_text_after' => '</div>',
'comment_info_before' => '<div class="evo_comment_info clear text-muted"><small>',
'comment_info_after' => '</small></div>',
'link_to' => 'userurl>userpage', // 'userpage' or 'userurl' or 'userurl>userpage' or 'userpage>userurl'
'author_link_text' => 'name', // avatar_name | avatar_login | only_avatar | name | login | nickname | firstname | lastname | fullname | preferredname
'before_image' => '<figure class="evo_image_block">',
'before_image_legend' => '<figcaption class="evo_image_legend">',
'after_image_legend' => '</figcaption>',
'after_image' => '</figure>',
'image_size' => 'fit-1280x720',
'image_class' => 'img-responsive',
'Comment' => NULL, // This object MUST be passed as a param!
'time_before' => '<time class="comment_date">',
'time_after' => '</time>',
), $params );
if( ! isset( $comment_template_counter ) )
{ // Initialize global comment counter:
$comment_template_counter = isset( $params['comment_number'] ) ? $params['comment_number'] : 1;
}
/**
* @var Comment
*/
$Comment = & $params['Comment'];
// Load comment's Item object:
$Comment->get_Item();
$Comment->anchor();
echo $params['comment_start'];
// Post title
if( $params['comment_post_display'] )
{
echo $params['comment_post_before'];
echo T_('In response to:').' ';
$Comment->Item->title( array(
'link_type' => 'permalink',
) );
echo $params['comment_post_after'];
}
// Title
echo $params['comment_title_before'];
switch( $Comment->get( 'type' ) )
{
case 'comment': // Display a comment:
case 'meta': // Display a meta comment:
if( $Comment->is_meta() )
{ // Meta comment:
echo '<span class="badge badge-info">'.$comment_template_counter.'</span> ';
}
if( empty($Comment->ID) )
{ // PREVIEW comment
echo '<span class="evo_comment_type_preview">'.T_('PREVIEW Comment from:').'</span> ';
}
else
{ // Normal comment
// $Comment->permanent_link( array(
// 'before' => '',
// 'after' => ' '.T_('from:').' ',
// 'text' => T_('Comment'),
// 'class' => 'evo_comment_type',
// 'nofollow' => true,
// ) );
}
$Comment->author2( array(
'before' => ' ',
'after' => '#',
'before_user' => '',
'after_user' => '#',
'format' => 'htmlbody',
'link_to' => $params['link_to'], // 'userpage' or 'userurl' or 'userurl>userpage' or 'userpage>userurl'
'link_text' => $params['author_link_text'],
) );
if( ! $Comment->get_author_User() )
{ // Display action icon to message only if this comment is from a visitor
$Comment->msgform_link( $Blog->get( 'msgformurl' ) );
}
break;
case 'trackback': // Display a trackback:
$Comment->permanent_link( array(
'before' => '',
'after' => ' '.T_('from:').' ',
'text' => T_('Trackback'),
'class' => 'evo_comment_type',
'nofollow' => true,
) );
$Comment->author( '', '#', '', '#', 'htmlbody', true, $params['author_link_text'] );
break;
case 'pingback': // Display a pingback:
$Comment->permanent_link( array(
'before' => '',
'after' => ' '.T_('from:').' ',
'text' => T_('Pingback'),
'class' => 'evo_comment_type',
'nofollow' => true,
) );
$Comment->author( '', '#', '', '#', 'htmlbody', true, $params['author_link_text'] );
break;
}
// Status
if( $Comment->status != 'published' )
{ // display status of comment (typically an angled banner in the top right corner):
$Comment->format_status( array(
'template' => '<div class="evo_status evo_status__$status$ badge pull-right">$status_title$</div>',
) );
}
echo $params['comment_title_after'];
// Info:
echo $params['comment_info_before'];
// Date
echo $params['time_before'];
$Comment->date(); echo ' @ '; $Comment->time( '#short_time' );
$Comment->reply_link(); /* Link for replying to the Comment */
$Comment->vote_helpful( '', '', '&', true, true );
echo $params['time_after'];
$commented_Item = & $Comment->get_Item();
$Comment->edit_link( ' / ', '', '#', '#', 'edit_link', '&', true, rawurlencode( $Comment->get_permanent_url() ) ); /* Link to backoffice for editing */
$Comment->delete_link( ' / ', '', '#', '#', 'delete_link', false, '&', true, false, '#', rawurlencode( $commented_Item->get_permanent_url() ) ); /* Link to backoffice for deleting */
echo $params['comment_info_after'];
// Avatar:
echo $params['comment_avatar_before'];
$Comment->avatar( 'crop-128x128', 'avatar' );
echo $params['comment_avatar_after'];
// Rating:
$Comment->rating( array(
'before' => $params['comment_rating_before'],
'after' => $params['comment_rating_after'],
) );
// Text:
echo $params['comment_text_before'];
$Comment->content( 'htmlbody', false, true, $params );
echo $params['comment_text_after'];
echo $params['comment_end'];
// Decrease a counter for meta comments:
$comment_template_counter--;
?>