13 protected $title =
false;
16 parent::__construct(
'CiteThisPage' );
24 parent::execute(
$par );
25 if ( $this->title instanceof
Title ) {
32 $form->setMethod(
'get' );
36 if ( isset( $this->par ) ) {
45 'default' => $default,
46 'label-message' =>
'citethispage-change-target'
55 if ( strlen( $data[
'page'] ) ) {
56 $this->title = Title::newFromText( $data[
'page'] );
70 $title = Title::newFromText( $search );
71 if ( !$title || !$title->canExist() ) {
76 $result = SearchEngine::completionSearch( $search );
77 return array_map(
function ( $sub ) {
78 return $sub->getSuggestedTitle();
79 }, $result->getSuggestions() );
88 $revId = $title->getLatestRevID();
93 $revision = Revision::newFromTitle( $title, $revId );
95 $out->wrapWikiMsg(
'<div class="errorbox">$1</div>',
96 [
'citethispage-badrevision', $title->getPrefixedText(), $revId ] );
102 $parserOptions->setTimestamp( $revision->getTimestamp() );
107 $parser->setHook(
'citation', [ $this,
'citationTag' ] );
110 $this->citationParser = $this->
getParser();
121 $this->
getOutput()->addModuleStyles(
'ext.citeThisPage' );
123 'enableSectionEditLinks' =>
false,
131 $parserConf = $this->
getConfig()->get(
'ParserConf' );
132 return new $parserConf[
'class']( $parserConf );
141 $msg = $this->
msg(
'citethispage-content' )->inContentLanguage()->plain();
143 # With MediaWiki 1.20 the plain text files were deleted
144 # and the text moved into SpecialCite.i18n.php
145 # This code is kept for b/c in case an installation has its own file "citethispage-content-xx"
146 # for a previously not supported language.
148 $dir = __DIR__ .
'/../';
150 if ( file_exists(
"${dir}citethispage-content-$code" ) ) {
151 $msg = file_get_contents(
"${dir}citethispage-content-$code" );
152 } elseif ( file_exists(
"${dir}citethispage-content" ) ) {
153 $msg = file_get_contents(
"${dir}citethispage-content" );
166 $parserOptions = ParserOptions::newFromUser( $this->
getUser() );
167 $parserOptions->setDateFormat(
'default' );
172 $parserOptions->setTidy(
false );
174 return $parserOptions;
192 $ret = $this->citationParser->parse(
199 return $ret->getText( [
200 'enableSectionEditLinks' =>
false,
Special page which uses an HTMLForm to handle processing.
string $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)
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.
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
do that in ParserLimitReportFormat instead $parser
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 see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
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 see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out