Go to the documentation of this file.
16 parent::__construct(
'Gadgets',
'',
true );
24 $parts = explode(
'/', $par );
26 if (
count( $parts ) == 2 && $parts[0] ==
'export' ) {
34 return 'gadget-' . Sanitizer::escapeId( $gadgetName, [
'noninitial' ] );
43 $output->setPageTitle( $this->
msg(
'gadgets-title' ) );
44 $output->addWikiMsg(
'gadgets-pagetext' );
54 if ( !
$lang->equals( MediaWikiServices::getInstance()->getContentLanguage() ) ) {
55 $langSuffix =
"/" .
$lang->getCode();
60 $editInterfaceMessage = $this->
getUser()->isAllowed(
'editinterface' )
70 [], [
'action' =>
'edit' ] )
72 $lnk =
"    [$lnkTarget]";
74 $ttext = $this->
msg(
"gadget-section-$section" )->parse();
87 foreach ( $entries
as $gadget ) {
88 $name = $gadget->getName();
97 $this->
msg( $editInterfaceMessage )->
text(),
99 [
'action' =>
'edit' ]
103 $this->
msg(
'gadgets-export' )->
text()
106 $nameHtml = $this->
msg(
"gadget-{$name}" )->parse();
113 $actionsHtml =
'  ' .
114 $this->
msg(
'parentheses' )->rawParams(
$lang->pipeList( $links ) )->escaped();
117 $nameHtml . $actionsHtml
122 $needLineBreakAfter =
true;
125 if ( $needLineBreakAfter ) {
129 $this->
msg(
'gadgets-uses' )->escaped() .
130 $this->
msg(
'colon-separator' )->escaped()
133 foreach ( $gadget->getPeers()
as $peer ) {
136 [
'href' =>
'#' . $this->
makeAnchor( $peer ) ],
140 foreach ( $gadget->getScriptsAndStyles()
as $codePage ) {
150 if ( $gadget->getLegacyScripts() ) {
151 if ( $needLineBreakAfter ) {
156 [
'class' =>
'mw-gadget-legacy errorbox' ],
157 $this->
msg(
'gadgets-legacy' )->parse()
159 $needLineBreakAfter =
true;
164 foreach ( $gadget->getRequiredRights()
as $right ) {
167 [
'title' => $this->
msg(
"right-$right" )->
plain() ],
172 if ( $needLineBreakAfter ) {
176 $this->
msg(
'gadgets-required-rights', implode(
"\n", $rights ),
count( $rights ) )->parse()
178 $needLineBreakAfter =
false;
182 $requiredSkins = $gadget->getRequiredSkins();
184 if ( is_array( $requiredSkins ) ) {
187 foreach ( $requiredSkins
as $skinid ) {
188 if ( isset( $validskins[$skinid] ) ) {
189 $skins[] = $this->
msg(
"skinname-$skinid" )->plain();
195 if ( $needLineBreakAfter ) {
199 $this->
msg(
'gadgets-required-skins',
$lang->commaList( $skins ) )
200 ->numParams(
count( $skins ) )->parse()
202 $needLineBreakAfter =
true;
207 if ( $gadget->isOnByDefault() ) {
208 if ( $needLineBreakAfter ) {
211 $output->addHTML( $this->
msg(
'gadgets-default' )->parse() );
212 $needLineBreakAfter =
true;
234 }
catch ( InvalidArgumentException
$e ) {
235 $output->showErrorPage(
'error',
'gadgets-not-found', [ $gadget ] );
240 $output->setPageTitle( $this->
msg(
'gadgets-export-title' ) );
241 $output->addWikiMsg(
'gadgets-export-text', $gadget, $g->getDefinition() );
243 $exportList =
"MediaWiki:gadget-$gadget\n";
244 foreach ( $g->getScriptsAndStyles()
as $page ) {
245 $exportList .=
"$page\n";
251 ->addHiddenField(
'pages', $exportList )
252 ->addHiddenField(
'wpDownload',
'1' )
253 ->addHiddenField(
'templates',
'1' )
256 ->setSubmitText( $this->
msg(
'gadgets-export-download' )->
text() )
258 ->displayForm(
false );
getPageTitle( $subpage=false)
Get a self-referential title object.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
msg( $key)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
if(!isset( $args[0])) $lang
$wgScript
The URL path to index.php.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getLanguage()
Shortcut to get user's language.
showExportForm( $gadget)
Exports a gadget with its dependencies in a serialized form.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static getSkinNames()
Fetch the set of available skins.
static closeElement( $element)
Returns "</$element>".
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
static singleton()
Get the configured default GadgetRepo.
showMainForm()
Displays form showing the list of installed gadgets.
getContext()
Gets the context this SpecialPage is executed in.
Allows to change the fields on the form that will be generated $name
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Parent class for all special pages.
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
static closeElement( $element)
Shortcut to close an XML element.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
MediaWiki Linker LinkRenderer null $linkRenderer
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
execute( $par)
Main execution function.