*
* @param $nt Title
*/
- function makeHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
wfProfileIn( __METHOD__ );
if ( ! is_object($nt) ) {
# Fail gracefully
'text' => $prefix.$text.$inside,
'pdbk' => $nt->getPrefixedDBkey(),
);
- if ( $query !== '' ) {
+ if ( $query !== array() ) {
$entry['query'] = $query;
}
foreach ( $entries as $index => $entry ) {
$pdbk = $entry['pdbk'];
$title = $entry['title'];
- $query = isset( $entry['query'] ) ? $entry['query'] : '';
+ $query = isset( $entry['query'] ) ? $entry['query'] : array();
$key = "$ns:$index";
$searchkey = "<!--LINK $key-->";
- if ( !isset( $colours[$pdbk] ) || $colours[$pdbk] == 'new' ) {
- $linkCache->addBadLinkObj( $title );
+ $displayText = $entry['text'];
+ if ( $displayText === '' ) {
+ $displayText = null;
+ }
+ if ( !isset( $colours[$pdbk] ) ) {
$colours[$pdbk] = 'new';
+ }
+ $attribs = array();
+ if ( $colours[$pdbk] == 'new' ) {
+ $linkCache->addBadLinkObj( $title );
$output->addLink( $title, 0 );
- // FIXME: replace deprecated makeBrokenLinkObj() by link()
- $replacePairs[$searchkey] = $sk->makeBrokenLinkObj( $title,
- $entry['text'],
- $query );
+ $type = array( 'broken' );
} else {
- // FIXME: replace deprecated makeColouredLinkObj() by link()
- $replacePairs[$searchkey] = $sk->makeColouredLinkObj( $title, $colours[$pdbk],
- $entry['text'],
- $query );
+ if ( $colours[$pdbk] != '' ) {
+ $attribs['class'] = $colours[$pdbk];
+ }
+ $type = array( 'known', 'noclasses' );
}
+ $replacePairs[$searchkey] = $sk->link( $title, $displayText,
+ $attribs, $query, $type );
}
}
$replacer = new HashtableReplacer( $replacePairs, 1 );
$s .= $this->makeKnownLinkHolder( $nt, $text, array(), $trail, $prefix );
} else {
# Links will be added to the output link list after checking
- $s .= $holders->makeHolder( $nt, $text, '', $trail, $prefix );
+ $s .= $holders->makeHolder( $nt, $text, array(), $trail, $prefix );
}
wfProfileOut( __METHOD__."-always_known" );
}
*
* @deprecated
*/
- function makeLinkHolder( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ function makeLinkHolder( &$nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
return $this->mLinkHolders->makeHolder( $nt, $text, $query, $trail, $prefix );
}