mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-12-18 01:40:31 +00:00
Maintenance for Gadgets extension.
* Use Message class. * Redice globals usage. * Update .gitignore. Change-Id: I087c8209b1a7ccf63171a2c14c8809eed90a297b
This commit is contained in:
parent
eced649f3f
commit
bf416b175a
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
*~
|
||||
*.kate-swp
|
||||
.*.swp
|
||||
.idea
|
||||
|
|
|
@ -107,11 +107,11 @@ class ApiQueryGadgets extends ApiQueryBase {
|
|||
* @return bool
|
||||
*/
|
||||
private function isNeeded( Gadget $gadget ) {
|
||||
global $wgUser;
|
||||
$user = $this->getUser();
|
||||
|
||||
return ( $this->neededIds === false || isset( $this->neededIds[$gadget->getName()] ) )
|
||||
&& ( !$this->listAllowed || $gadget->isAllowed( $wgUser ) )
|
||||
&& ( !$this->listEnabled || $gadget->isEnabled( $wgUser ) );
|
||||
&& ( !$this->listAllowed || $gadget->isAllowed( $user ) )
|
||||
&& ( !$this->listEnabled || $gadget->isEnabled( $user ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,7 +87,7 @@ class GadgetHooks {
|
|||
}
|
||||
|
||||
if ( $section !== '' ) {
|
||||
$section = wfMsgExt( "gadget-section-$section", 'parseinline' );
|
||||
$section = wfMessage( "gadget-section-$section" )->parse();
|
||||
|
||||
if ( count ( $available ) ) {
|
||||
$options[$section] = $available;
|
||||
|
@ -103,7 +103,7 @@ class GadgetHooks {
|
|||
'label' => ' ',
|
||||
'default' => Xml::tags( 'tr', array(),
|
||||
Xml::tags( 'td', array( 'colspan' => 2 ),
|
||||
wfMsgExt( 'gadgets-prefstext', 'parse' ) ) ),
|
||||
wfMessage( 'gadgets-prefstext' )->parseAsBlock() ) ),
|
||||
'section' => 'gadgets',
|
||||
'raw' => 1,
|
||||
'rawrow' => 1,
|
||||
|
@ -152,8 +152,6 @@ class GadgetHooks {
|
|||
* @return bool
|
||||
*/
|
||||
public static function beforePageDisplay( $out ) {
|
||||
global $wgUser;
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
||||
$gadgets = Gadget::loadList();
|
||||
|
@ -169,8 +167,9 @@ class GadgetHooks {
|
|||
/**
|
||||
* @var $gadget Gadget
|
||||
*/
|
||||
$user = $out->getUser();
|
||||
foreach ( $gadgets as $gadget ) {
|
||||
if ( $gadget->isEnabled( $wgUser ) && $gadget->isAllowed( $wgUser ) ) {
|
||||
if ( $gadget->isEnabled( $user ) && $gadget->isAllowed( $user ) ) {
|
||||
if ( $gadget->hasModule() ) {
|
||||
$out->addModuleStyles( $gadget->getModuleName() );
|
||||
$out->addModules( $gadget->getModuleName() );
|
||||
|
|
Loading…
Reference in a new issue