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'] ) ) {
59 $this->title = Title::newFromText( $data[
'page'] );
73 $title = Title::newFromText( $search );
79 $result = SearchEngine::completionSearch( $search );
80 return array_map(
function ( $sub ) {
81 return $sub->getSuggestedTitle();
82 }, $result->getSuggestions() );
96 $revision = Revision::newFromTitle(
$title, $revId );
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" );
170 $parserOptions = ParserOptions::newFromUser( $this->
getUser() );
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,
foreach(LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode
Special page which uses an HTMLForm to handle processing.
string null $par
The sub-page of the special page.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
onSubmit(array $data)
Process the form on POST submission.
getFormFields()
Get an HTMLForm descriptor array.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getParserOptions()
Get the common ParserOptions for both parses.
showCitations(Title $title, $revId)
requiresUnblock()
Whether this action cannot be executed by a blocked user.
requiresWrite()
Whether this action requires the wiki not to be locked.
getContentText()
Get the content to parse.
getDisplayFormat()
Get display format for the form.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
citationTag( $text, $params, Parser $parser)
Implements the <citation> tag.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Represents a title within MediaWiki.
canExist()
Is this in a namespace that allows actual pages?
getLatestRevID( $flags=0)
What is the page_latest field for this page?
getPrefixedText()
Get the prefixed title with spaces.