r94016 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94015‎ | r94016 | r94017 >
Date:08:52, 6 August 2011
Author:siebrand
Status:ok
Tags:
Comment:
stylize.php for Translate. How to fix that "///" is changed to "// /"?
Modified paths:
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialSupportedLanguages.php (modified) (history)
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageWebImporter.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslateYaml.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationHelpers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -380,7 +380,7 @@
381381
382382 if ( $s->type === 'changed' ) {
383383 $diff = new DifferenceEngine;
384 - if( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
 384+ if ( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
385385 $diff->setDiffLang( $wgContLang );
386386 }
387387 $diff->setText( $s->getOldText(), $s->getText() );
@@ -420,7 +420,7 @@
421421 $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-template' );
422422
423423 $diff = new DifferenceEngine;
424 - if( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
 424+ if ( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
425425 $diff->setDiffLang( $wgContLang );
426426 }
427427 $diff->setText( $oldTemplate, $newTemplate );
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -231,7 +231,7 @@
232232 }
233233
234234 // BC for <1.19
235 - $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker;
 235+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
236236
237237 $languages = array();
238238 foreach ( $status as $code => $percent ) {
@@ -433,7 +433,7 @@
434434 $ready = $page->getReadyTag();
435435
436436 $title = $page->getTitle();
437 - $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker;
 437+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
438438
439439 $latest = $title->getLatestRevId();
440440 $canmark = $ready === $latest && $marked !== $latest;
@@ -593,7 +593,7 @@
594594 global $wgOut, $wgUser;
595595 // $out was only added in some MW version
596596 if ( $out === null ) $out = $wgOut;
597 - $linker = class_exists('DummyLinker') ? new DummyLinker : new Linker;
 597+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
598598
599599 if ( !TranslatablePage::isTranslationPage( $out->getTitle() )
600600 && !TranslatablePage::isSourcePage( $out->getTitle() ) ) {
@@ -631,7 +631,7 @@
632632 $subpages .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
633633 } else {
634634 // This one is stupid imho, doesn't work with chihuahua
635 - //$subpages .= '&lt; ';
 635+ // $subpages .= '&lt; ';
636636 }
637637
638638 $subpages .= $getlink;
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -418,8 +418,8 @@
419419 return true;
420420 }
421421
422 -
423422
 423+
424424 $definitionTitle = Title::makeTitleSafe( $title->getNamespace(), "$key/" . $group->getSourceLanguage() );
425425 if ( $definitionTitle && $definitionTitle->exists() ) {
426426 $definitionRevision = $definitionTitle->getLatestRevID();
@@ -501,7 +501,7 @@
502502 'tooltip' => 'translate-searchprofile-tooltip',
503503 'namespaces' => $wgTranslateMessageNamespaces,
504504 );
505 -
 505+
506506 $profiles = wfArrayInsertAfter( $profiles, $insert, 'help' );
507507 return true;
508508 }
@@ -511,12 +511,12 @@
512512 return true;
513513 }
514514
515 - if( !$search->getSearchEngine()->supports( 'title-suffix-filter' ) ) {
 515+ if ( !$search->getSearchEngine()->supports( 'title-suffix-filter' ) ) {
516516 return false;
517517 }
518518
519519 $hidden = '';
520 - foreach( $opts as $key => $value ) {
 520+ foreach ( $opts as $key => $value ) {
521521 $hidden .= Html::hidden( $key, $value );
522522 }
523523
Index: trunk/extensions/Translate/utils/MessageWebImporter.php
@@ -478,7 +478,7 @@
479479 $containerParams = array( 'class' => "mw-tpt-sp-section mw-tpt-sp-section-type-{$type}" );
480480 $legendParams = array( 'class' => 'mw-tpt-sp-legend' );
481481 $contentParams = array( 'class' => 'mw-tpt-sp-content' );
482 - if( $lang ) {
 482+ if ( $lang ) {
483483 $contentParams['dir'] = wfGetLangObj( $lang )->getDir();
484484 $contentParams['lang'] = wfGetLangObj( $lang )->getCode();
485485 }
Index: trunk/extensions/Translate/utils/TranslateYaml.php
@@ -110,7 +110,7 @@
111111 return Spyc::YAMLDump( $text );
112112 case 'syck-pecl':
113113 // Just horrible output
114 - //return syck_dump( $text );
 114+ // return syck_dump( $text );
115115 case 'syck':
116116 return self::syckDump( $text );
117117 default:
Index: trunk/extensions/Translate/utils/TranslationHelpers.php
@@ -902,7 +902,7 @@
903903 }
904904
905905 $diff = new DifferenceEngine;
906 - if( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
 906+ if ( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
907907 $diff->setDiffLang( $this->group->getSourceLanguage() );
908908 }
909909 $diff->setText( $oldtext, $newtext );
@@ -954,7 +954,7 @@
955955 }
956956
957957 $diff = new DifferenceEngine;
958 - if( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
 958+ if ( method_exists( 'DifferenceEngine', 'setDiffLang' ) ) {
959959 $diff->setDiffLang( $this->group->getSourceLanguage() );
960960 }
961961 $diff->setText( $oldtext, $newtext );
Index: trunk/extensions/Translate/specials/SpecialSupportedLanguages.php
@@ -154,10 +154,10 @@
155155 $conds = array(
156156 'rc_title' . $dbr->buildLike( $dbr->anyString(), '/', $dbr->anyString() ),
157157 'rc_namespace' => $wgTranslateMessageNamespaces,
158 - 'rc_timestamp > ' . $dbr->timestamp( TS_DB, wfTimeStamp( TS_UNIX ) - 60*60*24*180 ),
 158+ 'rc_timestamp > ' . $dbr->timestamp( TS_DB, wfTimeStamp( TS_UNIX ) - 60 * 60 * 24 * 180 ),
159159 );
160160 $options = array( 'GROUP BY' => 'lang', 'HAVING' => 'count > 20' );
161 -
 161+
162162 $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options );
163163
164164 $data = array();
@@ -188,7 +188,7 @@
189189 'page_id=rev_page',
190190 );
191191 $options = array( 'GROUP BY' => 'rev_user_text, lang' );
192 -
 192+
193193 $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options );
194194
195195 $data = array();
@@ -258,7 +258,7 @@
259259 );
260260
261261 $tag = Html::element( 'a', $params, $name );
262 - $wgOut->addHtml( $tag ."\n" );
 262+ $wgOut->addHtml( $tag . "\n" );
