Jack Phoenix has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338297 )

Change subject: Coding style nitpicking
......................................................................

Coding style nitpicking

Change-Id: I613d882cd69857c5b3218f58666c713b03629a57
---
M CollaborationKit.hooks.php
M includes/CollaborationHubContentEditor.php
M includes/CollaborationListContentEditor.php
M includes/SpecialCreateCollaborationHub.php
M includes/SpecialCreateHubFeature.php
M includes/content/CollaborationHubContent.php
M includes/content/CollaborationKitImage.php
M includes/content/CollaborationListContent.php
M includes/content/CollaborationListContentHandler.php
M modules/ext.CollaborationKit.colour.js
M modules/ext.CollaborationKit.hubimage.js
M modules/ext.CollaborationKit.icon.js
M modules/ext.CollaborationKit.list.edit.js
M modules/ext.CollaborationKit.list.members.js
M modules/ext.CollaborationKit.list.ui.js
15 files changed, 210 insertions(+), 202 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/97/338297/1

diff --git a/CollaborationKit.hooks.php b/CollaborationKit.hooks.php
index ab56d6d..0a80756 100644
--- a/CollaborationKit.hooks.php
+++ b/CollaborationKit.hooks.php
@@ -153,13 +153,14 @@
                        // TOC disabled, mark as done.
                        $out->setProperty( 'CollaborationHubSubpage', true );
                } elseif ( $pout->getLimitReportData() ) {
-                       $out->setProperty( 'CollaborationHubSubpage', 
"in-progress" );
+                       $out->setProperty( 'CollaborationHubSubpage', 
'in-progress' );
                }
        }
