summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CommentStreams/includes/CommentStreamsAllComments.php')
-rw-r--r--CommentStreams/includes/CommentStreamsAllComments.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/CommentStreams/includes/CommentStreamsAllComments.php b/CommentStreams/includes/CommentStreamsAllComments.php
index 52eea7b1..c11810e7 100644
--- a/CommentStreams/includes/CommentStreamsAllComments.php
+++ b/CommentStreams/includes/CommentStreamsAllComments.php
@@ -22,6 +22,13 @@
* DEALINGS IN THE SOFTWARE.
*/
+namespace MediaWiki\Extension\CommentStreams;
+
+use Html;
+use SpecialPage;
+use Title;
+use WikiPage;
+
class CommentStreamsAllComments extends SpecialPage {
public function __construct() {
@@ -75,11 +82,11 @@ class CommentStreamsAllComments extends SpecialPage {
if ( $index < $limit ) {
$wikipage = WikiPage::newFromId( $page->page_id );
$comment = Comment::newFromWikiPage( $wikipage );
- if ( !is_null( $comment ) ) {
+ if ( $comment !== null ) {
$pagename = $comment->getWikiPage()->getTitle()->getPrefixedText();
$associatedpageid = $comment->getAssociatedId();
$associatedpage = WikiPage::newFromId( $associatedpageid );
- if ( !is_null( $associatedpage ) ) {
+ if ( $associatedpage !== null ) {
$associatedpagename =
'[[' . $associatedpage->getTitle()->getPrefixedText() . ']]';
$author = $comment->getUser();
@@ -90,11 +97,11 @@ class CommentStreamsAllComments extends SpecialPage {
$author = $author->getName();
}
$modificationdate = $comment->getModificationDate();
- if ( is_null( $modificationdate ) ) {
+ if ( $modificationdate === null ) {
$lasteditor = '';
} else {
$lasteditor =
- User::newFromId( $wikipage->getRevision()->getUser() );
+ \User::newFromId( $wikipage->getRevision()->getUser() );
if ( $lasteditor->isAnon() ) {
$lasteditor = '<i>' .
wfMessage( 'commentstreams-author-anonymous' ) . '</i>';
@@ -111,7 +118,7 @@ class CommentStreamsAllComments extends SpecialPage {
$wikitext .= '| ' . $lasteditor . PHP_EOL;
$wikitext .= '| ' . $comment->getCreationDate() . PHP_EOL;
$wikitext .= '| ' . $modificationdate . PHP_EOL;
- $index ++;
+ $index++;
}
}
} else {
@@ -120,7 +127,11 @@ class CommentStreamsAllComments extends SpecialPage {
}
$wikitext .= '|}' . PHP_EOL;
- $this->getOutput()->addWikiText( $wikitext );
+ if ( method_exists( 'OutputPage', 'addWikiTextAsInterface' ) ) {
+ $this->getOutput()->addWikiTextAsInterface( $wikitext );
+ } else {
+ $this->getOutput()->addWikiText( $wikitext );
+ }
if ( $offset > 0 || $more ) {
$this->addTableNavigation( $offset, $more, $limit, 'offset' );