Go to the documentation of this file.
18 parent::__construct(
'CiteThisPage' );
27 parent::execute(
$par );
28 if ( $this->title instanceof
Title ) {
39 if ( isset( $this->par ) ) {
48 'default' => $default,
49 'label-message' =>
'citethispage-change-target'
58 if ( strlen( $data[
'page'] ) ) {
80 return array_map(
function ( $sub ) {
81 return $sub->getSuggestedTitle();
82 }, $result->getSuggestions() );
98 $out->wrapWikiMsg(
'<div class="errorbox">$1</div>',
105 $parserOptions->setTimestamp( $revision->getTimestamp() );
110 $parser->setHook(
'citation', [ $this,
'citationTag' ] );
113 $this->citationParser = $this->
getParser();
115 $ret = $parser->parse(
124 $this->
getOutput()->addModuleStyles(
'ext.citeThisPage' );
125 $this->
getOutput()->addParserOutputContent( $ret, [
126 'enableSectionEditLinks' =>
false,
134 $parserConf = $this->
getConfig()->get(
'ParserConf' );
135 return new $parserConf[
'class']( $parserConf );
144 $msg = $this->
msg(
'citethispage-content' )->inContentLanguage()->plain();
146 # With MediaWiki 1.20 the plain text files were deleted
147 # and the text moved into SpecialCite.i18n.php
148 # This code is kept for b/c in case an installation has its own file "citethispage-content-xx"
149 # for a previously not supported language.
151 $dir = __DIR__ .
'/../';
152 $code = MediaWikiServices::getInstance()->getContentLanguage()
154 if ( file_exists(
"${dir}citethispage-content-$code" ) ) {
155 $msg = file_get_contents(
"${dir}citethispage-content-$code" );
156 } elseif ( file_exists(
"${dir}citethispage-content" ) ) {
157 $msg = file_get_contents(
"${dir}citethispage-content" );
171 $parserOptions->setDateFormat(
'default' );
172 $parserOptions->setInterfaceMessage(
true );
177 $parserOptions->setTidy(
false );
179 return $parserOptions;
197 $ret = $this->citationParser->parse(
204 return $ret->getText( [
205 'enableSectionEditLinks' =>
false,
getPageTitle( $subpage=false)
Get a self-referential title object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getOutput()
Get the OutputPage being used for this instance.
showCitations(Title $title, $revId)
getContentText()
Get the content to parse.
citationTag( $text, $params, Parser $parser)
Implements the <citation> tag.
getPrefixedText()
Get the prefixed title with spaces.
onSubmit(array $data)
Process the form on POST submission.
Special page which uses an HTMLForm to handle processing.
requiresWrite()
Whether this action requires the wiki not to be locked.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getConfig()
Shortcut to get main config object.
getDisplayFormat()
Get display format for the form.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
requiresUnblock()
Whether this action cannot be executed by a blocked user.
canExist()
Is this in a namespace that allows actual pages?
getFormFields()
Get an HTMLForm descriptor array.
string null $par
The sub-page of the special page.
getLatestRevID( $flags=0)
What is the page_latest field for this page?
getRequest()
Get the WebRequest being used for this instance.
getParserOptions()
Get the common ParserOptions for both parses.
completionSearch( $search)
Perform a completion search.
Represents a title within MediaWiki.
foreach(LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
static newFromUser( $user)
Get a ParserOptions object from a given user.