Platonides has uploaded a new change for review.
https://gerrit.wikimedia.org/r/58231
Change subject: Fix numerous instances of indentation using spaces instead of
tabs.
......................................................................
Fix numerous instances of indentation using spaces instead of tabs.
Change-Id: Ia6ea9b9ebfc97af68dd94a3d66ccec51a5537328
---
M CentralNotice.php
M api/ApiCentralNoticeAllocations.php
M includes/BannerChooser.php
M includes/BannerMessageGroup.php
M special/SpecialBannerAllocation.php
M special/SpecialCentralNotice.php
M special/SpecialGlobalAllocation.php
M special/SpecialNoticeTemplate.php
M tests/ApiAllocationsTest.php
9 files changed, 70 insertions(+), 70 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice
refs/changes/31/58231/1
diff --git a/CentralNotice.php b/CentralNotice.php
index d5b66c9..00074c3 100644
--- a/CentralNotice.php
+++ b/CentralNotice.php
@@ -10,7 +10,7 @@
* @license GNU General Public Licence 2.0 or later
*/
- $wgExtensionCredits[ 'other' ][] = array(
+$wgExtensionCredits[ 'other' ][] = array(
'path' => __FILE__,
'name' => 'CentralNotice',
'author' => array(
@@ -305,7 +305,7 @@
if ( $wgNoticeUseTranslateExtension ) {
$wgAutoloadClasses[ 'BannerMessageGroup' ] =
$includeDir . 'BannerMessageGroup.php';
$wgHooks[ 'TranslatePostInitGroups' ][ ] =
'efRegisterMessageGroups';
- $wgHooks[ 'TranslateEventMessageGroupStateChange' ][] = array(
'BannerMessageGroup::updateBannerGroupStateHook' );
+ $wgHooks[ 'TranslateEventMessageGroupStateChange' ][] =
array( 'BannerMessageGroup::updateBannerGroupStateHook' );
}
$wgSpecialPages[ 'CentralNotice' ] = 'CentralNotice';
@@ -479,10 +479,10 @@
$vars[ 'wgCentralBannerDispatcher' ] = $wgCentralBannerDispatcher;
$vars[ 'wgCentralBannerRecorder' ] = $wgCentralBannerRecorder;
$vars[ 'wgNoticeXXCountries' ] = $wgNoticeXXCountries;
- $vars[ 'wgNoticeNumberOfBuckets' ] = $wgNoticeNumberOfBuckets;
- $vars[ 'wgNoticeBucketExpiry' ] = $wgNoticeBucketExpiry;
- $vars[ 'wgNoticeNumberOfControllerBuckets' ] =
$wgNoticeNumberOfControllerBuckets;
- $vars[ 'wgNoticeCookieShortExpiry' ] = $wgNoticeCookieShortExpiry;
+ $vars[ 'wgNoticeNumberOfBuckets' ] = $wgNoticeNumberOfBuckets;
+ $vars[ 'wgNoticeBucketExpiry' ] = $wgNoticeBucketExpiry;
+ $vars[ 'wgNoticeNumberOfControllerBuckets' ] =
$wgNoticeNumberOfControllerBuckets;
+ $vars[ 'wgNoticeCookieShortExpiry' ] = $wgNoticeCookieShortExpiry;
if ( $wgNoticeInfrastructure ) {
$vars[ 'wgNoticeCloseButton' ] = $wgNoticeCloseButton;
diff --git a/api/ApiCentralNoticeAllocations.php
b/api/ApiCentralNoticeAllocations.php
index 4105da9..e37dcfc 100644
--- a/api/ApiCentralNoticeAllocations.php
+++ b/api/ApiCentralNoticeAllocations.php
@@ -74,7 +74,7 @@
}
public function getParamDescription() {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
$params = array();
diff --git a/includes/BannerChooser.php b/includes/BannerChooser.php
index 3c1cb31..9ca5dd0 100644
--- a/includes/BannerChooser.php
+++ b/includes/BannerChooser.php
@@ -70,20 +70,20 @@
// Filter for device category
$filterColumn( $this->banners, 'device', $device );
- // Filter for the provided bucket.
+ // Filter for the provided bucket.
$this->banners = array_filter(
$this->banners,
function ( $banner ) use ( $bucket ) {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
- // In case we change the number of buckets available, will map
- // the banner bucket down
- $bannerBucket = intval( $banner[ 'bucket' ] ) %
$wgNoticeNumberOfBuckets;
+ // In case we change the number of buckets
available, will map
+ // the banner bucket down
+ $bannerBucket = intval( $banner[ 'bucket' ] ) %
$wgNoticeNumberOfBuckets;
- // Actual mapping. It is assumed the user always was randomly
choosing out
- // of a ring with $wgNoticeNumberOfBuckets choices. This
implies that we will
- // always be mapping the ring down, never up.
- $userBucket = intval( $bucket ) % intval( $banner[
'campaign_num_buckets' ] );
+ // Actual mapping. It is assumed the user
always was randomly choosing out
+ // of a ring with $wgNoticeNumberOfBuckets
choices. This implies that we will
+ // always be mapping the ring down, never up.
+ $userBucket = intval( $bucket ) % intval(
$banner[ 'campaign_num_buckets' ] );
return ( $bannerBucket === $userBucket );
}
diff --git a/includes/BannerMessageGroup.php b/includes/BannerMessageGroup.php
index afc784c..11aad67 100644
--- a/includes/BannerMessageGroup.php
+++ b/includes/BannerMessageGroup.php
@@ -19,16 +19,16 @@
*/
public function __construct( $namespace, $title ) {
- $titleObj = Title::makeTitle( $namespace, $title );
- $this->id = static::getTranslateGroupName( $title );
+ $titleObj = Title::makeTitle( $namespace, $title );
+ $this->id = static::getTranslateGroupName( $title );
// For internal usage we just want the name of the banner. In
the MediaWiki namespace
// this is stored with a prefix. Elsewhere (like the
CentralNotice namespace) it is
// just the page name.
$this->bannerName = str_replace( 'Centralnotice-template-', '',
$title );
- // And now set the label for the Translate UI
- $this->setLabel( $titleObj->getPrefixedText() );
+ // And now set the label for the Translate UI
+ $this->setLabel( $titleObj->getPrefixedText() );
}
/**
diff --git a/special/SpecialBannerAllocation.php
b/special/SpecialBannerAllocation.php
index 624fe7f..6bc6ee4 100644
--- a/special/SpecialBannerAllocation.php
+++ b/special/SpecialBannerAllocation.php
@@ -193,7 +193,7 @@
* Show a list of banners with allocation. Newer banners are shown
first.
*/
public function showList() {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
// Obtain all banners & campaigns
$request = $this->getRequest();
diff --git a/special/SpecialCentralNotice.php b/special/SpecialCentralNotice.php
index 7fcce65..90be993 100644
--- a/special/SpecialCentralNotice.php
+++ b/special/SpecialCentralNotice.php
@@ -653,7 +653,7 @@
* @param $notice string The name of the campaign to view
*/
function listNoticeDetail( $notice ) {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
// Make sure notice exists
if ( !Campaign::campaignExists( $notice ) ) {
@@ -698,16 +698,16 @@
}
// Handle user bucketing
setting for campaign
- $numCampaignBuckets = min( $request->getInt(
'buckets', 1 ), $wgNoticeNumberOfBuckets );
- $numCampaignBuckets = pow( 2, floor( log(
$numCampaignBuckets, 2 ) ) );
+ $numCampaignBuckets = min(
$request->getInt( 'buckets', 1 ), $wgNoticeNumberOfBuckets );
+ $numCampaignBuckets = pow( 2,
floor( log( $numCampaignBuckets, 2 ) ) );
- Campaign::setNumericCampaignSetting(
- $notice,
- 'buckets',
- $numCampaignBuckets,
- $wgNoticeNumberOfBuckets,
- 1
- );
+
Campaign::setNumericCampaignSetting(
+ $notice,
+ 'buckets',
+ $numCampaignBuckets,
+
$wgNoticeNumberOfBuckets,
+ 1
+ );
// Handle setting campaign
priority
Campaign::setNumericCampaignSetting(
@@ -768,15 +768,15 @@
}
// Handle bucket changes - keep
in mind that the number of campaign buckets
- // might have changed simultaneously (and might have
happened server side)
+ // might have changed
simultaneously (and might have happened server side)
$updatedBuckets =
$request->getArray( 'bucket' );
if ( $updatedBuckets ) {
foreach (
$updatedBuckets as $templateId => $bucket ) {
Campaign::updateBucket(
- $notice,
- $templateId,
- intval( $bucket ) % $numCampaignBuckets
- );
+ $notice,
+
$templateId,
+ intval(
$bucket ) % $numCampaignBuckets
+ );
}
}
@@ -879,7 +879,7 @@
* Create form for managing campaign settings (start date, end date,
languages, etc.)
*/
function noticeDetailForm( $notice ) {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
if ( $this->editable ) {
$readonly = array();
@@ -977,7 +977,7 @@
$htmlOut .= Xml::tags( 'td', array(),
Xml::label( $this->msg( 'centralnotice-buckets'
)->text(), 'buckets' ) );
$htmlOut .= Xml::tags( 'td', array(),
- $this->numBucketsDropDown( $wgNoticeNumberOfBuckets,
$numBuckets ) );
+ $this->numBucketsDropDown( $wgNoticeNumberOfBuckets,
$numBuckets ) );
$htmlOut .= Xml::closeElement( 'tr' );
// Enabled
$htmlOut .= Xml::openElement( 'tr' );
@@ -1093,13 +1093,13 @@
);
// Bucket
- $numCampaignBuckets = min( intval( $row->not_buckets ),
$wgNoticeNumberOfBuckets );
+ $numCampaignBuckets = min( intval( $row->not_buckets ),
$wgNoticeNumberOfBuckets );
$htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
$this->bucketDropDown(
- "bucket[$row->tmp_id]",
- ( $numCampaignBuckets == 1 ? null : intval(
$row->asn_bucket ) ),
- $numCampaignBuckets
- )
+ "bucket[$row->tmp_id]",
+ ( $numCampaignBuckets == 1 ? null :
intval( $row->asn_bucket ) ),
+ $numCampaignBuckets
+ )
);
// Banner
@@ -1131,7 +1131,7 @@
}
function bucketDropDown( $name, $selected, $numberCampaignBuckets ) {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
$bucketLabel = function ( $val ) {
return chr( $val + ord( 'A' ) );
@@ -1141,14 +1141,14 @@
if ( $selected === null ) {
$selected = 0; // default to bucket 'A'
}
- $selected = $selected % $numberCampaignBuckets;
+ $selected = $selected % $numberCampaignBuckets;
$html = Html::openElement( 'select', array( 'name' =>
$name, 'id' => 'bucketSelector' ) );
foreach ( range( 0, $wgNoticeNumberOfBuckets - 1 ) as
$value ) {
- $attribs = array();
- if ( $value >= $numberCampaignBuckets ) {
- $attribs['disabled'] = 'disabled';
- }
+ $attribs = array();
+ if ( $value >= $numberCampaignBuckets ) {
+ $attribs['disabled'] = 'disabled';
+ }
$html .= Xml::option( $bucketLabel( $value ),
$value, $value === $selected, $attribs );
}
$html .= Html::closeElement( 'select' );
@@ -1161,23 +1161,23 @@
}
}
- function numBucketsDropDown( $numBuckets, $selected ) {
- if ( $selected === null ) {
- $selected = 1;
- }
+ function numBucketsDropDown( $numBuckets, $selected ) {
+ if ( $selected === null ) {
+ $selected = 1;
+ }
- if ( $this->editable ) {
- $html = Html::openElement( 'select', array( 'name' => 'buckets',
'id' => 'buckets' ) );
- foreach ( range( 0, intval( log( $numBuckets, 2 ) ) ) as $value ) {
- $value = pow( 2, $value );
- $html .= Xml::option( $value, $value, $value === $selected );
- }
- $html .= Html::closeElement( 'select' );
- return $html;
- } else {
- return htmlspecialchars( $selected );
- }
- }
+ if ( $this->editable ) {
+ $html = Html::openElement( 'select', array( 'name' =>
'buckets', 'id' => 'buckets' ) );
+ foreach ( range( 0, intval( log( $numBuckets, 2 ) ) )
as $value ) {
+ $value = pow( 2, $value );
+ $html .= Xml::option( $value, $value, $value
=== $selected );
+ }
+ $html .= Html::closeElement( 'select' );
+ return $html;
+ } else {
+ return htmlspecialchars( $selected );
+ }
+ }
/**
* Create form for adding banners to a campaign
diff --git a/special/SpecialGlobalAllocation.php
b/special/SpecialGlobalAllocation.php
index 55272c3..53ec940 100644
--- a/special/SpecialGlobalAllocation.php
+++ b/special/SpecialGlobalAllocation.php
@@ -187,7 +187,7 @@
* Show a list of banners with allocation. Newer banners are shown
first.
*/
public function showList() {
- global $wgNoticeNumberOfBuckets;
+ global $wgNoticeNumberOfBuckets;
// Begin building HTML
$htmlOut = '';
diff --git a/special/SpecialNoticeTemplate.php
b/special/SpecialNoticeTemplate.php
index b589e00..8a8b3d0 100644
--- a/special/SpecialNoticeTemplate.php
+++ b/special/SpecialNoticeTemplate.php
@@ -58,9 +58,9 @@
Banner::removeTemplate(
$template, $this->getUser() );
} catch ( MWException $ex ) {
$this->showError( array(
- 'centralnotice-template-still-bound',
- $template
- ) );
+
'centralnotice-template-still-bound',
+ $template
+ ) );
}
}
}
diff --git a/tests/ApiAllocationsTest.php b/tests/ApiAllocationsTest.php
index c78afe0..60b14b0 100644
--- a/tests/ApiAllocationsTest.php
+++ b/tests/ApiAllocationsTest.php
@@ -60,7 +60,7 @@
);
$ret = $this->doApiRequest( array(
- 'action' => 'centralnoticeallocations',
+ 'action' => 'centralnoticeallocations',
) );
$this->assertTrue( ComparisonUtil::assertSuperset( $ret[0],
$expected ) );
}
--
To view, visit https://gerrit.wikimedia.org/r/58231
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6ea9b9ebfc97af68dd94a3d66ccec51a5537328
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Platonides <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits