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] ) ) {
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'] ==
'' ) {
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 );
416 $isBadFile =
$file && $thumb &&
419 if ( !$thumb || $isBadFile ) {
424 'alt' => $frameParams[
'alt'],
425 'title' => $frameParams[
'title'],
426 'valign' => $frameParams[
'valign'] ??
false,
427 'img-class' => $frameParams[
'class'] ];
428 if ( isset( $frameParams[
'border'] ) ) {
429 $params[
'img-class'] .= ( $params[
'img-class'] !==
'' ?
' ' :
'' ) .
'thumbborder';
433 $s = $thumb->toHtml( $params );
435 if ( $frameParams[
'align'] !=
'' ) {
436 $s = Html::rawElement(
438 [
'class' =>
'float' . $frameParams[
'align'] ],
442 return str_replace(
"\n",
' ', $prefix .
$s . $postfix );
455 if ( isset( $frameParams[
'link-url'] ) && $frameParams[
'link-url'] !==
'' ) {
456 $mtoParams[
'custom-url-link'] = $frameParams[
'link-url'];
457 if ( isset( $frameParams[
'link-target'] ) ) {
458 $mtoParams[
'custom-target-link'] = $frameParams[
'link-target'];
461 $extLinkAttrs = $parser->getExternalLinkAttribs( $frameParams[
'link-url'] );
462 foreach ( $extLinkAttrs as $name => $val ) {
464 $mtoParams[
'parser-extlink-' . $name] = $val;
467 } elseif ( isset( $frameParams[
'link-title'] ) && $frameParams[
'link-title'] !==
'' ) {
468 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
469 $mtoParams[
'custom-title-link'] = Title::newFromLinkTarget(
470 $linkRenderer->normalizeTarget( $frameParams[
'link-title'] )
472 } elseif ( !empty( $frameParams[
'no-link'] ) ) {
475 $mtoParams[
'desc-link'] =
true;
476 $mtoParams[
'desc-query'] = $query;
494 $align =
'right', $params = [], $framed =
false, $manualthumb =
""
502 $frameParams[
'framed'] =
true;
504 if ( $manualthumb ) {
505 $frameParams[
'manualthumb'] = $manualthumb;
521 $handlerParams = [], $time =
false, $query =
"", ?
Parser $parser =
null
525 $page = $handlerParams[
'page'] ??
false;
526 if ( !isset( $frameParams[
'align'] ) ) {
527 $frameParams[
'align'] =
'right';
529 if ( !isset( $frameParams[
'alt'] ) ) {
530 $frameParams[
'alt'] =
'';
532 if ( !isset( $frameParams[
'title'] ) ) {
533 $frameParams[
'title'] =
'';
535 if ( !isset( $frameParams[
'caption'] ) ) {
536 $frameParams[
'caption'] =
'';
539 if ( empty( $handlerParams[
'width'] ) ) {
541 $handlerParams[
'width'] = isset( $frameParams[
'upright'] ) ? 130 : 180;
545 $manualthumb =
false;
548 $outerWidth = $handlerParams[
'width'] + 2;
550 if ( isset( $frameParams[
'manualthumb'] ) ) {
551 # Use manually specified thumbnail
552 $manual_title = Title::makeTitleSafe(
NS_FILE, $frameParams[
'manualthumb'] );
553 if ( $manual_title ) {
554 $manual_img = MediaWikiServices::getInstance()->getRepoGroup()
555 ->findFile( $manual_title );
557 $thumb = $manual_img->getUnscaledThumb( $handlerParams );
563 } elseif ( isset( $frameParams[
'framed'] ) ) {
565 $thumb =
$file->getUnscaledThumb( $handlerParams );
568 # Do not present an image bigger than the source, for bitmap-style images
569 # This is a hack to maintain compatibility with arbitrary pre-1.10 behavior
570 $srcWidth =
$file->getWidth( $page );
571 if ( $srcWidth && !
$file->mustRender() && $handlerParams[
'width'] > $srcWidth ) {
572 $handlerParams[
'width'] = $srcWidth;
574 $thumb =
$file->transform( $handlerParams );
578 $outerWidth = $thumb->getWidth() + 2;
580 $outerWidth = $handlerParams[
'width'] + 2;
584 # ThumbnailImage::toHtml() already adds page= onto the end of DjVu URLs
585 # So we don't need to pass it here in $query. However, the URL for the
586 # zoom icon still needs it, so we make a unique query for it. See T16771
587 $url = Title::newFromLinkTarget(
$title )->getLocalURL( $query );
592 && !isset( $frameParams[
'link-title'] )
593 && !isset( $frameParams[
'link-url'] )
594 && !isset( $frameParams[
'no-link'] ) ) {
595 $frameParams[
'link-url'] = $url;
598 $s =
"<div class=\"thumb t{$frameParams['align']}\">"
599 .
"<div class=\"thumbinner\" style=\"width:{$outerWidth}px;\">";
601 $isBadFile = $exists && $thumb && $parser &&
602 $parser->getBadFileLookup()->isBadFile(
603 $manualthumb ? $manual_title :
$title->getDBkey(),
610 } elseif ( !$thumb || $isBadFile ) {
611 $s .=
wfMessage(
'thumbnail_error',
'' )->escaped();
614 if ( !$noscale && !$manualthumb ) {
618 'alt' => $frameParams[
'alt'],
619 'title' => $frameParams[
'title'],
620 'img-class' => ( isset( $frameParams[
'class'] ) && $frameParams[
'class'] !==
''
621 ? $frameParams[
'class'] .
' '
622 :
'' ) .
'thumbimage'
625 $s .= $thumb->toHtml( $params );
626 if ( isset( $frameParams[
'framed'] ) ) {
629 $zoomIcon = Html::rawElement(
'div', [
'class' =>
'magnify' ],
630 Html::rawElement(
'a', [
632 'class' =>
'internal',
633 'title' =>
wfMessage(
'thumbnail-more' )->text() ],
637 $s .=
' <div class="thumbcaption">' . $zoomIcon . $frameParams[
'caption'] .
"</div></div></div>";
638 return str_replace(
"\n",
' ',
$s );
653 $hp15[
'width'] = round( $hp[
'width'] * 1.5 );
655 $hp20[
'width'] = $hp[
'width'] * 2;
656 if ( isset( $hp[
'height'] ) ) {
657 $hp15[
'height'] = round( $hp[
'height'] * 1.5 );
658 $hp20[
'height'] = $hp[
'height'] * 2;
661 $thumb15 =
$file->transform( $hp15 );
662 $thumb20 =
$file->transform( $hp20 );
663 if ( $thumb15 && !$thumb15->isError() && $thumb15->getUrl() !== $thumb->getUrl() ) {
664 $thumb->responsiveUrls[
'1.5'] = $thumb15->getUrl();
666 if ( $thumb20 && !$thumb20->isError() && $thumb20->getUrl() !== $thumb->getUrl() ) {
667 $thumb->responsiveUrls[
'2'] = $thumb20->getUrl();
685 $query =
'', $unused1 =
'', $unused2 =
'', $time =
false
688 wfWarn( __METHOD__ .
': Requires $title to be a LinkTarget object.' );
689 return "<!-- ERROR -->" . htmlspecialchars( $label );
695 if ( $label ==
'' ) {
696 $label =
$title->getPrefixedText();
698 $repoGroup = MediaWikiServices::getInstance()->getRepoGroup();
699 $currentExists = $time
700 && $repoGroup->findFile(
$title ) !==
false;
705 if ( $repoGroup->getLocalRepo()->checkRedirect(
$title ) ) {
709 htmlspecialchars( $label ),
710 [
'class' =>
'mw-redirect' ],
712 [
'known',
'noclasses' ]
716 return Html::element(
'a', [
717 'href' => self::getUploadUrl(
$title, $query ),
719 'title' =>
$title->getPrefixedText()
725 htmlspecialchars( $label ),
728 [
'known',
'noclasses' ]
742 $q =
'wpDestFile=' . Title::castFromLinkTarget( $destFile )->getPartialURL();
743 if ( $query !=
'' ) {
757 return $upload->getLocalURL( $q );
770 $img = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
771 $title, [
'time' => $time ]
790 $url =
$file->getUrl();
809 if ( !Hooks::runner()->onLinkerMakeMediaLinkFile(
810 Title::castFromLinkTarget(
$title ),
$file, $html, $attribs, $ret )
812 wfDebug(
"Hook LinkerMakeMediaLinkFile changed the output of link "
813 .
"with url {$url} and text {$html} to {$ret}" );
817 return Html::rawElement(
'a', $attribs, $html );
832 $key = strtolower( $name );
857 $linktype =
'', $attribs = [],
$title =
null
862 $class .=
" $linktype";
864 if ( isset( $attribs[
'class'] ) && $attribs[
'class'] ) {
865 $class .=
" {$attribs['class']}";
867 $attribs[
'class'] = $class;
870 $text = htmlspecialchars( $text );
876 $newRel = Parser::getExternalLinkRel( $url,
$title );
877 if ( !isset( $attribs[
'rel'] ) || $attribs[
'rel'] ===
'' ) {
878 $attribs[
'rel'] = $newRel;
879 } elseif ( $newRel !==
null ) {
881 $newRels = explode(
' ', $newRel );
882 $oldRels = explode(
' ', $attribs[
'rel'] );
883 $combined = array_unique( array_merge( $newRels, $oldRels ) );
884 $attribs[
'rel'] = implode(
' ', $combined );
887 $success = Hooks::runner()->onLinkerMakeExternalLink(
888 $url, $text, $link, $attribs, $linktype );
890 wfDebug(
"Hook LinkerMakeExternalLink changed the output of link "
891 .
"with url {$url} and text {$text} to {$link}" );
894 $attribs[
'href'] = $url;
895 return Html::rawElement(
'a', $attribs, $text );
906 public static function userLink( $userId, $userName, $altUserName =
false ) {
907 if ( $userName ===
'' || $userName ===
false || $userName ===
null ) {
908 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
909 'that need to be fixed?' );
910 return wfMessage(
'empty-username' )->parse();
913 $classes =
'mw-userlink';
915 if ( $userId == 0 ) {
916 $page = ExternalUserNames::getUserLinkTitle( $userName );
918 if ( ExternalUserNames::isExternal( $userName ) ) {
919 $classes .=
' mw-extuserlink';
920 } elseif ( $altUserName ===
false ) {
921 $altUserName = IPUtils::prettifyIP( $userName );
923 $classes .=
' mw-anonuserlink';
930 '<bdi>' . htmlspecialchars( $altUserName !==
false ? $altUserName : $userName ) .
'</bdi>';
933 ?
self::link( $page, $linkText, [
'class' => $classes ] )
934 : Html::rawElement(
'span', [
'class' => $classes ], $linkText );
952 $userId, $userText, $redContribsWhenNoEdits =
false, $flags = 0, $edits =
null,
953 $useParentheses =
true
955 if ( $userText ===
'' ) {
956 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
957 'that need to be fixed?' );
958 return ' ' .
wfMessage(
'empty-username' )->parse();
964 $addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId;
966 if ( $userId == 0 && ExternalUserNames::isExternal( $userText ) ) {
978 $attribs[
'class'] =
'mw-usertoollinks-contribs';
979 if ( $redContribsWhenNoEdits ) {
980 if ( intval( $edits ) === 0 && $edits !== 0 ) {
982 $edits = $user->getEditCount();
984 if ( $edits === 0 ) {
985 $attribs[
'class'] .=
' new';
992 $user = RequestContext::getMain()->getUser();
993 $userCanBlock = MediaWikiServices::getInstance()->getPermissionManager()
994 ->userHasRight( $user,
'block' );
995 if ( $blockable && $userCanBlock ) {
999 if ( $addEmailLink && $user->canSendEmail() ) {
1003 Hooks::runner()->onUserToolLinksEdit( $userId, $userText, $items );
1009 if ( $useParentheses ) {
1010 return wfMessage(
'word-separator' )->escaped()
1011 .
'<span class="mw-usertoollinks">'
1012 .
wfMessage(
'parentheses' )->rawParams(
$wgLang->pipeList( $items ) )->escaped()
1017 foreach ( $items as $tool ) {
1018 $tools[] = Html::rawElement(
'span', [], $tool );
1020 return ' <span class="mw-usertoollinks mw-changeslist-links">' .
1021 implode(
' ', $tools ) .
'</span>';
1034 $userId, $userText, $edits =
null, $useParentheses =
true
1046 if ( $userText ===
'' ) {
1047 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
1048 'that need to be fixed?' );
1049 return wfMessage(
'empty-username' )->parse();
1053 $moreLinkAttribs = [
'class' =>
'mw-usertoollinks-talk' ];
1054 $linkText =
wfMessage(
'talkpagelinktext' )->escaped();
1056 return $userTalkPage
1057 ?
self::link( $userTalkPage, $linkText, $moreLinkAttribs )
1058 : Html::rawElement(
'span', $moreLinkAttribs, $linkText );
1068 if ( $userText ===
'' ) {
1069 wfDebug( __METHOD__ .
' received an empty username. Are there database errors ' .
1070 'that need to be fixed?' );
1071 return wfMessage(
'empty-username' )->parse();
1075 $moreLinkAttribs = [
'class' =>
'mw-usertoollinks-block' ];
1089 if ( $userText ===
'' ) {
1090 wfLogWarning( __METHOD__ .
' received an empty username. Are there database errors ' .
1091 'that need to be fixed?' );
1092 return wfMessage(
'empty-username' )->parse();
1096 $moreLinkAttribs = [
'class' =>
'mw-usertoollinks-mail' ];
1113 $user = RequestContext::getMain()->getUser();
1116 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1117 $revRecord = $rev->getRevisionRecord();
1122 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) && $isPublic ) {
1123 $link =
wfMessage(
'rev-deleted-user' )->escaped();
1124 } elseif ( RevisionRecord::userCanBitfield(
1125 $revRecord->getVisibility(),
1126 RevisionRecord::DELETED_USER,
1129 $revUser = $revRecord->getUser( RevisionRecord::FOR_THIS_USER, $user );
1131 $revUser ? $revUser->getId() : 0,
1132 $revUser ? $revUser->getName() :
''
1135 $link =
wfMessage(
'rev-deleted-user' )->escaped();
1137 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
1138 return '<span class="history-deleted">' . $link .
'</span>';
1152 public static function revUserTools( $rev, $isPublic =
false, $useParentheses =
true ) {
1154 $user = RequestContext::getMain()->getUser();
1157 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1158 $revRecord = $rev->getRevisionRecord();
1163 if ( RevisionRecord::userCanBitfield(
1164 $revRecord->getVisibility(),
1165 RevisionRecord::DELETED_USER,
1168 ( !$revRecord->isDeleted( RevisionRecord::DELETED_USER ) || !$isPublic )
1170 $revUser = $revRecord->getUser( RevisionRecord::FOR_THIS_USER, $user );
1171 $userId = $revUser ? $revUser->getId() : 0;
1172 $userText = $revUser ? $revUser->getName() :
'';
1174 if ( $userId || $userText !==
'' ) {
1181 if ( !isset( $link ) ) {
1182 $link =
wfMessage(
'rev-deleted-user' )->escaped();
1185 if ( $revRecord->isDeleted( RevisionRecord::DELETED_USER ) ) {
1186 return ' <span class="history-deleted mw-userlink">' . $link .
'</span>';
1210 $comment,
$title =
null, $local =
false, $wikiId =
null
1212 # Sanitize text a bit:
1213 $comment = str_replace(
"\n",
" ", $comment );
1214 # Allow HTML entities (for T15815)
1215 $comment = Sanitizer::escapeHtmlAllowEntities( $comment );
1217 # Render autocomments and make links:
1240 $comment,
$title =
null, $local =
false, $wikiId =
null
1248 $comment = preg_replace_callback(
1254 '!(?:(?<=(.)))?/\*\s*(.*?)\s*\*/(?:(?=(.)))?!',
1255 function ( $match ) use (
$title, $local, $wikiId, &$append ) {
1259 $match += [
'',
'',
'',
'' ];
1261 $pre = $match[1] !==
'';
1263 $post = $match[3] !==
'';
1266 Hooks::runner()->onFormatAutocomments(
1267 $comment, $pre, $auto, $post, Title::castFromLinkTarget(
$title ), $local,
1270 if ( $comment ===
null ) {
1273 # Remove links that a user may have manually put in the autosummary
1274 # This could be improved by copying as much of Parser::stripSectionName as desired.
1275 $section = str_replace( [
1283 $sectionText = str_replace(
'[[',
'[[', $auto );
1285 $section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
1286 if ( $section !==
'' ) {
1290 $sectionTitle =
$title->createFragmentTarget( $section );
1301 # written summary $presep autocomment (summary )
1302 $pre =
wfMessage(
'autocomment-prefix' )->inContentLanguage()->escaped();
1305 # autocomment $postsep written summary ( summary)
1306 $auto .=
wfMessage(
'colon-separator' )->inContentLanguage()->escaped();
1309 $auto =
'<span dir="auto"><span class="autocomment">' . $auto .
'</span>';
1310 $append .=
'</span>';
1312 $comment = $pre . $auto;
1318 return $comment . $append;
1341 $comment,
$title =
null, $local =
false, $wikiId =
null
1343 return preg_replace_callback(
1346 \s*+ # ignore leading whitespace, the *+ quantifier disallows backtracking
1347 :? # ignore optional leading colon
1348 ([^[\]|]+) # 1. link target; page names cannot include [, ] or |
1351 # Stop matching at ]] without relying on backtracking.
1355 ([^[]*) # 3. link trail (the text up until the next link)
1357 function ( $match ) use (
$title, $local, $wikiId ) {
1358 $services = MediaWikiServices::getInstance();
1361 $medians .= preg_quote(
1362 $services->getNamespaceInfo()->getCanonicalName(
NS_MEDIA ),
'/' );
1364 $medians .= preg_quote(
1365 $services->getContentLanguage()->getNsText(
NS_MEDIA ),
1369 $comment = $match[0];
1371 # fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
1372 if ( strpos( $match[1],
'%' ) !==
false ) {
1374 rawurldecode( $match[1] ),
1375 [
'<' =>
'<',
'>' =>
'>' ]
1379 # Handle link renaming [[foo|text]] will show link as "text"
1380 if ( $match[2] !=
"" ) {
1387 if ( preg_match(
'/^' . $medians .
'(.*)$/i', $match[1], $submatch ) ) {
1388 # Media link; trail not supported.
1389 $linkRegexp =
'/\[\[(.*?)\]\]/';
1395 # Other kind of link
1396 # Make sure its target is non-empty
1397 if ( isset( $match[1][0] ) && $match[1][0] ==
':' ) {
1398 $match[1] = substr( $match[1], 1 );
1400 if ( $match[1] !==
false && $match[1] !==
'' ) {
1402 $services->getContentLanguage()->linkTrail(),
1406 $trail = $submatch[1];
1410 $linkRegexp =
'/\[\[(.*?)\]\]' . preg_quote( $trail,
'/' ) .
'/';
1417 $target = $services->getTitleParser()->
1418 parseTitle( $linkTarget );
1420 if ( $target->getText() ==
'' && !$target->isExternal()
1423 $target =
$title->createFragmentTarget( $target->getFragment() );
1434 $comment = preg_replace(
1462 LinkTarget $linkTarget, $text, $wikiId =
null, $options = []
1464 if ( $wikiId !==
null && !$linkTarget->
isExternal() ) {
1466 WikiMap::getForeignURL(
1470 : MediaWikiServices::getInstance()->getNamespaceInfo()->
1479 $link =
self::link( $linkTarget, $text, [], [], $options );
1494 # :Foobar -- override special treatment of prefix (images, language links)
1495 # /Foobar -- convert to CurrentPage/Foobar
1496 # /Foobar/ -- convert to CurrentPage/Foobar, strip the initial and final / from text
1497 # ../ -- convert to CurrentPage, from CurrentPage/CurrentSubPage
1498 # ../Foobar -- convert to CurrentPage/Foobar,
1499 # (from CurrentPage/CurrentSubPage)
1500 # ../Foobar/ -- convert to CurrentPage/Foobar, use 'Foobar' as text
1501 # (from CurrentPage/CurrentSubPage)
1503 $ret = $target; #
default return value is no change
1505 # Some namespaces don't allow subpages,
1506 # so only perform processing if subpages are allowed
1508 $contextTitle && MediaWikiServices::getInstance()->getNamespaceInfo()->
1509 hasSubpages( $contextTitle->getNamespace() )
1511 $hash = strpos( $target,
'#' );
1512 if ( $hash !==
false ) {
1513 $suffix = substr( $target, $hash );
1514 $target = substr( $target, 0, $hash );
1519 $target = trim( $target );
1520 $contextPrefixedText = MediaWikiServices::getInstance()->getTitleFormatter()->
1521 getPrefixedText( $contextTitle );
1522 # Look at the first character
1523 if ( $target !=
'' && $target[0] ===
'/' ) {
1524 # / at end means we don't want the slash to be shown
1526 $trailingSlashes = preg_match_all(
'%(/+)$%', $target, $m );
1527 if ( $trailingSlashes ) {
1528 $noslash = $target = substr( $target, 1, -strlen( $m[0][0] ) );
1530 $noslash = substr( $target, 1 );
1533 $ret = $contextPrefixedText .
'/' . trim( $noslash ) . $suffix;
1534 if ( $text ===
'' ) {
1535 $text = $target . $suffix;
1536 } #
this might be changed
for ugliness reasons
1538 # check for .. subpage backlinks
1540 $nodotdot = $target;
1541 while ( strncmp( $nodotdot,
"../", 3 ) == 0 ) {
1543 $nodotdot = substr( $nodotdot, 3 );
1545 if ( $dotdotcount > 0 ) {
1546 $exploded = explode(
'/', $contextPrefixedText );
1547 if ( count( $exploded ) > $dotdotcount ) { # not allowed to go below top level page
1548 $ret = implode(
'/', array_slice( $exploded, 0, -$dotdotcount ) );
1549 # / at the end means don't show full path
1550 if ( substr( $nodotdot, -1, 1 ) ===
'/' ) {
1551 $nodotdot = rtrim( $nodotdot,
'/' );
1552 if ( $text ===
'' ) {
1553 $text = $nodotdot . $suffix;
1556 $nodotdot = trim( $nodotdot );
1557 if ( $nodotdot !=
'' ) {
1558 $ret .=
'/' . $nodotdot;
1585 $comment,
$title =
null, $local =
false, $wikiId =
null, $useParentheses =
true
1590 if ( $comment ==
'' || $comment ==
'*' ) {
1594 if ( $useParentheses ) {
1595 $formatted =
wfMessage(
'parentheses' )->rawParams( $formatted )->escaped();
1596 $classNames =
'comment';
1598 $classNames =
'comment comment--without-parentheses';
1600 return " <span class=\"$classNames\">$formatted</span>";
1615 public static function revComment( $rev, $local =
false, $isPublic =
false,
1616 $useParentheses =
true
1619 $user = RequestContext::getMain()->getUser();
1622 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1623 $revRecord = $rev->getRevisionRecord();
1628 if ( $revRecord->getComment( RevisionRecord::RAW ) ===
null ) {
1631 if ( $revRecord->isDeleted( RevisionRecord::DELETED_COMMENT ) && $isPublic ) {
1632 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
1633 } elseif ( RevisionRecord::userCanBitfield(
1634 $revRecord->getVisibility(),
1635 RevisionRecord::DELETED_COMMENT,
1638 $comment = $revRecord->getComment( RevisionRecord::FOR_THIS_USER, $user );
1640 $comment ? $comment->text :
null,
1641 $revRecord->getPageAsLinkTarget(),
1647 $block =
" <span class=\"comment\">" .
wfMessage(
'rev-deleted-comment' )->escaped() .
"</span>";
1649 if ( $revRecord->isDeleted( RevisionRecord::DELETED_COMMENT ) ) {
1650 return " <span class=\"history-deleted comment\">$block</span>";
1662 $stxt =
wfMessage(
'historyempty' )->escaped();
1664 $stxt =
wfMessage(
'nbytes' )->numParams( $size )->escaped();
1666 return "<span class=\"history-size mw-diff-bytes\">$stxt</span>";
1687 return "</li>\n" . str_repeat(
"</ul>\n</li>\n", $level > 0 ? $level : 0 );
1701 public static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex =
false ) {
1702 $classes =
"toclevel-$level";
1703 if ( $sectionIndex !==
false ) {
1704 $classes .=
" tocsection-$sectionIndex";
1709 return Html::openElement(
'li', [
'class' => $classes ] )
1710 . Html::rawElement(
'a',
1711 [
'href' =>
"#$anchor" ],
1712 Html::element(
'span', [
'class' =>
'tocnumber' ], $tocnumber )
1714 . Html::rawElement(
'span', [
'class' =>
'toctext' ], $tocline )
1738 $lang =
$lang ?? RequestContext::getMain()->getLanguage();
1742 return '<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading">'
1743 . Html::element(
'input', [
1744 'type' =>
'checkbox',
1746 'id' =>
'toctogglecheckbox',
1747 'class' =>
'toctogglecheckbox',
1748 'style' =>
'display:none',
1750 . Html::openElement(
'div', [
1751 'class' =>
'toctitle',
1752 'lang' =>
$lang->getHtmlCode(),
1753 'dir' =>
$lang->getDir(),
1755 .
'<h2 id="mw-toc-heading">' .
$title .
'</h2>'
1756 .
'<span class="toctogglespan">'
1757 . Html::label(
'',
'toctogglecheckbox', [
1758 'class' =>
'toctogglelabel',
1763 .
"</ul>\n</div>\n";
1777 foreach ( $tree as $section ) {
1778 if ( $section[
'toclevel'] > $lastLevel ) {
1780 } elseif ( $section[
'toclevel'] < $lastLevel ) {
1782 $lastLevel - $section[
'toclevel'] );
1788 $section[
'line'], $section[
'number'],
1789 $section[
'toclevel'], $section[
'index'] );
1790 $lastLevel = $section[
'toclevel'];
1813 $link, $fallbackAnchor =
false
1815 $anchorEscaped = htmlspecialchars( $anchor );
1817 if ( $fallbackAnchor !==
false && $fallbackAnchor !== $anchor ) {
1818 $fallbackAnchor = htmlspecialchars( $fallbackAnchor );
1819 $fallback =
"<span id=\"$fallbackAnchor\"></span>";
1821 return "<h$level$attribs"
1822 .
"$fallback<span class=\"mw-headline\" id=\"$anchorEscaped\">$html</span>"
1834 $regex = MediaWikiServices::getInstance()->getContentLanguage()->linkTrail();
1836 if ( $trail !==
'' && preg_match( $regex, $trail, $m ) ) {
1837 list( , $inside, $trail ) = $m;
1839 return [ $inside, $trail ];
1872 $options = [
'verify' ]
1875 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1876 $revRecord = $rev->getRevisionRecord();
1881 if ( $context ===
null ) {
1882 $context = RequestContext::getMain();
1886 if ( in_array(
'verify', $options,
true ) ) {
1888 if ( $editCount ===
false ) {
1895 if ( !in_array(
'noBrackets', $options,
true ) ) {
1896 $inner = $context->msg(
'brackets' )->rawParams( $inner )->escaped();
1899 if ( $context->getUser()->getBoolOption(
'showrollbackconfirmation' ) ) {
1900 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
1901 $stats->increment(
'rollbackconfirmation.event.load' );
1902 $context->getOutput()->addModules(
'mediawiki.misc-authed-curate' );
1905 return '<span class="mw-rollback-link">' . $inner .
'</span>';
1930 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
1931 $revRecord = $rev->getRevisionRecord();
1944 $revQuery = MediaWikiServices::getInstance()->getRevisionStore()->getQueryInfo();
1947 [
'rev_user_text' =>
$revQuery[
'fields'][
'rev_user_text'],
'rev_deleted' ],
1948 [
'rev_page' => $revRecord->getPageId() ],
1951 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
1952 'ORDER BY' =>
'rev_timestamp DESC',
1958 $revUser = $revRecord->getUser( RevisionRecord::RAW );
1959 $revUserText = $revUser ? $revUser->getName() :
'';
1963 foreach (
$res as $row ) {
1964 if ( $row->rev_user_text != $revUserText ) {
1966 ( $row->rev_deleted & RevisionRecord::DELETED_TEXT
1967 || $row->rev_deleted & RevisionRecord::DELETED_USER
2009 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
2010 $revRecord = $rev->getRevisionRecord();
2016 $disableRollbackEditCountSpecialPage = [
'Recentchanges',
'Watchlist' ];
2018 if ( $context ===
null ) {
2019 $context = RequestContext::getMain();
2022 $title = $revRecord->getPageAsLinkTarget();
2023 $revUser = $revRecord->getUser();
2024 $revUserText = $revUser ? $revUser->getName() :
'';
2027 'action' =>
'rollback',
2028 'from' => $revUserText,
2029 'token' => $context->getUser()->getEditToken(
'rollback' ),
2033 'data-mw' =>
'interface',
2034 'title' => $context->msg(
'tooltip-rollback' )->text()
2037 $options = [
'known',
'noclasses' ];
2039 if ( $context->getRequest()->getBool(
'bot' ) ) {
2041 $query[
'hidediff'] =
'1';
2042 $query[
'bot'] =
'1';
2045 $disableRollbackEditCount =
false;
2047 foreach ( $disableRollbackEditCountSpecialPage as $specialPage ) {
2048 if ( $context->getTitle()->isSpecial( $specialPage ) ) {
2049 $disableRollbackEditCount =
true;
2055 if ( !$disableRollbackEditCount
2059 if ( !is_numeric( $editCount ) ) {
2064 $html = $context->msg(
'rollbacklinkcount-morethan' )
2067 $html = $context->msg(
'rollbacklinkcount' )->numParams( $editCount )->parse();
2073 $html = $context->msg(
'rollbacklink' )->escaped();
2087 if ( count( $hiddencats ) > 0 ) {
2088 # Construct the HTML
2089 $outText =
'<div class="mw-hiddenCategoriesExplanation">';
2090 $outText .=
wfMessage(
'hiddencategories' )->numParams( count( $hiddencats ) )->parseAsBlock();
2091 $outText .=
"</div><ul>\n";
2093 foreach ( $hiddencats as $titleObj ) {
2094 # If it's hidden, it must exist - no need to check with a LinkBatch
2096 .
self::link( $titleObj,
null, [], [],
'known' )
2099 $outText .=
'</ul>';
2120 public static function titleAttrib( $name, $options =
null, array $msgParams = [] ) {
2121 $message =
wfMessage(
"tooltip-$name", $msgParams );
2122 if ( !$message->exists() ) {
2125 $tooltip = $message->text();
2126 # Compatibility: formerly some tooltips had [alt-.] hardcoded
2127 $tooltip = preg_replace(
"/ ?\[alt-.\]$/",
'', $tooltip );
2128 # Message equal to '-' means suppress it.
2129 if ( $tooltip ==
'-' ) {
2134 $options = (array)$options;
2136 if ( in_array(
'nonexisting', $options ) ) {
2137 $tooltip =
wfMessage(
'red-link-title', $tooltip ?:
'' )->text();
2139 if ( in_array(
'withaccess', $options ) ) {
2141 if ( $accesskey !==
false ) {
2143 if ( $tooltip ===
false || $tooltip ===
'' ) {
2144 $tooltip =
wfMessage(
'brackets', $accesskey )->text();
2146 $tooltip .=
wfMessage(
'word-separator' )->text();
2147 $tooltip .=
wfMessage(
'brackets', $accesskey )->text();
2169 if ( isset( self::$accesskeycache[$name] ) ) {
2170 return self::$accesskeycache[$name];
2173 $message =
wfMessage(
"accesskey-$name" );
2175 if ( !$message->exists() ) {
2178 $accesskey = $message->plain();
2179 if ( $accesskey ===
'' || $accesskey ===
'-' ) {
2180 # @todo FIXME: Per standard MW behavior, a value of '-' means to suppress the
2181 # attribute, but this is broken for accesskey: that might be a useful
2187 self::$accesskeycache[$name] = $accesskey;
2188 return self::$accesskeycache[$name];
2207 wfDeprecated( __METHOD__ .
' with a Revision object',
'1.35' );
2208 $revRecord = $rev->getRevisionRecord();
2213 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
2214 $canHide = $permissionManager->userHasRight( $user,
'deleterevision' );
2215 $canHideHistory = $permissionManager->userHasRight( $user,
'deletedhistory' );
2216 if ( !$canHide && !( $revRecord->getVisibility() && $canHideHistory ) ) {
2220 if ( !RevisionRecord::userCanBitfield(
2221 $revRecord->getVisibility(),
2222 RevisionRecord::DELETED_RESTRICTED,
2227 $prefixedDbKey = MediaWikiServices::getInstance()->getTitleFormatter()->
2228 getPrefixedDBkey(
$title );
2229 if ( $revRecord->getId() ) {
2233 'type' =>
'revision',
2234 'target' => $prefixedDbKey,
2235 'ids' => $revRecord->getId()
2241 'type' =>
'archive',
2242 'target' => $prefixedDbKey,
2243 'ids' => $revRecord->getTimestamp()
2248 $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ),
2263 public static function revDeleteLink( $query = [], $restricted =
false, $delete =
true ) {
2265 $msgKey = $delete ?
'rev-delundel' :
'rev-showdeleted';
2266 $html =
wfMessage( $msgKey )->escaped();
2267 $tag = $restricted ?
'strong' :
'span';
2268 $link =
self::link( $sp, $html, [], $query, [
'known',
'noclasses' ] );
2271 [
'class' =>
'mw-revdelundel-link' ],
2272 wfMessage(
'parentheses' )->rawParams( $link )->escaped()
2286 $msgKey = $delete ?
'rev-delundel' :
'rev-showdeleted';
2287 $html =
wfMessage( $msgKey )->escaped();
2288 $htmlParentheses =
wfMessage(
'parentheses' )->rawParams( $html )->escaped();
2289 return Xml::tags(
'span', [
'class' =>
'mw-revdelundel-link' ], $htmlParentheses );
2306 array $msgParams = [],
2309 $options = (array)$options;
2310 $options[] =
'withaccess';
2311 $tooltipTitle = $name;
2314 $skin = RequestContext::getMain()->getSkin();
2315 $isWatchlistExpiryEnabled = $skin->getConfig()->get(
'WatchlistExpiry' );
2316 if ( $name ===
'ca-unwatch' && $isWatchlistExpiryEnabled ) {
2317 $watchStore = MediaWikiServices::getInstance()->getWatchedItemStore();
2318 $watchedItem = $watchStore->getWatchedItem( $skin->getUser(),
2319 $skin->getRelevantTitle() );
2321 $diffInDays = $watchedItem->getExpiryInDays();
2323 if ( $diffInDays ) {
2324 $msgParams = [ $diffInDays ];
2326 $tooltipTitle =
'ca-unwatch-expiring';
2328 $tooltipTitle =
'ca-unwatch-expiring-hours';
2338 if ( $attribs[
'title'] ===
false ) {
2339 unset( $attribs[
'title'] );
2341 if ( $attribs[
'accesskey'] ===
false ) {
2342 unset( $attribs[
'accesskey'] );
2354 public static function tooltip( $name, $options =
null ) {
2356 if ( $tooltip ===
false ) {
2359 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="", ?Parser $parser=null)
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.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
getTargetLanguage()
Get the target language for the content being parsed.
getBadFileLookup()
Get the BadFileLookup instance that this Parser is using.
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,...
static escapeRegexReplacement( $string)
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
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,...
static newFromId( $id)
Static factory method for creation from a given user ID.
static getDefaultOption( $opt)
Get a given default option value.
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