From 68b29a88599d052a423af6f2ad602ec55156a409 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 29 May 2013 15:49:16 +0100 Subject: [PATCH] JS and PHP code style fixes if( -> if ( for( -> for ( else if -> elseif Lines greater than 120 chars chomped. Change-Id: I909d4fe9785a656481878256830ae5965e48a416 --- ApiVisualEditor.php | 19 +++++++++++-------- demos/ve/index.php | 5 +++-- modules/unicodejs/unicodejs.wordbreak.js | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php index c7c2da7f14..06135357f6 100644 --- a/ApiVisualEditor.php +++ b/ApiVisualEditor.php @@ -42,12 +42,12 @@ class ApiVisualEditor extends ApiBase { if ( $status->isOK() ) { $content = $req->getContent(); - } else if ( $status->isGood() ) { + } elseif ( $status->isGood() ) { $this->dieUsage( $req->getContent(), 'parsoidserver-http-'.$req->getStatus() ); - } else if ( $errors = $status->getErrorsByType( 'error' ) ) { + } elseif ( $errors = $status->getErrorsByType( 'error' ) ) { $error = $errors[0]; $code = $error['message']; - if( count( $error['params'] ) ) { + if ( count( $error['params'] ) ) { $message = $error['params'][0]; } else { $message = 'MWHttpRequest error'; @@ -284,7 +284,7 @@ class ApiVisualEditor extends ApiBase { if ( $wikitext === false ) { $this->dieUsage( 'Error contacting the Parsoid server', 'parsoidserver' ); - } else if ( $params['paction'] === 'save' ) { + } elseif ( $params['paction'] === 'save' ) { // Save page $editResult = $this->saveWikitext( $page, $wikitext, $params ); if ( @@ -311,7 +311,7 @@ class ApiVisualEditor extends ApiBase { $result['newrevid'] = intval( $editResult['edit']['newrevid'] ); } } - } else if ( $params['paction'] === 'diff' ) { + } elseif ( $params['paction'] === 'diff' ) { $diff = $this->diffWikitext( $page, $wikitext ); if ( $diff['result'] === 'fail' ) { $this->dieUsage( 'Diff failed', 'difffailed' ); @@ -371,12 +371,15 @@ class ApiVisualEditor extends ApiBase { return array( 'page' => 'The page to perform actions on.', 'paction' => 'Action to perform', - 'oldid' => 'The revision number to use. If zero, the empty string is passed to Parsoid to indicate new page creation.', + 'oldid' => 'The revision number to use. If zero, the empty string is passed to Parsoid' + .' to indicate new page creation.', 'minor' => 'Flag for minor edit.', 'html' => 'HTML to send to parsoid in exchange for wikitext', 'summary' => 'Edit summary', - 'basetimestamp' => 'When saving, set this to the timestamp of the revision that was edited. Used to detect edit conflicts.', - 'starttimestamp' => 'When saving, set this to the timestamp of when the page was loaded. Used to detect edit conflicts.', + 'basetimestamp' => 'When saving, set this to the timestamp of the revision that was' + .' edited. Used to detect edit conflicts.', + 'starttimestamp' => 'When saving, set this to the timestamp of when the page was loaded.' + .' Used to detect edit conflicts.', 'token' => 'Edit token', ); } diff --git a/demos/ve/index.php b/demos/ve/index.php index 7630192ded..fce8f83331 100644 --- a/demos/ve/index.php +++ b/demos/ve/index.php @@ -71,7 +71,8 @@ $html = file_get_contents( $page ); - +
@@ -441,7 +442,7 @@ $html = file_get_contents( $page ); var getKids = function ( obj ) { var $ol = $( '
    ' ), $li; - for( var i = 0; i < obj.children.length; i++ ) { + for ( var i = 0; i < obj.children.length; i++ ) { $li = $( '
  1. ' ); $label = $( '' ).addClass( 've-demo-dump-element' ); if ( obj.children[i].length !== undefined ) { diff --git a/modules/unicodejs/unicodejs.wordbreak.js b/modules/unicodejs/unicodejs.wordbreak.js index 910038d475..9349b20b0c 100644 --- a/modules/unicodejs/unicodejs.wordbreak.js +++ b/modules/unicodejs/unicodejs.wordbreak.js @@ -79,7 +79,7 @@ // Check previous character was alpha-numeric if required if ( onlyAlphaNumeric ) { lastGroup = getGroup( string.read( i - direction + readCharOffset ) ); - if( lastGroup !== 'ALetter' && lastGroup !== 'Numeric' && lastGroup !== 'Katakana' ) { + if ( lastGroup !== 'ALetter' && lastGroup !== 'Numeric' && lastGroup !== 'Katakana' ) { continue; } }