includes: Code cleanup for the Minerva codebase
These code cleanups involves the following; - Consistency in using single quotes as already been used in the code base for loading resource loader test modules. - Remove irrelevant else cases when there is a return statement in the if cases. - Remove passing objects as references as they're already by default passed by references so no need for &. - Proper call to getLocalURL() instead of getLocalUrl() though PHP doesn't really care much about the case but let's use the function names as they are. - Fix PHPDoc params, remove useless $skin wrongly placed in the comment. The changes in this patch doesn't affect the behavior of the current system in any way. Change-Id: I9c886c058592486b7190b9567f79c496855f4ae3
This commit is contained in:
parent
71f6e5519a
commit
b3c5745808
|
@ -93,10 +93,10 @@ class MinervaHooks {
|
||||||
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
|
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
|
||||||
*
|
*
|
||||||
* @param array &$testModules
|
* @param array &$testModules
|
||||||
* @param ResourceLoader &$resourceLoader
|
* @param ResourceLoader $resourceLoader
|
||||||
*/
|
*/
|
||||||
public static function onResourceLoaderTestModules( array &$testModules,
|
public static function onResourceLoaderTestModules( array &$testModules,
|
||||||
ResourceLoader &$resourceLoader
|
ResourceLoader $resourceLoader
|
||||||
) {
|
) {
|
||||||
$testModule = [
|
$testModule = [
|
||||||
'dependencies' => [
|
'dependencies' => [
|
||||||
|
@ -118,9 +118,9 @@ class MinervaHooks {
|
||||||
'resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.js',
|
'resources/skins.minerva.scripts/page-issues/overlay/IssueNotice.js',
|
||||||
'resources/skins.minerva.scripts/page-issues/overlay/IssueList.js',
|
'resources/skins.minerva.scripts/page-issues/overlay/IssueList.js',
|
||||||
'resources/skins.minerva.scripts/page-issues/overlay/pageIssuesOverlay.js',
|
'resources/skins.minerva.scripts/page-issues/overlay/pageIssuesOverlay.js',
|
||||||
"resources/skins.minerva.scripts/page-issues/page/PageIssueLearnMoreLink.js",
|
'resources/skins.minerva.scripts/page-issues/page/PageIssueLearnMoreLink.js',
|
||||||
"resources/skins.minerva.scripts/page-issues/page/PageIssueLink.js",
|
'resources/skins.minerva.scripts/page-issues/page/PageIssueLink.js',
|
||||||
"resources/skins.minerva.scripts/page-issues/page/pageIssueFormatter.js",
|
'resources/skins.minerva.scripts/page-issues/page/pageIssueFormatter.js',
|
||||||
'resources/skins.minerva.scripts/pageIssues.js',
|
'resources/skins.minerva.scripts/pageIssues.js',
|
||||||
'resources/skins.minerva.scripts/UriUtil.js',
|
'resources/skins.minerva.scripts/UriUtil.js',
|
||||||
'resources/skins.minerva.scripts/TitleUtil.js',
|
'resources/skins.minerva.scripts/TitleUtil.js',
|
||||||
|
@ -136,7 +136,7 @@ class MinervaHooks {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Expose templates module
|
// Expose templates module
|
||||||
$testModules['qunit']["tests.skins.minerva"] = $testModule;
|
$testModules['qunit']['tests.skins.minerva'] = $testModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,7 +170,7 @@ class MinervaHooks {
|
||||||
// Add default warning message to Special:UserLogin and Special:UserCreate
|
// Add default warning message to Special:UserLogin and Special:UserCreate
|
||||||
// if no warning message set.
|
// if no warning message set.
|
||||||
if (
|
if (
|
||||||
!$request->getVal( 'warning', null ) &&
|
!$request->getVal( 'warning' ) &&
|
||||||
!$special->getUser()->isLoggedIn() &&
|
!$special->getUser()->isLoggedIn() &&
|
||||||
!$request->wasPosted()
|
!$request->wasPosted()
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -128,9 +128,9 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
] + $data['historyLink'];
|
] + $data['historyLink'];
|
||||||
$templateParser = new TemplateParser( __DIR__ );
|
$templateParser = new TemplateParser( __DIR__ );
|
||||||
return $templateParser->processTemplate( 'history', $args );
|
return $templateParser->processTemplate( 'history', $args );
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +159,7 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
*/
|
*/
|
||||||
protected function getSecondaryActionsHtml() {
|
protected function getSecondaryActionsHtml() {
|
||||||
$baseClass = MinervaUI::buttonClass( '', 'button' );
|
$baseClass = MinervaUI::buttonClass( '', 'button' );
|
||||||
/** @var $skin SkinMinerva $skin */
|
/** @var SkinMinerva $skin */
|
||||||
$skin = $this->getSkin();
|
$skin = $this->getSkin();
|
||||||
$html = '';
|
$html = '';
|
||||||
// no secondary actions on the user page
|
// no secondary actions on the user page
|
||||||
|
@ -193,9 +193,9 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
$content .= $data['subject-page'];
|
$content .= $data['subject-page'];
|
||||||
}
|
}
|
||||||
return $content . Html::closeElement( 'div' );
|
return $content . Html::closeElement( 'div' );
|
||||||
} else {
|
|
||||||
return $data[ 'bodytext' ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $data[ 'bodytext' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,9 +210,9 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
__DIR__ . '/../../resources/skins.minerva.scripts/menu/' );
|
__DIR__ . '/../../resources/skins.minerva.scripts/menu/' );
|
||||||
|
|
||||||
return $templateParser->processTemplate( 'menu', $data['menu_data'] );
|
return $templateParser->processTemplate( 'menu', $data['menu_data'] );
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,7 +239,7 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
'headelement' => $data[ 'headelement' ],
|
'headelement' => $data[ 'headelement' ],
|
||||||
'menuButton' => $data['menuButton'],
|
'menuButton' => $data['menuButton'],
|
||||||
'siteheading' => $data['footer-site-heading-html'],
|
'siteheading' => $data['footer-site-heading-html'],
|
||||||
'mainPageURL' => Title::newMainPage()->getLocalUrl(),
|
'mainPageURL' => Title::newMainPage()->getLocalURL(),
|
||||||
// A button when clicked will submit the form
|
// A button when clicked will submit the form
|
||||||
// This is used so that on tablet devices with JS disabled the search button
|
// This is used so that on tablet devices with JS disabled the search button
|
||||||
// passes the value of input to the search
|
// passes the value of input to the search
|
||||||
|
|
Loading…
Reference in New Issue