X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFeedContributions.php;h=9edf929f8eaf2f4cf5982cb56c5adddd08078e10;hb=b9333ae6557b86e4b074025c43e77e745610b345;hp=5bf8da9ff8bd501b19649ff2bc5f110ffaf5e79a;hpb=86529fef92eb87bf6a77aa8352aba0075cb6f728;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index 5bf8da9ff8..9edf929f8e 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -172,33 +172,29 @@ class ApiFeedContributions extends ApiBase { * @return string */ protected function feedItemDesc( RevisionRecord $revision ) { - if ( $revision ) { - $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text(); - try { - $content = $revision->getContent( SlotRecord::MAIN ); - } catch ( RevisionAccessException $e ) { - $content = null; - } - - if ( $content instanceof TextContent ) { - // only textual content has a "source view". - $html = nl2br( htmlspecialchars( $content->getNativeData() ) ); - } else { - // XXX: we could get an HTML representation of the content via getParserOutput, but that may - // contain JS magic and generally may not be suitable for inclusion in a feed. - // Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method. - // Compare also FeedUtils::formatDiffRow. - $html = ''; - } - - $comment = $revision->getComment(); + $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text(); + try { + $content = $revision->getContent( SlotRecord::MAIN ); + } catch ( RevisionAccessException $e ) { + $content = null; + } - return '

' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg . - htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) . - "

\n
\n
" . $html . '
'; + if ( $content instanceof TextContent ) { + // only textual content has a "source view". + $html = nl2br( htmlspecialchars( $content->getNativeData() ) ); + } else { + // XXX: we could get an HTML representation of the content via getParserOutput, but that may + // contain JS magic and generally may not be suitable for inclusion in a feed. + // Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method. + // Compare also FeedUtils::formatDiffRow. + $html = ''; } - return ''; + $comment = $revision->getComment(); + + return '

' . htmlspecialchars( $this->feedItemAuthor( $revision ) ) . $msg . + htmlspecialchars( FeedItem::stripComment( $comment ? $comment->text : '' ) ) . + "

\n
\n
" . $html . '
'; } public function getAllowedParams() {