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-10-30 | YEMblog
    • Hilights= sand, carini, slave, corinna…entire set really #
    • 5 more sets!!!!!! #
    • Great great show. Thx scott. #
    • Show #
    • #beautifulbuzz #
    • E: LOVING CUP #
    • *11:43 #
    • SetII= 1:26 #
    • Set, 10:43 #
    • Eveyones hugging. That was really something #
    • So loose yet so tight #
    • "check this out" #
    • This show has a very hamtpon 09run vibe in its length, energy, freshness and spectcular execution #
    • Fluffhead #
    • Not how sure it appeears on paper, but this set is REALLy REALLY good #
    • This slave buildup would be perfect background music for a morgan freeman #
    • Narration at the end of an underdog-triumphs movie #
    • Slave build happening fast and furious. And flawless. #
    • Slave #
    • All lights coverging midstage 15 ft up to create giant asterisk halo over treys head #
    • Golgi #
    • >really dark space #
    • >theme #
    • #IT #
    • Love when piper starts from standstill #
    • Piper #
    • Pagey been all about the rhodes this tour #
    • Page laying it down soulfully on rhodes #
    • >corinna #
    • No big ending on caspian #
    • >caspian #
    • Headed to page-led ambient space now after melodic arpeggios from trey #
    • Lots of notes, lots of highhat, awesome little groove jam #
    • Nice groove. Type2 again #
    • #rage #
    • OK. Hoth tease could be a stretch. But if 7.30.09 ghost gets 'praise u' then we get this one #
    • >carini green #
    • Teasing houses of the holy. Anyone else hear it? #
    • Melodic major chord groove led by trey, mike looking for queues #
    • Ophishally type2 #
    • We have liftoff #
    • *one #
    • Trey taking this onr for a walk #
    • #tension amp;release #
    • Trey riffing, fish/mike laying it down,page=sonic underbelly #
    • Nice minor-7 chord to get jam started #
    • Sandy sand #
    • Dont miss the candy stand on the 100 level! They have everything. #sour cherrygummiesftw #
    • Dancing #
    • 1017 start #
    • Pyite #
    • Lights #
    • Hilights=ocelot, 46. coMvps=trey,ck5 #
    • Venue feels like NE hampton #
    • 943…. Set1=1:27 #
    • #hothotheat #
    • "looking for clues but they couldnt be found"…so apropos for this wknd #
    • TypeII was brief #
    • >46daze #
    • Jam taking a dark, fx-based turn #typeII #
    • Ck5 flicking certain house lights on and off as part of his work 2nite #
    • My mistake…ck5 apparently has control over all lights… #
    • House lights came on #
    • Mike leading this in a very berekleyII-esque direction #
    • Nice quick segue #
    • >cities #
    • Big fish flub at start, but energy is back! #
    • #nailingit #
    • I think it must stand for: more of mike-induced astonishment #
    • Or, as the brah next to next to turned to say, "my oh my, adam" #
    • Moma #
    • I #
    • Rift #
    • Axilla #
    • Really short timber #
    • Im having a blast, but set energy took a bad turn at sample #
    • Bouncin #
    • (jerry) #
    • Timber #
    • And this one is no different. Next time big red. #
    • Never seen a ss in which trey didnt struggle w his part… #
    • Sugar shaq #
    • Trey pushing in dissonant direction and pulling back w melodic release #sweet #
    • Page on rhodes. Send this brah to oxford! Hes a scholar on the damn thing #
    • Light up or leave me alone #
    • Sample #
    • Most ocelot jams meander in the song's laid back style. This one built rose and peaked #
    • #bestocelotever #
    • This mini jam is strait up EMOTIVE #
    • Dont be tthe only one left on the lawt #
    • Ocelot #
    • When i die i hope heaven lokos a little like phish fall tour 2010 #
    • Spoiler: troy is the ocelot #
    • Kuroda early mvp. aqua green violet and be more aqua #
    • Mature crowd on the floor. No teens #
    • Acdc baaaag #
    • Sound=deep , clear fluid. Kuroda off to mind bending start…rapid fire primary colors #
    • I cannot believe were going to see a malloween set in this amazing place #awestruck #
    • My soul #
    • Kuroda puts spot on flag hanging in back. Entire crowd turns #
    • Star spangled banner a capella #
    • Lights #
    • Floor, fish side dish side about half way back #
    • Unless of course u had a hed full of acid ;) #
    • This room is so small itd be tuff to lose your crew… #
    • Big ups to the flagship resort! Its pretty sw33t! We have a pool! #
    • Really big manteca sign hanging from back of flr #
    • People are really really really happy tho #
    • Floor still only about 40% filled in, seating filling in slowly #
    • Tickets hanging from trees on the way in. Overheard someone say he got $20 for his xtra #
    • Smaller room thani thought. Youd never know capacity was 13k #
    • But the guy to gal ratio is ser 50:1 #
    • Thie VIBE in this place is incredible #
    • Also heard of spottings of big foot and ole lochness #
    • People also saying they heard costome set on 1031 will be third set #
    • Word on lawt is that venue has no curfew… Employees have been told they may work til 2am sun night #
    • Real mess getting into venue… But what a venue! #
    • Shocking number of xtras on lawt #
    • Cab driver just asked our crew: yallz goin to america got talent or some sh*t? Lol #
    • Test test #
    • Testing #
    • Just pulling into the strip on the 245 greyhound from nyc. First time here. Helloooo ac! #
    • List of 55 Phish Fans Tweeting From Atlantic City http://twitter.com/#!/YEMblog/phish-fans-tweeting-from-atlantic-city #phish #

    Post a Comment

    You must be logged in to post a comment.