Go to the documentation of this file.
67 # @todo FIXME: We have a whole bunch of handling here that doesn't happen in
68 # getExternalLinkAttributes, why?
104 $title = $nt->getPrefixedText();
119 $class = htmlspecialchars( $class );
121 if ( $class !=
'' ) {
122 $r .=
" class=\"$class\"";
125 $r .=
" title=\"$title\"";
139 if (
$t->isRedirect() ) {
141 $colour =
'mw-redirect';
142 } elseif ( $threshold > 0 &&
$t->isContentPage() &&
143 $t->exists() &&
$t->getLength() < $threshold
196 if ( !$target instanceof
Title ) {
198 return "<!-- ERROR -->$html";
201 if ( is_string(
$query ) ) {
203 wfDeprecated( __METHOD__ .
' with parameter $query as string (should be array)',
'1.20' );
217 # Normalize the Title if it's a special page
220 # If we don't know whether the page exists, let's find out.
223 if ( $target->isKnown() ) {
237 # Note: we want the href attribute first, for prettiness.
239 if ( in_array(
'forcearticlepath',
$options ) && $oldquery ) {
247 if ( is_null(
$html ) ) {
281 # We don't want to include fragments for broken links, because they
282 # generally make no sense.
283 if ( in_array(
'broken',
$options ) && $target->hasFragment() ) {
284 $target = clone $target;
285 $target->setFragment(
'' );
288 # If it's a broken link, add the appropriate query pieces, unless
289 # there's already an action specified, or unless 'edit' makes no sense
290 # (i.e., for a nonexistent special page).
292 && !$target->isSpecialPage() ) {
293 $query[
'action'] =
'edit';
297 if ( in_array(
'http',
$options ) ) {
299 } elseif ( in_array(
'https',
$options ) ) {
305 $ret = $target->getLinkURL(
$query,
false, $proto );
324 if ( !in_array(
'noclasses',
$options ) ) {
326 # Now build the classes.
329 if ( in_array(
'broken',
$options ) ) {
333 if ( $target->isExternal() ) {
334 $classes[] =
'extiw';
339 if ( $colour !==
'' ) {
340 $classes[] = $colour; # mw-
redirect or stub
343 if ( $classes !=
array() ) {
344 $defaults[
'class'] = implode(
' ', $classes );
349 # Get a default title attribute.
350 if ( $target->getPrefixedText() ==
'' ) {
351 # A link like [[#Foo]]. This used to mean an empty title
352 # attribute, but that's silly. Just don't output a title.
353 } elseif ( in_array(
'known',
$options ) ) {
354 $defaults[
'title'] = $target->getPrefixedText();
356 $defaults[
'title'] =
wfMessage(
'red-link-title', $target->getPrefixedText() )->
text();
359 # Finally, merge the custom attribs with the default ones, and iterate
360 # over that, deleting all "false" attributes.
363 foreach ( $merged
as $key => $val ) {
364 # A false value suppresses the attribute, and we don't want the
365 # href attribute to be overridden.
366 if ( $key !=
'href' and $val !==
false ) {
383 if ( !$target instanceof
Title ) {
389 if ( $target->getPrefixedText() ===
'' && $target->hasFragment() ) {
390 return htmlspecialchars( $target->getFragment() );
392 return htmlspecialchars( $target->getPrefixedText() );
411 $html = htmlspecialchars( $nt->getPrefixedText() );
414 return "<strong class=\"selflink\">{$prefix}{$html}{$inside}</strong>{$trail}";
433 $name = $context->
msg(
'blanknamespace' )->text();
437 return $context->
msg(
'invalidtitle-knownnamespace', $namespace,
$name,
$title )->text();
439 return $context->
msg(
'invalidtitle-unknownnamespace', $namespace,
$title )->text();
448 if (
$title->isSpecialPage() ) {
469 $basename = strrchr( $url,
'/' );
470 if (
false === $basename ) {
473 $basename = substr( $basename, 1 );
494 wfDebug(
"Hook LinkerMakeExternalImage changed the output of external image with url {$url} and alt text {$alt} to {$img}\n",
true );
549 if (
$file && !
$file->allowInlineDisplay() ) {
550 wfDebug( __METHOD__ .
': ' .
$title->getPrefixedDBkey() .
" does not allow inline display\n" );
559 $page = isset( $hp[
'page'] ) ? $hp[
'page'] :
false;
560 if ( !isset( $fp[
'align'] ) ) {
563 if ( !isset( $fp[
'alt'] ) ) {
566 if ( !isset( $fp[
'title'] ) ) {
569 if ( !isset( $fp[
'class'] ) ) {
573 $prefix = $postfix =
'';
575 if (
'center' == $fp[
'align'] ) {
576 $prefix =
'<div class="center">';
578 $fp[
'align'] =
'none';
580 if (
$file && !isset( $hp[
'width'] ) ) {
581 if ( isset( $hp[
'height'] ) &&
$file->isVectorized() ) {
585 $hp[
'width'] = $wgSVGMaxSize;
587 $hp[
'width'] =
$file->getWidth( $page );
590 if ( isset( $fp[
'thumbnail'] ) || isset( $fp[
'manualthumb'] ) || isset( $fp[
'framed'] ) || isset( $fp[
'frameless'] ) || !$hp[
'width'] ) {
591 global $wgThumbLimits, $wgThumbUpright;
592 if ( $widthOption ===
null || !isset( $wgThumbLimits[$widthOption] ) ) {
597 if ( isset( $fp[
'upright'] ) && $fp[
'upright'] == 0 ) {
598 $fp[
'upright'] = $wgThumbUpright;
601 $prefWidth = isset( $fp[
'upright'] ) ?
602 round( $wgThumbLimits[$widthOption] * $fp[
'upright'], -1 ) :
603 $wgThumbLimits[$widthOption];
607 if ( !isset( $hp[
'height'] ) && ( $hp[
'width'] <= 0 ||
608 $prefWidth < $hp[
'width'] ||
$file->isVectorized() ) ) {
609 $hp[
'width'] = $prefWidth;
614 if ( isset( $fp[
'thumbnail'] ) || isset( $fp[
'manualthumb'] ) || isset( $fp[
'framed'] ) ) {
615 # Create a thumbnail. Alignment depends on the writing direction of
616 # the page content language (right-aligned for LTR languages,
617 # left-aligned for RTL languages)
619 # If a thumbnail width has not been provided, it is set
620 # to the default user option as specified in Language*.php
621 if ( $fp[
'align'] ==
'' ) {
622 if (
$parser instanceof Parser ) {
623 $fp[
'align'] =
$parser->getTargetLanguage()->alignEnd();
625 # backwards compatibility, remove with makeImageLink2()
633 if (
$file && isset( $fp[
'frameless'] ) ) {
634 $srcWidth =
$file->getWidth( $page );
635 # For "frameless" option: do not present an image bigger than the source (for bitmap-style images)
636 # This is the same behavior as the "thumb" option does it already.
637 if ( $srcWidth && !
$file->mustRender() && $hp[
'width'] > $srcWidth ) {
638 $hp[
'width'] = $srcWidth;
642 if (
$file && isset( $hp[
'width'] ) ) {
643 # Create a resized image, without the additional thumbnail features
644 $thumb =
$file->transform( $hp );
655 'title' => $fp[
'title'],
656 'valign' => isset( $fp[
'valign'] ) ? $fp[
'valign'] :
false,
657 'img-class' => $fp[
'class'] );
658 if ( isset( $fp[
'border'] ) ) {
659 $params[
'img-class'] .= (
$params[
'img-class'] !==
'' ?
' ' :
'' ) .
'thumbborder';
665 if ( $fp[
'align'] !=
'' ) {
666 $s =
"<div class=\"float{$fp['align']}\">{$s}</div>";
668 return str_replace(
"\n",
' ', $prefix .
$s . $postfix );
690 $mtoParams =
array();
691 if ( isset( $frameParams[
'link-url'] ) && $frameParams[
'link-url'] !==
'' ) {
692 $mtoParams[
'custom-url-link'] = $frameParams[
'link-url'];
693 if ( isset( $frameParams[
'link-target'] ) ) {
694 $mtoParams[
'custom-target-link'] = $frameParams[
'link-target'];
697 $extLinkAttrs =
$parser->getExternalLinkAttribs( $frameParams[
'link-url'] );
698 foreach ( $extLinkAttrs
as $name => $val ) {
700 $mtoParams[
'parser-extlink-' .
$name] = $val;
703 } elseif ( isset( $frameParams[
'link-title'] ) && $frameParams[
'link-title'] !==
'' ) {
705 } elseif ( !empty( $frameParams[
'no-link'] ) ) {
708 $mtoParams[
'desc-link'] =
true;
709 $mtoParams[
'desc-query'] =
$query;
727 $align =
'right',
$params =
array(), $framed =
false, $manualthumb =
""
729 $frameParams =
array(
735 $frameParams[
'framed'] =
true;
737 if ( $manualthumb ) {
738 $frameParams[
'manualthumb'] = $manualthumb;
762 $page = isset( $hp[
'page'] ) ? $hp[
'page'] :
false;
763 if ( !isset( $fp[
'align'] ) ) {
764 $fp[
'align'] =
'right';
766 if ( !isset( $fp[
'alt'] ) ) {
769 if ( !isset( $fp[
'title'] ) ) {
772 if ( !isset( $fp[
'caption'] ) ) {
776 if ( empty( $hp[
'width'] ) ) {
778 $hp[
'width'] = isset( $fp[
'upright'] ) ? 130 : 180;
782 $manualthumb =
false;
785 $outerWidth = $hp[
'width'] + 2;
787 if ( isset( $fp[
'manualthumb'] ) ) {
788 # Use manually specified thumbnail
790 if ( $manual_title ) {
793 $thumb = $manual_img->getUnscaledThumb( $hp );
799 } elseif ( isset( $fp[
'framed'] ) ) {
801 $thumb =
$file->getUnscaledThumb( $hp );
804 # Do not present an image bigger than the source, for bitmap-style images
805 # This is a hack to maintain compatibility with arbitrary pre-1.10 behavior
806 $srcWidth =
$file->getWidth( $page );
807 if ( $srcWidth && !
$file->mustRender() && $hp[
'width'] > $srcWidth ) {
808 $hp[
'width'] = $srcWidth;
810 $thumb =
$file->transform( $hp );
814 $outerWidth = $thumb->getWidth() + 2;
816 $outerWidth = $hp[
'width'] + 2;
820 # ThumbnailImage::toHtml() already adds page= onto the end of DjVu URLs
821 # So we don't need to pass it here in $query. However, the URL for the
822 # zoom icon still needs it, so we make a unique query for it. See bug 14771
828 && !isset( $fp[
'link-title'] )
829 && !isset( $fp[
'link-url'] )
830 && !isset( $fp[
'no-link'] ) ) {
831 $fp[
'link-url'] = $url;
834 $s =
"<div class=\"thumb t{$fp['align']}\"><div class=\"thumbinner\" style=\"width:{$outerWidth}px;\">";
838 } elseif ( !$thumb ) {
839 $s .=
wfMessage(
'thumbnail_error',
'' )->escaped();
842 if ( !$noscale && !$manualthumb ) {
847 'title' => $fp[
'title'],
848 'img-class' => ( isset( $fp[
'class'] ) && $fp[
'class'] !==
'' ? $fp[
'class'] .
' ' :
'' ) .
'thumbimage'
852 if ( isset( $fp[
'framed'] ) ) {
858 'class' =>
'internal',
861 'src' => $wgStylePath .
'/common/images/magnify-clip' . (
$wgContLang->isRTL() ?
'-rtl' :
'' ) .
'.png',
867 $s .=
' <div class="thumbcaption">' . $zoomIcon . $fp[
'caption'] .
"</div></div></div>";
868 return str_replace(
"\n",
' ',
$s );
880 global $wgResponsiveImages;
881 if ( $wgResponsiveImages ) {
883 $hp15[
'width'] = round( $hp[
'width'] * 1.5 );
885 $hp20[
'width'] = $hp[
'width'] * 2;
886 if ( isset( $hp[
'height'] ) ) {
887 $hp15[
'height'] = round( $hp[
'height'] * 1.5 );
888 $hp20[
'height'] = $hp[
'height'] * 2;
891 $thumb15 =
$file->transform( $hp15 );
892 $thumb20 =
$file->transform( $hp20 );
893 if ( $thumb15 && $thumb15->getUrl() !== $thumb->getUrl() ) {
894 $thumb->responsiveUrls[
'1.5'] = $thumb15->getUrl();
896 if ( $thumb20 && $thumb20->getUrl() !== $thumb->getUrl() ) {
897 $thumb->responsiveUrls[
'2'] = $thumb20->getUrl();
914 global $wgEnableUploads, $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
916 return "<!-- ERROR -->" . htmlspecialchars( $label );
919 if ( $label ==
'' ) {
920 $label =
$title->getPrefixedText();
922 $encLabel = htmlspecialchars( $label );
925 if ( ( $wgUploadMissingFileUrl || $wgUploadNavigationUrl || $wgEnableUploads ) && !$currentExists ) {
936 return '<a href="' . htmlspecialchars( $href ) .
'" class="new" title="' .
937 htmlspecialchars(
$title->getPrefixedText(), ENT_QUOTES ) .
'">' .
953 global $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
954 $q =
'wpDestFile=' . $destFile->getPartialURL();
959 if ( $wgUploadMissingFileUrl ) {
961 } elseif ( $wgUploadNavigationUrl ) {
965 return $upload->getLocalURL( $q );
995 $url =
$file->getURL();
1001 $alt = htmlspecialchars(
$title->getText(), ENT_QUOTES );
1002 if (
$html ==
'' ) {
1005 $u = htmlspecialchars( $url );
1006 return "<a href=\"{$u}\" class=\"$class\" title=\"{$alt}\">{$html}</a>";
1018 $key = strtolower(
$name );
1036 $class =
"external";
1038 $class .=
" $linktype";
1041 $class .=
" {$attribs['class']}";
1046 $text = htmlspecialchars( $text );
1057 wfDebug(
"Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}\n",
true );
1072 public static function userLink( $userId, $userName, $altUserName =
false ) {
1073 if ( $userId == 0 ) {
1075 if ( $altUserName ===
false ) {
1084 htmlspecialchars( $altUserName !==
false ? $altUserName : $userName ),
1085 array(
'class' =>
'mw-userlink' )
1101 $userId, $userText, $redContribsWhenNoEdits =
false,
$flags = 0, $edits =
null
1104 $talkable = !( $wgDisableAnonTalk && 0 == $userId );
1106 $addEmailLink =
$flags & self::TOOL_LINKS_EMAIL && $userId;
1115 if ( $redContribsWhenNoEdits ) {
1116 if ( intval( $edits ) === 0 && $edits !== 0 ) {
1118 $edits =
$user->getEditCount();
1120 if ( $edits === 0 ) {
1128 if ( $blockable &&
$wgUser->isAllowed(
'block' ) ) {
1132 if ( $addEmailLink &&
$wgUser->canSendEmail() ) {
1136 wfRunHooks(
'UserToolLinksEdit',
array( $userId, $userText, &$items ) );
1139 return wfMessage(
'word-separator' )->plain()
1140 .
'<span class="mw-usertoollinks">'
1141 .
wfMessage(
'parentheses' )->rawParams(
$wgLang->pipeList( $items ) )->escaped()
1167 return $userTalkLink;
1208 return '<span class="history-deleted">' .
$link .
'</span>';
1226 .
wfMessage(
'word-separator' )->plain()
1232 return ' <span class="history-deleted">' .
$link .
'</span>';
1257 # Sanitize text a bit:
1259 # Allow HTML entities (for bug 13815)
1262 # Render autocomments and make links:
1291 self::$autocommentTitle =
$title;
1292 self::$autocommentLocal = $local;
1294 '!(.*)/\*\s*(.*?)\s*\*/(.*)!',
1295 array(
'Linker',
'formatAutocommentsCallback' ),
1297 self::$autocommentTitle =
null;
1298 self::$autocommentLocal =
null;
1322 # Remove links that a user may have manually put in the autosummary
1323 # This could be improved by copying as much of Parser::stripSectionName as desired.
1335 if ( $sectionTitle ) {
1344 # written summary $presep autocomment (summary )
1345 $pre .=
wfMessage(
'autocomment-prefix' )->inContentLanguage()->escaped();
1348 # autocomment $postsep written summary ( summary)
1349 $auto .=
wfMessage(
'colon-separator' )->inContentLanguage()->escaped();
1351 $auto =
'<span class="autocomment">' . $auto .
'</span>';
1374 self::$commentContextTitle =
$title;
1375 self::$commentLocal = $local;
1376 $html = preg_replace_callback(
1379 :? # ignore optional leading colon
1380 ([^\]|]+) # 1. link target; page names cannot include ] or |
1382 # 2. a pipe-separated substring; only the last is captured
1383 # Stop matching at | and ]] without relying on backtracking.
1387 ([^[]*) # 3. link trail (the text up until the next link)
1389 array(
'Linker',
'formatLinksInCommentCallback' ),
1391 self::$commentContextTitle =
null;
1392 self::$commentLocal =
null;
1408 # fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
1409 if ( strpos( $match[1],
'%' ) !==
false ) {
1410 $match[1] = str_replace(
array(
'<',
'>' ),
array(
'<',
'>' ), rawurldecode( $match[1] ) );
1413 # Handle link renaming [[foo|text]] will show link as "text"
1414 if ( $match[2] !=
"" ) {
1419 $submatch =
array();
1421 if ( preg_match(
'/^' . $medians .
'(.*)$/i', $match[1], $submatch ) ) {
1422 # Media link; trail not supported.
1423 $linkRegexp =
'/\[\[(.*?)\]\]/';
1429 # Other kind of link
1430 if ( preg_match(
$wgContLang->linkTrail(), $match[3], $submatch ) ) {
1431 $trail = $submatch[1];
1435 $linkRegexp =
'/\[\[(.*?)\]\]' . preg_quote( $trail,
'/' ) .
'/';
1436 if ( isset( $match[1][0] ) && $match[1][0] ==
':' ) {
1437 $match[1] = substr( $match[1], 1 );
1443 $match[1], $linkText );
1447 if ( $target->getText() ==
'' && !$target->isExternal()
1450 $newTarget = clone ( self::$commentContextTitle );
1451 $newTarget->setFragment(
'#' . $target->getFragment() );
1452 $target = $newTarget;
1477 # :Foobar -- override special treatment of prefix (images, language links)
1478 # /Foobar -- convert to CurrentPage/Foobar
1479 # /Foobar/ -- convert to CurrentPage/Foobar, strip the initial / from text
1480 # ../ -- convert to CurrentPage, from CurrentPage/CurrentSubPage
1481 # ../Foobar -- convert to CurrentPage/Foobar, from CurrentPage/CurrentSubPage
1486 # Some namespaces don't allow subpages,
1487 # so only perform processing if subpages are allowed
1489 $hash = strpos( $target,
'#' );
1490 if (
$hash !==
false ) {
1491 $suffix = substr( $target,
$hash );
1492 $target = substr( $target, 0,
$hash );
1497 $target = trim( $target );
1498 # Look at the first character
1499 if ( $target !=
'' && $target[0] ===
'/' ) {
1500 # / at end means we don't want the slash to be shown
1502 $trailingSlashes = preg_match_all(
'%(/+)$%', $target, $m );
1503 if ( $trailingSlashes ) {
1504 $noslash = $target = substr( $target, 1, -strlen( $m[0][0] ) );
1506 $noslash = substr( $target, 1 );
1509 $ret = $contextTitle->getPrefixedText() .
'/' . trim( $noslash ) . $suffix;
1510 if ( $text ===
'' ) {
1511 $text = $target . $suffix;
1512 } #
this might be changed
for ugliness
reasons
1514 # check for .. subpage backlinks
1516 $nodotdot = $target;
1517 while ( strncmp( $nodotdot,
"../", 3 ) == 0 ) {
1519 $nodotdot = substr( $nodotdot, 3 );
1521 if ( $dotdotcount > 0 ) {
1522 $exploded = explode(
'/', $contextTitle->getPrefixedText() );
1523 if ( count( $exploded ) > $dotdotcount ) { # not allowed to go
below top level
page
1524 $ret = implode(
'/', array_slice( $exploded, 0, -$dotdotcount ) );
1525 # / at the end means don't show full path
1526 if ( substr( $nodotdot, -1, 1 ) ===
'/' ) {
1527 $nodotdot = substr( $nodotdot, 0, -1 );
1528 if ( $text ===
'' ) {
1529 $text = $nodotdot . $suffix;
1532 $nodotdot = trim( $nodotdot );
1533 if ( $nodotdot !=
'' ) {
1534 $ret .=
'/' . $nodotdot;
1564 $formatted =
wfMessage(
'parentheses' )->rawParams( $formatted )->escaped();
1565 return " <span class=\"comment\">$formatted</span>";
1579 if (
$rev->getRawComment() ==
"" ) {
1583 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
1586 $rev->getTitle(), $local );
1588 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
1591 return " <span class=\"history-deleted\">$block</span>";
1602 $stxt =
wfMessage(
'historyempty' )->escaped();
1605 $stxt =
wfMessage(
'parentheses' )->rawParams( $stxt )->escaped();
1607 return "<span class=\"history-size\">$stxt</span>";
1625 return "</li>\n" . str_repeat(
"</ul>\n</li>\n", $level > 0 ? $level : 0 );
1633 public static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex =
false ) {
1634 $classes =
"toclevel-$level";
1635 if ( $sectionIndex !==
false ) {
1636 $classes .=
" tocsection-$sectionIndex";
1638 return "\n<li class=\"$classes\"><a href=\"#" .
1639 $anchor .
'"><span class="tocnumber">' .
1640 $tocnumber .
'</span> <span class="toctext">' .
1641 $tocline .
'</span></a>';
1661 public static function tocList( $toc, $lang =
false ) {
1665 return '<div id="toc" class="toc">'
1666 .
'<div id="toctitle"><h2>' .
$title .
"</h2></div>\n"
1668 .
"</ul>\n</div>\n";
1682 if (
$section[
'toclevel'] > $lastLevel ) {
1684 } elseif (
$section[
'toclevel'] < $lastLevel ) {
1686 $lastLevel -
$section[
'toclevel'] );
1716 $ret =
"<h$level$attribs"
1717 .
"<span class=\"mw-headline\" id=\"$anchor\">$html</span>"
1720 if ( $legacyAnchor !==
false ) {
1721 $ret =
"<div id=\"$legacyAnchor\"></div>$ret";
1735 if ( $trail !==
'' ) {
1737 if ( preg_match( $regex, $trail, $m ) ) {
1742 return array( $inside, $trail );
1771 if ( $context ===
null ) {
1775 if ( in_array(
'verify',
$options ) ) {
1777 if ( $editCount ===
false ) {
1784 if ( !in_array(
'noBrackets',
$options ) ) {
1785 $inner = $context->msg(
'brackets' )->rawParams( $inner )->plain();
1788 return '<span class="mw-rollback-link">' . $inner .
'</span>';
1807 global $wgShowRollbackEditCount;
1808 if ( !is_int( $wgShowRollbackEditCount ) || !$wgShowRollbackEditCount > 0 ) {
1818 array(
'rev_user_text',
'rev_deleted' ),
1820 array(
'rev_page' =>
$rev->getTitle()->getArticleID() ),
1823 'USE INDEX' =>
array(
'revision' =>
'page_timestamp' ),
1824 'ORDER BY' =>
'rev_timestamp DESC',
1825 'LIMIT' => $wgShowRollbackEditCount + 1
1831 foreach (
$res as $row ) {
1832 if (
$rev->getRawUserText() != $row->rev_user_text ) {
1844 if ( $verify && $editCount <= $wgShowRollbackEditCount && !$moreRevs ) {
1862 global $wgShowRollbackEditCount, $wgMiserMode;
1865 $disableRollbackEditCountSpecialPage =
array(
'Recentchanges',
'Watchlist' );
1867 if ( $context ===
null ) {
1873 'action' =>
'rollback',
1874 'from' =>
$rev->getUserText(),
1875 'token' => $context->getUser()->getEditToken(
array(
$title->getPrefixedText(),
$rev->getUserText() ) ),
1877 if ( $context->getRequest()->getBool(
'bot' ) ) {
1879 $query[
'hidediff'] =
'1';
1882 $disableRollbackEditCount =
false;
1883 if ( $wgMiserMode ) {
1884 foreach ( $disableRollbackEditCountSpecialPage
as $specialPage ) {
1885 if ( $context->getTitle()->isSpecial( $specialPage ) ) {
1886 $disableRollbackEditCount =
true;
1892 if ( !$disableRollbackEditCount && is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) {
1893 if ( !is_numeric( $editCount ) ) {
1897 if ( $editCount > $wgShowRollbackEditCount ) {
1898 $editCount_output = $context->msg(
'rollbacklinkcount-morethan' )->numParams( $wgShowRollbackEditCount )->parse();
1900 $editCount_output = $context->msg(
'rollbacklinkcount' )->numParams( $editCount )->parse();
1906 array(
'title' => $context->msg(
'tooltip-rollback' )->text() ),
1908 array(
'known',
'noclasses' )
1913 $context->msg(
'rollbacklink' )->escaped(),
1914 array(
'title' => $context->msg(
'tooltip-rollback' )->text() ),
1916 array(
'known',
'noclasses' )
1941 if ( count( $templates ) > 0 ) {
1942 # Do a batch existence check
1949 # Construct the HTML
1950 $outText =
'<div class="mw-templatesUsedExplanation">';
1952 $outText .=
wfMessage(
'templatesusedpreview' )->numParams( count( $templates ) )
1955 $outText .=
wfMessage(
'templatesusedsection' )->numParams( count( $templates ) )
1958 $outText .=
wfMessage(
'templatesused' )->numParams( count( $templates ) )
1961 $outText .=
"</div><ul>\n";
1963 usort( $templates,
'Title::compare' );
1964 foreach ( $templates
as $titleObj ) {
1966 $restrictions = $titleObj->getRestrictions(
'edit' );
1967 if ( $restrictions ) {
1970 if ( $restrictions ===
array(
'sysop' ) ) {
1971 $msg =
wfMessage(
'template-protected' );
1972 } elseif ( $restrictions ===
array(
'autoconfirmed' ) ) {
1973 $msg =
wfMessage(
'template-semiprotected' );
1975 if ( $msg && !$msg->isDisabled() ) {
1976 $protected = $msg->parse();
1981 foreach ( $restrictions
as $r ) {
1982 $msgs[] =
wfMessage(
"restriction-level-$r" )->parse();
1985 ->rawParams(
$wgLang->commaList( $msgs ) )->escaped();
1988 if ( $titleObj->quickUserCan(
'edit' ) ) {
1993 array(
'action' =>
'edit' )
2000 array(
'action' =>
'edit' )
2004 .
wfMessage(
'word-separator' )->escaped()
2005 .
wfMessage(
'parentheses' )->rawParams( $editLink )->escaped()
2006 .
wfMessage(
'word-separator' )->escaped()
2007 . $protected .
'</li>';
2010 if ( $more instanceof
Title ) {
2012 } elseif ( $more ) {
2013 $outText .=
"<li>$more</li>";
2016 $outText .=
'</ul>';
2033 if ( count( $hiddencats ) > 0 ) {
2034 # Construct the HTML
2035 $outText =
'<div class="mw-hiddenCategoriesExplanation">';
2036 $outText .=
wfMessage(
'hiddencategories' )->numParams( count( $hiddencats ) )->parseAsBlock();
2037 $outText .=
"</div><ul>\n";
2039 foreach ( $hiddencats
as $titleObj ) {
2040 $outText .=
'<li>' .
self::link( $titleObj,
null,
array(),
array(),
'known' ) .
"</li>\n"; # If
it's hidden, it must exist - no need to check with a LinkBatch
2042 $outText .= '</ul>
';
2044 wfProfileOut( __METHOD__ );
2055 public static function formatSize( $size ) {
2057 return htmlspecialchars( $wgLang->formatSize( $size ) );
2072 public static function titleAttrib( $name, $options = null ) {
2073 wfProfileIn( __METHOD__ );
2075 $message = wfMessage( "tooltip-$name" );
2077 if ( !$message->exists() ) {
2080 $tooltip = $message->text();
2081 # Compatibility: formerly some tooltips had [alt-.] hardcoded
2082 $tooltip = preg_replace( "/ ?\[alt-.\]$/", '', $tooltip );
2083 # Message equal to '-
' means suppress it.
2084 if ( $tooltip == '-
' ) {
2089 if ( $options == 'withaccess
' ) {
2090 $accesskey = self::accesskey( $name );
2091 if ( $accesskey !== false ) {
2092 if ( $tooltip === false || $tooltip === '' ) {
2093 $tooltip = wfMessage( 'brackets
', $accesskey )->escaped();
2095 $tooltip .= wfMessage( 'word-separator
' )->escaped();
2096 $tooltip .= wfMessage( 'brackets
', $accesskey )->escaped();
2101 wfProfileOut( __METHOD__ );
2105 static $accesskeycache;
2117 public static function accesskey( $name ) {
2118 if ( isset( self::$accesskeycache[$name] ) ) {
2119 return self::$accesskeycache[$name];
2121 wfProfileIn( __METHOD__ );
2123 $message = wfMessage( "accesskey-$name" );
2125 if ( !$message->exists() ) {
2128 $accesskey = $message->plain();
2129 if ( $accesskey === '' || $accesskey === '-
' ) {
2130 # @todo FIXME: Per standard MW behavior, a value of '-
' means to suppress the
2131 # attribute, but this is broken for accesskey: that might be a useful
2137 wfProfileOut( __METHOD__ );
2138 self::$accesskeycache[$name] = $accesskey;
2139 return self::$accesskeycache[$name];
2155 public static function getRevDeleteLink( User $user, Revision $rev, Title $title ) {
2156 $canHide = $user->isAllowed( 'deleterevision
' );
2157 if ( !$canHide && !( $rev->getVisibility() && $user->isAllowed( 'deletedhistory
' ) ) ) {
2161 if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
2162 return Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
2164 if ( $rev->getId() ) {
2165 // RevDelete links using revision ID are stable across
2166 // page deletion and undeletion; use when possible.
2168 'type' => 'revision
',
2169 'target
' => $title->getPrefixedDBkey(),
2170 'ids
' => $rev->getId()
2173 // Older deleted entries didn't
save a revision
ID.
2176 'type' =>
'archive',
2177 'target' =>
$title->getPrefixedDBkey(),
2178 'ids' =>
$rev->getTimestamp()
2198 $msgKey = $delete ?
'rev-delundel' :
'rev-showdeleted';
2200 $tag = $restricted ?
'strong' :
'span';
2214 $msgKey = $delete ?
'rev-delundel' :
'rev-showdeleted';
2216 $htmlParentheses =
wfMessage(
'parentheses' )->rawParams(
$html )->escaped();
2217 return Xml::tags(
'span',
array(
'class' =>
'mw-revdelundel-link' ), $htmlParentheses );
2244 if ( $text ===
'' ) {
2271 $title, $text =
'',
$query =
'', $trail =
'', $prefix =
'', $aprops =
'', $style =
''
2277 if ( $text ==
'' ) {
2288 array(
'known',
'noclasses' ) ) . $trail;
2299 # @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
2300 # no attribute" instead of "output '' as value for attribute", this
2301 # would be three lines.
2303 'title' => self::titleAttrib(
$name,
'withaccess' ),
2304 'accesskey' => self::accesskey(
$name )
2306 if (
$attribs[
'title'] ===
false ) {
2309 if (
$attribs[
'accesskey'] ===
false ) {
2320 # @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
2321 # no attribute" instead of "output '' as value for attribute", this
2322 # would be two lines.
2324 if ( $tooltip ===
false ) {
static getDefaultOption( $opt)
Get a given default option value.
static getImageLinkMTOParams( $frameParams, $query='', $parser=null)
Get the link parameters for MediaTransformOutput::toHtml() from given frame parameters supplied by th...
Cache for article titles (prefixed DB keys) and ids linked from one source.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a save
static generateRollback( $rev, IContextSource $context=null, $options=array( 'verify'))
Generate a rollback link for a given revision.
static newFromId( $id)
Static factory method for creation from a given user ID.
see documentation in includes Linker php for Linker::makeImageLink & $time
occurs before session is loaded can be modified ID
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static commentBlock( $comment, $title=null, $local=false)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
Some internal bits split of from Skin.php.
static formatLinksInComment( $comment, $title=null, $local=false)
Formats wiki links and media links in text; all other wiki formatting is ignored.
const TOOL_LINKS_NOBLOCK
Flags for userToolLinks()
static userTalkLink( $userId, $userText)
static singleton()
Get a RepoGroup instance.
static expandAttributes( $attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : att...
static revDeleteLink( $query=array(), $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
static userToolLinksRedContribs( $userId, $userText, $edits=null)
Alias for userToolLinks( $userId, $userText, true );.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static emailLink( $userId, $userText)
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
static revUserLink( $rev, $isPublic=false)
Generate a user link if the current user is allowed to view it.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
__call( $fname, $args)
Use PHP's magic __call handler to transform instance calls to a dummy instance into static calls to t...
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
static makeSelfLinkObj( $nt, $html='', $query='', $trail='', $prefix='')
Make appropriate markup for a link to the current article.
static getUploadUrl( $destFile, $query='')
Get the URL to upload a certain file.
static tocIndent()
Add another level to the Table of Contents.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
static mergeAttributes( $a, $b)
Merge two sets of HTML attributes.
wfProfileIn( $functionname)
Begin profiling of a function.
static fnamePart( $url)
Returns the filename part of an url.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
static getLinkColour( $t, $threshold)
Return the CSS colour of a known link.
static specialLink( $name, $key='')
Make a link to a special page given its name and, optionally, a message key from the link text.
null means default & $customAttribs
static escapeRegexReplacement( $string)
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
static normalizeSectionNameWhitespace( $section)
Normalizes whitespace in a section name, such as might be returned by Parser::stripSectionName(),...
msg()
Get a Message object with context set.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
static processResponsiveImages( $file, $thumb, $hp)
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
static getInterwikiLinkAttributes( $title, $unused=null, $class='external')
Get the appropriate HTML attributes to add to the "a" element of an interwiki link.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
static formatLinksInCommentCallback( $match)
static formatComment( $comment, $title=null, $local=false)
This function is called by all recent changes variants, by the page history, and by the user contribu...
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
static makeThumbLinkObj(Title $title, $file, $label='', $alt, $align='right', $params=array(), $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
static makeLinkObj( $nt, $text='', $query='', $trail='', $prefix='')
it s the revision text itself In either if gzip is the revision text is gzipped $flags
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
static tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex=false)
parameter level defines if we are on an indentation level
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=array(), $title=null)
Make an external link.
static formatAutocomments( $comment, $title=null, $local=false)
Converts autogenerated comments in edit summaries into section links.
static formatHiddenCategories( $hiddencats)
Returns HTML for the "hidden categories on this page" list.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned below
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
static tooltipAndAccesskeyAttribs( $name)
Returns the attributes for the tooltip and access key.
static makeMediaLinkObj( $title, $html='', $time=false)
Create a direct link to a given uploaded file.
static formatAutocommentsCallback( $match)
Helper function for Linker::formatAutocomments.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical reasons
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
static tocList( $toc, $lang=false)
Wraps the TOC in a table and provides the hide/collapse javascript.
static getRollbackEditCount( $rev, $verify)
This function will return the number of revisions which a rollback would revert and,...
do that in ParserLimitReportFormat instead $parser
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped $pre
wfProfileOut( $functionname='missing')
Stop profiling of a function.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
static tocLineEnd()
End a Table Of Contents line.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
wfGetLangObj( $langcode=false)
Return a Language object from $langcode.
static hasSubpages( $index)
Does the namespace allow subpages?
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
static makeImageLink2(Title $title, $file, $frameParams=array(), $handlerParams=array(), $time=false, $query="", $widthOption=null)
See makeImageLink() When this function is removed, remove if( $parser instanceof Parser ) check there...
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static getInternalLinkAttributesObj( $nt, $unused=null, $class='', $title=false)
Get the appropriate HTML attributes to add to the "a" element of an internal link,...
static normaliseSpecialPage(Title $title)
when a variable name is used in a it is silently declared as a new masking the global
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
processing should stop and the error should be shown to the user * false
static splitTrail( $trail)
Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array...
static prettifyIP( $ip)
Prettify an IP for display to end users.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
static makeKnownLinkObj( $title, $text='', $query='', $trail='', $prefix='', $aprops='', $style='')
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static revComment(Revision $rev, $local=false, $isPublic=false)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
presenting them properly to the user as errors is done by the caller $title
static blockLink( $userId, $userText)
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their please see
Allows to change the fields on the form that will be generated $name
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
static getInternalLinkAttributes( $title, $unused=null, $class='')
Get the appropriate HTML attributes to add to the "a" element of an internal link.
static makeThumbLink2(Title $title, $file, $frameParams=array(), $handlerParams=array(), $time=false, $query="")
static formatRevisionSize( $size)
see documentation in includes Linker php for Linker::makeImageLink & $handlerParams
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
static linkAttribs( $target, $attribs, $options)
Returns the array of attributes used when linking to the Title $target.
static makeHeadline( $level, $attribs, $anchor, $html, $link, $legacyAnchor=false)
Create a headline for content.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object $upload
static formatTemplates( $templates, $preview=false, $section=false, $more=null)
Returns HTML for the "templates used on this page" list.
static exists( $index)
Returns whether the specified namespace exists.
static getMain()
Static methods.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
static linkUrl( $target, $query, $options)
Returns the Url used to link to a Title.
Interface for objects which can provide a context on request.
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks & $hash
if(PHP_SAPI !='cli') $file
static tooltip( $name, $options=null)
Returns raw bits of HTML, use titleAttrib()
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
=Architecture==Two class hierarchies are used to provide the functionality associated with the different content models:*Content interface(and AbstractContent base class) define functionality that acts on the concrete content of a page, and *ContentHandler base class provides functionality specific to a content model, but not acting on concrete content. The most important function of ContentHandler is to act as a factory for the appropriate implementation of Content. These Content objects are to be used by MediaWiki everywhere, instead of passing page content around as text. All manipulation and analysis of page content must be done via the appropriate methods of the Content object. For each content model, a subclass of ContentHandler has to be registered with $wgContentHandlers. The ContentHandler object for a given content model can be obtained using ContentHandler::getForModelID($id). Also Title, WikiPage and Revision now have getContentHandler() methods for convenience. ContentHandler objects are singletons that provide functionality specific to the content type, but not directly acting on the content of some page. ContentHandler::makeEmptyContent() and ContentHandler::unserializeContent() can be used to create a Content object of the appropriate type. However, it is recommended to instead use WikiPage::getContent() resp. Revision::getContent() to get a page 's content as a Content object. These two methods should be the ONLY way in which page content is accessed. Another important function of ContentHandler objects is to define custom action handlers for a content model, see ContentHandler::getActionOverrides(). This is similar to what WikiPage::getActionOverrides() was already doing.==Serialization==With the ContentHandler facility, page content no longer has to be text based. Objects implementing the Content interface are used to represent and handle the content internally. For storage and data exchange, each content model supports at least one serialization format via ContentHandler::serializeContent($content). The list of supported formats for a given content model can be accessed using ContentHandler::getSupportedFormats(). Content serialization formats are identified using MIME type like strings. The following formats are built in:*text/x-wiki - wikitext *text/javascript - for js pages *text/css - for css pages *text/plain - for future use, e.g. with plain text messages. *text/html - for future use, e.g. with plain html messages. *application/vnd.php.serialized - for future use with the api and for extensions *application/json - for future use with the api, and for use by extensions *application/xml - for future use with the api, and for use by extensions In PHP, use the corresponding CONTENT_FORMAT_XXX constant. Note that when using the API to access page content, especially action=edit, action=parse and action=query &prop=revisions, the model and format of the content should always be handled explicitly. Without that information, interpretation of the provided content is not reliable. The same applies to XML dumps generated via maintenance/dumpBackup.php or Special:Export. Also note that the API will provide encapsulated, serialized content - so if the API was called with format=json, and contentformat is also json(or rather, application/json), the page content is represented as a string containing an escaped json structure. Extensions that use JSON to serialize some types of page content may provide specialized API modules that allow access to that content in a more natural form.==Compatibility==The ContentHandler facility is introduced in a way that should allow all existing code to keep functioning at least for pages that contain wikitext or other text based content. However, a number of functions and hooks have been deprecated in favor of new versions that are aware of the page 's content model, and will now generate warnings when used. Most importantly, the following functions have been deprecated:*Revisions::getText() and Revisions::getRawText() is deprecated in favor Revisions::getContent() *WikiPage::getText() is deprecated in favor WikiPage::getContent() Also, the old Article::getContent()(which returns text) is superceded by Article::getContentObject(). However, both methods should be avoided since they do not provide clean access to the page 's actual content. For instance, they may return a system message for non-existing pages. Use WikiPage::getContent() instead. Code that relies on a textual representation of the page content should eventually be rewritten. However, ContentHandler::getContentText() provides a stop-gap that can be used to get text for a page. Its behavior is controlled by $wgContentHandlerTextFallback it
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
static titleAttrib( $name, $options=null)
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static tocUnindent( $level)
Finish one or more sublevels on the Table of Contents.
wfFindFile( $title, $options=array())
Find a file.
static makeMediaLinkFile(Title $title, $file, $html='')
Create a direct link to a given uploaded file.
static makeImageLink($parser, Title $title, $file, $frameParams=array(), $handlerParams=array(), $time=false, $query="", $widthOption=null)
Given parameters derived from [[Image:Foo|options...]], generate the HTML that that syntax inserts in...
static normalizeSubpageLink( $contextTitle, $target, &$text)
static decodeTagAttributes( $text)
Return an associative array of attribute names and values from a partial tag string.
static getExternalLinkAttributes( $class='external')
Get the appropriate HTML attributes to add to the "a" element of an external link,...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could change
static generateTOC( $tree)
Generate a table of contents from a section tree Currently unused.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static getLinkAttributesInternal( $title, $class)
Common code for getLinkAttributesX functions.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
static buildRollbackLink( $rev, IContextSource $context=null, $editCount=false)
Build a raw rollback link, useful for collections of "tool" links.
static makeExternalImage( $url, $alt='')
Return the code for images which were added via external links, via Parser::maybeMakeExternalImage().
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second redirect
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
static linkText( $target)
Default text of the links to the Title $target.
static $commentContextTitle
static makeBrokenImageLinkObj( $title, $label='', $query='', $unused1='', $unused2='', $time=false)
Make a "broken" link to an image.
static escapeHtmlAllowEntities( $html)
Given HTML input, escape with htmlspecialchars but un-escape entities.
if(! $wgRequest->checkUrlExtension()) if(! $wgEnableAPI) $wgTitle
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page