68 # Do a batch existence check
70 foreach ( $templates as $title ) {
76 $outText =
'<div class="mw-templatesUsedExplanation">';
77 $count = count( $templates );
78 if (
$type ===
'preview' ) {
79 $outText .= $this->context->msg(
'templatesusedpreview' )->numParams( $count )
81 } elseif (
$type ===
'section' ) {
82 $outText .= $this->context->msg(
'templatesusedsection' )->numParams( $count )
85 $outText .= $this->context->msg(
'templatesused' )->numParams( $count )
88 $outText .=
"</div><ul>\n";
90 usort( $templates,
'Title::compare' );
96 $outText .= Html::rawElement(
'li', [], $this->linkRenderer->makeLink(
97 $more, $this->context->msg(
'moredotdotdot' )->text() ) );
100 $outText .= Html::rawElement(
'li', [], $more );
115 $titleObj = Title::newFromLinkTarget( $target );
118 return '<li>' . $this->linkRenderer->makeLink( $target )
119 . $this->context->msg(
'word-separator' )->escaped()
120 . $this->context->msg(
'parentheses' )->rawParams( $editLink )->escaped()
121 . $this->context->msg(
'word-separator' )->escaped()
122 . $protected .
'</li>';
134 if ( !$restrictions ) {
140 if ( $restrictions === [
'sysop' ] ) {
141 $msg = $this->context->msg(
'template-protected' );
142 } elseif ( $restrictions === [
'autoconfirmed' ] ) {
143 $msg = $this->context->msg(
'template-semiprotected' );
145 if ( $msg && !$msg->isDisabled() ) {
146 $protected = $msg->parse();
151 foreach ( $restrictions as $r ) {
152 $msgs[] = $this->context->msg(
"restriction-level-$r" )->parse();
154 $protected = $this->context->msg(
'parentheses' )
155 ->rawParams( $this->context->getLanguage()->commaList( $msgs ) )->escaped();
169 if ( $titleObj->quickUserCan(
'edit', $this->context->getUser() ) ) {
170 $linkMsg =
'editlink';
172 $linkMsg =
'viewsourcelink';
175 return $this->linkRenderer->makeLink(
177 $this->context->msg( $linkMsg )->text(),
179 [
'action' =>
'edit' ]
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 probably a stub 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))