"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "extensions/Gadgets/includes/SpecialGadgets.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

SpecialGadgets.php  (mediawiki-1.31.1):SpecialGadgets.php  (mediawiki-1.32.0)
skipping to change at line 12 skipping to change at line 12
/** /**
* Special:Gadgets, provides a preview of MediaWiki:Gadgets. * Special:Gadgets, provides a preview of MediaWiki:Gadgets.
* *
* @file * @file
* @ingroup SpecialPage * @ingroup SpecialPage
* @author Daniel Kinzler, brightbyte.de * @author Daniel Kinzler, brightbyte.de
* @copyright © 2007 Daniel Kinzler * @copyright © 2007 Daniel Kinzler
* @license GPL-2.0-or-later * @license GPL-2.0-or-later
*/ */
use MediaWiki\MediaWikiServices;
class SpecialGadgets extends SpecialPage { class SpecialGadgets extends SpecialPage {
public function __construct() { public function __construct() {
parent::__construct( 'Gadgets', '', true ); parent::__construct( 'Gadgets', '', true );
} }
/** /**
* Main execution function * Main execution function
* @param string $par Parameters passed to the page * @param string $par Parameters passed to the page
*/ */
public function execute( $par ) { public function execute( $par ) {
skipping to change at line 39 skipping to change at line 41
} }
private function makeAnchor( $gadgetName ) { private function makeAnchor( $gadgetName ) {
return 'gadget-' . Sanitizer::escapeId( $gadgetName, [ 'noninitia l' ] ); return 'gadget-' . Sanitizer::escapeId( $gadgetName, [ 'noninitia l' ] );
} }
/** /**
* Displays form showing the list of installed gadgets * Displays form showing the list of installed gadgets
*/ */
public function showMainForm() { public function showMainForm() {
global $wgContLang;
$output = $this->getOutput(); $output = $this->getOutput();
$this->setHeaders(); $this->setHeaders();
$output->setPageTitle( $this->msg( 'gadgets-title' ) ); $output->setPageTitle( $this->msg( 'gadgets-title' ) );
$output->addWikiMsg( 'gadgets-pagetext' ); $output->addWikiMsg( 'gadgets-pagetext' );
$gadgets = GadgetRepo::singleton()->getStructuredList(); $gadgets = GadgetRepo::singleton()->getStructuredList();
if ( !$gadgets ) { if ( !$gadgets ) {
return; return;
} }
$output->disallowUserJs(); $output->disallowUserJs();
$lang = $this->getLanguage(); $lang = $this->getLanguage();
$langSuffix = ""; $langSuffix = "";
if ( $lang->getCode() != $wgContLang->getCode() ) { if ( !$lang->equals( MediaWikiServices::getInstance()->getContent Language() ) ) {
$langSuffix = "/" . $lang->getCode(); $langSuffix = "/" . $lang->getCode();
} }
$listOpen = false; $listOpen = false;
$editInterfaceMessage = $this->getUser()->isAllowed( 'editinterfa ce' ) $editInterfaceMessage = $this->getUser()->isAllowed( 'editinterfa ce' )
? 'edit' ? 'edit'
: 'viewsource'; : 'viewsource';
$linkRenderer = $this->getLinkRenderer(); $linkRenderer = $this->getLinkRenderer();
skipping to change at line 106 skipping to change at line 106
$t, $t,
$this->msg( $editInterfaceMessage )->text (), $this->msg( $editInterfaceMessage )->text (),
[], [],
[ 'action' => 'edit' ] [ 'action' => 'edit' ]
); );
$links[] = $linkRenderer->makeLink( $links[] = $linkRenderer->makeLink(
$this->getPageTitle( "export/{$name}" ), $this->getPageTitle( "export/{$name}" ),
$this->msg( 'gadgets-export' )->text() $this->msg( 'gadgets-export' )->text()
); );
$ttext = $this->msg( "gadget-{$name}" )->parse(); $nameHtml = $this->msg( "gadget-{$name}" )->parse ();
if ( !$listOpen ) { if ( !$listOpen ) {
$listOpen = true; $listOpen = true;
$output->addHTML( Xml::openElement( 'ul' ) ); $output->addHTML( Html::openElement( 'ul' ) );
} }
$actions = '  ' . $actionsHtml = '  ' .
$this->msg( 'parentheses' )->rawParams( $ lang->pipeList( $links ) )->escaped(); $this->msg( 'parentheses' )->rawParams( $ lang->pipeList( $links ) )->escaped();
$output->addHTML( $output->addHTML(
Xml::openElement( 'li', [ 'id' => $this-> Html::openElement( 'li', [ 'id' => $this-
makeAnchor( $name ) ] ) . >makeAnchor( $name ) ] ) .
$ttext . $actions . "<br />" . $nameHtml . $actionsHtml
$this->msg( 'gadgets-uses' )->esc );
aped() . // Whether the next portion of the list item cont
$this->msg( 'colon-separator' )-> ents needs
escaped() // a line break between it and the next portion.
// This is set to false after lists, but true aft
er lines of text.
$needLineBreakAfter = true;
// Portion: Show files, dependencies, speers
if ( $needLineBreakAfter ) {
$output->addHTML( '<br />' );
}
$output->addHTML(
$this->msg( 'gadgets-uses' )->escaped() .
$this->msg( 'colon-separator' )->escaped(
)
); );
$lnk = []; $lnk = [];
foreach ( $gadget->getPeers() as $peer ) { foreach ( $gadget->getPeers() as $peer ) {
$lnk[] = Html::element( $lnk[] = Html::element(
'a', 'a',
[ 'href' => '#' . $this->makeAnch or( $peer ) ], [ 'href' => '#' . $this->makeAnch or( $peer ) ],
$peer $peer
); );
} }
foreach ( $gadget->getScriptsAndStyles() as $code Page ) { foreach ( $gadget->getScriptsAndStyles() as $code Page ) {
$t = Title::newFromText( $codePage ); $t = Title::newFromText( $codePage );
if ( !$t ) { if ( !$t ) {
continue; continue;
} }
$lnk[] = $linkRenderer->makeLink( $t, $t- >getText() ); $lnk[] = $linkRenderer->makeLink( $t, $t- >getText() );
} }
$output->addHTML( $lang->commaList( $lnk ) ); $output->addHTML( $lang->commaList( $lnk ) );
// Portion: Legacy scripts
if ( $gadget->getLegacyScripts() ) { if ( $gadget->getLegacyScripts() ) {
$output->addHTML( '<br />' . Html::rawEle if ( $needLineBreakAfter ) {
ment( $output->addHTML( '<br />' );
}
$output->addHTML( Html::rawElement(
'span', 'span',
[ 'class' => 'mw-gadget-legacy er rorbox' ], [ 'class' => 'mw-gadget-legacy er rorbox' ],
$this->msg( 'gadgets-legacy' )->p arse() $this->msg( 'gadgets-legacy' )->p arse()
) ); ) );
$needLineBreakAfter = true;
} }
// Portion: Show required rights (optional)
$rights = []; $rights = [];
foreach ( $gadget->getRequiredRights() as $right ) { foreach ( $gadget->getRequiredRights() as $right ) {
$rights[] = '* ' . $this->msg( "right-$ri $rights[] = '* ' . Html::element(
ght" )->plain(); 'code',
[ 'title' => $this->msg( "right-$
right" )->plain() ],
$right
);
} }
if ( count( $rights ) ) { if ( $rights ) {
$output->addHTML( '<br />' . if ( $needLineBreakAfter ) {
$this->msg( 'gadgets-requ $output->addHTML( '<br />' );
ired-rights', implode( "\n", $rights ), count( $rights ) )->parse() }
$output->addHTML(
$this->msg( 'gadgets-required-rig
hts', implode( "\n", $rights ), count( $rights ) )->parse()
); );
$needLineBreakAfter = false;
} }
// Portion: Show required skins (optional)
$requiredSkins = $gadget->getRequiredSkins(); $requiredSkins = $gadget->getRequiredSkins();
// $requiredSkins can be an array or true (if all skins are supported) // $requiredSkins can be an array, or true (if al l skins are supported)
if ( is_array( $requiredSkins ) ) { if ( is_array( $requiredSkins ) ) {
$skins = []; $skins = [];
$validskins = Skin::getSkinNames(); $validskins = Skin::getSkinNames();
foreach ( $requiredSkins as $skinid ) { foreach ( $requiredSkins as $skinid ) {
if ( isset( $validskins[$skinid] ) ) { if ( isset( $validskins[$skinid] ) ) {
$skins[] = $this->msg( "s kinname-$skinid" )->plain(); $skins[] = $this->msg( "s kinname-$skinid" )->plain();
} else { } else {
$skins[] = $skinid; $skins[] = $skinid;
} }
} }
if ( count( $skins ) ) { if ( $skins ) {
if ( $needLineBreakAfter ) {
$output->addHTML( '<br />
' );
}
$output->addHTML( $output->addHTML(
'<br />' .
$this->msg( 'gadgets-requ ired-skins', $lang->commaList( $skins ) ) $this->msg( 'gadgets-requ ired-skins', $lang->commaList( $skins ) )
->numParams( coun t( $skins ) )->parse() ->numParams( coun t( $skins ) )->parse()
); );
$needLineBreakAfter = true;
} }
} }
// Portion: Show on by default (optional)
if ( $gadget->isOnByDefault() ) { if ( $gadget->isOnByDefault() ) {
$output->addHTML( '<br />' . $this->msg( if ( $needLineBreakAfter ) {
'gadgets-default' )->parse() ); $output->addHTML( '<br />' );
}
$output->addHTML( $this->msg( 'gadgets-de
fault' )->parse() );
$needLineBreakAfter = true;
} }
$output->addHTML( Xml::closeElement( 'li' ) . "\n " ); $output->addHTML( Html::closeElement( 'li' ) . "\ n" );
} }
} }
if ( $listOpen ) { if ( $listOpen ) {
$output->addHTML( Xml::closeElement( 'ul' ) . "\n" ); $output->addHTML( Html::closeElement( 'ul' ) . "\n" );
} }
} }
/** /**
* Exports a gadget with its dependencies in a serialized form * Exports a gadget with its dependencies in a serialized form
* @param string $gadget Name of gadget to export * @param string $gadget Name of gadget to export
*/ */
public function showExportForm( $gadget ) { public function showExportForm( $gadget ) {
global $wgScript; global $wgScript;
 End of changes. 26 change blocks. 
31 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)