$colours = [];
$linkCache = LinkCache::singleton();
$output = $this->parent->getOutput();
+ $linkRenderer = $this->parent->getLinkRenderer();
$dbr = wfGetDB( DB_SLAVE );
- $threshold = $this->parent->getOptions()->getStubThreshold();
# Sort by namespace
ksort( $this->internals );
} else {
$id = $linkCache->getGoodLinkID( $pdbk );
if ( $id != 0 ) {
- $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
+ $colours[$pdbk] = $linkRenderer->getLinkClasses( $title );
$output->addLink( $title, $id );
$linkcolour_ids[$id] = $pdbk;
} elseif ( $linkCache->isBadLink( $pdbk ) ) {
$pdbk = $title->getPrefixedDBkey();
$linkCache->addGoodLinkObjFromRow( $title, $s );
$output->addLink( $title, $s->page_id );
- # @todo FIXME: Convoluted data flow
- # The redirect status and length is passed to getLinkColour via the LinkCache
- # Use formal parameters instead
- $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
+ $colours[$pdbk] = $linkRenderer->getLinkClasses( $title );
// add id to the extension todolist
$linkcolour_ids[$s->page_id] = $pdbk;
}
}
if ( $displayText === '' ) {
$displayText = null;
+ } else {
+ $displayText = new HtmlArmor( $displayText );
}
if ( !isset( $colours[$pdbk] ) ) {
$colours[$pdbk] = 'new';
if ( $colours[$pdbk] == 'new' ) {
$linkCache->addBadLinkObj( $title );
$output->addLink( $title, 0 );
- $type = [ 'broken' ];
+ $link = $linkRenderer->makeBrokenLink(
+ $title, $displayText, $attribs, $query
+ );
} else {
- if ( $colours[$pdbk] != '' ) {
- $attribs['class'] = $colours[$pdbk];
- }
- $type = [ 'known', 'noclasses' ];
+ $link = $linkRenderer->makePreloadedLink(
+ $title, $displayText, $colours[$pdbk], $attribs, $query
+ );
}
- $replacePairs[$searchkey] = Linker::link( $title, $displayText,
- $attribs, $query, $type );
+
+ $replacePairs[$searchkey] = $link;
}
}
$replacer = new HashtableReplacer( $replacePairs, 1 );
# Make interwiki link HTML
$output = $this->parent->getOutput();
$replacePairs = [];
- $options = [
- 'stubThreshold' => $this->parent->getOptions()->getStubThreshold(),
- ];
+ $linkRenderer = $this->parent->getLinkRenderer();
foreach ( $this->interwikis as $key => $link ) {
- $replacePairs[$key] = Linker::link( $link['title'], $link['text'], [], [], $options );
+ $replacePairs[$key] = $linkRenderer->makeLink(
+ $link['title'],
+ new HtmlArmor( $link['text'] )
+ );
$output->addInterwikiLink( $link['title'] );
}
$replacer = new HashtableReplacer( $replacePairs, 1 );
$variantMap = []; // maps $pdbkey_Variant => $keys (of link holders)
$output = $this->parent->getOutput();
$linkCache = LinkCache::singleton();
- $threshold = $this->parent->getOptions()->getStubThreshold();
$titlesToBeConverted = '';
$titlesAttrs = [];
);
$linkcolour_ids = [];
+ $linkRenderer = $this->parent->getLinkRenderer();
// for each found variants, figure out link holders and replace
foreach ( $varRes as $s ) {
$entry['pdbk'] = $varPdbk;
// set pdbk and colour
- # @todo FIXME: Convoluted data flow
- # The redirect status and length is passed to getLinkColour via the LinkCache
- # Use formal parameters instead
- $colours[$varPdbk] = Linker::getLinkColour( $variantTitle, $threshold );
+ $colours[$varPdbk] = $linkRenderer->getLinkClasses( $variantTitle );
$linkcolour_ids[$s->page_id] = $pdbk;
}
}