14 parent::__construct(
'Gadgets',
'',
true );
22 $parts = explode(
'/', $par );
24 if ( count( $parts ) == 2 && $parts[0] ==
'export' ) {
32 return 'gadget-' . Sanitizer::escapeId( $gadgetName, [
'noninitial' ] );
43 $output->setPageTitle( $this->
msg(
'gadgets-title' ) );
44 $output->addWikiMsg(
'gadgets-pagetext' );
55 $langSuffix =
"/" .
$lang->getCode();
60 $editInterfaceMessage = $this->
getUser()->isAllowed(
'editinterface' )
65 foreach ( $gadgets as
$section => $entries ) {
67 $t = Title::makeTitleSafe( NS_MEDIAWIKI,
"Gadget-section-$section$langSuffix" );
70 [], [
'action' =>
'edit' ] )
72 $lnk =
"    [$lnkTarget]";
74 $ttext = $this->
msg(
"gadget-section-$section" )->parse();
77 $output->addHTML( Xml::closeElement(
'ul' ) .
"\n" );
81 $output->addHTML( Html::rawElement(
'h2', [], $ttext . $lnk ) .
"\n" );
87 foreach ( $entries as $gadget ) {
88 $name = $gadget->getName();
89 $t = Title::makeTitleSafe( NS_MEDIAWIKI,
"Gadget-{$name}$langSuffix" );
97 $this->
msg( $editInterfaceMessage )->
text(),
99 [
'action' =>
'edit' ]
103 $this->
msg(
'gadgets-export' )->
text()
106 $ttext = $this->
msg(
"gadget-{$name}" )->parse();
110 $output->addHTML( Xml::openElement(
'ul' ) );
113 $actions =
'  ' .
114 $this->
msg(
'parentheses' )->rawParams(
$lang->pipeList( $links ) )->escaped();
116 Xml::openElement(
'li', [
'id' => $this->
makeAnchor( $name ) ] ) .
117 $ttext . $actions .
"<br />" .
118 $this->
msg(
'gadgets-uses' )->escaped() .
119 $this->
msg(
'colon-separator' )->escaped()
123 foreach ( $gadget->getPeers() as $peer ) {
124 $lnk[] = Html::element(
126 [
'href' =>
'#' . $this->
makeAnchor( $peer ) ],
130 foreach ( $gadget->getScriptsAndStyles() as $codePage ) {
131 $t = Title::newFromText( $codePage );
140 if ( $gadget->getLegacyScripts() ) {
141 $output->addHTML(
'<br />' . Html::rawElement(
143 [
'class' =>
'mw-gadget-legacy errorbox' ],
144 $this->
msg(
'gadgets-legacy' )->parse()
149 foreach ( $gadget->getRequiredRights() as $right ) {
150 $rights[] =
'* ' . $this->
msg(
"right-$right" )->plain();
152 if ( count( $rights ) ) {
154 $this->
msg(
'gadgets-required-rights', implode(
"\n", $rights ), count( $rights ) )->parse()
158 $requiredSkins = $gadget->getRequiredSkins();
160 if ( is_array( $requiredSkins ) ) {
163 foreach ( $requiredSkins as $skinid ) {
164 if ( isset( $validskins[$skinid] ) ) {
165 $skins[] = $this->
msg(
"skinname-$skinid" )->plain();
170 if ( count( $skins ) ) {
173 $this->
msg(
'gadgets-required-skins',
$lang->commaList( $skins ) )
174 ->numParams( count( $skins ) )->parse()
179 if ( $gadget->isOnByDefault() ) {
180 $output->addHTML(
'<br />' . $this->
msg(
'gadgets-default' )->parse() );
183 $output->addHTML( Xml::closeElement(
'li' ) .
"\n" );
188 $output->addHTML( Xml::closeElement(
'ul' ) .
"\n" );
202 }
catch ( InvalidArgumentException
$e ) {
203 $output->showErrorPage(
'error',
'gadgets-not-found', [ $gadget ] );
208 $output->setPageTitle( $this->
msg(
'gadgets-export-title' ) );
209 $output->addWikiMsg(
'gadgets-export-text', $gadget, $g->getDefinition() );
211 $exportList =
"MediaWiki:gadget-$gadget\n";
212 foreach ( $g->getScriptsAndStyles() as $page ) {
213 $exportList .=
"$page\n";
216 $output->addHTML( Html::openElement(
'form', [
'method' =>
'get',
'action' =>
$wgScript ] )
218 . Html::hidden(
'pages', $exportList )
219 . Html::hidden(
'wpDownload',
'1' )
220 . Html::hidden(
'templates',
'1' )
221 . Xml::submitButton( $this->
msg(
'gadgets-export-download' )->
text() )
222 . Html::closeElement(
'form' )
$wgScript
The URL path to index.php.
static singleton()
Get the configured default GadgetRepo.
static getSkinNames()
Fetch the set of available skins.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
Main execution function.
showExportForm( $gadget)
Exports a gadget with its dependencies in a serialized form.
showMainForm()
Displays form showing the list of installed gadgets.
Parent class for all special pages.
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.
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,...
msg( $key)
Wrapper around wfMessage that sets the current context.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
MediaWiki Linker LinkRenderer null $linkRenderer
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
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
returning false will NOT prevent logging $e
if(!isset( $args[0])) $lang