type == 'forum') { return '
'. $content .'
'; } else { return '

'. t('Comments :') .'

'. $content .'
'; } } /** * Theme output of user signature. * * @ingroup themeable */ function clameurs_user_signature($signature) { return '
'.$signature.'
'; } /** * Returns a formatted list of recent comments to be displayed in the comment block. * * @return * The comment list HTML. * @ingroup themeable */ function clameurs_comment_block() { $items = array(); foreach (comment_get_recent() as $comment) { $items[] = l($comment->subject, 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid)) .'
'. t('@time ago', array('@time' => format_interval(time() - $comment->timestamp))); } if ($items) { return theme('item_list', $items); } } /** * Themes a single comment and related items. * * @param $comment * The comment object. * @param $node * The comment node. * @param $links * An associative array containing control links suitable for passing into * theme_links(). These are generated by modules implementing hook_link() with * $type='comment'. Typical examples are links for editing and deleting * comments. * @param $visible * Switches between folded/unfolded view. If TRUE the comments are visible, if * FALSE the comments are folded. * @ingroup themeable */ function clameurs_comment_view($comment, $node, $links = array(), $visible = TRUE) { static $first_new = TRUE; $output = ''; $comment->new = node_mark($comment->nid, $comment->timestamp); if ($first_new && $comment->new != MARK_READ) { // Assign the anchor only for the first new comment. This avoids duplicate // id attributes on a page. $first_new = FALSE; $output .= "\n"; } $output .= "cid\">\n"; // Switch to folded/unfolded view of the comment if ($visible) { $comment->comment = check_markup($comment->comment, $comment->format, FALSE); // Comment API hook comment_invoke_comment($comment, 'view'); $output .= theme('comment', $comment, $node, $links); } else { $output .= theme('comment_folded', $comment); } return $output; } /** * Theme comment controls box where the user can change the default display mode and display order of comments. * * @param $form * The form structure. * @ingroup themeable */ function clameurs_comment_controls($form) { $output = '
'; $output .= drupal_render($form); $output .= '
'; $output .= '
'. t('Select your preferred way to display the comments and click "Save settings" to activate your changes.') .'
'; return theme('box', t('Comment viewing options'), $output); } /** * Theme comment flat collapsed view. * * @param $comment * The comment to be themed. * @param $node * The comment node. * @ingroup themeable */ function clameurs_comment_flat_collapsed($comment, $node) { return theme('comment_view', $comment, $node, '', 0); } /** * Theme comment flat expanded view. * * @param $comment * The comment to be themed. * @param $node * The comment node. * @ingroup themeable */ function clameurs_comment_flat_expanded($comment, $node) { $links = module_invoke_all('link', 'comment', $comment, 0); drupal_alter('link', $links, $node, $comment); return theme('comment_view', $comment, $node, $links); } /** * Theme comment thread collapsed view. * * @param $comment * The comment to be themed. * @param $node * The comment node. * @ingroup themeable */ function clameurs_comment_thread_collapsed($comment, $node) { return theme('comment_view', $comment, $node, '', 0); } /** * Theme comment thread expanded view. * * @param $comment * The comment to be themed. * @param $node * The comment node. * @ingroup themeable */ function clameurs_comment_thread_expanded($comment, $node) { $links = module_invoke_all('link', 'comment', $comment, 0); drupal_alter('link', $links, $node, $comment); return theme('comment_view', $comment, $node, $links); } /** * Theme a "you can't post comments" notice. * * @param $node * The comment node. * @ingroup themeable */ function clameurs_comment_post_forbidden($node) { global $user; static $authenticated_post_comments; if (!$user->uid) { if (!isset($authenticated_post_comments)) { // We only output any link if we are certain, that users get permission // to post comments by logging in. We also locally cache this information. $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval')); } if ($authenticated_post_comments) { // We cannot use drupal_get_destination() because these links // sometimes appear on /node and taxonomy listing pages. if (variable_get('comment_form_location_'. $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) { $destination = 'destination='. rawurlencode("comment/reply/$node->nid#comment-form"); } else { $destination = 'destination='. rawurlencode("node/$node->nid#comment-form"); } if (variable_get('user_register', 1)) { // Users can register themselves. return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); } else { // Only admins can add new users, no public registration. return t('Login to post comments', array('@login' => url('user/login', array('query' => $destination)))); } } } } /** * Theme a "Submitted by ..." notice. * * @param $comment * The comment. * @ingroup themeable */ function clameurs_comment_submitted($comment) { return t('Submitted by !username on @datetime.', array( '!username' => theme('username', $comment), '@datetime' => format_date($comment->timestamp) )); }