function theme_guestbook_entry in Guestbook 5
Same name and namespace in other branches
- 5.2 guestbook.module \theme_guestbook_entry()
- 6.2 guestbook.module \theme_guestbook_entry()
- 6 guestbook.module \theme_guestbook_entry()
- 7.2 guestbook.module \theme_guestbook_entry()
2 theme calls to theme_guestbook_entry()
- guestbook_delete_entry_confirm in ./
guestbook.module - theme_guestbook in ./
guestbook.module - Render a guestbook.
File
- ./
guestbook.module, line 662
Code
function theme_guestbook_entry($uid, $entry, $comment_entry = NULL, $zebra, $confirm_delete = false) {
global $user;
$output = '';
$display = (array) variable_get('guestbook_display', array(
'date',
'email',
'website',
'comments',
));
$output .= "\n<div class=\"comment guestbook-entry {$zebra}\">\n";
if ($comment_entry == $entry['id']) {
$output .= '<a name="comment-entry"></a>';
}
// Author.
if ($entry['author'] == 0) {
$author = "<b>" . check_plain($entry['anonname']) . "</b>";
}
else {
$author = "<b>" . theme('guestbook_user_picture', $entry['author']) . "</b>";
}
$output .= '<div class="author">' . $author . '</div>';
// Date, email, website.
$output .= '<div class="submitted">';
if (in_array('date', $display)) {
$output .= format_date($entry['created'], 'medium');
}
if (in_array('email', $display) && !empty($entry['anonemail'])) {
$output .= ' | <a href="mailto:' . check_url($entry['anonemail']) . '">' . t('E-mail') . '</a>';
}
if (in_array('website', $display) && !empty($entry['anonwebsite'])) {
// Auto-prepend HTTP protocol if website contains no protocol.
if (strpos($entry['anonwebsite'], '://') === FALSE) {
$entry['anonwebsite'] = 'http://' . $entry['anonwebsite'];
}
$output .= ' | <a href="' . check_url($entry['anonwebsite']) . '">' . t('Website') . '</a> ';
}
$output .= '</div>';
// Message.
$output .= '<div class="content guestbook-message">' . check_markup($entry['message'], variable_get('guestbook_input_format', 1), FALSE) . '</div>';
if ($entry['picture']) {
$output .= '<div style="clear:both;"></div>';
}
// Guestbook owner comment.
$output .= theme('guestbook_entry_comment', $uid, $entry, $comment_entry);
// Links.
if (_guestbook_access('administer', $uid) && !$confirm_delete) {
if ($comment_entry != $entry['id']) {
$pager = $_GET['page'] ? 'page=' . $_GET['page'] : NULL;
$output .= '<div class="links">» ';
$output .= l(t('Delete entry'), "guestbook/{$uid}/delete/{$entry['id']}", array(), $pager) . ' | ';
$output .= l($entry['comment'] == '' ? t('Add comment') : t('Edit comment'), "guestbook/{$uid}/comment/{$entry['id']}", array(), $pager, 'comment-entry');
$output .= '</div>';
}
}
$output .= "\n</div>";
return $output;
}