*
* @param $class String: the contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
- * @deprecated Just pass the external class directly to something using Html::expandAttributes
+ * @deprecated since 1.18 Just pass the external class directly to something using Html::expandAttributes
*/
static function getExternalLinkAttributes( $class = 'external' ) {
wfDeprecated( __METHOD__ );
* @return string HTML <a> attribute
*/
public static function link(
- $target, $text = null, $customAttribs = array(), $query = array(), $options = array()
+ $target, $html = null, $customAttribs = array(), $query = array(), $options = array()
) {
wfProfileIn( __METHOD__ );
if ( !$target instanceof Title ) {
wfProfileOut( __METHOD__ );
- return "<!-- ERROR -->$text";
+ return "<!-- ERROR -->$html";
}
$options = (array)$options;
$dummy = new DummyLinker; // dummy linker instance for bc on the hooks
$ret = null;
- if ( !wfRunHooks( 'LinkBegin', array( $dummy, $target, &$text,
+ if ( !wfRunHooks( 'LinkBegin', array( $dummy, $target, &$html,
&$customAttribs, &$query, &$options, &$ret ) ) ) {
wfProfileOut( __METHOD__ );
return $ret;
$attribs,
self::linkAttribs( $target, $customAttribs, $options )
);
- if ( is_null( $text ) ) {
- $text = self::linkText( $target );
+ if ( is_null( $html ) ) {
+ $html = self::linkText( $target );
}
$ret = null;
- if ( wfRunHooks( 'LinkEnd', array( $dummy, $target, $options, &$text, &$attribs, &$ret ) ) ) {
- $ret = Html::rawElement( 'a', $attribs, $text );
+ if ( wfRunHooks( 'LinkEnd', array( $dummy, $target, $options, &$html, &$attribs, &$ret ) ) ) {
+ $ret = Html::rawElement( 'a', $attribs, $html );
}
wfProfileOut( __METHOD__ );
* Default text of the links to the Title $target
*
* @param $target Title
+ *
+ * @return string
*/
private static function linkText( $target ) {
# We might be passed a non-Title by make*LinkObj(). Fail gracefully.
* despite $query not being used.
*
* @param $nt Title
+ *
+ * @return string
*/
static function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
if ( $text == '' ) {
return "<strong class=\"selflink\">{$prefix}{$text}{$inside}</strong>{$trail}";
}
+ /**
+ * @param $title Title
+ * @return Title
+ */
static function normaliseSpecialPage( Title $title ) {
if ( $title->getNamespace() == NS_SPECIAL ) {
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
/**
* Returns the filename part of an url.
* Used as alternative text for external images.
+ *
+ * @param $url string
+ *
+ * @return string
*/
static function fnamePart( $url ) {
$basename = strrchr( $url, '/' );
/**
* Return the code for images which were added via external links,
* via Parser::maybeMakeExternalImage().
+ *
+ * @param $url
+ * @param $alt
+ *
+ * @return string
*/
static function makeExternalImage( $url, $alt = '' ) {
if ( $alt == '' ) {
/* Deprecated methods */
- /**
- * @deprecated since 1.16 Use link()
- *
- * This function is a shortcut to makeLinkObj(Title::newFromText($title),...). Do not call
- * it if you already have a title object handy. See makeLinkObj for further documentation.
- *
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
- * the end of the link.
- */
- static function makeLink( $title, $text = '', $query = '', $trail = '' ) {
- wfProfileIn( __METHOD__ );
- $nt = Title::newFromText( $title );
- if ( $nt instanceof Title ) {
- $result = self::makeLinkObj( $nt, $text, $query, $trail );
- } else {
- wfDebug( 'Invalid title passed to self::makeLink(): "' . $title . "\"\n" );
- $result = $text == "" ? $title : $text;
- }
-
- wfProfileOut( __METHOD__ );
- return $result;
- }
-
- /**
- * @deprecated since 1.16 Use link()
- *
- * This function is a shortcut to makeKnownLinkObj(Title::newFromText($title),...). Do not call
- * it if you already have a title object handy. See makeKnownLinkObj for further documentation.
- *
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
- * the end of the link.
- * @param $prefix String: Optional prefix
- * @param $aprops String: extra attributes to the a-element
- */
- static function makeKnownLink(
- $title, $text = '', $query = '', $trail = '', $prefix = '', $aprops = ''
- ) {
- $nt = Title::newFromText( $title );
- if ( $nt instanceof Title ) {
- return self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix , $aprops );
- } else {
- wfDebug( 'Invalid title passed to self::makeKnownLink(): "' . $title . "\"\n" );
- return $text == '' ? $title : $text;
- }
- }
-
/**
* @deprecated since 1.16 Use link()
*
}
}
- /**
- * @deprecated since 1.16 Use link()
- *
- * This function is a shortcut to makeStubLinkObj(Title::newFromText($title),...). Do not call
- * it if you already have a title object handy. See makeStubLinkObj for further documentation.
- *
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
- * the end of the link.
- */
- static function makeStubLink( $title, $text = '', $query = '', $trail = '' ) {
- wfDeprecated( __METHOD__ );
- $nt = Title::newFromText( $title );
- if ( $nt instanceof Title ) {
- return self::makeStubLinkObj( $nt, $text, $query, $trail );
- } else {
- wfDebug( 'Invalid title passed to self::makeStubLink(): "' . $title . "\"\n" );
- return $text == '' ? $title : $text;
- }
- }
-
/**
* @deprecated since 1.16 Use link()
*
return $ret;
}
- /**
- * @deprecated since 1.16 Use link()
- *
- * Make a brown link to a short article.
- *
- * @param $nt Title object of the target page
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
- * the end of the link.
- * @param $prefix String: Optional prefix
- */
- static function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
- return self::makeColouredLinkObj( $nt, 'stub', $text, $query, $trail, $prefix );
- }
-
/**
* @deprecated since 1.16 Use link()
*
return self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix, '', $style );
}
- /** Obsolete alias */
- static function makeImage( $url, $alt = '' ) {
- wfDeprecated( __METHOD__ );
- return self::makeExternalImage( $url, $alt );
- }
-
- /**
- * Creates the HTML source for images
- * @deprecated since 1.16 use makeImageLink2
- *
- * @param $title Title object
- * @param $label String: label text
- * @param $alt String: alt text
- * @param $align String: horizontal alignment: none, left, center, right)
- * @param $handlerParams Array: parameters to be passed to the media handler
- * @param $framed Boolean: shows image in original size in a frame
- * @param $thumb Boolean: shows image as thumbnail in a frame
- * @param $manualthumb String: image name for the manual thumbnail
- * @param $valign String: vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom
- * @param $time String: timestamp of the file, set as false for current
- * @return String
- */
- static function makeImageLinkObj( $title, $label, $alt, $align = '', $handlerParams = array(),
- $framed = false, $thumb = false, $manualthumb = '', $valign = '', $time = false )
- {
- $frameParams = array( 'alt' => $alt, 'caption' => $label );
- if ( $align ) {
- $frameParams['align'] = $align;
- }
- if ( $framed ) {
- $frameParams['framed'] = true;
- }
- if ( $thumb ) {
- $frameParams['thumbnail'] = true;
- }
- if ( $manualthumb ) {
- $frameParams['manualthumb'] = $manualthumb;
- }
- if ( $valign ) {
- $frameParams['valign'] = $valign;
- }
- $file = wfFindFile( $title, array( 'time' => $time ) );
- return self::makeImageLink2( $title, $file, $frameParams, $handlerParams, $time );
- }
-
- /** @deprecated use Linker::makeMediaLinkObj() */
- static function makeMediaLink( $name, $unused = '', $text = '', $time = false ) {
- $nt = Title::makeTitleSafe( NS_FILE, $name );
- return self::makeMediaLinkObj( $nt, $text, $time );
- }
-
/**
* Returns the attributes for the tooltip and access key.
*/
return $attribs;
}
- /**
- * @deprecated since 1.14
- * Returns raw bits of HTML, use titleAttrib() and accesskey()
- */
- public static function tooltipAndAccesskey( $name ) {
- return Xml::expandAttributes( self::tooltipAndAccesskeyAttribs( $name ) );
- }
-
/**
* @deprecated since 1.14
* Returns raw bits of HTML, use titleAttrib()
return '';
}
return Xml::expandAttributes( array(
- 'title' => self::titleAttrib( $name, $options )
+ 'title' => $tooltip
) );
}
}