X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FImagePage.php;h=81677d41ceae426cd7a9ffd4f5323d7c55522a73;hb=1dee28cb5f1efd6d9e14d6cc1d0c73c3f69269b4;hp=8724c454e0ea35637fe5ac32a64f0036765386d5;hpb=88dcf22da0d379a586496cc1749f4749703c96b2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index 8724c454e0..d3d6da7935 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -272,18 +272,20 @@ class ImagePage extends Article { } /** - * Overloading Article's getContentObject method. + * Overloading Article's getEmptyPageParserOutput method. * * Omit noarticletext if sharedupload; text will be fetched from the * shared upload server if possible. - * @return string + * + * @param ParserOptions $options + * @return ParserOutput */ - public function getContentObject() { + public function getEmptyPageParserOutput( ParserOptions $options ) { $this->loadFile(); if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getId() ) { - return null; + return new ParserOutput(); } - return parent::getContentObject(); + return parent::getEmptyPageParserOutput( $options ); } private function getLanguageForRendering( WebRequest $request, File $file ) { @@ -440,7 +442,7 @@ class ImagePage extends Article { // in the mediawiki.page.image.pagination module $link = Linker::linkKnown( $this->getTitle(), - $label, + htmlspecialchars( $label ), [], [ 'page' => $page - 1 ] ); @@ -460,7 +462,7 @@ class ImagePage extends Article { $label = $this->getContext()->msg( 'imgmultipagenext' )->text(); $link = Linker::linkKnown( $this->getTitle(), - $label, + htmlspecialchars( $label ), [], [ 'page' => $page + 1 ] ); @@ -539,13 +541,13 @@ class ImagePage extends Article { // The dirmark, however, must not be immediately adjacent // to the filename, because it can get copied with it. // See T27277. - // @codingStandardsIgnoreStart Ignore long line + // phpcs:disable Generic.Files.LineLength $out->addWikiText( <<{$medialink} $dirmark$longDesc
$warning
EOT ); - // @codingStandardsIgnoreEnd + // phpcs:enable } else { $out->addWikiText( <<{$medialink} {$dirmark}$longDesc @@ -1015,11 +1017,8 @@ EOT * @return int Result of string comparison, or namespace comparison */ protected function compare( $a, $b ) { - if ( $a->page_namespace == $b->page_namespace ) { - return strcmp( $a->page_title, $b->page_title ); - } else { - return $a->page_namespace - $b->page_namespace; - } + return $a->page_namespace <=> $b->page_namespace + ?: strcmp( $a->page_title, $b->page_title ); } /** @@ -1045,9 +1044,8 @@ EOT $option = 0; } - return isset( $wgImageLimits[$option] ) - ? $wgImageLimits[$option] - : [ 800, 600 ]; // if nothing is set, fallback to a hardcoded default + // if nothing is set, fallback to a hardcoded default + return $wgImageLimits[$option] ?? [ 800, 600 ]; } /**