mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CookieWarning
synced 2024-11-23 22:03:41 +00:00
Use short array syntax instead of array()
Change-Id: I22f24bf047ff8bb476000bfbf879cc7612c10c27
This commit is contained in:
parent
45d70926ed
commit
12137c66d8
|
@ -52,7 +52,7 @@ class CookieWarningHooks {
|
|||
if ( $moreLink ) {
|
||||
$moreLink = Html::element(
|
||||
'a',
|
||||
array( 'href' => $moreLink ),
|
||||
[ 'href' => $moreLink ],
|
||||
$sk->msg( 'cookiewarning-moreinfo-label' )->text()
|
||||
);
|
||||
}
|
||||
|
@ -62,25 +62,25 @@ class CookieWarningHooks {
|
|||
}
|
||||
$tpl->data['headelement'] .= Html::openElement(
|
||||
'div',
|
||||
array( 'class' => 'mw-cookiewarning-container' )
|
||||
[ 'class' => 'mw-cookiewarning-container' ]
|
||||
) .
|
||||
Html::openElement(
|
||||
'div',
|
||||
array( 'class' => 'mw-cookiewarning-text' )
|
||||
[ 'class' => 'mw-cookiewarning-text' ]
|
||||
) .
|
||||
Html::element(
|
||||
'span',
|
||||
array(),
|
||||
[],
|
||||
$sk->msg( 'cookiewarning-info' )->text()
|
||||
) .
|
||||
$moreLink .
|
||||
Html::openElement( 'form', array( 'method' => 'POST' ) ) .
|
||||
Html::openElement( 'form', [ 'method' => 'POST' ] ) .
|
||||
Html::submitButton(
|
||||
$sk->msg( 'cookiewarning-ok-label' )->text(),
|
||||
array(
|
||||
[
|
||||
'name' => 'disablecookiewarning',
|
||||
'class' => 'mw-cookiewarning-dismiss'
|
||||
)
|
||||
]
|
||||
) .
|
||||
Html::closeElement( 'form' ) .
|
||||
Html::closeElement( 'div' ) .
|
||||
|
@ -122,8 +122,8 @@ class CookieWarningHooks {
|
|||
*/
|
||||
public static function onBeforePageDisplay( OutputPage $out ) {
|
||||
if ( self::showWarning( $out->getContext() ) ) {
|
||||
$out->addModuleStyles( array( 'ext.CookieWarning.styles' ) );
|
||||
$out->addModules( array( 'ext.CookieWarning' ) );
|
||||
$out->addModuleStyles( [ 'ext.CookieWarning.styles' ] );
|
||||
$out->addModules( [ 'ext.CookieWarning' ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,10 +160,10 @@ class CookieWarningHooks {
|
|||
* @return bool
|
||||
*/
|
||||
public static function onGetPreferences( User $user, &$defaultPreferences ) {
|
||||
$defaultPreferences['cookiewarning_dismissed'] = array(
|
||||
$defaultPreferences['cookiewarning_dismissed'] = [
|
||||
'type' => 'api',
|
||||
'default' => '0',
|
||||
);
|
||||
];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
|
|||
public function testOnSkinTemplateOutputPageBeforeExec( $enabled, $morelinkConfig,
|
||||
$morelinkCookieWarningMsg, $morelinkCookiePolicyMsg, $expectedLink
|
||||
) {
|
||||
$this->setMwGlobals( array(
|
||||
$this->setMwGlobals( [
|
||||
'wgCookieWarningEnabled' => $enabled,
|
||||
'wgCookieWarningMoreUrl' => $morelinkConfig,
|
||||
) );
|
||||
] );
|
||||
if ( $morelinkCookieWarningMsg ) {
|
||||
$title = Title::newFromText( 'cookiewarning-more-link', NS_MEDIAWIKI );
|
||||
$wikiPage = WikiPage::factory( $title );
|
||||
|
@ -50,8 +50,8 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function providerOnSkinTemplateOutputPageBeforeExec() {
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
// $wgCookieWarningEnabled
|
||||
true,
|
||||
// $wgCookieWarningMoreUrl
|
||||
|
@ -62,58 +62,58 @@ class CookieWarningHooksTest extends MediaWikiLangTestCase {
|
|||
false,
|
||||
// expected cookie warning link (when string), nothing if false
|
||||
'',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
true,
|
||||
'http://google.de',
|
||||
false,
|
||||
false,
|
||||
'<a href="http://google.de">More information</a>',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
true,
|
||||
'',
|
||||
'http://google.de',
|
||||
false,
|
||||
'<a href="http://google.de">More information</a>',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'http://google.de',
|
||||
'<a href="http://google.de">More information</a>',
|
||||
),
|
||||
],
|
||||
// the config should be the used, if set (no matter if the messages are used or not)
|
||||
array(
|
||||
[
|
||||
true,
|
||||
'http://google.de',
|
||||
false,
|
||||
'http://google123.de',
|
||||
'<a href="http://google.de">More information</a>',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
true,
|
||||
'http://google.de',
|
||||
'http://google1234.de',
|
||||
'http://google123.de',
|
||||
'<a href="http://google.de">More information</a>',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
true,
|
||||
'',
|
||||
'http://google.de',
|
||||
'http://google123.de',
|
||||
'<a href="http://google.de">More information</a>',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue