604800) { $print = date("M jS", $original); if($since > 31536000) { $print .= ", " . date("Y", $original); } return $print; } if($since < 60) { $print = "just now"; return $print; } // $j saves performing the count function each time around the loop for($i = 0, $j = count($chunks); $i < $j; $i++) { $seconds = $chunks[$i][0]; $name = $chunks[$i][1]; // finding the biggest chunk (if the chunk fits, break) if(($count = floor($since / $seconds)) != 0) { break; } } $print = ($count == 1) ? '1 '.$name : "$count {$name}s"; return $print . " ago"; } function c_items($feeds, $count = 10) { foreach($feeds as $feed) { $rss = fetch_rss($feed[url]); if($rss) { $link = $rss->channel[link]; $title = $rss->channel[title]; $items = array_slice($rss->items, 0, $count); foreach($items as $item) { $item[source][url] = $feed[url]; $item[source][type] = $feed[type]; $item[source][link] = $link; $item[source][title] = $title; if(isset($item[date_timestamp])) $cons_timestamp = $item[date_timestamp]; if(isset($item[published])) $cons_timestamp = strtotime(substr($item[published],0,-1)); if(isset($item[updated])) $cons_timestamp = strtotime(substr($item[updated],0,-1)); if(isset($item[dc][date])) $cons_timestamp = strtotime(substr($item[dc][date],0,19)); if(!isset($cons_timestamp)) $cons_timestamp = time(); while(isset($con[$cons_timestamp])) $cons_timestamp--; $con[$cons_timestamp] = $item; $con[$cons_timestamp]['cons_timestamp'] = $cons_timestamp; } } } krsort($con); $con = array_slice($con, 0, $count); return $con; } function print_cons_item($input) { $favicon = "http://rcboyce.com/projects/php/cons/images/small/local.png"; if(file_exists("/home/rcboyce/www/www/projects/php/cons/images/small/".$input[source][type].".png")) $favicon = "http://rcboyce.com/projects/php/cons/images/small/".$input[source][type].".png"; if($input[source][type] == "twitter") { $temp = explode(": ", $input[title], 2); $input[title] = $temp[1]; } echo '
".$input[description]."
"; break; } echo'".$input[description]."
"; break; } echo'