From d16dfb0ad5ce7f38ed2f5c198829d9849f703a8d Mon Sep 17 00:00:00 2001 From: Fomafix Date: Sat, 14 Mar 2015 15:49:04 +0000 Subject: [PATCH] Style code * Fix errors and warnings from phpcs. * Add commas at end of lines for arrays in PHP. * Add space between // and comment. * Add space between ) and {. * Use tabs instead of spaces for indenting. * Break lines in PHP with more than 100 characters. * Remove double spaces and spaces at end of line. * Remove spaces before comma. * Fix some typos. Change-Id: I9c014bdfa9832fa6a20d0190fe2fc668983d0fb9 --- WikiEditor.hooks.php | 27 ++++---- WikiEditor.php | 6 +- modules/jquery.wikiEditor.dialogs.config.js | 4 +- modules/jquery.wikiEditor.html | 6 +- modules/jquery.wikiEditor.js | 4 +- tests/selenium/WikiDialogsLinks.php | 68 +++++++++++++++++++ ...ks_Setup.php => WikiDialogsLinksSetup.php} | 51 +++++++++----- tests/selenium/WikiDialogs_Links.php | 67 ------------------ tests/selenium/WikiEditorConstants.php | 10 +-- tests/selenium/WikiEditorSeleniumConfig.php | 2 +- tests/selenium/WikiEditorTestSuite.php | 2 +- 11 files changed, 134 insertions(+), 113 deletions(-) create mode 100644 tests/selenium/WikiDialogsLinks.php rename tests/selenium/{WikiDialogs_Links_Setup.php => WikiDialogsLinksSetup.php} (89%) delete mode 100644 tests/selenium/WikiDialogs_Links.php diff --git a/WikiEditor.hooks.php b/WikiEditor.hooks.php index 7fb74d05..308a9fa1 100644 --- a/WikiEditor.hooks.php +++ b/WikiEditor.hooks.php @@ -122,7 +122,8 @@ class WikiEditorHooks { if ( !isset( $wgWikiEditorFeatures[$name] ) || $wgWikiEditorFeatures[$name]['global'] ) { return true; } - // Features with user preference control can have any number of preferences to be specific values to be enabled + // Features with user preference control can have any number of preferences + // to be specific values to be enabled if ( $wgWikiEditorFeatures[$name]['user'] ) { if ( isset( self::$features[$name]['requirements'] ) ) { foreach ( self::$features[$name]['requirements'] as $requirement => $value ) { @@ -134,7 +135,8 @@ class WikiEditorHooks { } return true; } - // Features controlled by $wgWikiEditorFeatures with both global and user set to false are awlways disabled + // Features controlled by $wgWikiEditorFeatures with both global and user + // set to false are always disabled return false; } @@ -336,7 +338,7 @@ class WikiEditorHooks { if ( count( $configurations ) ) { $vars = array_merge( $vars, $configurations ); } - //expose magic words for use by the wikieditor toolbar + // expose magic words for use by the wikieditor toolbar WikiEditorHooks::getMagicWords( $vars ); return true; } @@ -346,7 +348,8 @@ class WikiEditorHooks { * * Registers JavaScript test modules * - * @param $testModules array of javascript testing modules. 'qunit' is fed using tests/qunit/QUnitTestResources.php. + * @param $testModules array of javascript testing modules. 'qunit' is fed using + * tests/qunit/QUnitTestResources.php. * @param $resourceLoader object * @return bool */ @@ -383,7 +386,7 @@ class WikiEditorHooks { * @param $vars array * @return bool */ - private static function getMagicWords( &$vars ){ + private static function getMagicWords( &$vars ) { $requiredMagicWords = array( 'redirect', 'img_right', @@ -474,19 +477,19 @@ class WikiEditorHooks { if ( $status->value === EditPage::AS_CONFLICT_DETECTED ) { $data['action.saveFailure.type'] = 'editConflict'; - } else if ( $status->value === EditPage::AS_ARTICLE_WAS_DELETED ) { + } elseif ( $status->value === EditPage::AS_ARTICLE_WAS_DELETED ) { $data['action.saveFailure.type'] = 'editPageDeleted'; - } else if ( isset( $errors[0][0] ) && $errors[0][0] === 'abusefilter-disallowed' ) { + } elseif ( isset( $errors[0][0] ) && $errors[0][0] === 'abusefilter-disallowed' ) { $data['action.saveFailure.type'] = 'extensionAbuseFilter'; - } else if ( isset( $editPage->getArticle()->getPage()->ConfirmEdit_ActivateCaptcha ) ) { + } elseif ( isset( $editPage->getArticle()->getPage()->ConfirmEdit_ActivateCaptcha ) ) { // TODO: :( $data['action.saveFailure.type'] = 'extensionCaptcha'; - } else if ( isset( $errors[0][0] ) && $errors[0][0] === 'spamprotectiontext' ) { + } elseif ( isset( $errors[0][0] ) && $errors[0][0] === 'spamprotectiontext' ) { $data['action.saveFailure.type'] = 'extensionSpamBlacklist'; } else { - // Catch everything else... We don't seem to get userBadToken or - // userNewUser through this hook. - $data['action.saveFailure.type'] = 'responseUnknown'; + // Catch everything else... We don't seem to get userBadToken or + // userNewUser through this hook. + $data['action.saveFailure.type'] = 'responseUnknown'; } } self::doEventLogging( $action, $article, $data ); diff --git a/WikiEditor.php b/WikiEditor.php index de63dc6f..a8572edf 100644 --- a/WikiEditor.php +++ b/WikiEditor.php @@ -30,7 +30,7 @@ $GLOBALS['wgWikiEditorFeatures'] = array( // Adds a tab for previewing in-line 'preview' => array( 'global' => false, 'user' => true ), - // Adds a button and dialog for step-by-step publishing + // Adds a button and dialog for step-by-step publishing 'publish' => array( 'global' => false, 'user' => true ), ); @@ -152,7 +152,7 @@ $GLOBALS['wgResourceModules'] += array( 'jquery.wikiEditor', 'jquery.wikiEditor.toolbar.i18n', 'jquery.wikiEditor.toolbar', - ) + ), ), 'jquery.wikiEditor.toolbar.i18n' => $wikiEditorTpl + array( 'messages' => array( @@ -415,7 +415,7 @@ $GLOBALS['wgResourceModules'] += array( 'ext.wikiEditor', 'jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config', - ) + ), ), 'ext.wikiEditor.toolbar.styles' => $wikiEditorTpl + array( 'styles' => 'ext.wikiEditor.toolbar.styles.less', diff --git a/modules/jquery.wikiEditor.dialogs.config.js b/modules/jquery.wikiEditor.dialogs.config.js index 5ae4dbf8..7b543538 100644 --- a/modules/jquery.wikiEditor.dialogs.config.js +++ b/modules/jquery.wikiEditor.dialogs.config.js @@ -599,7 +599,7 @@ $.wikiEditor.modules.dialogs.config = { $( '#wikieditor-toolbar-link-int-target' ).suggestions(); // don't overwrite user's text - if ( selection !== '' ){ + if ( selection !== '' ) { $( '#wikieditor-toolbar-link-int-text' ).data( 'untouched', false ); } @@ -810,7 +810,7 @@ $.wikiEditor.modules.dialogs.config = { if ( fileName !== '' ) { fileTitle = new mw.Title( fileName ); // Append file namespace prefix to filename if not already contains it - if ( fileTitle.getNamespaceId() !== 6 ){ + if ( fileTitle.getNamespaceId() !== 6 ) { fileTitle = new mw.Title( fileName, 6 ); } fileName = fileTitle.toText(); diff --git a/modules/jquery.wikiEditor.html b/modules/jquery.wikiEditor.html index 7a890af0..349f0273 100644 --- a/modules/jquery.wikiEditor.html +++ b/modules/jquery.wikiEditor.html @@ -6,14 +6,14 @@ +