Michael Heilemann.
If you have Dunstan's Time Since installed, this plugin uses it for the title="" attributes on the comments and posts. (For WordPress 1.5) Author: Brian Meidell Author URI: http://meidell.dk/ Version 1.5: Now works without LOCK TABLE and CREATE TEMPORARY TABLE priviledges. Version 1.5.1: Can't remember what I did here Version 1.5.2: Fixed count select statement to not include spammy comments Version 1.5.3: Properly excludes track- and pingbacks Version 1.5.4: Excludes posts that are not published, even if they have comments Version 1.5.5: Fade old comments, fixed bug that wreaked havoc with Time Since Version 1.5.6: Bugfix from Jonas Rabbe (http://www.jonas.rabbe.com/) pertaining to timesince Version 1.5.7: Bugfix so old colors can be darker than new colors (stupid oversight), thanks to http://spiri.dk for spotting it. Bugfix where single digit hex would cause invalid colors, thanks to http://www.wereldkeuken.be/ for the fix. Version 1.5.8: Updated to work with WordPress 2.1 alpha by M. Heilemann. */ function blc_latest_comments($num_posts = 5, $num_comments = 6, $hide_pingbacks_and_trackbacks = true, $prefix = "
  • ", $postfix = "
  • ", $fade_old = true, $range_in_days = 10, $new_col = "#444444", $old_col = "#cccccc") { global $wpdb; function clamp($min, $max, $val) { return max($min,min($max,$val)); } $usetimesince = function_exists('time_since'); // Work nicely with Dunstan's Time Since plugin (adapted by Michael Heilemann) // This is compensating for the lack of subqueries in mysql 3.x // The approach used in previous versions needed the user to // have database lock and create tmp table priviledges. // This uses more queries and manual DISTINCT code, but it works with just select privs. if(!$hide_pingbacks_and_trackbacks) $ping = ""; else $ping = "AND comment_type<>'pingback' AND comment_type<>'trackback'"; $posts = $wpdb->get_results("SELECT comment_post_ID, post_title FROM ($wpdb->comments LEFT JOIN $wpdb->posts ON (comment_post_ID = ID)) WHERE comment_approved = '1' AND $wpdb->posts.post_status='publish' $ping ORDER BY comment_date DESC;"); $seen = array(); $num = 0; if($fade_old) { $max_time = $range_in_days * 24 * 60 * 60 ; $r_new = hexdec(substr($new_col, 1, 2)); $r_old = hexdec(substr($old_col, 1, 2)); //$r_min = min($min, $max); //$r_max = max($min, $max); $r_range = ($r_old-$r_new); $g_new = hexdec(substr($new_col, 3, 2)); $g_old = hexdec(substr($old_col, 3, 2)); //$g_min = min($min, $max); //$g_max = max($min, $max); $g_range = ($g_old-$g_new); $b_new = hexdec(substr($new_col, 5, 2)); $b_old = hexdec(substr($old_col, 5, 2)); //$b_min = min($min, $max); //$b_max = max($min, $max); $b_range = ($b_old-$b_new); } // print "ranges: $r_range, $g_range, $b_range
    "; // print "r: ".(0.5*$r_range+$r_new)."
    "; foreach($posts as $post) { // The following 5 lines is a manual DISTINCT and LIMIT, // since mysql 3.x doesn't allow you to control which way a DISTINCT // select merges multiple entries. if(array_key_exists($post->comment_post_ID, $seen)) continue; $seen[$post->comment_post_ID] = true; if($num++ > $num_posts) break; $commenters = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(comment_date) AS unixdate FROM $wpdb->comments WHERE comment_approved = '1' AND comment_post_ID = '".$post->comment_post_ID."' $ping ORDER BY comment_date DESC LIMIT $num_comments;"); $count = $wpdb->get_var("SELECT COUNT(comment_ID) AS c FROM $wpdb->comments WHERE comment_post_ID = $post->comment_post_ID AND comment_approved = '1' ".$ping); $i = 0; $link = get_permalink($post->comment_post_ID); if($usetimesince) $title = " title=\"Last comment was ".time_since($comment->unixdate)." ago\""; else $title = ""; echo $prefix."".stripslashes($post->post_title). "  ".$count."
    \n"; foreach($commenters as $commenter) { if($usetimesince) $title = " title=\"Posted ".time_since($commenter->unixdate)." ago\""; if($fade_old) { $diff = time() - $commenter->unixdate; $r = round($diff/$max_time*($r_range))+$r_new; $r = clamp(min($r_new, $r_old), max($r_new, $r_old), $r); $g = round($diff/$max_time*($g_range))+$g_new; $g = clamp(min($g_new, $g_old), max($g_new, $g_old), $g); $b = round($diff/$max_time*($b_range))+$b_new; $b = clamp(min($b_new, $b_old), max($b_new, $b_old), $b); $r_hex = str_pad(dechex($r), 2, '0', STR_PAD_LEFT); $g_hex = str_pad(dechex($g), 2, '0', STR_PAD_LEFT); $b_hex = str_pad(dechex($r), 2, '0', STR_PAD_LEFT); $colstr = " style=\"color: #".$r_hex.$g_hex.$b_hex.";\""; } if($i++ > 0) echo ", "; echo "comment_ID."\"$title>".stripslashes($commenter->comment_author).""; } if($count > $num_comments) echo " [...]"; echo "".$postfix."\n"; } } ?> @YEMblog Twitter Updates for 2010-08-19 | YEMblog
    • Can't believe Halfway to the Moon, Liquid Time, Burn That Bridge, Idea & Gone got no love on this leg. If only Holdsworth wrote 'em ;) #
    • And thanks to our nearly 4,000 followers for following along and for providing good feedback that helped on leg two #endoftourcredits #
    • Leg Two GTs: Greek1-SGordo Greek2-DaveO Greek3-ZZYX TRide-AdamE DC1 Alp1 & JB1-ScottyB DC2-SMarks Alp2-JWendt JB2-EWyman GREAT JOB BY ALL! #
    • @cdirksen Thanks for the update on the Norwegian Wood debate. I agree with the final decision #
    • Another great recap from Pauly of @CoventryMusic http://bit.ly/d0Zgat Really enjoyed his reviews this tour (and all of 3.0) #phish #
    • Be sure to check Eric Ward of @glidemag 's review of the first night of #phish at Jones Beach http://bit.ly/9ZKJHQ #phish #
    • thanks to @ericwyman for tweeting tonight and all our amazing guest tweeters this tour #
    • Btw, that 70's rock riff? Jethro Tull hymn 43. #completethought #
    • Thanks to Scotty @yemblog for the air time. It's been fun. @ericwyman OUT!!! #
    • Show MVP: @phish! Thank you for coming back in our lives. Not sure how we went without you. #phish #
    • Post show music. Me and Mrs Jones #
    • Band exiting quickly page side. Big ovation #phish #
    • I totally just rocked the left foot forward knee bending air guitar! #
    • "see you next…tour, thank you" @treyanastasio #
    • Let's bring these ponies back to the barn but let em run it out going back #
    • Reprise #phish #
    • Suzy #phish #
    • Back on stage. #
    • Set #phish #
    • I often think this how Trey would dance at a wedding when the bride and groom were getting down. #
    • "now were gonna break down this pre-drum and bass segment and I want you to sound off" #
    • Trey pacing in front of the troops. #
    • Trey showing off with fakie turns. #
    • Kurodas lights have been anxiety inducing at least twice. Pre boy looked like heatwaves. #straight #
    • Axilla, Timber > Light -> 46 Days -> My Friend, Harry Hood > Tweezer -> Horse > Silent, YEM http://bit.ly/cvIv9N #phish #
    • YEM #phish #
    • > Silent (but you already knew that) #phish #
    • Into horse, that is. #
    • Redoing the much maligned Hartford segue. #
    • > horse #
    • Just listening. #
    • Trey's been using the 70's rock fill all set. Expect more. #
    • Tweezer #phish #
    • Trey played a ton of notes there. Good thing he's got no character count #
    • Short segment of pretty notes. Built up, now back down. #
    • Round 2. Trey got a little sloppy, but this ones got the vibe. #
    • This time the balcony supplies the glowsticks. Better that than people. #phish #
    • To one. Note. At. A. Time. #
    • Doubles. Pre hood. And then it just falls apart. Lulz. #
    • Midset knife felt good. #
    • Hood #phish #
    • Trey built that one pretty well. About 20 second prelude. #
    • > my friend #
    • Driving jam. #
    • II: Axilla, Timber (Jerry) > Light > 46 Days #phish http://bit.ly/cvIv9N #
    • Stay up and hear that light again. Work won't mind #
    • > 46 days. Sick segue. #
    • heavy patterns. Stage is dark. Page shifting pitch over top. #
    • Mike driving the beat under it all. #
    • Layering. Page is up. #
    • Wow. Swung into some dark stuff fast. Pulling back to main vibe. #
    • CK5 following suit with a chase sequence. #
    • Chaotic and deep. #
    • Full on ROY. Trey playing a spiraling pattern downward. Mike calls back with a beacon. #
    • The captain has turned on the fasten seatbelt sign. #phish #
    • Light #phish #
    • No break from the energy level. #
    • Timber #phish #
    • Axilla #phish #
    • Fireworks in lot 5. #
    • Trey and mike conferencing. #
    • Lights. Set 2 #phish #
    • Big shout out to the rock-em-sock-em girls. @jldsy and bud!!!! #
    • Stayed on script pretty much start to finish. Super energy throughout. Back in 15. #
    • Set #phish #
    • Mike-o-esquanolas #cactus #
    • Hardcore #
    • Girls next door raging. Their own version of rock em sock em robots I think. #
    • I: Disease > Sample, Guelah Papyrus, Poor Heart, Ocelot, Chalk Dust, Gin, Tube, Destiny Unbound, Joy, Antelope #phish http://bit.ly/cvIv9N #
    • The @thisweekonlot crew just launched about 500. #
    • ERUPTION!!!!!! #glowsticks #
    • Antelope #phish #
    • Prettiest solo in the catalog? Other contenders: if I could, Billy breathes, velvet sea #phish #
    • Joy #phish #
    • Brief moment where they almost went off script. Mike kicked in lyrics. #
    • #cactus the effect formerly known as Meatball. #
    • Destiny Unbound #phish #
    • Set 1: Disease > Sample in a Jar, Guelah Papyrus, Poor Heart, Ocelot, Chalk Dust Torture, Bathtub Gin, Tube #phish http://bit.ly/cvIv9N #
    • Funky as "fudge" #
    • (insert traditional clav tweet) #love #
    • Back up tempo. Page gets a turn. #
    • Tube. #phish #
    • Big cheers. Great rock and roll so far. #
    • Down rhythm for the traditional finish. Nice little buildup to the peak. #
    • Trey with the fluttery riffs. Pace quickens and builds. #
    • Sounds like were gonna finally go for a little swim. Mike and fish holding the pace. #
    • Orchestra pelted with glowsticks for the second straight song. Build a mighty arsenal for later. #
    • Bathtub Gin #phish #
    • Chalkdust #phish #
    • Sticking to the main theme, but there's a nice little groove happening. #
    • Laser pointer count currently at 4. #phish #
    • You're outta your mind if you don't love the ROYGBIV extra. #phish #ck5 #
    • Sick Ck5. ROYGBIV on the screens. #
    • I: Down with Disease > Sample in a Jar, Guelah Papyrus, Poor Heart, Ocelot #phish http://bit.ly/cvIv9N #
    • Ocelot #phish #
    • Poor heart #phish #
    • Little extra picking from Trey to start. #
    • Guelah #phish #
    • I: Down With Disease, Sample In A Jar #phish http://bit.ly/cvIv9N #
    • Sample #phish #
    • Big energy. #
    • Straight up rock opener. Trey like lightning. Back into the lyrics. #
    • Beautifully dark. CK5 to start. Big difference from Greek and early start. #
    • 7 for 10 on post hiatus shows w/ DWD. #skewedstats #
    • DWD. TREY bouncing #
    • Lights #
    • Lower seats filling in. Getting close. #phish #
    • Rainbow above the stage. #
    • Muggy. Few raindrops. #
    • Lot scene very calm. Lots looking for extras, lots finding. Inside to beat the rush. #
    • Trey changed the Cliff lyrics to Stones "can't always get what you want" #mashup #possibly #
    • Rock on tease #jimmydeanjamesdean #
    • Hey Joe – Hendrix #
    • Nellie Kane #
    • You can get it if you really want – Jimmy Cliff ? #
    • Soundcheck happening. #phish #

    Post a Comment

    You must be logged in to post a comment.