function add_hwprofile($items, $args) { global $txt_hwprofile; global $region; $lurl = lhg_get_lang_url_from_region($region); if ($lurl != "") { $lurl = "/" . $lurl; } //if( $args->theme_location == 'primary' ) return $items . '<li id="menu-item-hwprofile" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-hwprofile"> <a href="' . $lurl . '/hardware-profile"><span><span> <i class="icon-user menucolor"></i>' . $txt_hwprofile . ' </span></span></a> </li>'; }
function plugin_additional_fields() { global $region; $lang = lhg_get_lang_from_region($region); //redirect to correct language after comment submittal $langurl = "/" . lhg_get_lang_url_from_region($region); if ($langurl == "/") { $langurl = ""; } if ($langurl == "/de") { $langurl = ""; } $comment_url = $langurl . $_SERVER['REQUEST_URI']; //echo "L: $lang R: $region"; //store language echo '<input id="language" name="language" type="hidden" value="' . $lang . '" />'; echo '<input id="redirect_to" name="redirect_to" type="hidden" value="' . $comment_url . '" />'; /* echo '<p class="comment-form-rating">'. '<label for="commenters-rating">' . __( 'Rating' ) . '</label>'. '<select name="commenters-rating"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select>'; */ // '<input id="commenters-rating" name="commenters-rating" type="text" size="30" tabindex="5" /></p>'; }
/** * @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 } } }
function widget($args, $instance) { global $comments, $comment; $cache = wp_cache_get('widget_recent_comments', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } extract($args, EXTR_SKIP); $output = ''; $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 5; } $comments = get_comments(array('number' => $number, 'status' => 'approve', 'post_status' => 'publish')); $output .= $before_widget; if ($title) { $output .= $before_title . '<i class="icon-comments"></i> ' . $title . $after_title; } $output .= "\n\n" . '<ul id="recentcomments1">' . "\n\n"; if ($comments) { foreach ((array) $comments as $comment) { //$output .= "Test"; global $region; $lang_url = lhg_get_lang_url_from_region($region); if ($lang_url != "") { $lang_url = "/" . $lang_url; } $cid = $comment->comment_ID; //echo "CID:".$cid; $clang = get_comment_meta($cid, 'language', true); //echo "Lang: $clang"."<br>"; $check = lhg_show_language($clang, $region); //echo "CHK: $check"; //author ID $uid = 0; //reset $output_tmp_1 = ""; $output_tmp_2 = ""; $uid = get_comment($cid)->user_id; //echo "UID: $uid"; //$CAID = get_comment_author ($comment->comment_ID); //echo "CID: $CAID"; $avatar = get_avatar($comment, 24); preg_match('#src=["|\'](.+)["|\']#Uuis', $avatar, $avatarurla); //echo "URL: $avatarurl[1]"; $avatarurl = $avatarurla[1]; if ($lang_url == "/de") { $lang_url = ""; } $user_link = '<a href="' . $lang_url . '/hardware-profile/user' . $uid . '">'; $user_link_end = '</a>'; if ($uid != 0) { $output_tmp_1 = $user_link; } if ($uid != 0) { $output_tmp_2 = $user_link_end; } $output_tmp = ' <li class="recentcomments"> <div class="widgetimg_all"> <div class="widgetimg_avatar">'; $output_tmp .= $output_tmp_1 . ' <img src="' . $avatarurl . '" height="24" width="24" alt="Avatar" />' . $output_tmp_2; $output_tmp .= ' </div> <div class="widgetimg_text"> ' . sprintf(_x('%1$s on %2$s', 'widgets'), $output_tmp_1 . str_replace("admin", "LHG Team", get_comment_author()) . $output_tmp_2, '<a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . translate_title(get_the_title($comment->comment_post_ID)) . '</a> ' . get_comment_date("", $coment->comment_ID) . " ") . ' </div> </div> </li> '; if ($comment_found < 5) { if ($check != 0) { //echo "A"; $output_lang .= $output_tmp; $comment_found++; } else { //echo "B"; if ($comment_default_found < 5) { $output_default .= $output_tmp; } $comment_default_found++; } } } if ($output_lang == "") { $output .= $output_default; } if ($output_lang != "") { $output .= $output_lang; } } $output .= '</ul>'; $output .= $after_widget; echo $output; $cache[$args['widget_id']] = $output; wp_cache_set('widget_recent_comments', $cache, 'widget'); }
function lhg_donation_table_shortcode_singe_language($attr) { global $region; global $top_users; global $donation; global $txt_cp_title; global $txt_cp_karma; global $txt_cp_points; global $txt_cp_donates_to; global $txt_cp_longtext; global $txt_cp_language; # before we create the table we update the data in the transverse DB lhg_update_karma_values('quarterly'); # How many users to show for ongoing quarter $max_users_to_show = 10; $langurl = lhg_get_lang_url_from_region($region); #extract($args, EXTR_SKIP); #echo $before_widget; //$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); #$output .='<i class="icon-trophy menucolor"></i> '.$txt_cp_title; #if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; //set default values #if($instance['num'] == '' || $instance['num'] == 0) { $instance['num'] = 1; } #if($instance['text'] == '') { $instance['text'] = '%user% (%points%)';} # Show table of top users of ongoing Quarter list($list_uid, $list_points) = cp_getAllQuarterlyPoints(); #list($list_guid, $list_points_guid) = cp_getAllQuarterlyPoints_transverse(); #print "<br>Users:"; #var_dump($list_uid); $i = 0; if (sizeof($list_uid) > 0) { $output .= '<table id="quarterly-points-table"> <tr id="quarterly-points-header-row"> <td class="qrtly-1" id="quarterly-points-1">Quarterly Points</td> <td class="qrtly-2" id="quarterly-points-2"></td> <td class="qrtly-3" id="quarterly-points-3">Username</td> <td class="qrtly-4" id="quarterly-points-3">Details</td> <td class="qrtly-5" id="quarterly-points-3">Total Karma</td> </tr> '; } if (sizeof($list_uid) > 0) { foreach ($list_uid as $uid) { # skip deleted users # skip anonymously added posts, i.e. user = user-submitted-posts $user = get_userdata($uid); if ($user !== false) { if ($uid != 12378) { #var_dump($user); #print sizeof($uid)."<p>"; $name = $user->first_name . " " . $user->last_name; $points = $list_points[$i]; $avatar = get_avatar($uid, 40); $user_language_txt = lhg_get_locale_from_id($uid); $user_language_flag = lhg_show_flag_by_lang($user_language_txt); $total_karma = cp_getPoints($uid); //$num_com * 3 + $num_art * 50; //registration date $regdate = date("d. M Y", strtotime(get_userdata($uid)->user_registered)); //donates to $donation_target = get_user_meta($uid, 'user_donation_target', true); if ($donation_target == "") { $donation_target = 1; } //print_r($y); //if ($langurl != "") $langurl = "/".$langurl; #print "Name: ".$user->user_nicename." ($uid) - $points<br>"; $output .= '<tr> <td class="qrtly-1" > <div class="userlist-place-quarter">' . $points . ' ' . $txt_cp_points . ' </div> </td> <td class="quartery-points-avatar qrtly-2"> <a href="./hardware-profile/user' . $uid . '" class="recent-comments"> <div class="userlist-avatar">' . $avatar . ' </div> </a> </td> <td class="qrtly-3"> <div class="userlist-displayname"> <a href="./hardware-profile/user' . $uid . '" class="recent-comments"> ' . $user->nickname . ' </a> </div> </td> <td class="qrtly-4"> <div class="quarterly-points-userlist-details"> ' . $txt_cp_donates_to . ': ' . $donation[$donation_target]["Name"] . '<br> ' . $txt_cp_language . ': ' . $user_language_flag . ' </div> </td> <td class="qrtly-5"> <div class="quartly-points-totalpoints"> ' . $total_karma . ' ' . $txt_cp_points . '<br> </div> </td> </tr>'; } } $i++; if ($i > $max_users_to_show) { break; } } } if (sizeof($list_uid) > 0) { $output .= "</table>"; } return $output; }
function widget($args, $instance) { global $region; global $top_users; global $donation; global $txt_cp_title; global $txt_cp_karma; global $txt_cp_points; global $txt_cp_donates_to; global $txt_cp_longtext; global $txt_cp_language; # How many users to show for ongoing quarter $max_users_to_show = 5; $langurl = lhg_get_lang_url_from_region($region); extract($args, EXTR_SKIP); echo $before_widget; //$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); $title = '<i class="icon-trophy menucolor"></i> ' . $txt_cp_title; if (!empty($title)) { echo $before_title . $title . $after_title; } //set default values if ($instance['num'] == '' || $instance['num'] == 0) { $instance['num'] = 1; } if ($instance['text'] == '') { $instance['text'] = '%user% (%points%)'; } # Show table of top users of ongoing Quarter list($list_uid, $list_points) = cp_getAllQuarterlyPoints(); #print "<br>Users:"; #var_dump($list_uid); $i = 0; if (sizeof($list_uid) > 0) { print '<table id="quarterly-points-table"> <tr id="quarterly-points-header-row"> <td class="qrtly-1" id="quarterly-points-1">Quarterly Points</td> <td class="qrtly-2" id="quarterly-points-2"></td> <td class="qrtly-3" id="quarterly-points-3">Username</td> <td class="qrtly-4" id="quarterly-points-3">Details</td> <td class="qrtly-5" id="quarterly-points-3">Total Points</td> </tr> '; } if (sizeof($list_uid) > 0) { foreach ($list_uid as $uid) { $user = get_userdata($uid); $name = $user->first_name . " " . $user->last_name; $points = $list_points[$i]; $avatar = get_avatar($uid, 40); $user_language_txt = lhg_get_locale_from_id($uid); $user_language_flag = lhg_show_flag_by_lang($user_language_txt); $total_karma = cp_getPoints($uid); //$num_com * 3 + $num_art * 50; //registration date $regdate = date("d. M Y", strtotime(get_userdata($uid)->user_registered)); //donates to $donation_target = get_user_meta($uid, 'user_donation_target', true); if ($donation_target == "") { $donation_target = 1; } //print_r($y); //if ($langurl != "") $langurl = "/".$langurl; #print "Name: ".$user->user_nicename." ($uid) - $points<br>"; echo '<tr> <td class="qrtly-1" > <div class="userlist-place-quarter">' . $points . ' ' . $txt_cp_points . ' </div> </td> <td class="quartery-points-avatar qrtly-2"> <a href="./hardware-profile/user' . $uid . '" class="recent-comments"> <div class="userlist-avatar">' . $avatar . ' </div> </a> </td> <td class="qrtly-3"> <div class="userlist-displayname"> <a href="./hardware-profile/user' . $uid . '" class="recent-comments">'; echo $user->user_nicename . ' </a> </div> </td> <td class="qrtly-4"> <div class="quarterly-points-userlist-details"> ' . $txt_cp_donates_to . ': ' . $donation[$donation_target]["Name"] . '<br> ' . $txt_cp_language . ': ' . $user_language_flag . ' </div> </td> <td class="qrtly-5"> <div class="quartly-points-totalpoints"> ' . $txt_cp_karma . ': ' . $total_karma . ' ' . $txt_cp_points . '<br> </div> </td> '; print "</tr>"; $i++; if ($i > $max_users_to_show - 1) { break; } } } if (sizeof($list_uid) > 0) { print "</table>"; } /* $top = cp_getAllPoints($instance['num'],get_option('cp_topfilter')); do_action('cp_topUsersWidget_before'); echo apply_filters('cp_topUsersWidget_before','<div class="userlist-all"><ul class="bwp-rc-ulist">'); $line = str_replace('%style%', $instance['style'], $line); foreach($top as $x=>$y){ $i++; $uid = $y['id']; $user = get_userdata($y['id']); $name = $user->first_name." ".$user->last_name; $string = str_replace('%string%', '', $instance['text']); $string = str_replace('%string%',$string,$line); $string = apply_filters('cp_displayUserInfo',$string,$y,$x+1); //Flag $user_language_txt = lhg_get_locale_from_id ( $uid ); $user_language_flag= lhg_show_flag_by_lang ( $user_language_txt ); //registration date $regdate = date("d. M Y", strtotime(get_userdata( $uid ) -> user_registered ) ); //donates to $donation_target = get_user_meta($uid,'user_donation_target',true); if ($donation_target == "") $donation_target = 1; $avatar = get_avatar($uid, 40); //print_r($y); //if ($langurl != "") $langurl = "/".$langurl; global $txt_cp_karma; global $txt_cp_points; global $txt_cp_donates_to; global $txt_cp_longtext; global $txt_cp_language; echo ' <a href="./hardware-profile/user'.$uid.'" class="recent-comments"> <div class="comment-box"> <div class="userlist-avatar">'. $avatar.' </div> <div class="userlist-name"> <div class="userlist-place">'. $i.'. </div> <div class="userlist-displayname">'; //if ($name == " ") { echo $y['display_name']; //}else{ // echo $name; //}; echo ' </div> <!-- div class="userlist-flag">'. $user_language_flag.' </div --> </div> <div class="userlist-details"> '.$txt_cp_karma.': '.$y['points'].' '.$txt_cp_points.'<br> '.$txt_cp_donates_to.': '.$donation[$donation_target]["Name"].'<br> '.$txt_cp_language.': '.$user_language_flag.' </div> </div> </a>'; // Registered since: '.$regdate.'<br> $top_users[$i]["ID"]=$uid; $top_users[$i]["Karma"]=$y['points']; $top_users[$i]["DisplayName"]=$y['display_name']; // echo $string; } echo apply_filters('cp_topUsersWidget_after','</ul></div>'); $topvotes = lhg_voted_donation(); $most_voted = lhg_most_voted ($topvotes); $most_voted_percent = lhg_most_voted_percent ($topvotes); //$most_voted = 2; // echo "TV: $topvotes"; */ global $donation_total; /* Former donation code echo ' <div class="userlist-chart">'.$txt_cp_longtext.': <b>'. $donation_total.' €</b> '.do_shortcode('[highchart-quarterly] '); */ echo 'Donations:<br>' . do_shortcode('[highchart_quarterly]'); $startQrt = cp_StartOfQuarter(); $endQrt = cp_EndOfQuarter(); #print "Range: ".date('jS \of F Y h:i:s A',$startQrt)." to ".date('jS \of F Y h:i:s A',$endQrt); // Currently, '.$most_voted_percent.'% of all users vote for "'.$donation[$most_voted]["Name"].'". //$topvo // echo '</div>'; //end of userlist all do_action('cp_topUsersWidget_after'); echo $after_widget; }
_e('Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-reloaded'); ?> ')"> <fieldset style="border:0"> <?php $subscriptions = $wp_subscribe_reloaded->get_subscriptions('email', 'equals', $email, 'dt', 'DESC'); # always show user info $current_user = wp_get_current_user(); #echo 'Username: '******'<br />'; #echo 'User email: ' . $current_user->user_email . '<br />'; #echo 'User first name: ' . $current_user->user_firstname . '<br />'; #echo 'User last name: ' . $current_user->user_lastname . '<br />'; $displayname = $current_user->display_name; $avatar = get_avatar($email, 45); global $region; $urllang = lhg_get_lang_url_from_region($region); if ($urllang != "") { $urllang = "/" . $urllang; } if (is_user_logged_in()) { if ($lang != "de") { $url_public_profile_txt = "http://www.linux-hardware-guide.com" . $urllang . "/hardware-profile/user" . get_current_user_id(); $url_public_profile = $urllang . "/hardware-profile/user" . get_current_user_id(); } } if ($lang == "de") { $url_public_profile_txt = "http://www.linux-hardware-guide.de/hardware-profile/user" . get_current_user_id(); $url_public_profile = "/hardware-profile/user" . get_current_user_id(); } echo '<div class="hwprofile-avatar">' . $avatar . '</div>'; if ($displayname != "") {