Index: trunk/phase3/includes/parser/LinkHolderArray.php |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | * |
193 | 193 | * @param $nt Title |
194 | 194 | */ |
195 | | - function makeHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 195 | + function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) { |
196 | 196 | wfProfileIn( __METHOD__ ); |
197 | 197 | if ( ! is_object($nt) ) { |
198 | 198 | # Fail gracefully |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | 'text' => $prefix.$text.$inside, |
207 | 207 | 'pdbk' => $nt->getPrefixedDBkey(), |
208 | 208 | ); |
209 | | - if ( $query !== '' ) { |
| 209 | + if ( $query !== array() ) { |
210 | 210 | $entry['query'] = $query; |
211 | 211 | } |
212 | 212 | |
— | — | @@ -349,23 +349,29 @@ |
350 | 350 | foreach ( $entries as $index => $entry ) { |
351 | 351 | $pdbk = $entry['pdbk']; |
352 | 352 | $title = $entry['title']; |
353 | | - $query = isset( $entry['query'] ) ? $entry['query'] : ''; |
| 353 | + $query = isset( $entry['query'] ) ? $entry['query'] : array(); |
354 | 354 | $key = "$ns:$index"; |
355 | 355 | $searchkey = "<!--LINK $key-->"; |
356 | | - if ( !isset( $colours[$pdbk] ) || $colours[$pdbk] == 'new' ) { |
| 356 | + $displayText = $entry['text']; |
| 357 | + if ( $displayText === '' ) { |
| 358 | + $displayText = null; |
| 359 | + } |
| 360 | + if ( !isset( $colours[$pdbk] ) ) { |
| 361 | + $colours[$pdbk] = 'new'; |
| 362 | + } |
| 363 | + $attribs = array(); |
| 364 | + if ( $colours[$pdbk] == 'new' ) { |
357 | 365 | $linkCache->addBadLinkObj( $title ); |
358 | | - $colours[$pdbk] = 'new'; |
359 | 366 | $output->addLink( $title, 0 ); |
360 | | - // FIXME: replace deprecated makeBrokenLinkObj() by link() |
361 | | - $replacePairs[$searchkey] = $sk->makeBrokenLinkObj( $title, |
362 | | - $entry['text'], |
363 | | - $query ); |
| 367 | + $type = array( 'broken' ); |
364 | 368 | } else { |
365 | | - // FIXME: replace deprecated makeColouredLinkObj() by link() |
366 | | - $replacePairs[$searchkey] = $sk->makeColouredLinkObj( $title, $colours[$pdbk], |
367 | | - $entry['text'], |
368 | | - $query ); |
| 369 | + if ( $colours[$pdbk] != '' ) { |
| 370 | + $attribs['class'] = $colours[$pdbk]; |
| 371 | + } |
| 372 | + $type = array( 'known', 'noclasses' ); |
369 | 373 | } |
| 374 | + $replacePairs[$searchkey] = $sk->link( $title, $displayText, |
| 375 | + $attribs, $query, $type ); |
370 | 376 | } |
371 | 377 | } |
372 | 378 | $replacer = new HashtableReplacer( $replacePairs, 1 ); |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1935,7 +1935,7 @@ |
1936 | 1936 | $s .= $this->makeKnownLinkHolder( $nt, $text, array(), $trail, $prefix ); |
1937 | 1937 | } else { |
1938 | 1938 | # Links will be added to the output link list after checking |
1939 | | - $s .= $holders->makeHolder( $nt, $text, '', $trail, $prefix ); |
| 1939 | + $s .= $holders->makeHolder( $nt, $text, array(), $trail, $prefix ); |
1940 | 1940 | } |
1941 | 1941 | wfProfileOut( __METHOD__."-always_known" ); |
1942 | 1942 | } |
— | — | @@ -1951,7 +1951,7 @@ |
1952 | 1952 | * |
1953 | 1953 | * @deprecated |
1954 | 1954 | */ |
1955 | | - function makeLinkHolder( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 1955 | + function makeLinkHolder( &$nt, $text = '', $query = array(), $trail = '', $prefix = '' ) { |
1956 | 1956 | return $this->mLinkHolders->makeHolder( $nt, $text, $query, $trail, $prefix ); |
1957 | 1957 | } |
1958 | 1958 | |
Index: trunk/phase3/includes/parser/CoreLinkFunctions.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | # Return false so that this link is reverted back to WikiText |
43 | 43 | return false; |
44 | 44 | } |
45 | | - return $holders->makeHolder( $title, isset($displayText) ? $displayText : $titleText, '', '', '' ); |
| 45 | + return $holders->makeHolder( $title, isset($displayText) ? $displayText : $titleText, array(), '', '' ); |
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |