3 * Split off some of the internal bits from Skin.php.
4 * These functions are used for primarily page content:
5 * links, embedded images, table of contents. Links are
6 * also used in the skin.
11 * For the moment, Skin is a descendent class of Linker.
12 * In the future, it should probably be further split
13 * so that ever other bit of the wiki doesn't have to
14 * go loading up Skin to get at it.
25 function postParseLinkColour( $s = NULL ) {
30 function getExternalLinkAttributes( $link, $text, $class='' ) {
33 $same = ($link == $text);
34 $link = urldecode( $link );
35 $link = $wgContLang->checkTitleEncoding( $link );
36 $link = preg_replace( '/[\\x00-\\x1f_]/', ' ', $link );
37 $link = htmlspecialchars( $link );
39 $r = ($class != '') ?
" class='$class'" : " class='external'";
41 $r .= " title=\"{$link}\"";
46 function getInternalLinkAttributes( $link, $text, $broken = false ) {
47 $link = urldecode( $link );
48 $link = str_replace( '_', ' ', $link );
49 $link = htmlspecialchars( $link );
51 if( $broken == 'stub' ) {
53 } else if ( $broken == 'yes' ) {
59 $r .= " title=\"{$link}\"";
66 function getInternalLinkAttributesObj( &$nt, $text, $broken = false ) {
67 if( $broken == 'stub' ) {
69 } else if ( $broken == 'yes' ) {
75 $r .= ' title="' . $nt->getEscapedText() . '"';
80 * Note: This function MUST call getArticleID() on the link,
81 * otherwise the cache won't get updated properly. See LINKCACHE.DOC.
83 function makeLink( $title, $text = '', $query = '', $trail = '' ) {
84 wfProfileIn( 'Linker::makeLink' );
85 $nt = Title
::newFromText( $title );
87 $result = $this->makeLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
89 wfDebug( 'Invalid title passed to Linker::makeLink(): "'.$title."\"\n" );
90 $result = $text == "" ?
$title : $text;
93 wfProfileOut( 'Linker::makeLink' );
98 function makeKnownLink( $title, $text = '', $query = '', $trail = '', $prefix = '',$aprops = '') {
99 $nt = Title
::newFromText( $title );
101 return $this->makeKnownLinkObj( Title
::newFromText( $title ), $text, $query, $trail, $prefix , $aprops );
103 wfDebug( 'Invalid title passed to Linker::makeKnownLink(): "'.$title."\"\n" );
104 return $text == '' ?
$title : $text;
108 /** @todo document */
109 function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) {
110 $nt = Title
::newFromText( $title );
112 return $this->makeBrokenLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
114 wfDebug( 'Invalid title passed to Linker::makeBrokenLink(): "'.$title."\"\n" );
115 return $text == '' ?
$title : $text;
119 /** @todo document */
120 function makeStubLink( $title, $text = '', $query = '', $trail = '' ) {
121 $nt = Title
::newFromText( $title );
123 return $this->makeStubLinkObj( Title
::newFromText( $title ), $text, $query, $trail );
125 wfDebug( 'Invalid title passed to Linker::makeStubLink(): "'.$title."\"\n" );
126 return $text == '' ?
$title : $text;
131 * Pass a title object, not a title string
133 function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
135 $fname = 'Linker::makeLinkObj';
136 wfProfileIn( $fname );
139 if ( ! is_object($nt) ) {
140 # wfDebugDieBacktrace();
141 wfProfileOut( $fname );
142 return "<!-- ERROR -->{$prefix}{$text}{$trail}";
145 $ns = $nt->getNamespace();
146 $dbkey = $nt->getDBkey();
147 if ( $nt->isExternal() ) {
148 $u = $nt->getFullURL();
149 $link = $nt->getPrefixedURL();
150 if ( '' == $text ) { $text = $nt->getPrefixedText(); }
151 $style = $this->getExternalLinkAttributes( $link, $text, 'extiw' );
154 if ( '' != $trail ) {
155 if ( preg_match( '/^([a-z]+)(.*)$$/sD', $trail, $m ) ) {
161 # Check for anchors, normalize the anchor
163 $parts = explode( '#', $u, 2 );
164 if ( count( $parts ) == 2 ) {
165 $anchor = urlencode( Sanitizer
::decodeCharReferences( str_replace(' ', '_', $parts[1] ) ) );
166 $replacearray = array(
170 $u = $parts[0] . '#' .
171 str_replace( array_keys( $replacearray ),
172 array_values( $replacearray ),
176 $t = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>";
178 wfProfileOut( $fname );
180 } elseif ( $nt->isAlwaysKnown() ) {
181 # Image links, special page links and self-links with fragements are always known.
182 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
184 wfProfileIn( $fname.'-immediate' );
185 # Work out link colour immediately
186 $aid = $nt->getArticleID() ;
188 $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
190 $threshold = $wgUser->getOption('stubthreshold') ;
191 if ( $threshold > 0 ) {
192 $dbr =& wfGetDB( DB_SLAVE
);
193 $s = $dbr->selectRow(
197 'page_is_redirect' ),
198 array( 'page_id' => $aid ), $fname ) ;
199 if ( $s !== false ) {
200 $size = $s->page_len
;
201 if ( $s->page_is_redirect
OR $s->page_namespace
!= NS_MAIN
) {
202 $size = $threshold*2 ; # Really big
205 $size = $threshold*2 ; # Really big
210 if ( $size < $threshold ) {
211 $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
213 $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
216 wfProfileOut( $fname.'-immediate' );
218 wfProfileOut( $fname );
223 * Pass a title object, not a title string
224 * @param object Title of target page
225 * @param string Text to replace the title
226 * @param string Link target
227 * @param string Text after link
228 * @param string Text before link text
229 * @param string Extra attributes to the a-element
230 * @return the a-element
232 function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '' ) {
234 $fname = 'Linker::makeKnownLinkObj';
235 wfProfileIn( $fname );
237 if ( !is_object( $nt ) ) {
238 wfProfileOut( $fname );
242 $u = $nt->escapeLocalURL( $query );
243 if ( '' != $nt->getFragment() ) {
244 if( $nt->getPrefixedDbkey() == '' ) {
247 $text = htmlspecialchars( $nt->getFragment() );
250 $anchor = urlencode( Sanitizer
::decodeCharReferences( str_replace( ' ', '_', $nt->getFragment() ) ) );
251 $replacearray = array(
255 $u .= '#' . str_replace(array_keys($replacearray),array_values($replacearray),$anchor);
258 $text = htmlspecialchars( $nt->getPrefixedText() );
260 $style = $this->getInternalLinkAttributesObj( $nt, $text );
262 if ( $aprops !== '' ) $aprops = ' ' . $aprops;
264 list( $inside, $trail ) = Linker
::splitTrail( $trail );
265 $r = "<a href=\"{$u}\"{$style}{$aprops}>{$prefix}{$text}{$inside}</a>{$trail}";
266 wfProfileOut( $fname );
271 * Pass a title object, not a title string
273 function makeBrokenLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
275 if ( ! isset($nt) ) {
276 # wfDebugDieBacktrace();
277 return "<!-- ERROR -->{$prefix}{$text}{$trail}";
280 $fname = 'Linker::makeBrokenLinkObj';
281 wfProfileIn( $fname );
283 if ( '' == $query ) {
286 $q = 'action=edit&'.$query;
288 $u = $nt->escapeLocalURL( $q );
291 $text = htmlspecialchars( $nt->getPrefixedText() );
293 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
295 list( $inside, $trail ) = Linker
::splitTrail( $trail );
296 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
298 wfProfileOut( $fname );
303 * Pass a title object, not a title string
305 function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
306 $link = $nt->getPrefixedURL();
308 $u = $nt->escapeLocalURL( $query );
311 $text = htmlspecialchars( $nt->getPrefixedText() );
313 $style = $this->getInternalLinkAttributesObj( $nt, $text, 'stub' );
315 list( $inside, $trail ) = Linker
::splitTrail( $trail );
316 $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
321 * Generate either a normal exists-style link or a stub link, depending
322 * on the given page size.
326 * @param string $text
327 * @param string $query
328 * @param string $trail
329 * @param string $prefix
330 * @return string HTML of link
332 function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
334 $threshold = intval( $wgUser->getOption( 'stubthreshold' ) );
335 if( $size < $threshold ) {
336 return $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
338 return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
342 /** @todo document */
343 function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
344 $u = $nt->escapeLocalURL( $query );
346 $text = htmlspecialchars( $nt->getPrefixedText() );
348 list( $inside, $trail ) = Linker
::splitTrail( $trail );
349 return "<strong>{$prefix}{$text}{$inside}</strong>{$trail}";
352 /** @todo document */
353 function fnamePart( $url ) {
354 $basename = strrchr( $url, '/' );
355 if ( false === $basename ) {
358 $basename = substr( $basename, 1 );
360 return htmlspecialchars( $basename );
363 /** Obsolete alias */
364 function makeImage( $url, $alt = '' ) {
365 return $this->makeExternalImage( $url, $alt );
368 /** @todo document */
369 function makeExternalImage( $url, $alt = '' ) {
371 $alt = $this->fnamePart( $url );
373 $s = '<img src="'.$url.'" alt="'.$alt.'" />';
377 /** @todo document */
378 function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
379 $thumb = false, $manual_thumb = '' )
381 global $wgContLang, $wgUser, $wgThumbLimits;
383 $img = new Image( $nt );
384 $url = $img->getViewURL();
385 $prefix = $postfix = '';
387 wfDebug( "makeImageLinkObj: '$width'x'$height'\n" );
389 if ( 'center' == $align )
391 $prefix = '<div class="center">';
396 if ( $thumb ||
$framed ) {
398 # Create a thumbnail. Alignment depends on language
399 # writing direction, # right aligned for left-to-right-
400 # languages ("Western languages"), left-aligned
401 # for right-to-left-languages ("Semitic languages")
403 # If thumbnail width has not been provided, it is set
404 # to the default user option as specified in Language*.php
405 if ( $align == '' ) {
406 $align = $wgContLang->isRTL() ?
'left' : 'right';
410 if ( $width === false ) {
411 $wopt = $wgUser->getOption( 'thumbsize' );
413 if( !isset( $wgThumbLimits[$wopt] ) ) {
414 $wopt = User
::getDefaultOption( 'thumbsize' );
417 $width = min( $img->getWidth(), $wgThumbLimits[$wopt] );
420 return $prefix.$this->makeThumbLinkObj( $img, $label, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix;
423 if ( $width && $img->exists() ) {
425 # Create a resized image, without the additional thumbnail
428 if ( $height == false )
430 if ( $manual_thumb == '') {
431 $thumb = $img->getThumbnail( $width, $height );
433 if( $width > $img->width
&& ( $height == -1 ||
$height > $img->height
)) {
434 // Requested a display size larger than the actual image;
436 $height = round($thumb->height
* $width / $thumb->width
);
437 wfDebug( "makeImageLinkObj: client-size height set to '$height'\n" );
439 $width = $thumb->width
;
440 $height = $thumb->height
;
441 wfDebug( "makeImageLinkObj: thumb height set to '$height'\n" );
443 $url = $thumb->getUrl();
447 $width = $img->width
;
448 $height = $img->height
;
451 wfDebug( "makeImageLinkObj2: '$width'x'$height'\n" );
452 $u = $nt->escapeLocalURL();
454 $s = $this->makeBrokenImageLinkObj( $img->getTitle() );
455 //$s .= "<br />{$alt}<br />{$url}<br />\n";
457 $s = '<a href="'.$u.'" class="image" title="'.$alt.'">' .
458 '<img src="'.$url.'" alt="'.$alt.'" ' .
460 ?
( 'width="'.$width.'" height="'.$height.'" ' )
462 'longdesc="'.$u.'" /></a>';
464 if ( '' != $align ) {
465 $s = "<div class=\"float{$align}\"><span>{$s}</span></div>";
467 return str_replace("\n", ' ',$prefix.$s.$postfix);
471 * Make HTML for a thumbnail including image, border and caption
472 * $img is an Image object
474 function makeThumbLinkObj( $img, $label = '', $alt, $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
475 global $wgStylePath, $wgContLang;
476 $url = $img->getViewURL();
478 $width = $height = 0;
479 if ( $img->exists() )
481 $width = $img->getWidth();
482 $height = $img->getHeight();
484 if ( 0 == $width ||
0 == $height )
486 $width = $height = 200;
488 if ( $boxwidth == 0 )
494 // Use image dimensions, don't scale
496 $boxheight = $height;
499 if ( $boxheight === false )
501 if ( '' == $manual_thumb ) {
502 $thumb = $img->getThumbnail( $boxwidth, $boxheight );
503 $thumbUrl = $thumb->getUrl();
504 $boxwidth = $thumb->width
;
505 $boxheight = $thumb->height
;
508 $oboxwidth = $boxwidth +
2;
510 if ( $manual_thumb != '' ) # Use manually specified thumbnail
512 $manual_title = Title
::makeTitleSafe( NS_IMAGE
, $manual_thumb ); #new Title ( $manual_thumb ) ;
513 $manual_img = new Image( $manual_title );
514 $thumbUrl = $manual_img->getViewURL();
515 if ( $manual_img->exists() )
517 $width = $manual_img->getWidth();
518 $height = $manual_img->getHeight();
520 $boxheight = $height ;
521 $oboxwidth = $boxwidth +
2 ;
525 $u = $img->getEscapeLocalURL();
527 $more = htmlspecialchars( wfMsg( 'thumbnail-more' ) );
528 $magnifyalign = $wgContLang->isRTL() ?
'left' : 'right';
529 $textalign = $wgContLang->isRTL() ?
' style="text-align:right"' : '';
531 $s = "<div class=\"thumb t{$align}\"><div style=\"width:{$oboxwidth}px;\">";
532 if( $thumbUrl == '' ) {
533 // Couldn't generate thumbnail? Scale the image client-side.
536 if( !$img->exists() ) {
537 $s .= $this->makeBrokenImageLinkObj( $img->getTitle() );
540 $s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
541 '<img src="'.$thumbUrl.'" alt="'.$alt.'" ' .
542 'width="'.$boxwidth.'" height="'.$boxheight.'" ' .
543 'longdesc="'.$u.'" /></a>';
547 $zoomicon = '<div class="magnify" style="float:'.$magnifyalign.'">'.
548 '<a href="'.$u.'" class="internal" title="'.$more.'">'.
549 '<img src="'.$wgStylePath.'/common/images/magnify-clip.png" ' .
550 'width="15" height="11" alt="'.$more.'" /></a></div>';
553 $s .= ' <div class="thumbcaption" '.$textalign.'>'.$zoomicon.$label."</div></div></div>";
554 return str_replace("\n", ' ', $s);
558 * Pass a title object, not a title string
560 function makeBrokenImageLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
562 if ( ! isset($nt) ) {
563 # wfDebugDieBacktrace();
564 return "<!-- ERROR -->{$prefix}{$text}{$trail}";
567 $fname = 'Linker::makeBrokenImageLinkObj';
568 wfProfileIn( $fname );
570 $q = 'wpDestFile=' . urlencode( $nt->getDBkey() );
571 if ( '' != $query ) {
574 $uploadTitle = Title
::makeTitle( NS_SPECIAL
, 'Upload' );
575 $url = $uploadTitle->escapeLocalURL( $q );
578 $text = htmlspecialchars( $nt->getPrefixedText() );
580 $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
581 list( $inside, $trail ) = Linker
::splitTrail( $trail );
582 $s = "<a href=\"{$url}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
584 wfProfileOut( $fname );
588 /** @todo document */
589 function makeMediaLink( $name, /* wtf?! */ $url, $alt = '' ) {
590 $nt = Title
::makeTitleSafe( NS_IMAGE
, $name );
591 return $this->makeMediaLinkObj( $nt, $alt );
595 * Create a direct link to a given uploaded file.
597 * @param Title $title
598 * @param string $text pre-sanitized HTML
599 * @param bool $nourl Mask absolute URLs, so the parser doesn't
600 * linkify them (it is currently not context-aware)
601 * @return string HTML
604 * @todo Handle invalid or missing images better.
606 function makeMediaLinkObj( $title, $text = '', $nourl=false ) {
607 if( is_null( $title ) ) {
608 ### HOTFIX. Instead of breaking, return empty string.
611 $name = $title->getDBKey();
612 $img = new Image( $title );
613 if( $img->exists() ) {
614 $url = $img->getURL();
616 $url = str_replace( "http://", UNIQ_PREFIX
. "NOPARSEhttp://", $url );
620 $upload = Title
::makeTitle( NS_SPECIAL
, 'Upload' );
621 $url = $upload->getLocalUrl( 'wpDestFile=' . urlencode( $img->getName() ) );
624 $alt = htmlspecialchars( $title->getText() );
628 $u = htmlspecialchars( $url );
629 return "<a href=\"{$u}\" class='$class' title=\"{$alt}\">{$text}</a>";
633 /** @todo document */
634 function specialLink( $name, $key = '' ) {
637 if ( '' == $key ) { $key = strtolower( $name ); }
638 $pn = $wgContLang->ucfirst( $name );
639 return $this->makeKnownLink( $wgContLang->specialPage( $pn ),
643 /** @todo document */
644 function makeExternalLink( $url, $text, $escape = true, $linktype = '' ) {
645 $style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
646 global $wgNoFollowLinks;
647 if( $wgNoFollowLinks ) {
648 $style .= ' rel="nofollow"';
650 $url = htmlspecialchars( $url );
652 $text = htmlspecialchars( $text );
654 return '<a href="'.$url.'"'.$style.'>'.$text.'</a>';
658 * This function is called by all recent changes variants, by the page history,
659 * and by the user contributions list. It is responsible for formatting edit
660 * comments. It escapes any HTML in the comment, but adds some CSS to format
661 * auto-generated comments (from section editing) and formats [[wikilinks]].
663 * The &$title parameter must be a title OBJECT. It is used to generate a
664 * direct link to the section in the autocomment.
665 * @author Erik Moeller <moeller@scireview.de>
667 * Note: there's not always a title to pass to this function.
668 * Since you can't set a default parameter for a reference, I've turned it
669 * temporarily to a value pass. Should be adjusted further. --brion
671 function formatComment($comment, $title = NULL) {
672 $fname = 'Linker::formatComment';
673 wfProfileIn( $fname );
676 $comment = str_replace( "\n", " ", $comment );
677 $comment = htmlspecialchars( $comment );
679 # The pattern for autogen comments is / * foo * /, which makes for
681 # We look for all comments, match any text before and after the comment,
682 # add a separator where needed and format the comment itself with CSS
683 while (preg_match('/(.*)\/\*\s*(.*?)\s*\*\/(.*)/', $comment,$match)) {
691 # This is hackish but should work in most cases.
692 $section=str_replace('[[','',$section);
693 $section=str_replace(']]','',$section);
694 $title->mFragment
=$section;
695 $link=$this->makeKnownLinkObj($title,wfMsg('sectionlink'));
699 if($pre) { $auto = $sep.' '.$auto; }
700 if($post) { $auto .= ' '.$sep; }
701 $auto='<span class="autocomment">'.$auto.'</span>';
702 $comment=$pre.$auto.$post;
705 # format regular and media links - all other wiki formatting
707 $medians = $wgContLang->getNsText( NS_MEDIA
) . ':';
708 while(preg_match('/\[\[(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) {
709 # Handle link renaming [[foo|text]] will show link as "text"
710 if( "" != $match[3] ) {
715 if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
716 # Media link; trail not supported.
717 $linkRegexp = '/\[\[(.*?)\]\]/';
718 $thelink = $this->makeMediaLink( $submatch[1], "", $text );
721 if( preg_match( $wgContLang->linkTrail(), $match[4], $submatch ) ) {
722 $trail = $submatch[1];
726 $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
727 if ($match[1][0] == ':')
728 $match[1] = substr($match[1], 1);
729 $thelink = $this->makeLink( $match[1], $text, "", $trail );
731 # Quote backreferences, then run preg_replace
732 $thelink = strtr( $thelink, array( "\\" => "\\\\", '$' => "\\$" ) );
733 $comment = preg_replace( $linkRegexp, $thelink, $comment, 1 );
735 wfProfileOut( $fname );
740 * Wrap a comment in standard punctuation and formatting if
741 * it's non-empty, otherwise return empty string.
743 * @param string $comment
744 * @param Title $title
748 function commentBlock( $comment, $title = NULL ) {
749 if( $comment == '' ||
$comment == '*' ) {
752 $formatted = $this->formatComment( $comment, $title );
753 return " <span class='comment'>($formatted)</span>";
757 /** @todo document */
758 function tocIndent() {
762 /** @todo document */
763 function tocUnindent($level) {
764 return "</li>\n" . str_repeat( "</ul>\n</li>\n", $level>0 ?
$level : 0 );
768 * parameter level defines if we are on an indentation level
770 function tocLine( $anchor, $tocline, $tocnumber, $level ) {
771 return "\n<li class='toclevel-$level'><a href=\"#" .
772 $anchor . '"><span class="tocnumber">' .
773 $tocnumber . '</span> <span class="toctext">' .
774 $tocline . '</span></a>';
777 /** @todo document */
778 function tocLineEnd() {
782 /** @todo document */
783 function tocList($toc) {
784 global $wgJsMimeType;
785 $title = wfMsgForContent('toc') ;
787 '<table id="toc" class="toc" summary="' . $title .'"><tr><td>'
788 . '<div id="toctitle"><h2>' . $title . "</h2></div>\n"
790 . "</ul>\n</td></tr></table>\n"
791 . '<script type="' . $wgJsMimeType . '">'
792 . ' if (window.showTocToggle) {'
793 . ' var tocShowText = "' . wfEscapeJsString( wfMsgForContent('showtoc') ) . '";'
794 . ' var tocHideText = "' . wfEscapeJsString( wfMsgForContent('hidetoc') ) . '";'
795 . ' showTocToggle();'
800 /** @todo document */
801 function editSectionLinkForOther( $title, $section ) {
804 $title = Title
::newFromText($title);
805 $editurl = '§ion='.$section;
806 $url = $this->makeKnownLink($title->getPrefixedText(),wfMsg('editsection'),'action=edit'.$editurl);
808 if( $wgContLang->isRTL() ) {
815 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
819 /** @todo document */
820 function editSectionLink( $nt, $section ) {
823 $editurl = '§ion='.$section;
824 $url = $this->makeKnownLink($nt->getPrefixedText(),wfMsg('editsection'),'action=edit'.$editurl);
826 if( $wgContLang->isRTL() ) {
833 return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
837 * Split a link trail, return the "inside" portion and the remainder of the trail
838 * as a two-element array
842 function splitTrail( $trail ) {
843 static $regex = false;
844 if ( $regex === false ) {
846 $regex = $wgContLang->linkTrail();
849 if ( '' != $trail ) {
850 if ( preg_match( $regex, $trail, $m ) ) {
855 return array( $inside, $trail );