X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpager%2FIndexPager.php;h=6af60a7b19b6d397d8fc25a0dc9afb32d9e69756;hb=520b167979260edf2cee41842e526ec985c37f92;hp=04021cc038a1ff4f6074f8fd28c7748f125bdf10;hpb=699920cc66790c3f5675ffa340c361950ee6225f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/pager/IndexPager.php b/includes/pager/IndexPager.php index 04021cc038..6af60a7b19 100644 --- a/includes/pager/IndexPager.php +++ b/includes/pager/IndexPager.php @@ -21,10 +21,11 @@ * @ingroup Pager */ -use Wikimedia\Rdbms\IResultWrapper; -use Wikimedia\Rdbms\IDatabase; -use MediaWiki\Linker\LinkTarget; +use MediaWiki\Linker\LinkRenderer; +use MediaWiki\MediaWikiServices; use MediaWiki\Navigation\PrevNextNavigationRenderer; +use Wikimedia\Rdbms\IDatabase; +use Wikimedia\Rdbms\IResultWrapper; /** * IndexPager is an efficient pager which uses a (roughly unique) index in the @@ -157,7 +158,10 @@ abstract class IndexPager extends ContextSource implements Pager { */ public $mResult; - public function __construct( IContextSource $context = null ) { + /** @var LinkRenderer */ + private $linkRenderer; + + public function __construct( IContextSource $context = null, LinkRenderer $linkRenderer = null ) { if ( $context ) { $this->setContext( $context ); } @@ -209,6 +213,7 @@ abstract class IndexPager extends ContextSource implements Pager { ? $dir[$this->mOrderType] : $dir; } + $this->linkRenderer = $linkRenderer; } /** @@ -526,9 +531,9 @@ abstract class IndexPager extends ContextSource implements Pager { $attrs['class'] = "mw-{$type}link"; } - return Linker::linkKnown( + return $this->getLinkRenderer()->makeKnownLink( $this->getTitle(), - $text, + new HtmlArmor( $text ), $attrs, $query + $this->getDefaultQuery() ); @@ -790,18 +795,25 @@ abstract class IndexPager extends ContextSource implements Pager { /** * Generate (prev x| next x) (20|50|100...) type links for paging * - * @param LinkTarget $title + * @param Title $title * @param int $offset * @param int $limit * @param array $query Optional URL query parameter string * @param bool $atend Optional param for specified if this is the last page * @return string */ - protected function buildPrevNextNavigation( LinkTarget $title, $offset, $limit, + protected function buildPrevNextNavigation( Title $title, $offset, $limit, array $query = [], $atend = false ) { $prevNext = new PrevNextNavigationRenderer( $this ); return $prevNext->buildPrevNextNavigation( $title, $offset, $limit, $query, $atend ); } + + protected function getLinkRenderer() { + if ( $this->linkRenderer === null ) { + $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); + } + return $this->linkRenderer; + } }