$unix_date) { $difference = $now - $unix_date; $tense = "ago"; } else { $difference = $unix_date - $now; $tense = "from now"; } for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); if($difference != 1) { $periods[$j].= "s"; } return "$difference $periods[$j] {$tense}"; } function widget_facebook($args) { extract($args); $fb_widget_options = unserialize(get_option('fb_widget_options')); $title = stripslashes($fb_widget_options['title']); $dispname = stripslashes($fb_widget_options['dispname']); $dformat=$fb_widget_options['df']; echo $before_widget . $before_title . $title . $after_title; global $wpdb; // We need to get the user_id from the userdata table for this blog. $sql="Select user_id from ".WORDBOOK_USERDATA; $result = $wpdb->get_results($sql); $wbuser = wordbook_get_userdata($result[0]->user_id); $fbclient = wordbook_fbclient($wbuser); list($fbuid, $users, $error_code, $error_msg) = wordbook_fbclient_getinfo($fbclient, array( 'is_app_user', 'first_name', 'name', 'status', 'pic', )); $profile_url = "http://www.facebook.com/profile.php?id=$fbuid"; if ($fbuid) { if (is_array($users)) { $user = $users[0]; if ($user['pic']) { echo '
'.$name.'';
echo ' '.$user['status']['message'].'
';
if ($dformat=='fbt') {
echo '('.nicetime($user['status']['time']).').'; }
else {echo '('.date($dformat, $user['status']['time']).').';}
echo '