r60558 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60557‎ | r60558 | r60559 >
Date:13:43, 2 January 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Update formatting
Modified paths:
  • /trunk/extensions/Translate/utils/MessageWebImporter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/MessageWebImporter.php
@@ -32,10 +32,15 @@
3333 global $wgUser;
3434 return $this->user ? $this->user : $wgUser;
3535 }
36 - public function setUser( User $user ) { $this->user = $user; }
3736
 37+ public function setUser( User $user ) {
 38+ $this->user = $user;
 39+ }
3840
39 - public function getGroup() { return $this->group; }
 41+ public function getGroup() {
 42+ return $this->group;
 43+ }
 44+
4045 /**
4146 * Group is either MessageGroup object or group id.
4247 */
@@ -47,9 +52,14 @@
4853 }
4954 }
5055
51 - public function getCode() { return $this->code; }
52 - public function setCode( $code = 'en' ) { $this->code = $code; }
 56+ public function getCode() {
 57+ return $this->code;
 58+ }
5359
 60+ public function setCode( $code = 'en' ) {
 61+ $this->code = $code;
 62+ }
 63+
5464 protected function getAction() {
5565 return $this->getTitle()->getFullURL();
5666 }
@@ -67,8 +77,7 @@
6878 Xml::openElement( 'form', $formParams ) .
6979 Xml::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
7080 Xml::hidden( 'token', $this->getUser()->editToken() ) .
71 - Xml::hidden( 'process', 1 )
72 - ;
 81+ Xml::hidden( 'process', 1 );
7382 }
7483
7584 protected function doFooter() {
@@ -77,6 +86,7 @@
7887
7988 protected function allowProcess() {
8089 global $wgRequest;
 90+
8191 if ( $wgRequest->wasPosted() &&
8292 $wgRequest->getBool( 'process', false ) &&
8393 $this->getUser()->matchEditToken( $wgRequest->getVal( 'token' ) ) ) {
@@ -95,12 +105,16 @@
96106 }
97107
98108 protected function getDefaultAction( $fuzzy, $action ) {
99 - if ( $action ) return $action;
 109+ if ( $action ) {
 110+ return $action;
 111+ }
 112+
100113 return $fuzzy ? 'conflict' : 'import';
101114 }
102115
103116 public function execute( $messages ) {
104117 global $wgOut;
 118+
105119 $this->out = $wgOut;
106120
107121 // Set up diff engine
@@ -122,12 +136,14 @@
123137 // Determine changes
124138 $alldone = $process;
125139 $changed = array();
 140+
126141 foreach ( $messages as $key => $value ) {
127142 $fuzzy = $old = false;
 143+
128144 if ( isset( $collection[$key] ) ) {
129145 $old = $collection[$key]->translation();
130146 $fuzzy = TranslateEditAddons::hasFuzzyString( $old ) ||
131 - TranslateEditAddons::isFuzzy( self::makeTitle( $group, $key, $code ) );
 147+ TranslateEditAddons::isFuzzy( self::makeTitle( $group, $key, $code ) );
132148 }
133149
134150 // No changes at all, ignore
@@ -151,7 +167,9 @@
152168 $action = $wgRequest->getVal( "action-$type-$safekey" );
153169
154170 if ( $process ) {
155 - if ( !count( $changed ) ) $changed[] = '<ul>';
 171+ if ( !count( $changed ) ) {
 172+ $changed[] = '<ul>';
 173+ }
156174
157175 global $wgLang;
158176 if ( $action === null ) {
@@ -216,9 +234,13 @@
217235 }
218236
219237 if ( $process || ( !count( $changed ) && $code !== 'en' ) ) {
220 - if ( !count( $changed ) ) $this->out->addWikiMsg( 'translate-manage-nochanges-other' );
 238+ if ( !count( $changed ) ) {
 239+ $this->out->addWikiMsg( 'translate-manage-nochanges-other' );
 240+ }
221241
222 - if ( !count( $changed ) || strpos( $changed[count( $changed ) - 1], '<li>' ) !== 0 ) $changed[] = '<ul>';
 242+ if ( !count( $changed ) || strpos( $changed[count( $changed ) - 1], '<li>' ) !== 0 ) {
 243+ $changed[] = '<ul>';
 244+ }
223245
224246 $message = wfMsgExt( 'translate-manage-import-done', 'parseinline' );
225247 $changed[] = "<li>$message</li></ul>";
@@ -333,9 +355,7 @@
334356 $text = "* " . wfMsgExt( $key, array(), $c );
335357 }
336358
337 - return array( 'translate-manage-import-fuzzy',
338 - "\n" . $text
339 - );
 359+ return array( 'translate-manage-import-fuzzy', "\n" . $text );
340360 }
341361
342362 // FIXME: duplicate of SpecialManageGroups::getFuzzyBot()

Status & tagging log