* Get the appropriate HTML attributes to add to the "a" element of an ex-
* ternal link, as created by [wikisyntax].
*
- * @param string $title The (unescaped) title text for the link
- * @param string $unused Unused
* @param string $class The contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
*/
- function getExternalLinkAttributes( $title, $unused = null, $class='' ) {
- return $this->getLinkAttributesInternal( $title, $class, 'external' );
+ function getExternalLinkAttributes( $class = 'external' ) {
+ return $this->getLinkAttributesInternal( '', $class );
}
/**
* @param string $class The contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
*/
- function getInterwikiLinkAttributes( $title, $unused = null, $class='' ) {
+ function getInterwikiLinkAttributes( $title, $unused = null, $class = 'external' ) {
global $wgContLang;
# FIXME: We have a whole bunch of handling here that doesn't happen in
$title = $wgContLang->checkTitleEncoding( $title );
$title = preg_replace( '/[\\x00-\\x1f]/', ' ', $title );
- return $this->getLinkAttributesInternal( $title, $class, 'external' );
+ return $this->getLinkAttributesInternal( $title, $class );
}
/**
/**
* Common code for getLinkAttributesX functions
*/
- private function getLinkAttributesInternal( $title, $class, $classDefault = false ) {
+ private function getLinkAttributesInternal( $title, $class ) {
$title = htmlspecialchars( $title );
- if( $class === '' and $classDefault !== false ) {
- # FIXME: Parameter defaults the hard way! We should just have
- # $class = 'external' or whatever as the default in the externally-
- # exposed functions, not $class = ''.
- $class = $classDefault;
- }
$class = htmlspecialchars( $class );
$r = '';
- if( $class !== '' ) {
+ if ( $class != '' ) {
$r .= " class=\"$class\"";
}
- $r .= " title=\"$title\"";
+ if ( $title != '') {
+ $r .= " title=\"$title\"";
+ }
return $r;
}
* hook play with them, *then* expand it all at once.
*/
function makeExternalLink( $url, $text, $escape = true, $linktype = '', $attribs = array() ) {
- $attribsText = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
+ $attribsText = $this->getExternalLinkAttributes( 'external ' . $linktype );
$url = htmlspecialchars( $url );
if( $escape ) {
$text = htmlspecialchars( $text );
foreach ( $tree as $section ) {
if ( $section['toclevel'] > $lastLevel )
$toc .= $this->tocIndent();
- else if ( $secton['toclevel'] < $lastLevel )
+ else if ( $section['toclevel'] < $lastLevel )
$toc .= $this->tocUnindent(
$lastLevel - $section['toclevel'] );
else
* @return string HTML headline
*/
public function makeHeadline( $level, $attribs, $anchor, $text, $link, $legacyAnchor = false ) {
- $ret = "<a name=\"$anchor\" id=\"$anchor\"></a>"
- . "<h$level$attribs"
+ $ret = "<h$level id=\"$anchor\"$attribs"
. $link
. " <span class=\"mw-headline\">$text</span>"
. "</h$level>";
if ( $legacyAnchor !== false ) {
- $ret = "<a name=\"$legacyAnchor\" id=\"$legacyAnchor\"></a>$ret";
+ $ret = "<a id=\"$legacyAnchor\"></a>$ret";
}
return $ret;
}