Skip to content

Instantly share code, notes, and snippets.

@ellisio
Created November 14, 2011 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ellisio/6a1e0782834fc806668a to your computer and use it in GitHub Desktop.
Save ellisio/6a1e0782834fc806668a to your computer and use it in GitHub Desktop.
$last_reply_time = 0;
if (isset($comments[(count($comments) - 1)])) {
$last_reply_time = strtotime($comments[(count($comments) - 1)]->comment_date_gmt);
}
else if (count($social_items)) {
$latest_item = null;
foreach ($social_items as $service => $items) {
foreach ($items as $comment) {
if ($latest_item === null) {
$latest_item = strtotime($comment->comment_date_gmt);
}
else {
$time = strtotime($comment->comment_date_gmt);
if ($time > $latest_item) {
$latest_item = $time;
}
}
}
}
if ($latest_item !== null) {
$last_reply_time = $latest_item;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment