86 public static function link(
87 $target, $html =
null, $customAttribs = [], $query = [], $options = []
90 wfWarn( __METHOD__ .
': Requires $target to be a LinkTarget object.', 2 );
91 return "<!-- ERROR -->$html";
94 $services = MediaWikiServices::getInstance();
95 $options = (array)$options;
98 if ( !isset( $options[
'stubThreshold'] ) ) {
99 $defaultLinkRenderer = $services->getLinkRenderer();
100 $options[
'stubThreshold'] = $defaultLinkRenderer->getStubThreshold();
102 $linkRenderer = $services->getLinkRendererFactory()
103 ->createFromLegacyOptions( $options );
105 $linkRenderer = $services->getLinkRenderer();
108 if ( $html !==
null ) {
114 if ( in_array(
'known', $options,
true ) ) {
115 return $linkRenderer->makeKnownLink( $target, $text, $customAttribs, $query );
118 if ( in_array(
'broken', $options,
true ) ) {
119 return $linkRenderer->makeBrokenLink( $target, $text, $customAttribs, $query );
122 if ( in_array(
'noclasses', $options,
true ) ) {
123 return $linkRenderer->makePreloadedLink( $target, $text,
'', $customAttribs, $query );
126 return $linkRenderer->makeLink( $target, $text, $customAttribs, $query );
143 $target, $html =
null, $customAttribs = [],
144 $query = [], $options = [
'known' ]
146 return self::link( $target, $html, $customAttribs, $query, $options );
164 public static function makeSelfLinkObj( $nt, $html =
'', $query =
'', $trail =
'', $prefix =
'' ) {
165 $nt = Title::newFromLinkTarget( $nt );
166 $ret =
"<a class=\"mw-selflink selflink\">{$prefix}{$html}</a>{$trail}";
167 if ( !Hooks::runner()->onSelfLinkBegin( $nt, $html, $trail, $prefix, $ret ) ) {
172 $html = htmlspecialchars( $nt->getPrefixedText() );
175 return "<a class=\"mw-selflink selflink\">{$prefix}{$html}{$inside}</a>{$trail}";
190 if ( MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $namespace ) ) {
192 $name = $context->
msg(
'blanknamespace' )->text();
194 $name = MediaWikiServices::getInstance()->getContentLanguage()->
195 getFormattedNsText( $namespace );
197 return $context->
msg(
'invalidtitle-knownnamespace', $namespace, $name,
$title )->text();
200 return $context->
msg(
'invalidtitle-unknownnamespace', $namespace,
$title )->text();
211 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
212 return $linkRenderer->normalizeTarget( $target );
224 $basename = strrchr( $url,
'/' );
225 if ( $basename ===
false ) {
228 $basename = substr( $basename, 1 );
248 $success = Hooks::runner()->onLinkerMakeExternalImage( $url, $alt, $img );
250 wfDebug(
"Hook LinkerMakeExternalImage changed the output of external image "
251 .
"with url {$url} and alt text {$alt} to {$img}" );
254 return Html::element(
'img',
300 $file, $frameParams = [], $handlerParams = [], $time =
false,
301 $query =
"", $widthOption =
null
306 if ( !Hooks::runner()->onImageBeforeProduceHTML( $dummy,
$title,
307 $file, $frameParams, $handlerParams, $time,
$res,
308 $parser, $query, $widthOption )
313 if (
$file && !
$file->allowInlineDisplay() ) {
314 wfDebug( __METHOD__ .
': ' .
$title->getPrefixedDBkey() .
" does not allow inline display" );
319 $page = $handlerParams[
'page'] ??
false;
320 if ( !isset( $frameParams[
'align'] ) ) {
321 $frameParams[
'align'] =
'';
323 if ( !isset( $frameParams[
'alt'] ) ) {
324 $frameParams[
'alt'] =
'';
326 if ( !isset( $frameParams[
'title'] ) ) {
327 $frameParams[
'title'] =
'';
329 if ( !isset( $frameParams[
'class'] ) ) {
330 $frameParams[
'class'] =
'';
333 $prefix = $postfix =
'';
335 if ( $frameParams[
'align'] ==
'center' ) {
336 $prefix =
'<div class="center">';
338 $frameParams[
'align'] =
'none';
340 if (
$file && !isset( $handlerParams[
'width'] ) ) {
341 if ( isset( $handlerParams[
'height'] ) &&
$file->isVectorized() ) {
347 $handlerParams[
'width'] =
$file->getWidth( $page );
350 if ( isset( $frameParams[
'thumbnail'] )
351 || isset( $frameParams[
'manualthumb'] )
352 || isset( $frameParams[
'framed'] )
353 || isset( $frameParams[
'frameless'] )
354 || !$handlerParams[
'width']
358 if ( $widthOption ===
null || !isset(
$wgThumbLimits[$widthOption] ) ) {
359 $widthOption = User::getDefaultOption(
'thumbsize' );
363 if ( isset( $frameParams[
'upright'] ) && $frameParams[
'upright'] == 0 ) {
370 $prefWidth = isset( $frameParams[
'upright'] ) ?
371 round(
$wgThumbLimits[$widthOption] * $frameParams[
'upright'], -1 ) :
376 if ( !isset( $handlerParams[
'height'] ) && ( $handlerParams[
'width'] <= 0 ||
377 $prefWidth < $handlerParams[
'width'] ||
$file->isVectorized() ) ) {
378 $handlerParams[
'width'] = $prefWidth;
383 if ( isset( $frameParams[
'thumbnail'] ) || isset( $frameParams[
'manualthumb'] )
384 || isset( $frameParams[
'framed'] )
386 # Create a thumbnail. Alignment depends on the writing direction of
387 # the page content language (right-aligned for LTR languages,
388 # left-aligned for RTL languages)
389 # If a thumbnail width has not been provided, it is set
390 # to the default user option as specified in Language*.php
391 if ( $frameParams[
'align'] ==
'' ) {
392 $frameParams[
'align'] = $parser->getTargetLanguage()->alignEnd();
399 if (
$file && isset( $frameParams[
'frameless'] ) ) {
400 $srcWidth =
$file->getWidth( $page );
401 # For "frameless" option: do not present an image bigger than the
402 # source (for bitmap-style images). This is the same behavior as the
403 # "thumb" option does it already.
404 if ( $srcWidth && !
$file->mustRender() && $handlerParams[
'width'] > $srcWidth ) {
405 $handlerParams[
'width'] = $srcWidth;
409 if (
$file && isset( $handlerParams[
'width'] ) ) {
410 # Create a resized image, without the additional thumbnail features
411 $thumb =
$file->transform( $handlerParams );
421 'alt' => $frameParams[
'alt'],
422 'title' => $frameParams[
'title'],
423 'valign' => $frameParams[
'valign'] ??
false,
424 'img-class' => $frameParams[
'class'] ];
425 if ( isset( $frameParams[
'border'] ) ) {
426 $params[
'img-class'] .= ( $params[
'img-class'] !==
'' ?
' ' :
'' ) .
'thumbborder';
430 $s = $thumb->toHtml( $params );
432 if ( $frameParams[
'align'] !=
'' ) {
433 $s = Html::rawElement(
435 [
'class' =>
'float' . $frameParams[
'align'] ],
439 return str_replace(
"\n",
' ', $prefix .
$s . $postfix );
452 if ( isset( $frameParams[
'link-url'] ) && $frameParams[
'link-url'] !==
'' ) {
453 $mtoParams[
'custom-url-link'] = $frameParams[
'link-url'];
454 if ( isset( $frameParams[
'link-target'] ) ) {
455 $mtoParams[
'custom-target-link'] = $frameParams[
'link-target'];
458 $extLinkAttrs = $parser->getExternalLinkAttribs( $frameParams[
'link-url'] );
459 foreach ( $extLinkAttrs as $name => $val ) {
461 $mtoParams[
'parser-extlink-' . $name] = $val;
464 } elseif ( isset( $frameParams[
'link-title'] ) && $frameParams[
'link-title'] !==
'' ) {
465 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
466 $mtoParams[
'custom-title-link'] = Title::newFromLinkTarget(
467 $linkRenderer->normalizeTarget( $frameParams[
'link-title'] )
469 } elseif ( !empty( $frameParams[
'no-link'] ) ) {
472 $mtoParams[
'desc-link'] =
true;
473 $mtoParams[
'desc-query'] = $query;
491 $align =
'right', $params = [], $framed =
false, $manualthumb =
""
499 $frameParams[
'framed'] =
true;
501 if ( $manualthumb ) {
502 $frameParams[
'manualthumb'] = $manualthumb;
517 $handlerParams = [], $time =
false, $query =
""
521 $page = $handlerParams[
'page'] ??
false;
522 if ( !isset( $frameParams[
'align'] ) ) {
523 $frameParams[
'align'] =
'right';
525 if ( !isset( $frameParams[
'alt'] ) ) {
526 $frameParams[
'alt'] =
'';
528 if ( !isset( $frameParams[
'title'] ) ) {
529 $frameParams[
'title'] =
'';
531 if ( !isset( $frameParams[
'caption'] ) ) {
532 $frameParams[
'caption'] =
'';
535 if ( empty( $handlerParams[
'width'] ) ) {
537 $handlerParams[
'width'] = isset( $frameParams[
'upright'] ) ? 130 : 180;
541 $manualthumb =
false;
544 $outerWidth = $handlerParams[
'width'] + 2;
546 if ( isset( $frameParams[
'manualthumb'] ) ) {
547 # Use manually specified thumbnail
548 $manual_title = Title::makeTitleSafe(
NS_FILE, $frameParams[
'manualthumb'] );
549 if ( $manual_title ) {
550 $manual_img = MediaWikiServices::getInstance()->getRepoGroup()
551 ->findFile( $manual_title );
553 $thumb = $manual_img->getUnscaledThumb( $handlerParams );
559 } elseif ( isset( $frameParams[
'framed'] ) ) {
561 $thumb =
$file->getUnscaledThumb( $handlerParams );
564 # Do not present an image bigger than the source, for bitmap-style images
565 # This is a hack to maintain compatibility with arbitrary pre-1.10 behavior
566 $srcWidth =
$file->getWidth( $page );
567 if ( $srcWidth && !
$file->mustRender() && $handlerParams[
'width'] > $srcWidth ) {
568 $handlerParams[
'width'] = $srcWidth;
570 $thumb =
$file->transform( $handlerParams );
574 $outerWidth = $thumb->getWidth() + 2;
576 $outerWidth = $handlerParams[
'width'] + 2;
580 # ThumbnailImage::toHtml() already adds page= onto the end of DjVu URLs
581 # So we don't need to pass it here in $query. However, the URL for the
582 # zoom icon still needs it, so we make a unique query for it. See T16771
583 $url = Title::newFromLinkTarget(
$title )->getLocalURL( $query );
588 && !isset( $frameParams[
'link-title'] )
589 && !isset( $frameParams[
'link-url'] )
590 && !isset( $frameParams[
'no-link'] ) ) {
591 $frameParams[
'link-url'] = $url;
594 $s =
"<div class=\"thumb t{$frameParams['align']}\">"
595 .
"<div class=\"thumbinner\" style=\"width:{$outerWidth}px;\">";
600 } elseif ( !$thumb ) {
601 $s .=
wfMessage(
'thumbnail_error',
'' )->escaped();
604 if ( !$noscale && !$manualthumb ) {
608 'alt' => $frameParams[
'alt'],
609 'title' => $frameParams[
'title'],
610 'img-class' => ( isset( $frameParams[
'class'] ) && $frameParams[
'class'] !==
''
611 ? $frameParams[
'class'] .
' '
612 :
'' ) .
'thumbimage'
615 $s .= $thumb->toHtml( $params );
616 if ( isset( $frameParams[
'framed'] ) ) {
619 $zoomIcon = Html::rawElement(
'div', [
'class' =>
'magnify' ],
620 Html::rawElement(
'a', [
622 'class' =>
'internal',
623 'title' =>
wfMessage(
'thumbnail-more' )->text() ],
627 $s .=
' <div class="thumbcaption">' . $zoomIcon . $frameParams[
'caption'] .
"</div></div></div>";
628 return str_replace(
"\n",
' ',
$s );
643 $hp15[
'width'] = round( $hp[
'width'] * 1.5 );
645 $hp20[
'width'] = $hp[
'width'] * 2;
646 if ( isset( $hp[
'height'] ) ) {
647 $hp15[
'height'] = round( $hp[
'height'] * 1.5 );
648 $hp20[
'height'] = $hp[
'height'] * 2;
651 $thumb15 =
$file->transform( $hp15 );
652 $thumb20 =
$file->transform( $hp20 );
653 if ( $thumb15 && !$thumb15->isError() && $thumb15->getUrl() !== $thumb->getUrl() ) {
654 $thumb->responsiveUrls[
'1.5'] = $thumb15->getUrl();
656 if ( $thumb20 && !$thumb20->isError() && $thumb20->getUrl() !== $thumb->getUrl() ) {
657 $thumb->responsiveUrls[
'2'] = $thumb20->getUrl();
675 $query =
'', $unused1 =
'', $unused2 =
'', $time =
false
678 wfWarn( __METHOD__ .
': Requires $title to be a LinkTarget object.' );
679 return "<!-- ERROR -->" . htmlspecialchars( $label );
685 if ( $label ==
'' ) {
686 $label =
$title->getPrefixedText();
688 $repoGroup = MediaWikiServices::getInstance()->getRepoGroup();
689 $currentExists = $time
690 && $repoGroup->findFile(
$title ) !==
false;
695 if ( $repoGroup->getLocalRepo()->checkRedirect(
$title ) ) {
699 htmlspecialchars( $label ),
700 [
'class' =>
'mw-redirect' ],
702 [
'known',
'noclasses' ]
706 return Html::element(
'a', [
707 'href' => self::getUploadUrl(
$title, $query ),
709 'title' =>
$title->getPrefixedText()
715 htmlspecialchars( $label ),
718 [
'known',
'noclasses' ]
732 $q =
'wpDestFile=' . Title::castFromLinkTarget( $destFile )->getPartialURL();
733 if ( $query !=
'' ) {
747 return $upload->getLocalURL( $q );
760 $img = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
761 $title, [
'time' => $time ]
780 $url =
$file->getUrl();
799 if ( !Hooks::runner()->onLinkerMakeMediaLinkFile(
800 Title::castFromLinkTarget(
$title ),
$file, $html, $attribs, $ret )
802 wfDebug(
"Hook LinkerMakeMediaLinkFile changed the output of link "
803 .
"with url {$url} and text {$html} to {$ret}" );
807 return Html::rawElement(
'a', $attribs, $html );
822 $key = strtolower( $name );
847 $linktype =
'', $attribs = [],
$title =
null
852 $class .=
" $linktype";
854 if ( isset( $attribs[
'class'] ) && $attribs[
'class'] ) {
855 $class .=
" {$attribs['class']}";
857 $attribs[
'class'] = $class;
860 $text = htmlspecialchars( $text );
866 $newRel = Parser::getExternalLinkRel( $url,
$title );
867 if ( !isset( $attribs[
'rel'] ) || $attribs[
'rel'] ===
'' ) {
868 $attribs[
'rel'] = $newRel;
869 } elseif ( $newRel !==
null ) {
871 $newRels = explode(
' ', $newRel );
872 $oldRels = explode(
' ', $attribs[
'rel'] );
873 $combined = array_unique( array_merge( $newRels, $oldRels ) );
874 $attribs[
'rel'] = implode(
' ', $combined );
877 $success = Hooks::runner()->onLinkerMakeExternalLink(
878 $url, $text, $link, $attribs, $linktype );
880 wfDebug(
"Hook LinkerMakeExternalLink changed the output of link "
881 .
"with url {$url} and text {$text} to {$link}" );
884 $attribs[
'href'] = $url;
885 return Html::rawElement(
'a', $attribs, $text );
896 public static function userLink( $userId, $userName, $altUserName =
false ) {
897 if ( $userName ===
'' || $userName ===
false || $userName ===
null ) {
898 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
899 'that need to be fixed?' );
900 return wfMessage(
'empty-username' )->parse();
903 $classes =
'mw-userlink';
905 if ( $userId == 0 ) {
906 $page = ExternalUserNames::getUserLinkTitle( $userName );
908 if ( ExternalUserNames::isExternal( $userName ) ) {
909 $classes .=
' mw-extuserlink';
910 } elseif ( $altUserName ===
false ) {
911 $altUserName = IPUtils::prettifyIP( $userName );
913 $classes .=
' mw-anonuserlink';
920 '<bdi>' . htmlspecialchars( $altUserName !==
false ? $altUserName : $userName ) .
'</bdi>';
923 ?
self::link( $page, $linkText, [
'class' => $classes ] )
924 : Html::rawElement(
'span', [
'class' => $classes ], $linkText );
942 $userId, $userText, $redContribsWhenNoEdits =
false, $flags = 0, $edits =
null,
943 $useParentheses =
true
945 if ( $userText ===
'' ) {
946 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
947 'that need to be fixed?' );
948 return ' ' .
wfMessage(
'empty-username' )->parse();
954 $addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId;
956 if ( $userId == 0 && ExternalUserNames::isExternal( $userText ) ) {
968 $attribs[
'class'] =
'mw-usertoollinks-contribs';
969 if ( $redContribsWhenNoEdits ) {
970 if ( intval( $edits ) === 0 && $edits !== 0 ) {
971 $user = User::newFromId( $userId );
972 $edits = $user->getEditCount();
974 if ( $edits === 0 ) {
975 $attribs[
'class'] .=
' new';
982 $user = RequestContext::getMain()->getUser();
983 $userCanBlock = MediaWikiServices::getInstance()->getPermissionManager()
984 ->userHasRight( $user,
'block' );
985 if ( $blockable && $userCanBlock ) {
989 if ( $addEmailLink && $user->canSendEmail() ) {
993 Hooks::runner()->onUserToolLinksEdit( $userId, $userText, $items );
999 if ( $useParentheses ) {
1000 return wfMessage(
'word-separator' )->escaped()
1001 .
'<span class="mw-usertoollinks">'
1002 .
wfMessage(
'parentheses' )->rawParams(
$wgLang->pipeList( $items ) )->escaped()
1007 foreach ( $items as $tool ) {
1008 $tools[] = Html::rawElement(
'span', [], $tool );
1010 return ' <span class="mw-usertoollinks mw-changeslist-links">' .
1011 implode(
' ', $tools ) .
'</span>';
1024 $userId, $userText, $edits =
null, $useParentheses =
true
1036 if ( $userText ===
'' ) {
1037 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
1038 'that need to be fixed?' );
1039 return wfMessage(
'empty-username' )->parse();
1043 $moreLinkAttribs = [
'class' =>
'mw-usertoollinks-talk' ];
1044 $linkText =
wfMessage(
'talkpagelinktext' )->escaped();
1046 return $userTalkPage
1047 ?
self::link( $userTalkPage, $linkText, $moreLinkAttribs )
1048 : Html::rawElement(
'span', $moreLinkAttribs, $linkText );
1058 if ( $userText ===
'' ) {
1059 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
1060 'that need to be fixed?' );
1061 return wfMessage(
'empty-username' )->parse();
1065 $moreLinkAttribs = [
'class' =>
'mw-usertoollinks-block' ];
1079 if ( $userText ===
'' ) {
1080 wfLogWarning( __METHOD__ .
' received an empty username. Are there database errors ' .
1081 'that need to be fixed?' );
1082 return wfMessage(
'empty-username' )->parse();
1086 $moreLinkAttribs = [
'class' =>
'mw-usertoollinks-mail' ];
1103 $user = RequestContext::getMain()->getUser();
1106 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1107 $revRecord = $rev->getRevisionRecord();
1112 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) && $isPublic ) {
1113 $link =
wfMessage(
'rev-deleted-user' )->escaped();
1114 } elseif ( RevisionRecord::userCanBitfield(
1115 $revRecord->getVisibility(),
1116 RevisionRecord::DELETED_USER,
1119 $revUser = $revRecord->getUser( RevisionRecord::FOR_THIS_USER, $user );
1121 $revUser ? $revUser->getId() : 0,
1122 $revUser ? $revUser->getName() :
''
1125 $link =
wfMessage(
'rev-deleted-user' )->escaped();
1127 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
1128 return '<span class="history-deleted">' . $link .
'</span>';
1142 public static function revUserTools( $rev, $isPublic =
false, $useParentheses =
true ) {
1144 $user = RequestContext::getMain()->getUser();
1147 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1148 $revRecord = $rev->getRevisionRecord();
1153 if ( RevisionRecord::userCanBitfield(
1154 $revRecord->getVisibility(),
1155 RevisionRecord::DELETED_USER,
1158 ( !$revRecord->isDeleted( RevisionRecord::DELETED_USER ) || !$isPublic )
1160 $revUser = $revRecord->getUser( RevisionRecord::FOR_THIS_USER, $user );
1161 $userId = $revUser ? $revUser->getId() : 0;
1162 $userText = $revUser ? $revUser->getName() :
'';
1164 if ( $userId || $userText !==
'' ) {
1171 if ( !isset( $link ) ) {
1172 $link =
wfMessage(
'rev-deleted-user' )->escaped();
1175 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
1176 return ' <span class="history-deleted mw-userlink">' . $link .
'</span>';
1200 $comment,
$title =
null, $local =
false, $wikiId =
null
1202 # Sanitize text a bit:
1203 $comment = str_replace(
"\n",
" ", $comment );
1204 # Allow HTML entities (for T15815)
1205 $comment = Sanitizer::escapeHtmlAllowEntities( $comment );
1207 # Render autocomments and make links:
1230 $comment,
$title =
null, $local =
false, $wikiId =
null
1238 $comment = preg_replace_callback(
1244 '!(?:(?<=(.)))?/\*\s*(.*?)\s*\*/(?:(?=(.)))?!',
1245 function ( $match ) use (
$title, $local, $wikiId, &$append ) {
1249 $match += [
'',
'',
'',
'' ];
1251 $pre = $match[1] !==
'';
1253 $post = $match[3] !==
'';
1256 Hooks::runner()->onFormatAutocomments(
1257 $comment, $pre, $auto, $post, Title::castFromLinkTarget(
$title ), $local,
1260 if ( $comment ===
null ) {
1263 # Remove links that a user may have manually put in the autosummary
1264 # This could be improved by copying as much of Parser::stripSectionName as desired.
1265 $section = str_replace( [
1273 $sectionText = str_replace(
'[[',
'[[', $auto );
1275 $section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
1276 if ( $section !==
'' ) {
1280 $sectionTitle =
$title->createFragmentTarget( $section );
1291 # written summary $presep autocomment (summary )
1292 $pre =
wfMessage(
'autocomment-prefix' )->inContentLanguage()->escaped();
1295 # autocomment $postsep written summary ( summary)
1296 $auto .=
wfMessage(
'colon-separator' )->inContentLanguage()->escaped();
1299 $auto =
'<span dir="auto"><span class="autocomment">' . $auto .
'</span>';
1300 $append .=
'</span>';
1302 $comment = $pre . $auto;
1308 return $comment . $append;
1331 $comment,
$title =
null, $local =
false, $wikiId =
null
1333 return preg_replace_callback(
1336 \s*+ # ignore leading whitespace, the *+ quantifier disallows backtracking
1337 :? # ignore optional leading colon
1338 ([^[\]|]+) # 1. link target; page names cannot include [, ] or |
1341 # Stop matching at ]] without relying on backtracking.
1345 ([^[]*) # 3. link trail (the text up until the next link)
1347 function ( $match ) use (
$title, $local, $wikiId ) {
1348 $services = MediaWikiServices::getInstance();
1351 $medians .= preg_quote(
1352 $services->getNamespaceInfo()->getCanonicalName(
NS_MEDIA ),
'/' );
1354 $medians .= preg_quote(
1355 $services->getContentLanguage()->getNsText(
NS_MEDIA ),
1359 $comment = $match[0];
1361 # fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
1362 if ( strpos( $match[1],
'%' ) !==
false ) {
1364 rawurldecode( $match[1] ),
1365 [
'<' =>
'<',
'>' =>
'>' ]
1369 # Handle link renaming [[foo|text]] will show link as "text"
1370 if ( $match[2] !=
"" ) {
1377 if ( preg_match(
'/^' . $medians .
'(.*)$/i', $match[1], $submatch ) ) {
1378 # Media link; trail not supported.
1379 $linkRegexp =
'/\[\[(.*?)\]\]/';
1385 # Other kind of link
1386 # Make sure its target is non-empty
1387 if ( isset( $match[1][0] ) && $match[1][0] ==
':' ) {
1388 $match[1] = substr( $match[1], 1 );
1390 if ( $match[1] !==
false && $match[1] !==
'' ) {
1392 $services->getContentLanguage()->linkTrail(),
1396 $trail = $submatch[1];
1400 $linkRegexp =
'/\[\[(.*?)\]\]' . preg_quote( $trail,
'/' ) .
'/';
1407 $target = $services->getTitleParser()->
1408 parseTitle( $linkTarget );
1410 if ( $target->getText() ==
'' && !$target->isExternal()
1413 $target =
$title->createFragmentTarget( $target->getFragment() );
1424 $comment = preg_replace(
1426 StringUtils::escapeRegexReplacement( $thelink ),
1452 LinkTarget $linkTarget, $text, $wikiId =
null, $options = []
1454 if ( $wikiId !==
null && !$linkTarget->
isExternal() ) {
1456 WikiMap::getForeignURL(
1460 : MediaWikiServices::getInstance()->getNamespaceInfo()->
1469 $link =
self::link( $linkTarget, $text, [], [], $options );
1484 # :Foobar -- override special treatment of prefix (images, language links)
1485 # /Foobar -- convert to CurrentPage/Foobar
1486 # /Foobar/ -- convert to CurrentPage/Foobar, strip the initial and final / from text
1487 # ../ -- convert to CurrentPage, from CurrentPage/CurrentSubPage
1488 # ../Foobar -- convert to CurrentPage/Foobar,
1489 # (from CurrentPage/CurrentSubPage)
1490 # ../Foobar/ -- convert to CurrentPage/Foobar, use 'Foobar' as text
1491 # (from CurrentPage/CurrentSubPage)
1493 $ret = $target; #
default return value is no change
1495 # Some namespaces don't allow subpages,
1496 # so only perform processing if subpages are allowed
1498 $contextTitle && MediaWikiServices::getInstance()->getNamespaceInfo()->
1499 hasSubpages( $contextTitle->getNamespace() )
1501 $hash = strpos( $target,
'#' );
1502 if ( $hash !==
false ) {
1503 $suffix = substr( $target, $hash );
1504 $target = substr( $target, 0, $hash );
1509 $target = trim( $target );
1510 $contextPrefixedText = MediaWikiServices::getInstance()->getTitleFormatter()->
1511 getPrefixedText( $contextTitle );
1512 # Look at the first character
1513 if ( $target !=
'' && $target[0] ===
'/' ) {
1514 # / at end means we don't want the slash to be shown
1516 $trailingSlashes = preg_match_all(
'%(/+)$%', $target, $m );
1517 if ( $trailingSlashes ) {
1518 $noslash = $target = substr( $target, 1, -strlen( $m[0][0] ) );
1520 $noslash = substr( $target, 1 );
1523 $ret = $contextPrefixedText .
'/' . trim( $noslash ) . $suffix;
1524 if ( $text ===
'' ) {
1525 $text = $target . $suffix;
1526 } #
this might be changed
for ugliness reasons
1528 # check for .. subpage backlinks
1530 $nodotdot = $target;
1531 while ( strncmp( $nodotdot,
"../", 3 ) == 0 ) {
1533 $nodotdot = substr( $nodotdot, 3 );
1535 if ( $dotdotcount > 0 ) {
1536 $exploded = explode(
'/', $contextPrefixedText );
1537 if ( count( $exploded ) > $dotdotcount ) { # not allowed to go below top level page
1538 $ret = implode(
'/', array_slice( $exploded, 0, -$dotdotcount ) );
1539 # / at the end means don't show full path
1540 if ( substr( $nodotdot, -1, 1 ) ===
'/' ) {
1541 $nodotdot = rtrim( $nodotdot,
'/' );
1542 if ( $text ===
'' ) {
1543 $text = $nodotdot . $suffix;
1546 $nodotdot = trim( $nodotdot );
1547 if ( $nodotdot !=
'' ) {
1548 $ret .=
'/' . $nodotdot;
1575 $comment,
$title =
null, $local =
false, $wikiId =
null, $useParentheses =
true
1580 if ( $comment ==
'' || $comment ==
'*' ) {
1584 if ( $useParentheses ) {
1585 $formatted =
wfMessage(
'parentheses' )->rawParams( $formatted )->escaped();
1586 $classNames =
'comment';
1588 $classNames =
'comment comment--without-parentheses';
1590 return " <span class=\"$classNames\">$formatted</span>";
1605 public static function revComment( $rev, $local =
false, $isPublic =
false,
1606 $useParentheses =
true
1609 $user = RequestContext::getMain()->getUser();
1612 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1613 $revRecord = $rev->getRevisionRecord();
1618 if ( $revRecord->getComment( RevisionRecord::RAW ) ===
null ) {
1621 if ( $revRecord->isDeleted( RevisionRecord::DELETED_COMMENT ) && $isPublic ) {
1622 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
1623 } elseif ( RevisionRecord::userCanBitfield(
1624 $revRecord->getVisibility(),
1625 RevisionRecord::DELETED_COMMENT,
1628 $comment = $revRecord->getComment( RevisionRecord::FOR_THIS_USER, $user );
1630 $comment ? $comment->text :
null,
1631 $revRecord->getPageAsLinkTarget(),
1637 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
1639 if ( $revRecord->isDeleted( RevisionRecord::DELETED_COMMENT ) ) {
1640 return " <span class=\"history-deleted comment\">$block</span>";
1652 $stxt =
wfMessage(
'historyempty' )->escaped();
1654 $stxt =
wfMessage(
'nbytes' )->numParams( $size )->escaped();
1656 return "<span class=\"history-size mw-diff-bytes\">$stxt</span>";
1677 return "</li>\n" . str_repeat(
"</ul>\n</li>\n", $level > 0 ? $level : 0 );
1691 public static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex =
false ) {
1692 $classes =
"toclevel-$level";
1693 if ( $sectionIndex !==
false ) {
1694 $classes .=
" tocsection-$sectionIndex";
1699 return Html::openElement(
'li', [
'class' => $classes ] )
1700 . Html::rawElement(
'a',
1701 [
'href' =>
"#$anchor" ],
1702 Html::element(
'span', [
'class' =>
'tocnumber' ], $tocnumber )
1704 . Html::rawElement(
'span', [
'class' =>
'toctext' ], $tocline )
1728 $lang =
$lang ?? RequestContext::getMain()->getLanguage();
1732 return '<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading">'
1733 . Html::element(
'input', [
1734 'type' =>
'checkbox',
1736 'id' =>
'toctogglecheckbox',
1737 'class' =>
'toctogglecheckbox',
1738 'style' =>
'display:none',
1740 . Html::openElement(
'div', [
1741 'class' =>
'toctitle',
1742 'lang' =>
$lang->getHtmlCode(),
1743 'dir' =>
$lang->getDir(),
1745 .
'<h2 id="mw-toc-heading">' .
$title .
'</h2>'
1746 .
'<span class="toctogglespan">'
1747 . Html::label(
'',
'toctogglecheckbox', [
1748 'class' =>
'toctogglelabel',
1753 .
"</ul>\n</div>\n";
1767 foreach ( $tree as $section ) {
1768 if ( $section[
'toclevel'] > $lastLevel ) {
1770 } elseif ( $section[
'toclevel'] < $lastLevel ) {
1772 $lastLevel - $section[
'toclevel'] );
1778 $section[
'line'], $section[
'number'],
1779 $section[
'toclevel'], $section[
'index'] );
1780 $lastLevel = $section[
'toclevel'];
1803 $link, $fallbackAnchor =
false
1805 $anchorEscaped = htmlspecialchars( $anchor );
1807 if ( $fallbackAnchor !==
false && $fallbackAnchor !== $anchor ) {
1808 $fallbackAnchor = htmlspecialchars( $fallbackAnchor );
1809 $fallback =
"<span id=\"$fallbackAnchor\"></span>";
1811 return "<h$level$attribs"
1812 .
"$fallback<span class=\"mw-headline\" id=\"$anchorEscaped\">$html</span>"
1824 $regex = MediaWikiServices::getInstance()->getContentLanguage()->linkTrail();
1826 if ( $trail !==
'' && preg_match( $regex, $trail, $m ) ) {
1827 list( , $inside, $trail ) = $m;
1829 return [ $inside, $trail ];
1862 $options = [
'verify' ]
1865 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1866 $revRecord = $rev->getRevisionRecord();
1871 if ( $context ===
null ) {
1872 $context = RequestContext::getMain();
1876 if ( in_array(
'verify', $options,
true ) ) {
1878 if ( $editCount ===
false ) {
1885 if ( !in_array(
'noBrackets', $options,
true ) ) {
1886 $inner = $context->msg(
'brackets' )->rawParams( $inner )->escaped();
1889 if ( $context->getUser()->getBoolOption(
'showrollbackconfirmation' ) ) {
1890 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
1891 $stats->increment(
'rollbackconfirmation.event.load' );
1892 $context->getOutput()->addModules(
'mediawiki.misc-authed-curate' );
1895 return '<span class="mw-rollback-link">' . $inner .
'</span>';
1920 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1921 $revRecord = $rev->getRevisionRecord();
1934 $revQuery = MediaWikiServices::getInstance()->getRevisionStore()->getQueryInfo();
1937 [
'rev_user_text' =>
$revQuery[
'fields'][
'rev_user_text'],
'rev_deleted' ],
1938 [
'rev_page' => $revRecord->getPageId() ],
1941 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
1942 'ORDER BY' =>
'rev_timestamp DESC',
1948 $revUser = $revRecord->getUser( RevisionRecord::RAW );
1949 $revUserText = $revUser ? $revUser->getName() :
'';
1953 foreach (
$res as $row ) {
1954 if ( $row->rev_user_text != $revUserText ) {
1956 ( $row->rev_deleted & RevisionRecord::DELETED_TEXT
1957 || $row->rev_deleted & RevisionRecord::DELETED_USER
1999 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
2000 $revRecord = $rev->getRevisionRecord();
2006 $disableRollbackEditCountSpecialPage = [
'Recentchanges',
'Watchlist' ];
2008 if ( $context ===
null ) {
2009 $context = RequestContext::getMain();
2012 $title = $revRecord->getPageAsLinkTarget();
2013 $revUser = $revRecord->getUser();
2014 $revUserText = $revUser ? $revUser->getName() :
'';
2017 'action' =>
'rollback',
2018 'from' => $revUserText,
2019 'token' => $context->getUser()->getEditToken(
'rollback' ),
2023 'data-mw' =>
'interface',
2024 'title' => $context->msg(
'tooltip-rollback' )->text()
2027 $options = [
'known',
'noclasses' ];
2029 if ( $context->getRequest()->getBool(
'bot' ) ) {
2031 $query[
'hidediff'] =
'1';
2032 $query[
'bot'] =
'1';
2035 $disableRollbackEditCount =
false;
2037 foreach ( $disableRollbackEditCountSpecialPage as $specialPage ) {
2038 if ( $context->getTitle()->isSpecial( $specialPage ) ) {
2039 $disableRollbackEditCount =
true;
2045 if ( !$disableRollbackEditCount
2049 if ( !is_numeric( $editCount ) ) {
2054 $html = $context->msg(
'rollbacklinkcount-morethan' )
2057 $html = $context->msg(
'rollbacklinkcount' )->numParams( $editCount )->parse();
2063 $html = $context->msg(
'rollbacklink' )->escaped();
2077 if ( count( $hiddencats ) > 0 ) {
2078 # Construct the HTML
2079 $outText =
'<div class="mw-hiddenCategoriesExplanation">';
2080 $outText .=
wfMessage(
'hiddencategories' )->numParams( count( $hiddencats ) )->parseAsBlock();
2081 $outText .=
"</div><ul>\n";
2083 foreach ( $hiddencats as $titleObj ) {
2084 # If it's hidden, it must exist - no need to check with a LinkBatch
2086 .
self::link( $titleObj,
null, [], [],
'known' )
2089 $outText .=
'</ul>';
2110 public static function titleAttrib( $name, $options =
null, array $msgParams = [] ) {
2111 $message =
wfMessage(
"tooltip-$name", $msgParams );
2112 if ( !$message->exists() ) {
2115 $tooltip = $message->text();
2116 # Compatibility: formerly some tooltips had [alt-.] hardcoded
2117 $tooltip = preg_replace(
"/ ?\[alt-.\]$/",
'', $tooltip );
2118 # Message equal to '-' means suppress it.
2119 if ( $tooltip ==
'-' ) {
2124 $options = (array)$options;
2126 if ( in_array(
'nonexisting', $options ) ) {
2127 $tooltip =
wfMessage(
'red-link-title', $tooltip ?:
'' )->text();
2129 if ( in_array(
'withaccess', $options ) ) {
2131 if ( $accesskey !==
false ) {
2133 if ( $tooltip ===
false || $tooltip ===
'' ) {
2134 $tooltip =
wfMessage(
'brackets', $accesskey )->text();
2136 $tooltip .=
wfMessage(
'word-separator' )->text();
2137 $tooltip .=
wfMessage(
'brackets', $accesskey )->text();
2159 if ( isset( self::$accesskeycache[$name] ) ) {
2160 return self::$accesskeycache[$name];
2163 $message =
wfMessage(
"accesskey-$name" );
2165 if ( !$message->exists() ) {
2168 $accesskey = $message->plain();
2169 if ( $accesskey ===
'' || $accesskey ===
'-' ) {
2170 # @todo FIXME: Per standard MW behavior, a value of '-' means to suppress the
2171 # attribute, but this is broken for accesskey: that might be a useful
2177 self::$accesskeycache[$name] = $accesskey;
2178 return self::$accesskeycache[$name];
2197 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
2198 $revRecord = $rev->getRevisionRecord();
2203 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
2204 $canHide = $permissionManager->userHasRight( $user,
'deleterevision' );
2205 $canHideHistory = $permissionManager->userHasRight( $user,
'deletedhistory' );
2206 if ( !$canHide && !( $revRecord->getVisibility() && $canHideHistory ) ) {
2210 if ( !RevisionRecord::userCanBitfield(
2211 $revRecord->getVisibility(),
2212 RevisionRecord::DELETED_RESTRICTED,
2217 $prefixedDbKey = MediaWikiServices::getInstance()->getTitleFormatter()->
2218 getPrefixedDBkey(
$title );
2219 if ( $revRecord->getId() ) {
2223 'type' =>
'revision',
2224 'target' => $prefixedDbKey,
2225 'ids' => $revRecord->getId()
2231 'type' =>
'archive',
2232 'target' => $prefixedDbKey,
2233 'ids' => $revRecord->getTimestamp()
2238 $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ),
2253 public static function revDeleteLink( $query = [], $restricted =
false, $delete =
true ) {
2255 $msgKey = $delete ?
'rev-delundel' :
'rev-showdeleted';
2256 $html =
wfMessage( $msgKey )->escaped();
2257 $tag = $restricted ?
'strong' :
'span';
2258 $link =
self::link( $sp, $html, [], $query, [
'known',
'noclasses' ] );
2261 [
'class' =>
'mw-revdelundel-link' ],
2262 wfMessage(
'parentheses' )->rawParams( $link )->escaped()
2276 $msgKey = $delete ?
'rev-delundel' :
'rev-showdeleted';
2277 $html =
wfMessage( $msgKey )->escaped();
2278 $htmlParentheses =
wfMessage(
'parentheses' )->rawParams( $html )->escaped();
2279 return Xml::tags(
'span', [
'class' =>
'mw-revdelundel-link' ], $htmlParentheses );
2296 array $msgParams = [],
2299 $options = (array)$options;
2300 $options[] =
'withaccess';
2301 $tooltipTitle = $name;
2304 $skin = RequestContext::getMain()->getSkin();
2305 $isWatchlistExpiryEnabled = $skin->getConfig()->get(
'WatchlistExpiry' );
2306 if ( $name ===
'ca-unwatch' && $isWatchlistExpiryEnabled ) {
2307 $watchStore = MediaWikiServices::getInstance()->getWatchedItemStore();
2308 $watchedItem = $watchStore->getWatchedItem( $skin->getUser(),
2309 $skin->getRelevantTitle() );
2311 $diffInDays = $watchedItem->getExpiryInDays();
2313 if ( $diffInDays ) {
2314 $msgParams = [ $diffInDays ];
2316 $tooltipTitle =
'ca-unwatch-expiring';
2318 $tooltipTitle =
'ca-unwatch-expiring-hours';
2328 if ( $attribs[
'title'] ===
false ) {
2329 unset( $attribs[
'title'] );
2331 if ( $attribs[
'accesskey'] ===
false ) {
2332 unset( $attribs[
'accesskey'] );
2344 public static function tooltip( $name, $options =
null ) {
2346 if ( $tooltip ===
false ) {
2349 return Xml::expandAttributes( [
$wgThumbUpright
Adjust width of upright images when parameter 'upright' is used This allows a nicer look for upright ...
$wgThumbLimits
Adjust thumbnails on image pages according to a user setting.
$wgDisableAnonTalk
Disable links to talk pages of anonymous users (IPs) in listings on special pages like page history,...
$wgSVGMaxSize
Don't scale a SVG larger than this.
$wgShowRollbackEditCount
The $wgShowRollbackEditCount variable is used to show how many edits can be rolled back.
$wgUploadMissingFileUrl
Point the upload link for missing files to an external URL, as with $wgUploadNavigationUrl.
$wgUploadNavigationUrl
Point the upload navigation link to an external URL Useful if you want to use a shared repository by ...
$wgResponsiveImages
Generate and use thumbnails suitable for screens with 1.5 and 2.0 pixel densities.
$wgEnableUploads
Allow users to upload files.
$wgMiserMode
Disable database-intensive features.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
Marks HTML that shouldn't be escaped.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Some internal bits split of from Skin.php.
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
static makeMediaLinkFile(LinkTarget $title, $file, $html='')
Create a direct link to a given uploaded file.
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
static fnamePart( $url)
Returns the filename part of an url.
static tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex=false)
parameter level defines if we are on an indentation level
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
static accesskey( $name)
Given the id of an interface element, constructs the appropriate accesskey attribute from the system ...
static formatAutocomments( $comment, $title=null, $local=false, $wikiId=null)
Converts autogenerated comments in edit summaries into section links.
static specialLink( $name, $key='')
Make a link to a special page given its name and, optionally, a message key from the link text.
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static makeExternalImage( $url, $alt='')
Return the code for images which were added via external links, via Parser::maybeMakeExternalImage().
static buildRollbackLink( $rev, IContextSource $context=null, $editCount=false)
Build a raw rollback link, useful for collections of "tool" links.
static makeCommentLink(LinkTarget $linkTarget, $text, $wikiId=null, $options=[])
Generates a link to the given LinkTarget.
static processResponsiveImages( $file, $thumb, $hp)
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
static blockLink( $userId, $userText)
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static getRollbackEditCount( $rev, $verify)
This function will return the number of revisions which a rollback would revert and,...
static normalizeSubpageLink( $contextTitle, $target, &$text)
const TOOL_LINKS_NOBLOCK
Flags for userToolLinks()
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.
static makeImageLink(Parser $parser, LinkTarget $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query="", $widthOption=null)
Given parameters derived from [[Image:Foo|options...]], generate the HTML that that syntax inserts in...
static revUserLink( $rev, $isPublic=false)
Generate a user link if the current user is allowed to view it.
static revComment( $rev, $local=false, $isPublic=false, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
static emailLink( $userId, $userText)
static formatHiddenCategories( $hiddencats)
Returns HTML for the "hidden categories on this page" list.
static splitTrail( $trail)
Split a link trail, return the "inside" portion and the remainder of the trail as a two-element array...
static makeThumbLink2(LinkTarget $title, $file, $frameParams=[], $handlerParams=[], $time=false, $query="")
static generateTOC( $tree, Language $lang=null)
Generate a table of contents from a section tree.
static formatRevisionSize( $size)
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
static tooltip( $name, $options=null)
Returns raw bits of HTML, use titleAttrib()
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
static userTalkLink( $userId, $userText)
static getRevDeleteLink(User $user, $rev, LinkTarget $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
static formatLinksInComment( $comment, $title=null, $local=false, $wikiId=null)
Formats wiki links and media links in text; all other wiki formatting is ignored.
static makeMediaLinkObj( $title, $html='', $time=false)
Create a direct link to a given uploaded file.
static makeThumbLinkObj(LinkTarget $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
static normaliseSpecialPage(LinkTarget $target)
static makeHeadline( $level, $attribs, $anchor, $html, $link, $fallbackAnchor=false)
Create a headline for content.
static tocUnindent( $level)
Finish one or more sublevels on the Table of Contents.
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
static tocList( $toc, Language $lang=null)
Wraps the TOC in a div with ARIA navigation role and provides the hide/collapse JavaScript.
static getImageLinkMTOParams( $frameParams, $query='', $parser=null)
Get the link parameters for MediaTransformOutput::toHtml() from given frame parameters supplied by th...
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
static tocLineEnd()
End a Table Of Contents line.
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
static userToolLinksRedContribs( $userId, $userText, $edits=null, $useParentheses=true)
Alias for userToolLinks( $userId, $userText, true );.
static makeBrokenImageLinkObj( $title, $label='', $query='', $unused1='', $unused2='', $time=false)
Make a "broken" link to an image.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Represents a page (or page fragment) title within MediaWiki.
static tryNew( $namespace, $title, $fragment='', $interwiki='')
Constructs a TitleValue, or returns null if the parameters are not valid.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Representation of a pair of user and title for watchlist entries.
getExpiry(?int $style=TS_MW)
When the watched item will expire.
Interface for objects which can provide a MediaWiki context on request.
msg( $key,... $params)
This is the method for getting translated interface messages.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!isset( $args[0])) $lang