mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
JS and PHP code style fixes
if( -> if ( for( -> for ( else if -> elseif Lines greater than 120 chars chomped. Change-Id: I909d4fe9785a656481878256830ae5965e48a416
This commit is contained in:
parent
750ab24d31
commit
68b29a8859
|
@ -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',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ $html = file_get_contents( $page );
|
|||
<?php echo basename( $page, '.html' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</ul>
|
||||
<div class="ve-demo-editor"></div>
|
||||
|
||||
|
@ -441,7 +442,7 @@ $html = file_get_contents( $page );
|
|||
var getKids = function ( obj ) {
|
||||
var $ol = $( '<ol start="0"></ol>' ),
|
||||
$li;
|
||||
for( var i = 0; i < obj.children.length; i++ ) {
|
||||
for ( var i = 0; i < obj.children.length; i++ ) {
|
||||
$li = $( '<li>' );
|
||||
$label = $( '<span>' ).addClass( 've-demo-dump-element' );
|
||||
if ( obj.children[i].length !== undefined ) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue