68 # Do a batch existence check
72 $outText =
'<div class="mw-templatesUsedExplanation">';
73 $count = count( $templates );
74 if (
$type ===
'preview' ) {
75 $outText .= $this->context->msg(
'templatesusedpreview' )->numParams( $count )
78 $outText .= $this->context->msg(
'templatesusedsection' )->numParams( $count )
81 $outText .= $this->context->msg(
'templatesused' )->numParams( $count )
84 $outText .=
"</div><ul>\n";
86 usort( $templates,
'Title::compare' );
92 $outText .= Html::rawElement(
'li', [], $this->linkRenderer->makeLink(
93 $more, $this->context->msg(
'moredotdotdot' )->text() ) );
96 $outText .= Html::rawElement(
'li', [], $more );
111 $titleObj = Title::newFromLinkTarget( $target );
114 return '<li>' . $this->linkRenderer->makeLink( $target )
115 . $this->context->msg(
'word-separator' )->escaped()
116 . $this->context->msg(
'parentheses' )->rawParams( $editLink )->escaped()
117 . $this->context->msg(
'word-separator' )->escaped()
118 . $protected .
'</li>';
130 if ( !$restrictions ) {
136 if ( $restrictions === [
'sysop' ] ) {
137 $msg = $this->context->msg(
'template-protected' );
138 }
elseif ( $restrictions === [
'autoconfirmed' ] ) {
139 $msg = $this->context->msg(
'template-semiprotected' );
141 if ( $msg && !$msg->isDisabled() ) {
142 $protected = $msg->parse();
147 foreach ( $restrictions as $r ) {
148 $msgs[] = $this->context->msg(
"restriction-level-$r" )->parse();
150 $protected = $this->context->msg(
'parentheses' )
151 ->rawParams( $this->context->getLanguage()->commaList( $msgs ) )->escaped();
165 if ( $titleObj->quickUserCan(
'edit', $this->context->getUser() ) ) {
166 $linkMsg =
'editlink';
168 $linkMsg =
'viewsourcelink';
171 return $this->linkRenderer->makeLink(
173 $this->context->msg( $linkMsg )->text(),
175 [
'action' =>
'edit' ]
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Handles formatting for the "templates used on this page" lists.
buildEditLink(Title $titleObj)
Return a link to the edit page, with the text saying "view source" if the user can't edit the page.
formatTemplate(LinkTarget $target)
Builds an item for an individual template.
format(array $templates, $type=false, $more=null)
Make an HTML list of templates, and then add a "More..." link at the bottom.
__construct(IContextSource $context, LinkRenderer $linkRenderer)
getRestrictionsText(array $restrictions)
If the page is protected, get the relevant text for those restrictions.
LinkRenderer $linkRenderer
Represents a title within MediaWiki.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
Interface for objects which can provide a MediaWiki context on request.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))