- wfProfileOut( __METHOD__ );
- return $ret;
- }
-
- /**
- * @deprecated Use link()
- *
- * Make a red link to the edit page of a given title.
- *
- * @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.
- */
- function makeBrokenLinkObj( $title, $text = '', $query = '', $trail = '', $prefix = '' ) {
- wfProfileIn( __METHOD__ );
-
- list( $inside, $trail ) = Linker::splitTrail( $trail );
- if( $text === '' ) {
- $text = $this->linkText( $title );
- }
- $nt = $this->normaliseSpecialPage( $title );
-
- $ret = $this->link( $title, "$prefix$text$inside", array(),
- wfCgiToArray( $query ), 'broken' ) . $trail;
-
- wfProfileOut( __METHOD__ );
- return $ret;
- }
-
- /**
- * @deprecated 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.
- */
- function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
- wfDeprecated( __METHOD__ );
- return $this->makeColouredLinkObj( $nt, 'stub', $text, $query, $trail, $prefix );
- }
-
- /**
- * @deprecated Use link()
- *
- * Make a coloured link.
- *
- * @param $nt Title object of the target page
- * @param $colour Integer: colour of the link
- * @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.
- */
- function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) {
- if($colour != ''){
- $style = $this->getInternalLinkAttributesObj( $nt, $text, $colour );
- } else $style = '';
- return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix, '', $style );
- }
-
- /**
- * Generate either a normal exists-style link or a stub link, depending
- * on the given page size.
- *
- * @param $size Integer
- * @param $nt Title object.
- * @param $text String
- * @param $query String
- * @param $trail String
- * @param $prefix String
- * @return string HTML of link
- */
- function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
- global $wgUser;
- $threshold = intval( $wgUser->getOption( 'stubthreshold' ) );
- $colour = ( $size < $threshold ) ? 'stub' : '';
- return $this->makeColouredLinkObj( $nt, $colour, $text, $query, $trail, $prefix );
- }
-
- /**
- * Make appropriate markup for a link to the current article. This is currently rendered
- * as the bold link text. The calling sequence is the same as the other make*LinkObj functions,
- * despite $query not being used.
- */
- function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
- if ( '' == $text ) {
- $text = htmlspecialchars( $nt->getPrefixedText() );
- }
- list( $inside, $trail ) = Linker::splitTrail( $trail );
- return "<strong class=\"selflink\">{$prefix}{$text}{$inside}</strong>{$trail}";
- }
-
- function normaliseSpecialPage( Title $title ) {
- if ( $title->getNamespace() == NS_SPECIAL ) {
- list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $title->getDBkey() );
- if ( !$name ) return $title;
- $ret = SpecialPage::getTitleFor( $name, $subpage );
- $ret->mFragment = $title->getFragment();
- return $ret;
- } else {
- return $title;
- }
- }
-
- /** @todo document */
- function fnamePart( $url ) {
- $basename = strrchr( $url, '/' );
- if ( false === $basename ) {
- $basename = $url;
- } else {
- $basename = substr( $basename, 1 );
- }
- return $basename;
- }
-
- /** Obsolete alias */
- function makeImage( $url, $alt = '' ) {
- wfDeprecated( __METHOD__ );
- return $this->makeExternalImage( $url, $alt );
- }
-
- /** @todo document */
- function makeExternalImage( $url, $alt = '' ) {
- if ( '' == $alt ) {
- $alt = $this->fnamePart( $url );
- }
- $img = '';
- $success = wfRunHooks('LinkerMakeExternalImage', array( &$url, &$alt, &$img ) );
- if(!$success) {
- wfDebug("Hook LinkerMakeExternalImage changed the output of external image with url {$url} and alt text {$alt} to {$img}", true);
- return $img;
- }
- return Xml::element( 'img',
- array(
- 'src' => $url,
- 'alt' => $alt ) );
- }
-
- /**
- * Creates the HTML source for images
- * @deprecated use makeImageLink2
- *
- * @param object $title
- * @param string $label label text
- * @param string $alt alt text
- * @param string $align horizontal alignment: none, left, center, right)
- * @param array $handlerParams Parameters to be passed to the media handler
- * @param boolean $framed shows image in original size in a frame
- * @param boolean $thumb shows image as thumbnail in a frame
- * @param string $manualthumb image name for the manual thumbnail
- * @param string $valign vertical alignment: baseline, sub, super, top, text-top, middle, bottom, text-bottom
- * @param string $time, timestamp of the file, set as false for current
- * @return string
- */
- 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, $time );
- return $this->makeImageLink2( $title, $file, $frameParams, $handlerParams, $time );
- }
-
- /**
- * Given parameters derived from [[Image:Foo|options...]], generate the
- * HTML that that syntax inserts in the page.
- *
- * @param Title $title Title object
- * @param File $file File object, or false if it doesn't exist
- *
- * @param array $frameParams Associative array of parameters external to the media handler.
- * Boolean parameters are indicated by presence or absence, the value is arbitrary and
- * will often be false.
- * thumbnail If present, downscale and frame
- * manualthumb Image name to use as a thumbnail, instead of automatic scaling
- * framed Shows image in original size in a frame
- * frameless Downscale but don't frame
- * upright If present, tweak default sizes for portrait orientation
- * upright_factor Fudge factor for "upright" tweak (default 0.75)
- * border If present, show a border around the image
- * align Horizontal alignment (left, right, center, none)
- * valign Vertical alignment (baseline, sub, super, top, text-top, middle,
- * bottom, text-bottom)
- * alt Alternate text for image (i.e. alt attribute). Plain text.
- * caption HTML for image caption.
- *
- * @param array $handlerParams Associative array of media handler parameters, to be passed
- * to transform(). Typical keys are "width" and "page".
- * @param string $time, timestamp of the file, set as false for current
- * @param string $query, query params for desc url
- * @return string HTML for an image, with links, wrappers, etc.
- */
- function makeImageLink2( Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false, $query = "" ) {
- $res = null;
- if( !wfRunHooks( 'ImageBeforeProduceHTML', array( &$this, &$title,
- &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
- return $res;
- }
-
- global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright;
- if ( $file && !$file->allowInlineDisplay() ) {
- wfDebug( __METHOD__.': '.$title->getPrefixedDBkey()." does not allow inline display\n" );
- return $this->link( $title );
- }
-
- // Shortcuts
- $fp =& $frameParams;
- $hp =& $handlerParams;