-
Notifications
You must be signed in to change notification settings - Fork 0
/
_item_comment.inc.php
161 lines (141 loc) · 5.33 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
<?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-2015 by Francois Planque - {@link http://fplanque.com/}
*
* @package evoskins
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
// 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' => '<footer class="evo_comment_footer clear text-muted"><small>',
'comment_info_after' => '</small></footer></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' => '<div class="image_block">',
'before_image_legend' => '<div class="image_legend">',
'after_image_legend' => '</div>',
'after_image' => '</div>',
'image_size' => 'fit-400x320',
'Comment' => NULL, // This object MUST be passed as a param!
), $params );
/**
* @var Comment
*/
$Comment = & $params['Comment'];
// Load comment's Item object:
$Comment->get_Item();
$Comment->anchor();
echo $params['comment_start'];
// Status
if( $Comment->status != 'published' )
{ // display status of comment (typically an angled banner in the top right corner):
$Comment->status( 'styled' );
}
// 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:
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;
}
echo $params['comment_title_after'];
// Avatar:
echo $params['comment_avatar_before'];
$Comment->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'];
// Info:
echo $params['comment_info_before'];
$commented_Item = & $Comment->get_Item();
$Comment->edit_link( '', '', '#', '#', 'permalink_right', '&', true, rawurlencode( $Comment->get_permanent_url() ) ); /* Link to backoffice for editing */
$Comment->delete_link( '', '', '#', '#', 'permalink_right', false, '&', true, false, '#', rawurlencode( $commented_Item->get_permanent_url() ) ); /* Link to backoffice for deleting */
$Comment->date(); echo ' @ '; $Comment->time( '#short_time' );
$Comment->reply_link(); /* Link for replying to the Comment */
$Comment->vote_helpful( '', '', '&', true, true );
echo $params['comment_info_after'];
echo $params['comment_end'];
?>