themable comment to html
git-svn-id: file:///home/shish/svn/shimmie2/trunk@339 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
0e608bdd45
commit
52128a30af
2 changed files with 23 additions and 23 deletions
|
@ -27,28 +27,6 @@ class Comment { // {{{
|
|||
$this->image_id = $row['image_id'];
|
||||
$this->poster_ip = $row['poster_ip'];
|
||||
}
|
||||
|
||||
public function to_html($trim=false) {
|
||||
global $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($this->comment);
|
||||
send_event($tfe);
|
||||
|
||||
$i_uid = int_escape($this->owner_id);
|
||||
$h_name = html_escape($this->owner_name);
|
||||
$h_poster_ip = html_escape($this->poster_ip);
|
||||
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
|
||||
$i_comment_id = int_escape($this->comment_id);
|
||||
$i_image_id = int_escape($this->image_id);
|
||||
|
||||
$h_userlink = "<a href='".make_link("user/$h_name")."'>$h_name</a>";
|
||||
$h_dellink = $user->is_admin() ?
|
||||
"<br>($h_poster_ip, <a ".
|
||||
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
|
||||
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del</a>)" : "";
|
||||
$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>>>></a>\n" : "";
|
||||
return "<p>$h_userlink: $h_comment $h_imagelink $h_dellink</p>";
|
||||
}
|
||||
} // }}}
|
||||
|
||||
class CommentList extends Extension {
|
||||
|
|
|
@ -41,11 +41,33 @@ class CommentListTheme extends Themelet {
|
|||
private function comments_to_html($comments, $trim=false) {
|
||||
$html = "";
|
||||
foreach($comments as $comment) {
|
||||
$html .= $comment->to_html($trim);
|
||||
$html .= $this->comment_to_html($comment, $trim);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
private function comment_to_html($comment, $trim=false) {
|
||||
global $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($comment->comment);
|
||||
send_event($tfe);
|
||||
|
||||
$i_uid = int_escape($comment->owner_id);
|
||||
$h_name = html_escape($comment->owner_name);
|
||||
$h_poster_ip = html_escape($comment->poster_ip);
|
||||
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
|
||||
$i_comment_id = int_escape($comment->comment_id);
|
||||
$i_image_id = int_escape($comment->image_id);
|
||||
|
||||
$h_userlink = "<a href='".make_link("user/$h_name")."'>$h_name</a>";
|
||||
$h_dellink = $user->is_admin() ?
|
||||
"<br>($h_poster_ip, <a ".
|
||||
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
|
||||
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del</a>)" : "";
|
||||
$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>>>></a>\n" : "";
|
||||
return "<p class='comment'>$h_userlink: $h_comment $h_imagelink $h_dellink</p>";
|
||||
}
|
||||
|
||||
// FIXME: privatise this
|
||||
public function build_postbox($image_id) {
|
||||
$i_image_id = int_escape($image_id);
|
||||
|
|
Reference in a new issue