Go to the documentation of this file.
16 parent::__construct(
'Gadgets',
'',
true );
23 $parts = explode(
'/', $par );
25 if ( count( $parts ) == 2 && $parts[0] ==
'export' ) {
43 $output->setPageTitle( $this->
msg(
'gadgets-title' ) );
44 $output->addWikiMsg(
'gadgets-pagetext' );
51 $output->disallowUserJs();
54 if ( !
$lang->equals( MediaWikiServices::getInstance()->getContentLanguage() ) ) {
55 $langSuffix =
"/" .
$lang->getCode();
60 $editInterfaceMessage = $this->
getUser()->isAllowed(
'editinterface' )
65 foreach ( $gadgets as $section => $entries ) {
66 if ( $section !==
false && $section !==
'' ) {
70 [], [
'action' =>
'edit' ] )
71 : htmlspecialchars( $section );
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 ) {
126 $output->addHTML(
'<br />' );
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 ) {
147 $output->addHTML(
$lang->commaList( $lnk ) );
150 if ( $gadget->getLegacyScripts() ) {
151 if ( $needLineBreakAfter ) {
152 $output->addHTML(
'<br />' );
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 ) {
173 $output->addHTML(
'<br />' );
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 ) {
196 $output->addHTML(
'<br />' );
199 $this->
msg(
'gadgets-required-skins',
$lang->commaList( $skins ) )
200 ->numParams( count( $skins ) )->parse()
202 $needLineBreakAfter =
true;
207 if ( $gadget->isOnByDefault() ) {
208 if ( $needLineBreakAfter ) {
209 $output->addHTML(
'<br />' );
211 $output->addHTML( $this->
msg(
'gadgets-default' )->parse() );
212 $needLineBreakAfter =
true;
235 }
catch ( InvalidArgumentException $e ) {
236 $output->showErrorPage(
'error',
'gadgets-not-found', [ $gadget ] );
241 $output->setPageTitle( $this->
msg(
'gadgets-export-title' ) );
242 $output->addWikiMsg(
'gadgets-export-text', $gadget, $g->getDefinition() );
244 $exportList =
"MediaWiki:gadget-$gadget\n";
245 foreach ( $g->getScriptsAndStyles() as $page ) {
246 $exportList .=
"$page\n";
252 ->addHiddenField(
'pages', $exportList )
253 ->addHiddenField(
'wpDownload',
'1' )
254 ->addHiddenField(
'templates',
'1' )
257 ->setSubmitText( $this->
msg(
'gadgets-export-download' )->text() )
259 ->displayForm(
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.
if(!isset( $args[0])) $lang
static escapeIdForAttribute( $id, $mode=self::ID_PRIMARY)
Given a section name or other user-generated or otherwise unsafe string, escapes it to be a valid HTM...
$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.
static getSkinNames()
Fetch the set of available skins.
static closeElement( $element)
Returns "</$element>".
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
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.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Parent class for all special pages.
static closeElement( $element)
Shortcut to close an XML element.
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()).