+
        /**
         * Register __NOCOLLABORATIONHUBTOC__ as a magic word.
         *
-        * @param Array &$magicWords All double underscore magic ids
+        * @param array &$magicWords All double underscore magic ids
         */
        public static function onGetDoubleUnderscoreIDs( array &$magicWords ) {
                $magicWords[] = 'nocollaborationhubtoc';
diff --git a/includes/CollaborationHubContentEditor.php 
b/includes/CollaborationHubContentEditor.php
index 01f0b83..c27957e 100644
--- a/includes/CollaborationHubContentEditor.php
+++ b/includes/CollaborationHubContentEditor.php
@@ -38,7 +38,6 @@
         * @return string html
         */
        protected function getFormFields( $parts ) {
-
                $fields = [
                        'display_name' => [
                                'type' => 'text',
@@ -62,7 +61,7 @@
 
                $colours = [];
                foreach ( CollaborationHubContent::getThemeColours() as $colour 
) {
-                       $colours[ 'collaborationkit-' . $colour ] = $colour;
+                       $colours['collaborationkit-' . $colour] = $colour;
                }
                if ( $parts[4] == '' ) {
                        $selectedColour = 'lightgrey';
@@ -156,7 +155,7 @@
                $partFields = $this->getFormFields( $parts );
                // See setCollabkitTheme for how the setProperty works.
                $out->setProperty( 'collabkit-theme', $this->colour );
-               $out->addHtml( Html::rawElement( 'div', [ 'class' => 
'mw-collabkit-modifiededitform' ], $partFields ) );
+               $out->addHTML( Html::rawElement( 'div', [ 'class' => 
'mw-collabkit-modifiededitform' ], $partFields ) );
        }
 
        /**
diff --git a/includes/CollaborationListContentEditor.php 
b/includes/CollaborationListContentEditor.php
index 6f49384..f2a73c3 100644
--- a/includes/CollaborationListContentEditor.php
+++ b/includes/CollaborationListContentEditor.php
@@ -36,7 +36,7 @@
                        return parent::showContentForm();
                }
                $out = RequestContext::getMain()->getOutput();
-               $out->addHtml( Html::Hidden( 'wpCollaborationKitOptions', 
$parts[1] ) );
+               $out->addHTML( Html::hidden( 'wpCollaborationKitOptions', 
$parts[1] ) );
 
                if ( $parts[2] == '' ) {
                        $includedContent = '';
@@ -69,7 +69,7 @@
                $dummyForm = HTMLForm::factory( 'ooui', $fields, 
$this->getContext() );
                $partFields = $dummyForm->prepareForm()->getBody();
 
-               $out->addHtml( Html::rawElement( 'div', [ 'class' => 
'mw-collabkit-modifiededitform' ], $partFields ) );
+               $out->addHTML( Html::rawElement( 'div', [ 'class' => 
'mw-collabkit-modifiededitform' ], $partFields ) );
        }
 
        /**
diff --git a/includes/SpecialCreateCollaborationHub.php 
b/includes/SpecialCreateCollaborationHub.php
index cd35a5d..f6ed6b6 100644
--- a/includes/SpecialCreateCollaborationHub.php
+++ b/includes/SpecialCreateCollaborationHub.php
@@ -38,7 +38,7 @@
                $namespaceNames = $this->getLanguage()->getNamespaces();
                $namespaceChoices = [];
                foreach ( $allowedNamespaces as $nsIndex => $nsCanBeUsed ) {
-                       $namespaceChoices[ $namespaceNames[ $nsIndex ] ] = 
$nsIndex;
+                       $namespaceChoices[$namespaceNames[$nsIndex]] = $nsIndex;
                }
 
                $fields = [
@@ -76,13 +76,13 @@
 
                // Our preference is the Project namespace
                if ( in_array( 4, $allowedNamespaces ) ) {
-                       $fields[ 'namespace' ][ 'default' ] = 4;
+                       $fields['namespace']['default'] = 4;
                }
 
                // Colours for the hub styles
                $colours = [];
                foreach ( CollaborationHubContent::getThemeColours() as $colour 
) {
-                       $colours[ 'collaborationkit-' . $colour ] = $colour;
+                       $colours['collaborationkit-' . $colour] = $colour;
                }
                $fields['colour'] = [
                        'type' => 'select',
@@ -143,7 +143,7 @@
         */
        public function onSubmit( array $data ) {
                $namespaces = $this->getLanguage()->getNamespaces();
-               $pagename = $namespaces[ $data[ 'namespace' ] ] . ':' . 
$data['title'];
+               $pagename = $namespaces[$data['namespace']] . ':' . 
$data['title'];
                $title = Title::newFromText( $pagename );
                if ( !$title ) {
                        return Status::newFatal( 
'collaborationkit-createhub-invalidtitle' );
diff --git a/includes/SpecialCreateHubFeature.php 
b/includes/SpecialCreateHubFeature.php
index 3fa15ee..6350327 100644
--- a/includes/SpecialCreateHubFeature.php
+++ b/includes/SpecialCreateHubFeature.php
@@ -28,7 +28,6 @@
         * @return array
         */
        protected function getFormFields() {
-
                // Allow the collaboration hub to be passed via parameter (full 
page title) ?collaborationhub=
                // Allow the feature name to be passed via parameter (subpage 
title) ?feature=
                if ( $this->getRequest()->getVal( 'collaborationhub' ) ) {
@@ -72,8 +71,10 @@
                                'type' => 'radio',
                                'cssclass' => 'mw-ck-content-type-input',
                                'label-message' => 
'collaborationkit-createhubfeature-contenttype',
-                               'options' => [ $this->msg( 
'collaborationkit-createhubfeature-freetext' )->text() => 'wikitext',
-                                       $this->msg( 
'collaborationkit-createhubfeature-articlelist' )->text() => 
'CollaborationListContent' ]
+                               'options' => [
+                                       $this->msg( 
'collaborationkit-createhubfeature-freetext' )->text() => 'wikitext',
+                                       $this->msg( 
'collaborationkit-createhubfeature-articlelist' )->text() => 
'CollaborationListContent'
+                               ]
                        ]
                ];
 
@@ -99,8 +100,8 @@
         * @return Status
         */
        public function onSubmit( array $data ) {
-               $collaborationHub = $data[ 'collaborationhub' ];
-               $featureName = $data[ 'featurename' ];
+               $collaborationHub = $data['collaborationhub'];
+               $featureName = $data['featurename'];
 
                $titleText = $collaborationHub . '/' . $featureName;
 
@@ -130,7 +131,7 @@
                        return Status::newFatal( 
'collaborationkit-createhubfeature-hubdoesnotexist' );
                }
 
-               if ( $hubTitleObject->getContentModel() != 
"CollaborationHubContent" ) {
+               if ( $hubTitleObject->getContentModel() != 
'CollaborationHubContent' ) {
                        return Status::newFatal( 
'collaborationkit-createhubfeature-hubisnotahub' );
                }
 
@@ -226,7 +227,8 @@
                $hubTitleObject->invalidateCache();
 
                // Once all the pages we want to create are created, we send 
them to the first one
-               $this->getOutput()->redirect( $title->getFullUrl() );
+               $this->getOutput()->redirect( $title->getFullURL() );
+
                return Status::newGood();
        }
 
diff --git a/includes/content/CollaborationHubContent.php 
b/includes/content/CollaborationHubContent.php
index 1ca01ee..dfb0d33 100644
--- a/includes/content/CollaborationHubContent.php
+++ b/includes/content/CollaborationHubContent.php
@@ -353,7 +353,6 @@
                $membersPageName = $title->getFullText() . '/' . wfMessage( 
'collaborationkit-hub-pagetitle-members' )->inContentLanguage()->text();
                $membersTitle = Title::newFromText( $membersPageName );
                if ( $membersTitle->exists() || $membersContent !== null ) {
-
                        $membersPageID = $membersTitle->getArticleID();
                        $output->addJsConfigVars( 
'wgCollaborationKitAssociatedMemberList', $membersPageID );
 
@@ -429,7 +428,6 @@
                $announcementsTitle = Title::newFromText( $title->getFullText() 
. '/' . $announcementsSubpageName );
 
                if ( $announcementsTitle->exists() || $announcementsText !== 
null ) {
-
                        if ( $announcementsText === null ) {
                                $announcementsWikiPage = WikiPage::factory( 
$announcementsTitle );
                                $announcementsText = 
$announcementsWikiPage->getContent()->getParserOutput( $announcementsTitle 
)->getText();
@@ -486,7 +484,7 @@
                        // TODO make sure they have create permission, too
                        $html .= new OOUI\ButtonWidget( [
                                'label' => wfMessage( 
'collaborationkit-hub-addpage' )->inContentLanguage()->text(),
-                               'href' => SpecialPage::getTitleFor( 
'CreateHubFeature' )->getFullUrl( [ 'collaborationhub' => $title->getFullText() 
] ),
+                               'href' => SpecialPage::getTitleFor( 
'CreateHubFeature' )->getFullURL( [ 'collaborationhub' => $title->getFullText() 
] ),
                                'flags' => [ 'progressive' ],
                                'icon' => 'add'
                        ] );
@@ -584,7 +582,7 @@
 
                                $html .= new OOUI\ButtonWidget( [
                                        'label' => wfMessage( 
'collaborationkit-hub-missingpage-create' )->inContentLanguage()->text(),
-                                       'href' => SpecialPage::getTitleFor( 
'CreateHubFeature' )->getFullUrl( [ 'collaborationhub' => 
$title->getFullText(), 'feature' => $spTitle->getSubpageText() ] )
+                                       'href' => SpecialPage::getTitleFor( 
'CreateHubFeature' )->getFullURL( [ 'collaborationhub' => 
$title->getFullText(), 'feature' => $spTitle->getSubpageText() ] )
                                ] );
 
                                // register as template for stuff
@@ -634,18 +632,18 @@
                $sectionLinks = [];
                $sectionLinksText = '';
                if ( isset( $spRev ) ) {
-                       $sectionLinks[ 'viewLink' ] = [];
-                       $sectionLinks[ 'viewLink' ][ 'title' ] = 
$spTitle->getLinkURL();
-                       $sectionLinks[ 'viewLink' ][ 'msg' ] = wfMessage( 
'collaborationkit-hub-subpage-view' )->inContentLanguage()->text();
-                       $sectionLinks[ 'viewLink' ][ 'icon' ] = 'search';
+                       $sectionLinks['viewLink'] = [];
+                       $sectionLinks['viewLink']['title'] = 
$spTitle->getLinkURL();
+                       $sectionLinks['viewLink']['msg'] = wfMessage( 
'collaborationkit-hub-subpage-view' )->inContentLanguage()->text();
+                       $sectionLinks['viewLink']['icon'] = 'search';
 
-                       $sectionLinks[ 'editLink' ] = [];
-                       $sectionLinks[ 'editLink' ][ 'title' ] = 
$spTitle->getEditURL();
-                       $sectionLinks[ 'editLink' ][ 'msg' ] = wfMessage( 
'edit' )->inContentLanguage()->text();
-                       $sectionLinks[ 'editLink' ][ 'icon' ] = 'edit';
+                       $sectionLinks['editLink'] = [];
+                       $sectionLinks['editLink']['title'] = 
$spTitle->getEditURL();
+                       $sectionLinks['editLink']['msg'] = wfMessage( 'edit' 
)->inContentLanguage()->text();
+                       $sectionLinks['editLink']['icon'] = 'edit';
                }
                foreach ( $sectionLinks as $sectionLink ) {
-                       $sectionLinksText .= $this->makeEditSectionLink( 
$sectionLink[ 'title' ], $sectionLink[ 'msg' ], $sectionLink[ 'icon' ] );
+                       $sectionLinksText .= $this->makeEditSectionLink( 
$sectionLink['title'], $sectionLink['msg'], $sectionLink['icon'] );
                }
 
                // Assemble header
@@ -806,10 +804,10 @@
                foreach ( $this->content as $item ) {
                        $out .= $this->escapeForHumanEditable( $item['title'] );
                        if ( isset ( $item['image'] ) ) {
-                               $out .= "|image=" . 
$this->escapeForHumanEditable( $item['image'] );
+                               $out .= '|image=' . 
$this->escapeForHumanEditable( $item['image'] );
                        }
                        if ( isset( $item['displayTitle'] ) ) {
-                               $out .= "|display_title=" . 
$this->escapeForHumanEditable( $item['displayTitle'] );
+                               $out .= '|display_title=' . 
$this->escapeForHumanEditable( $item['displayTitle'] );
                        }
                        if ( substr( $out, -1 ) === '|' ) {
                                $out = substr( $out, 0, strlen( $out ) - 1 );
@@ -893,7 +891,7 @@
         * @return array
         */
        private static function convertFromHumanEditableItemLine( $line ) {
-               $parts = explode( "|", $line );
+               $parts = explode( '|', $line );
                $parts = array_map( [ __CLASS__, 'unescapeForHumanEditable' ], 
$parts );
                $itemRes = [ 'title' => $parts[0] ];
                if ( count( $parts ) > 1 ) {
@@ -901,19 +899,19 @@
                        foreach ( $parts as $part ) {
                                list( $key, $value ) = explode( '=', $part );
                                switch ( $key ) {
-                               case 'image':
-                               case 'display_title':
-                                       $itemRes[$key] = $value;
-                                       break;
-                               default:
-                                       $context = wfEscapeWikiText( substr( 
$part, 30 ) );
-                                       if ( strlen( $context ) === 30 ) {
-                                               $context .= '...';
-                                       }
-                                       throw new 
MWContentSerializationException(
-                                               "Unrecognized option for list 
item:" .
-                                               wfEscapeWikiText( $key )
-                                       );
+                                       case 'image':
+                                       case 'display_title':
+                                               $itemRes[$key] = $value;
+                                               break;
+                                       default:
+                                               $context = wfEscapeWikiText( 
substr( $part, 30 ) );
+                                               if ( strlen( $context ) === 30 
) {
+                                                       $context .= '...';
+                                               }
+                                               throw new 
MWContentSerializationException(
+                                                       'Unrecognized option 
for list item:' .
+                                                       wfEscapeWikiText( $key )
+                                               );
                                }
                        }
                }
diff --git a/includes/content/CollaborationKitImage.php 
b/includes/content/CollaborationKitImage.php
index 8637192..c7afe56 100644
--- a/includes/content/CollaborationKitImage.php
+++ b/includes/content/CollaborationKitImage.php
@@ -31,29 +31,29 @@
        public static function makeImage( $image, $width, $options = [] ) {
 
                // Default options
-               if ( !isset( $options[ 'classes' ] ) ) {
-                       $options[ 'classes' ] = [];
+               if ( !isset( $options['classes'] ) ) {
+                       $options['classes'] = [];
                }
-               if ( !isset( $options[ 'link' ] ) ) {
-                       $options[ 'link' ] = true;
+               if ( !isset( $options['link'] ) ) {
+                       $options['link'] = true;
                }
-               if ( !isset( $options[ 'colour' ] ) ) {
-                       $options[ 'colour' ] = '';
+               if ( !isset( $options['colour'] ) ) {
+                       $options['colour'] = '';
                }
-               if ( !isset( $options[ 'css' ] ) ) {
-                       $options[ 'css' ] = '';
+               if ( !isset( $options['css'] ) ) {
+                       $options['css'] = '';
                }
-               if ( !isset( $options[ 'renderAsWikitext' ] ) ) {
-                       $options[ 'renderAsWikitext' ] = false;
+               if ( !isset( $options['renderAsWikitext'] ) ) {
+                       $options['renderAsWikitext'] = false;
                }
-               if ( !isset( $options[ 'label' ] ) ) {
-                       $options[ 'label' ] = '';
+               if ( !isset( $options['label'] ) ) {
+                       $options['label'] = '';
                }
-               if ( !isset( $options[ 'fallback' ] ) ) {
-                       if ( isset( $options[ 'label' ] ) ) {
-                               $options[ 'fallback' ] = $options[ 'label' ];
+               if ( !isset( $options['fallback'] ) ) {
+                       if ( isset( $options['label'] ) ) {
+                               $options['fallback'] = $options['label'];
                        } else {
-                               $options[ 'fallback' ] = 'none';
+                               $options['fallback'] = 'none';
                        }
                }
 
@@ -61,26 +61,26 @@
 
                // Use fallback icon or random icon if stated image doesn't 
exist
                if ( $image === null || $image == '' || ( !wfFindFile( $image ) 
&& !in_array( $image, $cannedIcons ) ) ) {
-                       if ( $options[ 'fallback' ] == 'none' ) {
+                       if ( $options['fallback'] == 'none' ) {
                                return '';
-                       } elseif ( in_array( $options[ 'fallback' ], 
$cannedIcons ) ) {
-                               $image = $options[ 'fallback' ];
+                       } elseif ( in_array( $options['fallback'], $cannedIcons 
) ) {
+                               $image = $options['fallback'];
                        } else {
-                               $image = $cannedIcons[ hexdec( sha1( $options[ 
'fallback' ] )[0] ) % 27];
+                               $image = $cannedIcons[hexdec( sha1( 
$options['fallback'] )[0] ) % 27];
                        }
                }
 
                // Are we loading an image file or constructing a div based on 
an icon class?
                if ( wfFindFile( $image ) ) {
-                       $imageCode = self::makeImageFromFile( $image, $options[ 
'classes' ], $width, $options[ 'link' ],
-                               $options[ 'renderAsWikitext' ], $options[ 
'label' ] );
+                       $imageCode = self::makeImageFromFile( $image, 
$options['classes'], $width, $options[ 'link' ],
+                               $options['renderAsWikitext'], $options['label'] 
);
                } elseif ( in_array( $image, $cannedIcons ) ) {
-                       $imageCode = self::makeImageFromIcon( $image, $options[ 
'classes' ], $width, $options[ 'colour' ],
-                               $options[ 'link' ], $options[ 
'renderAsWikitext' ], $options[ 'label' ] );
+                       $imageCode = self::makeImageFromIcon( $image, 
$options['classes'], $width, $options[ 'colour' ],
+                               $options['link'], $options['renderAsWikitext'], 
$options['label'] );
                }
 
                // Finishing up
-               $wrapperAttributes = [ 'class' => $options[ 'classes' ], 
'style' => $options[ 'css' ] ];
+               $wrapperAttributes = [ 'class' => $options['classes'], 'style' 
=> $options['css'] ];
                $imageBlock = Html::rawElement( 'div', $wrapperAttributes, 
$imageCode );
                return $imageBlock;
        }
@@ -100,11 +100,11 @@
                        $wikitext = "[[{$imageFullName}|{$width}px";
 
                        if ( $link === false ) {
-                               $wikitext .= "|nolink]]";
+                               $wikitext .= '|nolink]]';
                        } elseif ( is_string( $link ) ) {
                                $wikitext .= "|link={$link}]]";
                        } else {
-                               $wikitext .= "]]";
+                               $wikitext .= ']]';
                        }
 
                        return $wikitext;
@@ -162,7 +162,6 @@
         */
        protected static function linkFactory( $imageHtml, $link, $label, 
$imageObj = null ) {
                // Important assumption: image is being rendered as HTML and 
not wikitext.
-
                if ( $link instanceof Title ) {
                        $linkHref = $link->getLinkUrl();
                } elseif ( is_string( $link ) ) {
diff --git a/includes/content/CollaborationListContent.php 
b/includes/content/CollaborationListContent.php
index 1e91be9..0f8d1ef 100644
--- a/includes/content/CollaborationListContent.php
+++ b/includes/content/CollaborationListContent.php
@@ -60,7 +60,11 @@
                $data = $status->value;
                // FIXME: The schema should be checking for required fields but 
for some reason that doesn't work
                // This may be an issue with EventLogging
-               if ( !isset( $data->description ) || !isset( $data->columns ) 
|| !isset( $data->options ) || !isset( $data->displaymode ) ) {
+               if (
+                       !isset( $data->description ) || !isset( $data->columns 
) ||
+                       !isset( $data->options ) || !isset( $data->displaymode )
+               )
+               {
                        return false;
                }
 
@@ -70,14 +74,14 @@
                        EventLogging::schemaValidate( $jsonAsArray, $listSchema 
);
                        // FIXME: The schema should be enforcing data type 
requirements, but it isn't.
                        // Again, this is probably EventLogging.
-                       $numberOfColumns = count( $jsonAsArray[ "columns" ] );
+                       $numberOfColumns = count( $jsonAsArray['columns'] );
                        for ( $i = 0; $i < $numberOfColumns; $i++ ) {
-                               if ( !is_array( $jsonAsArray[ "columns" ][ $i ] 
) ) {
+                               if ( !is_array( $jsonAsArray['columns'][$i] ) ) 
{
                                        return false;
                                } else {
-                                       $numberOfItems = count( $jsonAsArray[ 
"columns" ][ $i ][ "items" ] );
+                                       $numberOfItems = count( 
$jsonAsArray['columns'][$i]['items'] );
                                        for ( $j = 0; $j < $numberOfItems; $j++ 
) {
-                                               if ( !is_array( $jsonAsArray[ 
"columns" ][ $i ][ "items" ][ $j ] ) ) {
+                                               if ( !is_array( 
$jsonAsArray['columns'][$i]['items'][$j] ) ) {
                                                        return false;
                                                }
                                        }
@@ -109,7 +113,7 @@
                }
 
                // Force intrepretation as boolean for certain options
-               if ( $name == "includedesc" ) {
+               if ( $name == 'includedesc' ) {
                        $value = (bool)$value;
                }
 
@@ -134,13 +138,13 @@
        }
 
        /**
-       * Beautifies JSON and does subst: prior to save.
-       *
-       * @param Title $title
-       * @param User $user
-       * @param ParserOptions $popts
-       * @return CollaborationListContent
-       */
+        * Beautifies JSON and does subst: prior to save.
+        *
+        * @param Title $title
+        * @param User $user
+        * @param ParserOptions $popts
+        * @return CollaborationListContent
+        */
        public function preSaveTransform( Title $title, User $user, 
ParserOptions $popts ) {
                global $wgParser;
                // WikiPage::doEditContent invokes PST before validation. As 
such, native data
@@ -270,7 +274,7 @@
                $iconWidth = $options['iconWidth'];
 
                // Hack to force style loading even when we don't have a Parser 
reference.
-               $text = "<collaborationkitloadliststyles/>";
+               $text = '<collaborationkitloadliststyles/>';
 
                // Ugly way to prevent unexpected column header TOCs and 
editsection links from showing up
                $text .= "__NOTOC__ __NOEDITSECTION__\n";
@@ -340,8 +344,8 @@
                                        $titleForItem = Title::newFromText( 
$item->link );
                                }
                                $text .= Html::openElement( 'div', [
-                                       "class" => "mw-ck-list-item",
-                                       "data-collabkit-item-title" => 
$item->title
+                                       'class' => 'mw-ck-list-item',
+                                       'data-collabkit-item-title' => 
$item->title
                                ] );
                                if ( $options['mode'] !== 'no-img' ) {
                                        if ( isset( $item->image ) ) {
@@ -365,8 +369,8 @@
                                        } else {
                                                $titleText = $item->title;
                                        }
-                                       $text .= "[[:" . 
$titleForItem->getPrefixedDBkey() . "|"
-                                               . wfEscapeWikiText( $titleText 
) . "]]";
+                                       $text .= '[[:' . 
$titleForItem->getPrefixedDBkey() . '|'
+                                               . wfEscapeWikiText( $titleText 
) . ']]';
                                } else {
                                        $text .=  wfEscapeWikiText( 
$item->title );
                                }
@@ -431,7 +435,7 @@
 
                // Step 3: None of the above work? Time for fallback icons.
                if ( $image === null ) {
-                       $iconColour = "lightgrey";
+                       $iconColour = 'lightgrey';
                        $linkOrNot = false;
                        if ( $displayMode == 'members' ) {
                                $image = 'user';
@@ -443,7 +447,12 @@
                return CollaborationKitImage::makeImage(
                        $image,
                        $size,
-                       [ 'classes' => [ 'mw-ck-list-image' ], 'colour' => 
$iconColour, 'link' => $linkOrNot, 'renderAsWikitext' => true ]
+                       [
+                               'classes' => [ 'mw-ck-list-image' ],
+                               'colour' => $iconColour,
+                               'link' => $linkOrNot,
+                               'renderAsWikitext' => true
+                       ]
                );
        }
 
@@ -458,7 +467,7 @@
                if ( $toModel === CONTENT_MODEL_WIKITEXT && $lossy === 'lossy' 
) {
                        global $wgContLang;
                        // using wgContLang is kind of icky. Maybe we should 
transclude
-                       // from mediawiki namespace, or give up on not 
splitting the
+                       // from MediaWiki namespace, or give up on not 
splitting the
                        // parser cache and just use {{int:... (?)
                        $renderOpts = $this->getFullRenderListOptions();
                        $text = $this->convertToWikitext( $wgContLang, 
$renderOpts );
@@ -512,7 +521,7 @@
                        case 'natural':
                                return $items;
                        default:
-                               throw new UnexpectedValueException( "invalid 
sort mode" );
+                               throw new UnexpectedValueException( 'invalid 
sort mode' );
                }
        }
 
@@ -652,34 +661,34 @@
                                $out .= 'column';
                        }
                        if ( isset( $column->notes ) ) {
-                               $out .= "|notes=" . 
$this->escapeForHumanEditable( $column->notes );
+                               $out .= '|notes=' . 
$this->escapeForHumanEditable( $column->notes );
                        }
                        $out .= self::HUMAN_COLUMN_SPLIT2;
 
                        foreach ( $column->items as $item ) {
                                $out .= $this->escapeForHumanEditable( 
$item->title );
                                if ( isset ( $item->notes ) ) {
-                                       $out .= "|" . 
$this->escapeForHumanEditable( $item->notes );
+                                       $out .= '|' . 
$this->escapeForHumanEditable( $item->notes );
                                } else {
-                                       $out .= "|";
+                                       $out .= '|';
                                }
                                if ( isset( $item->link ) ) {
                                        if ( $item->link === false ) {
-                                               $out .= "|nolink";
+                                               $out .= '|nolink';
                                        } else {
                                                $out .= "|link=" . 
$this->escapeForHumanEditable( $item->link );
                                        }
                                }
                                if ( isset( $item->image ) ) {
                                        if ( $item->image === false ) {
-                                               $out .= "|noimage";
+                                               $out .= '|noimage';
                                        } else {
-                                               $out .= "|image=" . 
$this->escapeForHumanEditable( $item->image );
+                                               $out .= '|image=' . 
$this->escapeForHumanEditable( $item->image );
                                        }
                                }
                                if ( isset( $item->tags ) ) {
                                        foreach ( (array)$item->tags as $tag ) {
-                                               $out .= "|tag=" . 
$this->escapeForHumanEditable( $tag );
+                                               $out .= '|tag=' . 
$this->escapeForHumanEditable( $tag );
                                        }
                                }
                                if ( substr( $out, -1 ) === '|' ) {
@@ -760,12 +769,12 @@
 
                $split2 = strrpos( $text, self::HUMAN_DESC_SPLIT );
                if ( $split2 === false ) {
-                       throw new MWContentSerializationException( "Missing 
list description" );
+                       throw new MWContentSerializationException( 'Missing 
list description' );
                }
 
                $split1 = strrpos( $text, self::HUMAN_DESC_SPLIT, -strlen( 
$text ) + $split2 - 1 );
                if ( $split1 === false ) {
-                       throw new MWContentSerializationException( "Missing 
list description" );
+                       throw new MWContentSerializationException( 'Missing 
list description' );
                }
                $dividerLength = strlen( self::HUMAN_DESC_SPLIT );
 
@@ -774,10 +783,10 @@
                $res['options'] = self::parseHumanOptions( $optionString );
 
                if ( isset ( $res['options']->DISPLAYMODE ) ) {
-                       $res[ 'displaymode' ] = $res['options']->DISPLAYMODE;
+                       $res['displaymode'] = $res['options']->DISPLAYMODE;
                        unset( $res['options']->DISPLAYMODE );
                } else {
-                       throw new MWContentSerializationException( "Missing 
list displaymode" );
+                       throw new MWContentSerializationException( 'Missing 
list displaymode' );
                }
 
                $res['description'] = substr( $text, 0, $split1 );
@@ -807,12 +816,12 @@
 
                $columnContent = explode( self::HUMAN_COLUMN_SPLIT2, $column );
 
-               $parts = explode( "|", $columnContent[0] );
+               $parts = explode( '|', $columnContent[0] );
 
                $parts = array_map( [ __CLASS__, 'unescapeForHumanEditable' ], 
$parts );
 
                if ( $parts[0] != 'column' ) {
-                       $columnItem[ 'label' ] = $parts[0];
+                       $columnItem['label'] = $parts[0];
                }
 
                $parts = array_slice( $parts, 1 );
@@ -825,18 +834,18 @@
                                list( $key, $value ) = explode( '=', $part );
 
                                switch ( $key ) {
-                               case 'notes':
-                                       $columnItem[$key] = $value;
-                                       break;
-                               default:
-                                       $context = wfEscapeWikiText( substr( 
$part, 30 ) );
-                                       if ( strlen( $context ) === 30 ) {
-                                               $context .= '...';
-                                       }
-                                       throw new 
MWContentSerializationException(
-                                               "Unrecognized option for 
column:" .
-                                               wfEscapeWikiText( $key )
-                                       );
+                                       case 'notes':
+                                               $columnItem[$key] = $value;
+                                               break;
+                                       default:
+                                               $context = wfEscapeWikiText( 
substr( $part, 30 ) );
+                                               if ( strlen( $context ) === 30 
) {
+                                                       $context .= '...';
+                                               }
+                                               throw new 
MWContentSerializationException(
+                                                       'Unrecognized option 
for column:' .
+                                                       wfEscapeWikiText( $key )
+                                               );
                                }
                        }
                }
@@ -860,15 +869,15 @@
         * @return array
         */
        private static function convertFromHumanEditableItemLine( $line ) {
-               $parts = explode( "|", $line );
+               $parts = explode( '|', $line );
                $parts = array_map( [ __CLASS__, 'unescapeForHumanEditable' ], 
$parts );
                $itemRes = [ 'title' => $parts[0] ];
                if ( count( $parts ) > 1 ) {
                        // If people are using batch editor, they might define 
an image etc. despite lack of a note
                        // This is to catch that and prevent weirdness.
-                       $testExplosion = explode( "=", $parts[1] );
+                       $testExplosion = explode( '=', $parts[1] );
                        if ( in_array( $testExplosion[0], [ 'image', 'link', 
'tags', 'sortkey' ] ) ) {
-                               $itemRes[ $testExplosion[0] ] = 
$testExplosion[1];
+                               $itemRes[$testExplosion[0]] = $testExplosion[1];
                                $itemRes['notes'] = '';
                        } else {
                                $itemRes['notes'] = $parts[1];
@@ -877,31 +886,31 @@
                        foreach ( $parts as $part ) {
                                list( $key, $value ) = explode( '=', $part );
                                switch ( $key ) {
-                               case 'nolink':
-                                       $itemRes['link'] = false;
-                                       break;
-                               case 'noimage':
-                                       $itemRes['image'] = false;
-                                       break;
-                               case 'tag':
-                                       if ( !isset( $itemRes['tags'] ) ) {
-                                               $itemRes['tags'] = [];
-                                       }
-                                       $itemRes['tags'][] = $value;
-                                       break;
-                               case 'image':
-                               case 'link':
-                                       $itemRes[$key] = $value;
-                                       break;
-                               default:
-                                       $context = wfEscapeWikiText( substr( 
$part, 30 ) );
-                                       if ( strlen( $context ) === 30 ) {
-                                               $context .= '...';
-                                       }
-                                       throw new 
MWContentSerializationException(
-                                               "Unrecognized option for list 
item:" .
-                                               wfEscapeWikiText( $key )
-                                       );
+                                       case 'nolink':
+                                               $itemRes['link'] = false;
+                                               break;
+                                       case 'noimage':
+                                               $itemRes['image'] = false;
+                                               break;
+                                       case 'tag':
+                                               if ( !isset( $itemRes['tags'] ) 
) {
+                                                       $itemRes['tags'] = [];
+                                               }
+                                               $itemRes['tags'][] = $value;
+                                               break;
+                                       case 'image':
+                                       case 'link':
+                                               $itemRes[$key] = $value;
+                                               break;
+                                       default:
+                                               $context = wfEscapeWikiText( 
substr( $part, 30 ) );
+                                               if ( strlen( $context ) === 30 
) {
+                                                       $context .= '...';
+                                               }
+                                               throw new 
MWContentSerializationException(
+                                                       'Unrecognized option 
for list item:' .
+                                                       wfEscapeWikiText( $key )
+                                               );
                                }
                        }
                } else {
@@ -1008,7 +1017,7 @@
                        ) {
                                $nonUserItems[] = $item;
                        } else {
-                               $userItems[ $title->getDBKey() ] = $item;
+                               $userItems[$title->getDBKey()] = $item;
                        }
                }
                $res = $this->filterActiveUsers( $userItems );
diff --git a/includes/content/CollaborationListContentHandler.php 
b/includes/content/CollaborationListContentHandler.php
index 3a397f4..cfb0759 100644
--- a/includes/content/CollaborationListContentHandler.php
+++ b/includes/content/CollaborationListContentHandler.php
@@ -102,16 +102,16 @@
        public static function makeMemberList( $username, $initialDescription ) 
{
                $linkToUserpage = Title::makeTitleSafe( NS_USER, $username 
)->getPrefixedText();
                $newMemberList = [
-                       "displaymode" => "members",
-                       "columns" => [ [
-                               "items" => [ [
-                                       "title" => $linkToUserpage
+                       'displaymode' => 'members',
+                       'columns' => [ [
+                               'items' => [ [
+                                       'title' => $linkToUserpage
                                ] ]
                        ] ],
-                       "options" => [
-                               "mode" => "normal"
+                       'options' => [
+                               'mode' => 'normal'
                        ],
-                       "description" => "$initialDescription"
+                       'description' => $initialDescription
                ];
 
                $newMemberListJson = FormatJson::encode( $newMemberList, "\t", 
FormatJson::ALL_OK );
@@ -160,7 +160,6 @@
         * @todo rework this to use a generic CollaborationList editor function 
once it exists
         */
        public static function postMemberList( Title $title, $summary, 
IContextSource $context ) {
-
                $username = $context->getUser()->getName();
                $collabList = self::makeMemberList(
                        $username,
diff --git a/modules/ext.CollaborationKit.colour.js 
b/modules/ext.CollaborationKit.colour.js
index 18df988..992e015 100644
--- a/modules/ext.CollaborationKit.colour.js
+++ b/modules/ext.CollaborationKit.colour.js
@@ -48,8 +48,8 @@
                radioChoices = [];
                for ( i = 0; i < colourList.length; i++ ) {
                        radioChoices.push( new OO.ui.RadioOptionWidget( {
-                               label: getColourBlock( colourList[ i ] ),
-                               data: colourList[ i ]
+                               label: getColourBlock( colourList[i] ),
+                               data: colourList[i]
                        } ) );
                }
 
diff --git a/modules/ext.CollaborationKit.hubimage.js 
b/modules/ext.CollaborationKit.hubimage.js
index a5718a4..7351307 100644
--- a/modules/ext.CollaborationKit.hubimage.js
+++ b/modules/ext.CollaborationKit.hubimage.js
@@ -25,7 +25,7 @@
        ProcessDialog.prototype.initialize = function () {
                var defaultSearchTerm, nsPrefix;
 
-               nsPrefix = mw.config.get( 'wgFormattedNamespaces' )[ 6 ] + ':';
+               nsPrefix = mw.config.get( 'wgFormattedNamespaces' )[6] + ':';
 
                ProcessDialog.super.prototype.initialize.apply( this, arguments 
);
 
@@ -138,7 +138,7 @@
                        } )
                        .done( function ( data ) {
                                $( 'img.hubimagePreview' )
-                                       .attr( 'src', data.query.pages[ 0 
].imageinfo[ 0 ].thumburl )
+                                       .attr( 'src', 
data.query.pages[0].imageinfo[0].thumburl )
                                        .css( 'height', 'auto' );
                        }
                );
diff --git a/modules/ext.CollaborationKit.icon.js 
b/modules/ext.CollaborationKit.icon.js
index 779b7eb..2c20f7b 100644
--- a/modules/ext.CollaborationKit.icon.js
+++ b/modules/ext.CollaborationKit.icon.js
@@ -42,7 +42,7 @@
 
                        radioChoices.push( new OO.ui.RadioOptionWidget( {
                                label: divElm,
-                               data: iconList[ i ]
+                               data: iconList[i]
                        } ) );
                }
 
diff --git a/modules/ext.CollaborationKit.list.edit.js 
b/modules/ext.CollaborationKit.list.edit.js
index a768ce5..60ad145 100644
--- a/modules/ext.CollaborationKit.list.edit.js
+++ b/modules/ext.CollaborationKit.list.edit.js
@@ -39,13 +39,13 @@
 
                cur = getCurrentJson( mw.config.get( 'wgArticleId' ), function 
( res ) {
                        var newItems = [];
-                       $.each( res.content.columns[ colId ].items, function ( 
index ) {
+                       $.each( res.content.columns[colId].items, function ( 
index ) {
                                if ( this.title === title ) {
                                        return;
                                }
-                               newItems[ newItems.length ] = this;
+                               newItems[newItems.length] = this;
                        } );
-                       res.content.columns[ colId ].items = newItems;
+                       res.content.columns[colId].items = newItems;
                        // Interface for extension defined tags lacking...
                        // res.tags = 'collabkit-list-delete';
                        // FIXME inContentLanguage???
@@ -80,7 +80,7 @@
                        colId = $this.data( 'collabkit-column-id' );
                        list[ colId ] = [];
                        $this.children( '.mw-ck-list-item' ).each( function () {
-                               list[ colId ][ list[ colId ].length ] = $( this 
).data( 'collabkit-item-title' );
+                               list[colId][list[colId].length] = $( this 
).data( 'collabkit-item-title' );
                        } );
                } );
                return list;
@@ -111,11 +111,11 @@
                        reorderedItem = $item.data( 'collabkit-item-title' );
 
                        outer: for ( i = 0; i < originalOrder.length; i++ ) {
-                               if ( res.content.columns[ i ].items.length !== 
originalOrder[ i ].length ) {
+                               if ( res.content.columns[i].items.length !== 
originalOrder[i].length ) {
                                        isEditConflict = true;
                                } else {
-                                       for ( j = 0; j < originalOrder[ i 
].length; j++ ) {
-                                               if ( res.content.columns[ i 
].items[ j ].title !== originalOrder[ i ][ j ] ) {
+                                       for ( j = 0; j < 
originalOrder[i].length; j++ ) {
+                                               if ( 
res.content.columns[i].items[j].title !== originalOrder[i][j] ) {
                                                        isEditConflict = true;
                                                        break outer;
                                                }
@@ -155,29 +155,29 @@
                                        oneMore,
                                        i,
                                        j,
-                                       resItems = res.content.columns[ 
colGuess ].items;
+                                       resItems = 
res.content.columns[colGuess].items;
 
                                indexGuess = indexGuess % resItems.length;
 
-                               if ( resItems[ indexGuess ].title === title ) {
-                                       return resItems[ indexGuess ];
+                               if ( resItems[indexGuess].title === title ) {
+                                       return resItems[indexGuess];
                                }
 
                                oneMore = ( indexGuess + 1 ) % resItems.length;
                                oneLess = indexGuess - 1 < 0 ? resItems.length 
- 1 : indexGuess - 1;
-                               if ( resItems[ oneMore ].title === title ) {
-                                       return resItems[ oneMore ];
+                               if ( resItems[oneMore].title === title ) {
+                                       return resItems[oneMore];
                                }
 
-                               if ( resItems[ oneLess ].title === title ) {
-                                       return resItems[ oneLess ];
+                               if ( resItems[oneLess].title === title ) {
+                                       return resItems[oneLess];
                                }
 
                                // Still here, check entire array.
                                for ( i = 0; i < res.content.columns.length; 
i++ ) {
-                                       for ( j = 0; j < res.content.columns[ i 
].items.length; j++ ) {
-                                               if ( res.content.columns[ i 
].items[ j ].title === title ) {
-                                                       return 
res.content.columns[ i ].items[ j ];
+                                       for ( j = 0; j < 
res.content.columns[i].items.length; j++ ) {
+                                               if ( 
res.content.columns[i].items[j].title === title ) {
+                                                       return 
res.content.columns[i].items[j];
                                                }
                                        }
                                }
@@ -190,13 +190,13 @@
                        };
                        resArray = [];
                        for ( i = 0; i < newOrder.length; i++ ) {
-                               resArray[ i ] = [];
-                               for ( j = 0; j < newOrder[ i ].length; j++ ) {
-                                       resArray[ i ][ j ] = 
findItemInResArray( newOrder[ i ][ j ], j, i );
+                               resArray[i] = [];
+                               for ( j = 0; j < newOrder[i].length; j++ ) {
+                                       resArray[i][j] = findItemInResArray( 
newOrder[i][j], j, i );
                                }
                        }
                        for ( i = 0; i < resArray.length; i++ ) {
-                               res.content.columns[ i ].items = resArray[ i ];
+                               res.content.columns[i].items = resArray[i];
                        }
 
                        res.summary = mw.msg( 
'collaborationkit-list-move-summary', reorderedItem );
@@ -234,23 +234,23 @@
 
                        if ( !data.query ||
                                !data.query.pages ||
-                               !data.query.pages[ pageId ] ||
-                               !data.query.pages[ pageId ].revisions ||
-                               !data.query.pages[ pageId ].revisions[ 0 ]
+                               !data.query.pages[pageId] ||
+                               !data.query.pages[pageId].revisions ||
+                               !data.query.pages[pageId].revisions[0]
                        ) {
                                mw.log( 'Could not get page ' + pageId );
                                // FIXME better error handling
                                alert( mw.msg( 
'collaborationkit-list-error-couldnotgetpage' ) );
                                throw new Error( 'Could not get page' );
                        }
-                       rev = data.query.pages[ pageId ].revisions[ 0 ];
+                       rev = data.query.pages[pageId].revisions[0];
                        if ( rev.contentmodel !== 'CollaborationListContent' ) {
                                throw new Error( 'Page not a list' );
                        }
                        res.revid = rev.revid;
                        res.pageid = pageId;
                        res.timestamp = rev.timestamp;
-                       res.content = JSON.parse( rev[ '*' ] );
+                       res.content = JSON.parse( rev['*'] );
                        callback( res );
                } ).fail(
                        function () { alert( mw.msg( 
'collaborationkit-list-error-generic' ) ); }
diff --git a/modules/ext.CollaborationKit.list.members.js 
b/modules/ext.CollaborationKit.list.members.js
index c873679..fab7561 100644
--- a/modules/ext.CollaborationKit.list.members.js
+++ b/modules/ext.CollaborationKit.list.members.js
@@ -30,10 +30,10 @@
                                rvprop: 'content'
                        } )
                                .done( function ( data ) {
-                                       newMemberList = data.query.pages[ 
destinationPage ].revisions[ 0 ][ '*' ];
-                                       newMemberList = JSON.parse( 
newMemberList ).columns[ 0 ].items;
+                                       newMemberList = 
data.query.pages[destinationPage].revisions[0]['*'];
+                                       newMemberList = JSON.parse( 
newMemberList ).columns[0].items;
                                        for ( i = 0; i < newMemberList.length; 
i++ ) {
-                                               if ( newMemberList[ i ].title 
== escapedText ) {
+                                               if ( newMemberList[i].title == 
escapedText ) {
                                                        $( 
'.mw-ck-members-join' ).css( 'display', 'none' );
                                                }
                                        }
@@ -66,15 +66,15 @@
                        }
                        itemToAdd.title = curUserTitle.getPrefixedText();
 
-                       for ( i = 0; i < res.content.columns[ 0 ].items.length; 
i++ ) {
+                       for ( i = 0; i < res.content.columns[0].items.length; 
i++ ) {
                                // TODO: Title normalization maybe?
-                               if ( res.content.columns[ 0 ].items[ i ].title 
=== itemToAdd.title ) {
+                               if ( res.content.columns[0].items[i].title === 
itemToAdd.title ) {
                                        alert( mw.msg( 
'collaborationkit-list-alreadyadded' ) );
                                        return;
                                }
                        }
-                       index = res.content.columns[ 0 ].items.length;
-                       res.content.columns[ 0 ].items[ index ] = itemToAdd;
+                       index = res.content.columns[0].items.length;
+                       res.content.columns[0].items[index] = itemToAdd;
                        res.summary = mw.msg( 
'collaborationkit-list-add-self-summary', itemToAdd.title );
                        LE.saveJson( res, function () {
                                if ( destinationUrl === undefined ) {
@@ -97,7 +97,7 @@
                                inprop: 'url',
                                pageids: memberListPage
                        } ).done( function ( data ) {
-                               memberListUrl = data.query.pages[ 
memberListPage ].fullurl;
+                               memberListUrl = 
data.query.pages[memberListPage].fullurl;
                                $( '.mw-ck-members-join a' )
                                        .attr( 'href', memberListUrl );
 
diff --git a/modules/ext.CollaborationKit.list.ui.js 
b/modules/ext.CollaborationKit.list.ui.js
index 5a0fa36..56abe24 100644
--- a/modules/ext.CollaborationKit.list.ui.js
+++ b/modules/ext.CollaborationKit.list.ui.js
@@ -191,8 +191,9 @@
                                itemToAdd.image = file;
                        }
                        if ( dialog.itemIndex !== undefined ) {
-                               if (    res.content.columns[ dialog.itemColId 
].items <= dialog.itemIndex ||
-                                       res.content.columns[ dialog.itemColId 
].items[ dialog.itemIndex ].title !== dialog.itemTitle
+                               if (
+                                       
res.content.columns[dialog.itemColId].items <= dialog.itemIndex ||
+                                       
res.content.columns[dialog.itemColId].items[dialog.itemIndex].title !== 
dialog.itemTitle
                                ) {
                                        alert( mw.msg( 
'collaborationkit-list-error-editconflict' ) );
                                        location.reload();
@@ -327,8 +328,8 @@
                                        for ( i = 0; i < oldListTitles.length; 
i++ ) {
                                                count += oldListTitles.length;
                                                count -= newListTitles.length;
-                                               for ( j = 0; j < oldListTitles[ 
i ].length; j++ ) {
-                                                       if ( oldListTitles[ i 
][ j ] !== newListTitles[ i ][ j ] ) {
+                                               for ( j = 0; j < 
oldListTitles[i].length; j++ ) {
+                                                       if ( 
oldListTitles[i][j] !== newListTitles[i][j] ) {
                                                                changed = true;
                                                                break;
                                                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/338297
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I613d882cd69857c5b3218f58666c713b03629a57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to