function ap_get_latest_history_html($post_id, $avatar = false, $icon = false) { $history = ap_get_latest_history($post_id); $html = ''; if ($history) { if ($avatar) { $html .= '<a class="ap-savatar" href="' . ap_user_link($history['user_id']) . '">' . get_avatar($history['user_id'], 20) . '</a>'; } if ($icon) { $html .= '<span class="' . ap_history_icon($history['type']) . ' ap-tlicon"></span>'; } $html .= '<span class="ap-post-history">' . sprintf(__('%s %s about %s ago', 'ap'), ap_user_display_name($history['user_id']), ap_history_name($history['type']), ap_human_time(mysql2date('U', $history['date']))) . '</span>'; } elseif (!$icon) { $html = '<span class="ap-post-history">' . sprintf(__('Asked by %s', 'ap'), ap_user_display_name()) . '</span>'; } if ($html) { return apply_filters('ap_latest_history_html', $html); } return false; }
function ap_get_latest_history_html($post_id, $avatar = false, $icon = false) { $history = ap_get_latest_history($post_id); $html = ''; if ($history) { if ($icon) { $html .= '<span class="' . ap_history_icon($history['type']) . ' ap-tlicon"></span>'; } if ($avatar) { $html .= '<a class="ap-savatar" href="' . ap_user_link($history['user_id']) . '">' . get_avatar($history['user_id'], 22) . '</a>'; } if ($history['type'] == 'added_label' || $history['type'] == 'removed_label') { $label = ''; $terms = get_terms('question_label', array('include' => explode(',', $history['value']))); if ($terms) { foreach ($terms as $term) { $label .= ap_label_html($term); } } $label .= ' ' . _n('label', 'labels', count($terms), 'ap'); $title = ap_history_name($history['type'], $label); } else { $title = ap_history_name($history['type']); } $html .= '<span class="ap-post-history">' . sprintf(__('%s %s about <time class="updated" datetime="' . mysql2date('c', $history['date']) . '">%s</time> ago', 'ap'), ap_user_display_name($history['user_id']), $title, ap_human_time(mysql2date('U', $history['date']))) . '</span>'; } elseif (!$icon) { $html = '<span class="ap-post-history">' . sprintf(__('Asked by %s', 'ap'), ap_user_display_name()) . '</span>'; } if ($html) { return apply_filters('ap_latest_history_html', $html); } return false; }