function lhg_comment_percent_bar($uid) { global $lang; if ($lang == "de") { return; } #$karma = cp_getPoints( $uid ); $karma = lhg_get_karma($uid); $level = lhg_get_rank_level($uid); $rank_txt = cp_module_ranks_getRank($public_user_ID); $max_rank = 3; $tooltip = lhg_user_tooltip($uid); $output = '<div class="comment_percent_bar">'; $output .= '<div class="rateline" style="border: 0px solid #000;" title="' . $tooltip . '"> <div style="float: left;"></div> <div class="outerbox" style="background-color: #fff; width: 54px; float: left; margin: 4px 0px; border: 1px solid #eee;"> <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 6px; width: ' . 100 * $level / $max_rank . '%;" > </div> </div> </div>'; //$output .= ''.$rank_txt.''; $output .= '</div>'; return $output; }
/** * @see Walker::start_el() * @since 2.7.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $comment Comment data object. * @param int $depth Depth of comment in reference to parents. * @param array $args */ function start_el(&$output, $comment, $depth, $args) { global $txt_says; global $txt_at; $depth++; $GLOBALS['comment_depth'] = $depth; if (!empty($args['callback'])) { call_user_func($args['callback'], $comment, $args, $depth); return; } $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); if ('div' == $args['style']) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } // LHG: Link avatar and name global $region; $lang_url = lhg_get_lang_url_from_region($region); //echo "REG: $region, LU: $lang_url"; $uid = get_comment(get_comment_ID())->user_id; if ($lang_url != "") { $lang_url = "/" . $lang_url; } if ($uid != 0) { $tooltip = lhg_user_tooltip($uid); } $user_link = '<a href="' . $lang_url . '/hardware-profile/user' . $uid . '" class="userlink" title="' . $tooltip . '"></a>'; $user_link_end = ''; //</a>'; if ($uid != 0) { $output_tmp_1 = $user_link; } if ($uid != 0) { $output_tmp_2 = $user_link_end; } $percent_bar = ""; if ($uid != 0) { $percent_bar = lhg_comment_percent_bar($uid); } ?> <<?php echo $tag; ?> <?php comment_class(empty($args['has_children']) ? '' : 'parent'); ?> id="comment-<?php comment_ID(); ?> "> <?php if ('div' != $args['style']) { ?> <div id="div-comment-<?php comment_ID(); ?> " class="comment-body"> <?php } ?> <div class="comment-author vcard"> <?php $args['avatar_size'] = 50; if ($args['avatar_size'] != 0) { echo "\n " . $output_tmp_1 . ' <div title="' . $tooltip . '"> ' . get_avatar($comment, $args['avatar_size']) . ' </div> ' . $percent_bar . $output_tmp_2; } ?> <?php $commlink = get_comment_author_link(); $commlink = str_replace("admin", "LHG-Team", $commlink); printf(__('<cite class="fn">%s</cite> <span class="says">' . $txt_says . ':</span>'), $output_tmp_1 . $commlink . $output_tmp_2); ?> </div> <?php if ($comment->comment_approved == '0') { ?> <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.'); ?> </em> <br /> <?php } ?> <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?> "> <?php /* translators: 1: date, 2: time */ printf(__('%1$s ' . $txt_at . ' %2$s'), get_comment_date(), get_comment_time()); ?> </a><?php if (get_current_user_id() != 0) { edit_comment_link(__('(Edit)'), ' ', ''); } $out = show_user_rating(); echo ' <span class="commentrating">' . $out . '</span>'; ?> </div> <?php /* span class="collapseomatic" id="id<?php get_comment_ID();?>" title="Trigger">Trigger</span><div id="target-id<?php get_comment_ID();?>" class="collapseomatic_content"> */ ?> <?php ob_start(); comment_text(); $ctext = ob_get_clean(); $ctext = str_replace("<collapse>", '<div id="target-id' . get_comment_ID() . '" class="collapseomatic_content">', $ctext); //$ctext = str_replace("</collapse>",'</div><div class="collapseomatic" id="id'.get_comment_ID().'" title="Show more">Show more</div><span id="swap-id'.get_comment_ID().'" alt="" style="display:none;">Show less</span>',$ctext); $ctext = str_replace("</collapse>", '</div><div class="collapseomatic" id="id' . get_comment_ID() . '" title="Show more">Show more</div><span id="swap-id' . get_comment_ID() . '" alt="" style="display:none;">Show less</span>', $ctext); //attachment breaks <p>, hack needed $ctext = str_replace("<!-- help-p -->", "</p>", $ctext); echo $ctext; global $last_reply_field; //echo "Depth: $depth"; //create answer field if ($depth == 1) { ob_start(); ?> <div class="reply"> <?php comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> <?php //Include Flattr button global $lang; //echo "<br>UserID: $comment->user_id<br>"; $UID = get_comment(get_comment_ID())->user_id; $FL_USERNAME = get_the_author_meta('flattr-id', get_comment(get_comment_ID())->user_id); //$comment->user_id ); //echo "User: $FL_USERNAME<br>"; //echo "TITLE= $title"; //echo "LANG: $lang<br>"; if ($FL_USERNAME != "" && $UID != 0) { $FL_URL = get_comment_link($comment->comment_ID); $FL_URL = str_replace("#", "%23", $FL_URL); $title = get_the_title(); $title = str_replace("(", " ", $title); $title = str_replace(")", " ", $title); $title = str_replace(",", " ", $title); $title = str_replace(";", " ", $title); $title = str_replace(""", "", $title); $FL_DESCRIPTION = "Comment%20" . $comment->comment_ID . "%20to%20article%20:%20{$title}"; echo '<span class="flattr-button"><a href="https://flattr.com/submit/auto?user_id=' . $FL_USERNAME . '&url=' . $FL_URL . '&title=Linux%20Hardware%20Guide&description=' . $FL_DESCRIPTION . '&tags=Linux,Hardware&category=text">'; echo '<img src="https://api.flattr.com/button/flattr-badge-large.png" alt="Flattr Button"></a></span>'; } ?> </div> <?php $last_reply_field = ob_get_clean(); //echo "STRL: ".strlen($last_reply_field); } ?> <?php //echo "depth: $depth<br>"; if ($depth != 1) { if ('div' != $args['style']) { ?> </div> <?php } } }