From: Zach Copley Date: Mon, 4 Apr 2011 22:08:47 +0000 (-0700) Subject: QnA - Rework output for notice stream X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9a371658bd227309d88eb542b45dae9af5475aba;p=quix0rs-gnu-social.git QnA - Rework output for notice stream --- diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php index cc70cb7aeb..35811a309a 100644 --- a/plugins/QnA/QnAPlugin.php +++ b/plugins/QnA/QnAPlugin.php @@ -384,7 +384,7 @@ class QnAPlugin extends MicroAppPlugin $nli = new NoticeListItem($notice, $out); $nli->showNotice(); - $out->elementStart('div', array('class' => 'entry-content question-desciption')); + $out->elementStart('div', array('class' => 'entry-content question-description')); $question = QnA_Question::getByNotice($notice); diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php index a2333be6dc..c8dcd43162 100644 --- a/plugins/QnA/classes/QnA_Answer.php +++ b/plugins/QnA/classes/QnA_Answer.php @@ -205,31 +205,31 @@ class QnA_Answer extends Managed_DataObject { $notice = $question->getNotice(); - $fmt = ''; + $out = new XMLStringer(); + $cls = array('qna_answer'); if (!empty($answer->best)) { - $fmt = '

'; - } else { - $fmt = '

'; + $cls[] = 'best'; } - $fmt .= 'answer by %3$s'; - $fmt .= '%4$s'; + $out->elementStart('p', array('class' => implode(' ', $cls))); + $out->elementStart('span', 'answer-content'); + $out->raw(QnAPlugin::shorten($answer->content, $notice)); + $out->elementEnd('span'); + if (!empty($answer->revisions)) { - $fmt .= '' - . $answer->revisions - . _m('revisions') - . ''; + $out->elementstart('span', 'answer-revisions'); + $out->text( + htmlspecialchars( + sprintf(_m('%s revisions'), $answer->revisions) + ) + ); + $out->elementEnd('span'); } - $fmt .= '

'; - return sprintf( - $fmt, - htmlspecialchars($notice->bestUrl()), - htmlspecialchars($profile->profileurl), - htmlspecialchars($profile->getBestName()), - htmlspecialchars($answer->content) - ); + $out->elementEnd('p'); + + return $out->getString(); } static function toString($profile, $question, $answer) diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index 93d45c56c8..3f1a33d33c 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -213,14 +213,12 @@ class QnA_Question extends Managed_DataObject { $notice = $question->getNotice(); - $fmt = '%s'; + $out = new XMLStringer(); + $out->elementStart('span', 'question_description'); + $out->raw(QnAPlugin::shorten($question->description, $notice)); + $out->elementEnd('span'); - $q = sprintf( - $fmt, - htmlspecialchars($question->description) - ); - - return $q; + return $out->getString(); } static function toString($profile, $question, $answers)