263263 }
264264 $wgOut->addHtml( '</div>' );
265265 }
@@ -267,7 +267,7 @@
268268 global $wgOut, $wgLang, $wgUser;
269269 $skin = $wgUser->getSkin();
270270
271 - $day = 60*60*24;
 271+ $day = 60 * 60 * 24;
272272
273273 // Scale of the activity colors, anything
274274 // longer than this is just inactive
@@ -292,7 +292,7 @@
293293 $username, $wgLang->formatNum( $count ), $wgLang->formatNum( $last ) );
294294 $last = max( 1, min( $period, $last ) );
295295 $styles['border-bottom'] = '3px solid #' . $this->getActivityColour( $period - $last, $period );
296 - #$styles['color'] = '#' . $this->getBackgroundColour( $period - $last, $period );
 296+ # $styles['color'] = '#' . $this->getBackgroundColour( $period - $last, $period );
297297 } else {
298298 $enc = "<s>$enc</s>";
299299 }
@@ -325,7 +325,7 @@
326326 $fields = array( 'user_name', 'user_editcount', 'MAX(rev_timestamp) as lastedit' );
327327 $conds = array( 'user_id = rev_user' );
328328 $options = array( 'GROUP BY' => 'user_name' );
329 -
 329+
330330 $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options );
331331 foreach ( $res as $row ) {
332332 $editcounts[$row->user_name] = $row->user_editcount;
@@ -363,16 +363,16 @@
364364 return $red . $green . $blue;
365365 }
366366
367 - function shuffle_assoc($list) {
368 - if (!is_array($list)) return $list;
 367+ function shuffle_assoc( $list ) {
 368+ if ( !is_array( $list ) ) return $list;
369369
370 - $keys = array_keys($list);
371 - shuffle($keys);
372 - $random = array();
373 - foreach ($keys as $key)
374 - $random[$key] = $list[$key];
 370+ $keys = array_keys( $list );
 371+ shuffle( $keys );
 372+ $random = array();
 373+ foreach ( $keys as $key )
 374+ $random[$key] = $list[$key];
375375
376 - return $random;
 376+ return $random;
377377 }
378378
379379 protected function preQueryUsers( $users ) {
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -355,12 +355,12 @@
356356
357357 // Initialise messages.
358358 $collection = $group->initCollection( $code );
359 -
 359+
360360 $ffs = $group->getFFS();
361361 if ( $ffs instanceof GettextFFS && $code === 'qqq' ) {
362362 $template = $ffs->read( 'en' );
363363 $infile = array();
364 - foreach( $template['TEMPLATE'] as $key => $data ) {
 364+ foreach ( $template['TEMPLATE'] as $key => $data ) {
365365 if ( isset( $data['comments']['.'] ) ) {
366366 $infile[$key] = '1';
367367 }

Status & tagging log