Index: trunk/phase3/includes/Linker.php |
— | — | @@ -18,14 +18,6 @@ |
19 | 19 | function __construct() {} |
20 | 20 | |
21 | 21 | /** |
22 | | - * @deprecated |
23 | | - */ |
24 | | - function postParseLinkColour( $s = null ) { |
25 | | - wfDeprecated( __METHOD__ ); |
26 | | - return null; |
27 | | - } |
28 | | - |
29 | | - /** |
30 | 22 | * Get the appropriate HTML attributes to add to the "a" element of an ex- |
31 | 23 | * ternal link, as created by [wikisyntax]. |
32 | 24 | * |
— | — | @@ -330,235 +322,6 @@ |
331 | 323 | } |
332 | 324 | |
333 | 325 | /** |
334 | | - * @deprecated Use link() |
335 | | - * |
336 | | - * This function is a shortcut to makeLinkObj(Title::newFromText($title),...). Do not call |
337 | | - * it if you already have a title object handy. See makeLinkObj for further documentation. |
338 | | - * |
339 | | - * @param $title String: the text of the title |
340 | | - * @param $text String: link text |
341 | | - * @param $query String: optional query part |
342 | | - * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
343 | | - * be included in the link text. Other characters will be appended after |
344 | | - * the end of the link. |
345 | | - */ |
346 | | - function makeLink( $title, $text = '', $query = '', $trail = '' ) { |
347 | | - wfProfileIn( __METHOD__ ); |
348 | | - $nt = Title::newFromText( $title ); |
349 | | - if ( $nt instanceof Title ) { |
350 | | - $result = $this->makeLinkObj( $nt, $text, $query, $trail ); |
351 | | - } else { |
352 | | - wfDebug( 'Invalid title passed to Linker::makeLink(): "'.$title."\"\n" ); |
353 | | - $result = $text == "" ? $title : $text; |
354 | | - } |
355 | | - |
356 | | - wfProfileOut( __METHOD__ ); |
357 | | - return $result; |
358 | | - } |
359 | | - |
360 | | - /** |
361 | | - * @deprecated Use link() |
362 | | - * |
363 | | - * This function is a shortcut to makeKnownLinkObj(Title::newFromText($title),...). Do not call |
364 | | - * it if you already have a title object handy. See makeKnownLinkObj for further documentation. |
365 | | - * |
366 | | - * @param $title String: the text of the title |
367 | | - * @param $text String: link text |
368 | | - * @param $query String: optional query part |
369 | | - * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
370 | | - * be included in the link text. Other characters will be appended after |
371 | | - * the end of the link. |
372 | | - */ |
373 | | - function makeKnownLink( $title, $text = '', $query = '', $trail = '', $prefix = '',$aprops = '') { |
374 | | - $nt = Title::newFromText( $title ); |
375 | | - if ( $nt instanceof Title ) { |
376 | | - return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix , $aprops ); |
377 | | - } else { |
378 | | - wfDebug( 'Invalid title passed to Linker::makeKnownLink(): "'.$title."\"\n" ); |
379 | | - return $text == '' ? $title : $text; |
380 | | - } |
381 | | - } |
382 | | - |
383 | | - /** |
384 | | - * @deprecated Use link() |
385 | | - * |
386 | | - * This function is a shortcut to makeBrokenLinkObj(Title::newFromText($title),...). Do not call |
387 | | - * it if you already have a title object handy. See makeBrokenLinkObj for further documentation. |
388 | | - * |
389 | | - * @param string $title The text of the title |
390 | | - * @param string $text Link text |
391 | | - * @param string $query Optional query part |
392 | | - * @param string $trail Optional trail. Alphabetic characters at the start of this string will |
393 | | - * be included in the link text. Other characters will be appended after |
394 | | - * the end of the link. |
395 | | - */ |
396 | | - function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) { |
397 | | - $nt = Title::newFromText( $title ); |
398 | | - if ( $nt instanceof Title ) { |
399 | | - return $this->makeBrokenLinkObj( $nt, $text, $query, $trail ); |
400 | | - } else { |
401 | | - wfDebug( 'Invalid title passed to Linker::makeBrokenLink(): "'.$title."\"\n" ); |
402 | | - return $text == '' ? $title : $text; |
403 | | - } |
404 | | - } |
405 | | - |
406 | | - /** |
407 | | - * @deprecated Use link() |
408 | | - * |
409 | | - * This function is a shortcut to makeStubLinkObj(Title::newFromText($title),...). Do not call |
410 | | - * it if you already have a title object handy. See makeStubLinkObj for further documentation. |
411 | | - * |
412 | | - * @param $title String: the text of the title |
413 | | - * @param $text String: link text |
414 | | - * @param $query String: optional query part |
415 | | - * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
416 | | - * be included in the link text. Other characters will be appended after |
417 | | - * the end of the link. |
418 | | - */ |
419 | | - function makeStubLink( $title, $text = '', $query = '', $trail = '' ) { |
420 | | - wfDeprecated( __METHOD__ ); |
421 | | - $nt = Title::newFromText( $title ); |
422 | | - if ( $nt instanceof Title ) { |
423 | | - return $this->makeStubLinkObj( $nt, $text, $query, $trail ); |
424 | | - } else { |
425 | | - wfDebug( 'Invalid title passed to Linker::makeStubLink(): "'.$title."\"\n" ); |
426 | | - return $text == '' ? $title : $text; |
427 | | - } |
428 | | - } |
429 | | - |
430 | | - /** |
431 | | - * @deprecated Use link() |
432 | | - * |
433 | | - * Make a link for a title which may or may not be in the database. If you need to |
434 | | - * call this lots of times, pre-fill the link cache with a LinkBatch, otherwise each |
435 | | - * call to this will result in a DB query. |
436 | | - * |
437 | | - * @param $nt Title: the title object to make the link from, e.g. from |
438 | | - * Title::newFromText. |
439 | | - * @param $text String: link text |
440 | | - * @param $query String: optional query part |
441 | | - * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
442 | | - * be included in the link text. Other characters will be appended after |
443 | | - * the end of the link. |
444 | | - * @param $prefix String: optional prefix. As trail, only before instead of after. |
445 | | - */ |
446 | | - function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) { |
447 | | - wfProfileIn( __METHOD__ ); |
448 | | - |
449 | | - $query = wfCgiToArray( $query ); |
450 | | - list( $inside, $trail ) = Linker::splitTrail( $trail ); |
451 | | - if( $text === '' ) { |
452 | | - $text = $this->linkText( $nt ); |
453 | | - } |
454 | | - |
455 | | - $ret = $this->link( $nt, "$prefix$text$inside", array(), $query ) . $trail; |
456 | | - |
457 | | - wfProfileOut( __METHOD__ ); |
458 | | - return $ret; |
459 | | - } |
460 | | - |
461 | | - /** |
462 | | - * @deprecated Use link() |
463 | | - * |
464 | | - * Make a link for a title which definitely exists. This is faster than makeLinkObj because |
465 | | - * it doesn't have to do a database query. It's also valid for interwiki titles and special |
466 | | - * pages. |
467 | | - * |
468 | | - * @param $nt Title object of target page |
469 | | - * @param $text String: text to replace the title |
470 | | - * @param $query String: link target |
471 | | - * @param $trail String: text after link |
472 | | - * @param $prefix String: text before link text |
473 | | - * @param $aprops String: extra attributes to the a-element |
474 | | - * @param $style String: style to apply - if empty, use getInternalLinkAttributesObj instead |
475 | | - * @return the a-element |
476 | | - */ |
477 | | - function makeKnownLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) { |
478 | | - wfProfileIn( __METHOD__ ); |
479 | | - |
480 | | - if ( $text == '' ) { |
481 | | - $text = $this->linkText( $title ); |
482 | | - } |
483 | | - $attribs = Sanitizer::mergeAttributes( |
484 | | - Sanitizer::decodeTagAttributes( $aprops ), |
485 | | - Sanitizer::decodeTagAttributes( $style ) |
486 | | - ); |
487 | | - $query = wfCgiToArray( $query ); |
488 | | - list( $inside, $trail ) = Linker::splitTrail( $trail ); |
489 | | - |
490 | | - $ret = $this->link( $title, "$prefix$text$inside", $attribs, $query, |
491 | | - array( 'known', 'noclasses' ) ) . $trail; |
492 | | - |
493 | | - wfProfileOut( __METHOD__ ); |
494 | | - return $ret; |
495 | | - } |
496 | | - |
497 | | - /** |
498 | | - * @deprecated Use link() |
499 | | - * |
500 | | - * Make a red link to the edit page of a given title. |
501 | | - * |
502 | | - * @param $nt Title object of the target page |
503 | | - * @param $text String: Link text |
504 | | - * @param $query String: Optional query part |
505 | | - * @param $trail String: Optional trail. Alphabetic characters at the start of this string will |
506 | | - * be included in the link text. Other characters will be appended after |
507 | | - * the end of the link. |
508 | | - */ |
509 | | - function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) { |
510 | | - wfProfileIn( __METHOD__ ); |
511 | | - |
512 | | - list( $inside, $trail ) = Linker::splitTrail( $trail ); |
513 | | - if( $text === '' ) { |
514 | | - $text = $this->linkText( $title ); |
515 | | - } |
516 | | - $nt = $this->normaliseSpecialPage( $title ); |
517 | | - |
518 | | - $ret = $this->link( $title, "$prefix$text$inside", array(), |
519 | | - wfCgiToArray( $query ), 'broken' ) . $trail; |
520 | | - |
521 | | - wfProfileOut( __METHOD__ ); |
522 | | - return $ret; |
523 | | - } |
524 | | - |
525 | | - /** |
526 | | - * @deprecated Use link() |
527 | | - * |
528 | | - * Make a brown link to a short article. |
529 | | - * |
530 | | - * @param $nt Title object of the target page |
531 | | - * @param $text String: link text |
532 | | - * @param $query String: optional query part |
533 | | - * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
534 | | - * be included in the link text. Other characters will be appended after |
535 | | - * the end of the link. |
536 | | - */ |
537 | | - function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { |
538 | | - wfDeprecated( __METHOD__ ); |
539 | | - return $this->makeColouredLinkObj( $nt, 'stub', $text, $query, $trail, $prefix ); |
540 | | - } |
541 | | - |
542 | | - /** |
543 | | - * @deprecated Use link() |
544 | | - * |
545 | | - * Make a coloured link. |
546 | | - * |
547 | | - * @param $nt Title object of the target page |
548 | | - * @param $colour Integer: colour of the link |
549 | | - * @param $text String: link text |
550 | | - * @param $query String: optional query part |
551 | | - * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
552 | | - * be included in the link text. Other characters will be appended after |
553 | | - * the end of the link. |
554 | | - */ |
555 | | - function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) { |
556 | | - if($colour != ''){ |
557 | | - $style = $this->getInternalLinkAttributesObj( $nt, $text, $colour ); |
558 | | - } else $style = ''; |
559 | | - return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix, '', $style ); |
560 | | - } |
561 | | - |
562 | | - /** |
563 | 326 | * Generate either a normal exists-style link or a stub link, depending |
564 | 327 | * on the given page size. |
565 | 328 | * |
— | — | @@ -613,12 +376,6 @@ |
614 | 377 | return $basename; |
615 | 378 | } |
616 | 379 | |
617 | | - /** Obsolete alias */ |
618 | | - function makeImage( $url, $alt = '' ) { |
619 | | - wfDeprecated( __METHOD__ ); |
620 | | - return $this->makeExternalImage( $url, $alt ); |
621 | | - } |
622 | | - |
623 | 380 | /** @todo document */ |
624 | 381 | function makeExternalImage( $url, $alt = '' ) { |
625 | 382 | if ( '' == $alt ) { |
— | — | @@ -637,45 +394,6 @@ |
638 | 395 | } |
639 | 396 | |
640 | 397 | /** |
641 | | - * Creates the HTML source for images |
642 | | - * @deprecated use makeImageLink2 |
643 | | - * |
644 | | - * @param object $title |
645 | | - * @param string $label label text |
646 | | - * @param string $alt alt text |
647 | | - * @param string $align horizontal alignment: none, left, center, right) |
648 | | - * @param array $handlerParams Parameters to be passed to the media handler |
649 | | - * @param boolean $framed shows image in original size in a frame |
650 | | - * @param boolean $thumb shows image as thumbnail in a frame |
651 | | - * @param string $manualthumb image name for the manual thumbnail |
652 | | - * @param string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom |
653 | | - * @param string $time, timestamp of the file, set as false for current |
654 | | - * @return string |
655 | | - */ |
656 | | - function makeImageLinkObj( $title, $label, $alt, $align = '', $handlerParams = array(), $framed = false, |
657 | | - $thumb = false, $manualthumb = '', $valign = '', $time = false ) |
658 | | - { |
659 | | - $frameParams = array( 'alt' => $alt, 'caption' => $label ); |
660 | | - if ( $align ) { |
661 | | - $frameParams['align'] = $align; |
662 | | - } |
663 | | - if ( $framed ) { |
664 | | - $frameParams['framed'] = true; |
665 | | - } |
666 | | - if ( $thumb ) { |
667 | | - $frameParams['thumbnail'] = true; |
668 | | - } |
669 | | - if ( $manualthumb ) { |
670 | | - $frameParams['manualthumb'] = $manualthumb; |
671 | | - } |
672 | | - if ( $valign ) { |
673 | | - $frameParams['valign'] = $valign; |
674 | | - } |
675 | | - $file = wfFindFile( $title, $time ); |
676 | | - return $this->makeImageLink2( $title, $file, $frameParams, $handlerParams, $time ); |
677 | | - } |
678 | | - |
679 | | - /** |
680 | 398 | * Given parameters derived from [[Image:Foo|options...]], generate the |
681 | 399 | * HTML that that syntax inserts in the page. |
682 | 400 | * |
— | — | @@ -969,12 +687,6 @@ |
970 | 688 | } |
971 | 689 | } |
972 | 690 | |
973 | | - /** @deprecated use Linker::makeMediaLinkObj() */ |
974 | | - function makeMediaLink( $name, $unused = '', $text = '', $time = false ) { |
975 | | - $nt = Title::makeTitleSafe( NS_FILE, $name ); |
976 | | - return $this->makeMediaLinkObj( $nt, $text, $time ); |
977 | | - } |
978 | | - |
979 | 691 | /** |
980 | 692 | * Create a direct link to a given uploaded file. |
981 | 693 | * |
— | — | @@ -1461,34 +1173,6 @@ |
1462 | 1174 | } |
1463 | 1175 | |
1464 | 1176 | /** |
1465 | | - * Used to generate section edit links that point to "other" pages |
1466 | | - * (sections that are really part of included pages). |
1467 | | - * |
1468 | | - * @param $title Title string. |
1469 | | - * @param $section Integer: section number. |
1470 | | - */ |
1471 | | - public function editSectionLinkForOther( $title, $section ) { |
1472 | | - wfDeprecated( __METHOD__ ); |
1473 | | - $title = Title::newFromText( $title ); |
1474 | | - return $this->doEditSectionLink( $title, $section ); |
1475 | | - } |
1476 | | - |
1477 | | - /** |
1478 | | - * @param $nt Title object. |
1479 | | - * @param $section Integer: section number. |
1480 | | - * @param $hint Link String: title, or default if omitted or empty |
1481 | | - */ |
1482 | | - public function editSectionLink( Title $nt, $section, $hint = '' ) { |
1483 | | - wfDeprecated( __METHOD__ ); |
1484 | | - if( $hint === '' ) { |
1485 | | - # No way to pass an actual empty $hint here! The new interface al- |
1486 | | - # lows this, so we have to do this for compatibility. |
1487 | | - $hint = null; |
1488 | | - } |
1489 | | - return $this->doEditSectionLink( $nt, $section, $hint ); |
1490 | | - } |
1491 | | - |
1492 | | - /** |
1493 | 1177 | * Create a section edit link. This supersedes editSectionLink() and |
1494 | 1178 | * editSectionLinkForOther(). |
1495 | 1179 | * |
— | — | @@ -1735,40 +1419,6 @@ |
1736 | 1420 | } |
1737 | 1421 | |
1738 | 1422 | /** |
1739 | | - * @deprecated Returns raw bits of HTML, use titleAttrib() and accesskey() |
1740 | | - */ |
1741 | | - public function tooltipAndAccesskey( $name ) { |
1742 | | - # FIXME: If Sanitizer::expandAttributes() treated "false" as "output |
1743 | | - # no attribute" instead of "output '' as value for attribute", this |
1744 | | - # would be three lines. |
1745 | | - $attribs = array( |
1746 | | - 'title' => $this->titleAttrib( $name, 'withaccess' ), |
1747 | | - 'accesskey' => $this->accesskey( $name ) |
1748 | | - ); |
1749 | | - if ( $attribs['title'] === false ) { |
1750 | | - unset( $attribs['title'] ); |
1751 | | - } |
1752 | | - if ( $attribs['accesskey'] === false ) { |
1753 | | - unset( $attribs['accesskey'] ); |
1754 | | - } |
1755 | | - return Xml::expandAttributes( $attribs ); |
1756 | | - } |
1757 | | - |
1758 | | - /** @deprecated Returns raw bits of HTML, use titleAttrib() */ |
1759 | | - public function tooltip( $name, $options = null ) { |
1760 | | - # FIXME: If Sanitizer::expandAttributes() treated "false" as "output |
1761 | | - # no attribute" instead of "output '' as value for attribute", this |
1762 | | - # would be two lines. |
1763 | | - $tooltip = $this->titleAttrib( $name, $options ); |
1764 | | - if ( $tooltip === false ) { |
1765 | | - return ''; |
1766 | | - } |
1767 | | - return Xml::expandAttributes( array( |
1768 | | - 'title' => $this->titleAttrib( $name, $options ) |
1769 | | - ) ); |
1770 | | - } |
1771 | | - |
1772 | | - /** |
1773 | 1423 | * Given the id of an interface element, constructs the appropriate title |
1774 | 1424 | * attribute from the system messages. (Note, this is usually the id but |
1775 | 1425 | * isn't always, because sometimes the accesskey needs to go on a different |
— | — | @@ -1850,4 +1500,356 @@ |
1851 | 1501 | $link = $this->link( $sp, $text, array(), $query, array( 'known', 'noclasses' ) ); |
1852 | 1502 | return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), "($link)" ); |
1853 | 1503 | } |
| 1504 | + |
| 1505 | + /* Deprecated methods */ |
| 1506 | + |
| 1507 | + /** |
| 1508 | + * @deprecated |
| 1509 | + */ |
| 1510 | + function postParseLinkColour( $s = null ) { |
| 1511 | + wfDeprecated( __METHOD__ ); |
| 1512 | + return null; |
| 1513 | + } |
| 1514 | + |
| 1515 | + |
| 1516 | + /** |
| 1517 | + * @deprecated Use link() |
| 1518 | + * |
| 1519 | + * This function is a shortcut to makeLinkObj(Title::newFromText($title),...). Do not call |
| 1520 | + * it if you already have a title object handy. See makeLinkObj for further documentation. |
| 1521 | + * |
| 1522 | + * @param $title String: the text of the title |
| 1523 | + * @param $text String: link text |
| 1524 | + * @param $query String: optional query part |
| 1525 | + * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
| 1526 | + * be included in the link text. Other characters will be appended after |
| 1527 | + * the end of the link. |
| 1528 | + */ |
| 1529 | + function makeLink( $title, $text = '', $query = '', $trail = '' ) { |
| 1530 | + wfProfileIn( __METHOD__ ); |
| 1531 | + $nt = Title::newFromText( $title ); |
| 1532 | + if ( $nt instanceof Title ) { |
| 1533 | + $result = $this->makeLinkObj( $nt, $text, $query, $trail ); |
| 1534 | + } else { |
| 1535 | + wfDebug( 'Invalid title passed to Linker::makeLink(): "'.$title."\"\n" ); |
| 1536 | + $result = $text == "" ? $title : $text; |
| 1537 | + } |
| 1538 | + |
| 1539 | + wfProfileOut( __METHOD__ ); |
| 1540 | + return $result; |
| 1541 | + } |
| 1542 | + |
| 1543 | + /** |
| 1544 | + * @deprecated Use link() |
| 1545 | + * |
| 1546 | + * This function is a shortcut to makeKnownLinkObj(Title::newFromText($title),...). Do not call |
| 1547 | + * it if you already have a title object handy. See makeKnownLinkObj for further documentation. |
| 1548 | + * |
| 1549 | + * @param $title String: the text of the title |
| 1550 | + * @param $text String: link text |
| 1551 | + * @param $query String: optional query part |
| 1552 | + * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
| 1553 | + * be included in the link text. Other characters will be appended after |
| 1554 | + * the end of the link. |
| 1555 | + */ |
| 1556 | + function makeKnownLink( $title, $text = '', $query = '', $trail = '', $prefix = '',$aprops = '') { |
| 1557 | + $nt = Title::newFromText( $title ); |
| 1558 | + if ( $nt instanceof Title ) { |
| 1559 | + return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix , $aprops ); |
| 1560 | + } else { |
| 1561 | + wfDebug( 'Invalid title passed to Linker::makeKnownLink(): "'.$title."\"\n" ); |
| 1562 | + return $text == '' ? $title : $text; |
| 1563 | + } |
| 1564 | + } |
| 1565 | + |
| 1566 | + /** |
| 1567 | + * @deprecated Use link() |
| 1568 | + * |
| 1569 | + * This function is a shortcut to makeBrokenLinkObj(Title::newFromText($title),...). Do not call |
| 1570 | + * it if you already have a title object handy. See makeBrokenLinkObj for further documentation. |
| 1571 | + * |
| 1572 | + * @param string $title The text of the title |
| 1573 | + * @param string $text Link text |
| 1574 | + * @param string $query Optional query part |
| 1575 | + * @param string $trail Optional trail. Alphabetic characters at the start of this string will |
| 1576 | + * be included in the link text. Other characters will be appended after |
| 1577 | + * the end of the link. |
| 1578 | + */ |
| 1579 | + function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) { |
| 1580 | + $nt = Title::newFromText( $title ); |
| 1581 | + if ( $nt instanceof Title ) { |
| 1582 | + return $this->makeBrokenLinkObj( $nt, $text, $query, $trail ); |
| 1583 | + } else { |
| 1584 | + wfDebug( 'Invalid title passed to Linker::makeBrokenLink(): "'.$title."\"\n" ); |
| 1585 | + return $text == '' ? $title : $text; |
| 1586 | + } |
| 1587 | + } |
| 1588 | + |
| 1589 | + /** |
| 1590 | + * @deprecated Use link() |
| 1591 | + * |
| 1592 | + * This function is a shortcut to makeStubLinkObj(Title::newFromText($title),...). Do not call |
| 1593 | + * it if you already have a title object handy. See makeStubLinkObj for further documentation. |
| 1594 | + * |
| 1595 | + * @param $title String: the text of the title |
| 1596 | + * @param $text String: link text |
| 1597 | + * @param $query String: optional query part |
| 1598 | + * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
| 1599 | + * be included in the link text. Other characters will be appended after |
| 1600 | + * the end of the link. |
| 1601 | + */ |
| 1602 | + function makeStubLink( $title, $text = '', $query = '', $trail = '' ) { |
| 1603 | + wfDeprecated( __METHOD__ ); |
| 1604 | + $nt = Title::newFromText( $title ); |
| 1605 | + if ( $nt instanceof Title ) { |
| 1606 | + return $this->makeStubLinkObj( $nt, $text, $query, $trail ); |
| 1607 | + } else { |
| 1608 | + wfDebug( 'Invalid title passed to Linker::makeStubLink(): "'.$title."\"\n" ); |
| 1609 | + return $text == '' ? $title : $text; |
| 1610 | + } |
| 1611 | + } |
| 1612 | + |
| 1613 | + /** |
| 1614 | + * @deprecated Use link() |
| 1615 | + * |
| 1616 | + * Make a link for a title which may or may not be in the database. If you need to |
| 1617 | + * call this lots of times, pre-fill the link cache with a LinkBatch, otherwise each |
| 1618 | + * call to this will result in a DB query. |
| 1619 | + * |
| 1620 | + * @param $nt Title: the title object to make the link from, e.g. from |
| 1621 | + * Title::newFromText. |
| 1622 | + * @param $text String: link text |
| 1623 | + * @param $query String: optional query part |
| 1624 | + * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
| 1625 | + * be included in the link text. Other characters will be appended after |
| 1626 | + * the end of the link. |
| 1627 | + * @param $prefix String: optional prefix. As trail, only before instead of after. |
| 1628 | + */ |
| 1629 | + function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) { |
| 1630 | + wfProfileIn( __METHOD__ ); |
| 1631 | + |
| 1632 | + $query = wfCgiToArray( $query ); |
| 1633 | + list( $inside, $trail ) = Linker::splitTrail( $trail ); |
| 1634 | + if( $text === '' ) { |
| 1635 | + $text = $this->linkText( $nt ); |
| 1636 | + } |
| 1637 | + |
| 1638 | + $ret = $this->link( $nt, "$prefix$text$inside", array(), $query ) . $trail; |
| 1639 | + |
| 1640 | + wfProfileOut( __METHOD__ ); |
| 1641 | + return $ret; |
| 1642 | + } |
| 1643 | + |
| 1644 | + /** |
| 1645 | + * @deprecated Use link() |
| 1646 | + * |
| 1647 | + * Make a link for a title which definitely exists. This is faster than makeLinkObj because |
| 1648 | + * it doesn't have to do a database query. It's also valid for interwiki titles and special |
| 1649 | + * pages. |
| 1650 | + * |
| 1651 | + * @param $nt Title object of target page |
| 1652 | + * @param $text String: text to replace the title |
| 1653 | + * @param $query String: link target |
| 1654 | + * @param $trail String: text after link |
| 1655 | + * @param $prefix String: text before link text |
| 1656 | + * @param $aprops String: extra attributes to the a-element |
| 1657 | + * @param $style String: style to apply - if empty, use getInternalLinkAttributesObj instead |
| 1658 | + * @return the a-element |
| 1659 | + */ |
| 1660 | + function makeKnownLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) { |
| 1661 | + wfProfileIn( __METHOD__ ); |
| 1662 | + |
| 1663 | + if ( $text == '' ) { |
| 1664 | + $text = $this->linkText( $title ); |
| 1665 | + } |
| 1666 | + $attribs = Sanitizer::mergeAttributes( |
| 1667 | + Sanitizer::decodeTagAttributes( $aprops ), |
| 1668 | + Sanitizer::decodeTagAttributes( $style ) |
| 1669 | + ); |
| 1670 | + $query = wfCgiToArray( $query ); |
| 1671 | + list( $inside, $trail ) = Linker::splitTrail( $trail ); |
| 1672 | + |
| 1673 | + $ret = $this->link( $title, "$prefix$text$inside", $attribs, $query, |
| 1674 | + array( 'known', 'noclasses' ) ) . $trail; |
| 1675 | + |
| 1676 | + wfProfileOut( __METHOD__ ); |
| 1677 | + return $ret; |
| 1678 | + } |
| 1679 | + |
| 1680 | + /** |
| 1681 | + * @deprecated Use link() |
| 1682 | + * |
| 1683 | + * Make a red link to the edit page of a given title. |
| 1684 | + * |
| 1685 | + * @param $nt Title object of the target page |
| 1686 | + * @param $text String: Link text |
| 1687 | + * @param $query String: Optional query part |
| 1688 | + * @param $trail String: Optional trail. Alphabetic characters at the start of this string will |
| 1689 | + * be included in the link text. Other characters will be appended after |
| 1690 | + * the end of the link. |
| 1691 | + */ |
| 1692 | + function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 1693 | + wfProfileIn( __METHOD__ ); |
| 1694 | + |
| 1695 | + list( $inside, $trail ) = Linker::splitTrail( $trail ); |
| 1696 | + if( $text === '' ) { |
| 1697 | + $text = $this->linkText( $title ); |
| 1698 | + } |
| 1699 | + $nt = $this->normaliseSpecialPage( $title ); |
| 1700 | + |
| 1701 | + $ret = $this->link( $title, "$prefix$text$inside", array(), |
| 1702 | + wfCgiToArray( $query ), 'broken' ) . $trail; |
| 1703 | + |
| 1704 | + wfProfileOut( __METHOD__ ); |
| 1705 | + return $ret; |
| 1706 | + } |
| 1707 | + |
| 1708 | + /** |
| 1709 | + * @deprecated Use link() |
| 1710 | + * |
| 1711 | + * Make a brown link to a short article. |
| 1712 | + * |
| 1713 | + * @param $nt Title object of the target page |
| 1714 | + * @param $text String: link text |
| 1715 | + * @param $query String: optional query part |
| 1716 | + * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
| 1717 | + * be included in the link text. Other characters will be appended after |
| 1718 | + * the end of the link. |
| 1719 | + */ |
| 1720 | + function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 1721 | + wfDeprecated( __METHOD__ ); |
| 1722 | + return $this->makeColouredLinkObj( $nt, 'stub', $text, $query, $trail, $prefix ); |
| 1723 | + } |
| 1724 | + |
| 1725 | + /** |
| 1726 | + * @deprecated Use link() |
| 1727 | + * |
| 1728 | + * Make a coloured link. |
| 1729 | + * |
| 1730 | + * @param $nt Title object of the target page |
| 1731 | + * @param $colour Integer: colour of the link |
| 1732 | + * @param $text String: link text |
| 1733 | + * @param $query String: optional query part |
| 1734 | + * @param $trail String: optional trail. Alphabetic characters at the start of this string will |
| 1735 | + * be included in the link text. Other characters will be appended after |
| 1736 | + * the end of the link. |
| 1737 | + */ |
| 1738 | + function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 1739 | + if($colour != ''){ |
| 1740 | + $style = $this->getInternalLinkAttributesObj( $nt, $text, $colour ); |
| 1741 | + } else $style = ''; |
| 1742 | + return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix, '', $style ); |
| 1743 | + } |
| 1744 | + /** Obsolete alias */ |
| 1745 | + function makeImage( $url, $alt = '' ) { |
| 1746 | + wfDeprecated( __METHOD__ ); |
| 1747 | + return $this->makeExternalImage( $url, $alt ); |
| 1748 | + } |
| 1749 | + |
| 1750 | + /** |
| 1751 | + * Creates the HTML source for images |
| 1752 | + * @deprecated use makeImageLink2 |
| 1753 | + * |
| 1754 | + * @param object $title |
| 1755 | + * @param string $label label text |
| 1756 | + * @param string $alt alt text |
| 1757 | + * @param string $align horizontal alignment: none, left, center, right) |
| 1758 | + * @param array $handlerParams Parameters to be passed to the media handler |
| 1759 | + * @param boolean $framed shows image in original size in a frame |
| 1760 | + * @param boolean $thumb shows image as thumbnail in a frame |
| 1761 | + * @param string $manualthumb image name for the manual thumbnail |
| 1762 | + * @param string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom |
| 1763 | + * @param string $time, timestamp of the file, set as false for current |
| 1764 | + * @return string |
| 1765 | + */ |
| 1766 | + function makeImageLinkObj( $title, $label, $alt, $align = '', $handlerParams = array(), $framed = false, |
| 1767 | + $thumb = false, $manualthumb = '', $valign = '', $time = false ) |
| 1768 | + { |
| 1769 | + $frameParams = array( 'alt' => $alt, 'caption' => $label ); |
| 1770 | + if ( $align ) { |
| 1771 | + $frameParams['align'] = $align; |
| 1772 | + } |
| 1773 | + if ( $framed ) { |
| 1774 | + $frameParams['framed'] = true; |
| 1775 | + } |
| 1776 | + if ( $thumb ) { |
| 1777 | + $frameParams['thumbnail'] = true; |
| 1778 | + } |
| 1779 | + if ( $manualthumb ) { |
| 1780 | + $frameParams['manualthumb'] = $manualthumb; |
| 1781 | + } |
| 1782 | + if ( $valign ) { |
| 1783 | + $frameParams['valign'] = $valign; |
| 1784 | + } |
| 1785 | + $file = wfFindFile( $title, $time ); |
| 1786 | + return $this->makeImageLink2( $title, $file, $frameParams, $handlerParams, $time ); |
| 1787 | + } |
| 1788 | + |
| 1789 | + /** @deprecated use Linker::makeMediaLinkObj() */ |
| 1790 | + function makeMediaLink( $name, $unused = '', $text = '', $time = false ) { |
| 1791 | + $nt = Title::makeTitleSafe( NS_FILE, $name ); |
| 1792 | + return $this->makeMediaLinkObj( $nt, $text, $time ); |
| 1793 | + } |
| 1794 | + |
| 1795 | + /** |
| 1796 | + * Used to generate section edit links that point to "other" pages |
| 1797 | + * (sections that are really part of included pages). |
| 1798 | + * |
| 1799 | + * @param $title Title string. |
| 1800 | + * @param $section Integer: section number. |
| 1801 | + */ |
| 1802 | + public function editSectionLinkForOther( $title, $section ) { |
| 1803 | + wfDeprecated( __METHOD__ ); |
| 1804 | + $title = Title::newFromText( $title ); |
| 1805 | + return $this->doEditSectionLink( $title, $section ); |
| 1806 | + } |
| 1807 | + |
| 1808 | + /** |
| 1809 | + * @param $nt Title object. |
| 1810 | + * @param $section Integer: section number. |
| 1811 | + * @param $hint Link String: title, or default if omitted or empty |
| 1812 | + */ |
| 1813 | + public function editSectionLink( Title $nt, $section, $hint = '' ) { |
| 1814 | + wfDeprecated( __METHOD__ ); |
| 1815 | + if( $hint === '' ) { |
| 1816 | + # No way to pass an actual empty $hint here! The new interface al- |
| 1817 | + # lows this, so we have to do this for compatibility. |
| 1818 | + $hint = null; |
| 1819 | + } |
| 1820 | + return $this->doEditSectionLink( $nt, $section, $hint ); |
| 1821 | + } |
| 1822 | + |
| 1823 | + /** |
| 1824 | + * @deprecated Returns raw bits of HTML, use titleAttrib() and accesskey() |
| 1825 | + */ |
| 1826 | + public function tooltipAndAccesskey( $name ) { |
| 1827 | + # FIXME: If Sanitizer::expandAttributes() treated "false" as "output |
| 1828 | + # no attribute" instead of "output '' as value for attribute", this |
| 1829 | + # would be three lines. |
| 1830 | + $attribs = array( |
| 1831 | + 'title' => $this->titleAttrib( $name, 'withaccess' ), |
| 1832 | + 'accesskey' => $this->accesskey( $name ) |
| 1833 | + ); |
| 1834 | + if ( $attribs['title'] === false ) { |
| 1835 | + unset( $attribs['title'] ); |
| 1836 | + } |
| 1837 | + if ( $attribs['accesskey'] === false ) { |
| 1838 | + unset( $attribs['accesskey'] ); |
| 1839 | + } |
| 1840 | + return Xml::expandAttributes( $attribs ); |
| 1841 | + } |
| 1842 | + |
| 1843 | + /** @deprecated Returns raw bits of HTML, use titleAttrib() */ |
| 1844 | + public function tooltip( $name, $options = null ) { |
| 1845 | + # FIXME: If Sanitizer::expandAttributes() treated "false" as "output |
| 1846 | + # no attribute" instead of "output '' as value for attribute", this |
| 1847 | + # would be two lines. |
| 1848 | + $tooltip = $this->titleAttrib( $name, $options ); |
| 1849 | + if ( $tooltip === false ) { |
| 1850 | + return ''; |
| 1851 | + } |
| 1852 | + return Xml::expandAttributes( array( |
| 1853 | + 'title' => $this->titleAttrib( $name, $options ) |
| 1854 | + ) ); |
| 1855 | + } |
1854 | 1856 | } |