function theme_guestbook_entry in Guestbook 7.2
Same name and namespace in other branches
- 5.2 guestbook.module \theme_guestbook_entry()
- 5 guestbook.module \theme_guestbook_entry()
- 6.2 guestbook.module \theme_guestbook_entry()
- 6 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 952
Code
function theme_guestbook_entry($variables) {
global $user;
$uid = $variables['uid'];
$entry = $variables['entry'];
$comment_entry = $variables['comment_entry'];
$zebra = $variables['zebra'];
$confirm_delete = $variables['confirm_delete'];
$output = '';
$display = (array) variable_get('guestbook_display', array(
'date',
'email',
'website',
'comments',
));
$output .= "\n<div class=\"guestbook-entry clear-block {$zebra}" . ($entry['status'] ? '' : ' guestbook-entry-unpublished') . "\">\n";
if ($comment_entry == $entry['id']) {
$output .= '<a name="comment-entry"></a>';
}
// Author.
if ($entry['author'] == 0) {
$output .= "<b>" . check_plain($entry['anonname']) . "</b>";
}
else {
$entry['uid'] = $entry['author'];
$output .= theme('username', array(
'account' => (object) $entry,
'display' => 'guestbook',
));
}
// 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>';
// Status.
if (!$entry['status']) {
$output .= '<div class="guestbook-entry-status">' . t('Not published') . '</div>';
}
// Message.
$output .= '<div class="guestbook-message">' . check_markup($entry['message'], $entry['message_format'], '', TRUE) . '</div>';
// Guestbook owner comment.
$output .= theme('guestbook_entry_comment', array(
'uid' => $uid,
'entry' => $entry,
'comment_entry' => $comment_entry,
));
// Links.
if (_guestbook_access('moderate', $uid) && !$confirm_delete) {
if ($comment_entry != $entry['id']) {
$links = array();
$pager = !empty($_GET['page']) ? array(
'page' => $_GET['page'],
) : array();
if (user_access('moderate own guestbook') || user_access('moderate all guestbooks')) {
$links['delete'] = array(
'title' => t('Delete entry'),
'href' => guestbook_path($uid) . '/delete/' . $entry['id'],
'query' => drupal_get_destination() + $pager,
);
$links['edit'] = array(
'title' => t('Edit entry'),
'href' => guestbook_path($uid) . '/edit/' . $entry['id'],
'query' => drupal_get_destination() + $pager,
);
}
$links['guestbook-comment'] = array(
'title' => $entry['comment'] == '' ? t('Add comment') : t('Edit comment'),
'href' => guestbook_path($uid) . '/comment/' . $entry['id'],
'query' => drupal_get_destination() + $pager,
'fragment' => 'comment-entry',
);
$output .= theme('links', array(
'links' => $links,
'attributes' => array(
'class' => array(
'guestbook-links',
'links',
'inline',
),
),
));
}
}
$output .= "\n</div>";
return $output;
}