It is a dirty fix but should work:
function q_item_title($q_item) {
$html = '';
if(isset($q_item['raw']['closedbyid'])) {
$result = qa_db_read_one_assoc(qa_db_query_sub(
'SELECT content, type FROM ^posts WHERE postid = #',
$q_item['raw']['closedbyid']
), true
);
if(isset($result)) {
if ($result['type'] === 'NOTE') {
$reason = 'Off-topic';
$class = 'offtopic';
} else {
$reason = 'Duplicate';
$class = 'duplicate';
}
$html = sprintf('<span class="qa-q-%s">[%s]</span>', $class, $reason);
}
}
$this->output(
'<div class="qa-q-item-title">',
$html,
sprintf('<a href="%s">%s</a>', $q_item['url'], $q_item['title']),
'</div>'
);
}
This will output Off-topic or Duplicate as the text and qa-q-duplicate and qa-q-offtopic as the CSS classes to use in each case.