r108128 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108127‎ | r108128 | r108129 >
Date:09:45, 5 January 2012
Author:siebrand
Status:ok
Tags:
Comment:
stylize.php.
Modified paths:
  • /trunk/extensions/ContributionScores/ContributionScores.i18n.php (modified) (history)
  • /trunk/extensions/ContributionScores/ContributionScores.php (modified) (history)
  • /trunk/extensions/ContributionScores/ContributionScores_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionScores/ContributionScores_body.php
@@ -3,7 +3,7 @@
44 * \brief Contains code for the ContributionScores Class (extends SpecialPage).
55 */
66
7 -///Special page class for the Contribution Scores extension
 7+/// Special page class for the Contribution Scores extension
88 /**
99 * Special page that generates a list of wiki contributors based
1010 * on edit diversity (unique pages edited) and edit volume (total
@@ -17,7 +17,7 @@
1818 parent::__construct( 'ContributionScores' );
1919 }
2020
21 - ///Generates a "Contribution Scores" table for a given LIMIT and date range
 21+ /// Generates a "Contribution Scores" table for a given LIMIT and date range
2222 /**
2323 * Function generates Contribution Scores tables in HTML format (not wikiText)
2424 *
@@ -33,17 +33,17 @@
3434
3535 $dbr = wfGetDB( DB_SLAVE );
3636
37 - $userTable = $dbr->tableName('user');
38 - $userGroupTable = $dbr->tableName('user_groups');
39 - $revTable = $dbr->tableName('revision');
40 - $ipBlocksTable = $dbr->tableName('ipblocks');
 37+ $userTable = $dbr->tableName( 'user' );
 38+ $userGroupTable = $dbr->tableName( 'user_groups' );
 39+ $revTable = $dbr->tableName( 'revision' );
 40+ $ipBlocksTable = $dbr->tableName( 'ipblocks' );
4141
4242 $sqlWhere = "";
4343 $nextPrefix = "WHERE";
4444
4545 if ( $days > 0 ) {
46 - $date = time() - (60*60*24*$days);
47 - $dateString = $dbr->timestamp($date);
 46+ $date = time() - ( 60 * 60 * 24 * $days );
 47+ $dateString = $dbr->timestamp( $date );
4848 $sqlWhere .= " {$nextPrefix} rev_timestamp > '$dateString'";
4949 $nextPrefix = "AND";
5050 }
@@ -90,8 +90,8 @@
9191
9292 $sortable = in_array( 'nosort', $opts ) ? '' : ' sortable';
9393
94 - $output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n".
95 - "<tr class='header'>\n".
 94+ $output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" .
 95+ "<tr class='header'>\n" .
9696 Html::element( 'th', array(), wfMsg( 'contributionscores-score' ) ) .
9797 Html::element( 'th', array(), wfMsg( 'contributionscores-pages' ) ) .
9898 Html::element( 'th', array(), wfMsg( 'contributionscores-changes' ) ) .
@@ -101,7 +101,7 @@
102102
103103 foreach ( $res as $row ) {
104104 // Use real name if option used and real name present.
105 - if( $wgContribScoresUseRealName && $row->user_real_name !== '' ) {
 105+ if ( $wgContribScoresUseRealName && $row->user_real_name !== '' ) {
106106 $userLink = Linker::userLink(
107107 $row->user_id,
108108 $row->user_name,
@@ -142,12 +142,12 @@
143143 if ( !empty( $title ) )
144144 $output = Html::rawElement( 'table', array( 'cellspacing' => 0, 'cellpadding' => 0,
145145 'class' => 'contributionscores-wrapper', 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() ),
146 - "\n".
147 - "<tr>\n".
148 - "<td style='padding: 0px;'>{$title}</td>\n".
149 - "</tr>\n".
150 - "<tr>\n".
151 - "<td style='padding: 0px;'>{$output}</td>\n".
 146+ "\n" .
 147+ "<tr>\n" .
 148+ "<td style='padding: 0px;'>{$title}</td>\n" .
 149+ "</tr>\n" .
 150+ "<tr>\n" .
 151+ "<td style='padding: 0px;'>{$output}</td>\n" .
152152 "</tr>\n" );
153153
154154 return $output;
@@ -156,7 +156,7 @@
157157 function execute( $par ) {
158158 $this->setHeaders();
159159
160 - if( $this->including() ) {
 160+ if ( $this->including() ) {
161161 $this->showInclude( $par );
162162 } else {
163163 $this->showPage();
@@ -178,7 +178,7 @@
179179 $options = 'none';
180180
181181 if ( !empty( $par ) ) {
182 - $params = explode('/', $par );
 182+ $params = explode( '/', $par );
183183
184184 $limit = intval( $params[0] );
185185
@@ -231,7 +231,7 @@
232232 } else {
233233 $reportTitle = wfMsg( 'contributionscores-allrevisions' );
234234 }
235 - $reportTitle .= " " . wfMsgExt('contributionscores-top', 'parsemag', $wgLang->formatNum( $revs ) );
 235+ $reportTitle .= " " . wfMsgExt( 'contributionscores-top', 'parsemag', $wgLang->formatNum( $revs ) );
236236 $title = Xml::element( 'h2', array( 'class' => 'contributionscores-title' ), $reportTitle ) . "\n";
237237 $wgOut->addHTML( $title );
238238 $wgOut->addHTML( $this->genContributionScoreTable( $days, $revs ) );
Index: trunk/extensions/ContributionScores/ContributionScores.i18n.php
@@ -405,7 +405,7 @@
406406 *Jaden (1) dypk za kuždy wobźěłany bok
407407 *Kwadratny kórjeń (wšych cynjonych změnow) - (cełkowna licba bokow) * 2
408408 Licba dypkow, kótaraž wulicyjo se za tym nałogom, gódnośi wšakosć změnow wušej ako licbu změnow.
409 -Zasadnje toś ta licba dypkow měri pśedewšym wobźěłane změny pód źiwanim na wusoku licbu změnow -
 409+Zasadnje toś ta licba dypkow měri pśedewšym wobźěłane změny pód źiwanim na wusoku licbu změnow -
410410 pód wuměnjenim až to by było bok z wušeju kwalitu.',
411411 'contributionscores-top' => '({{PLURAL:$1|Nejlěpšy $1|Nejlěpšej $1|Nejlěpše $1|Nejlěpšych $1}})',
412412 'contributionscores-days' => '{{PLURAL:$1|Slědny $1 źeń|Slědnej $1 dnja|Slědne $1 dny|Slědnych $1 dnjow}}',
@@ -807,7 +807,7 @@
808808 'contributionscores' => 'Nòt pou kontribisyon yo',
809809 'contributionscores-desc' => 'Sonde bazdone wiki a pou pi gwo [[Special:ContributionScores|kantite kontribisyon pa itilizatè]]',
810810 'contributionscores-info' => 'Nòt yo kalkile konsa:
811 -*Yon (1) pwen pou chak paj inik ki te modifye
 811+*Yon (1) pwen pou chak paj inik ki te modifye
812812 *Rasin Kare de (kantite modifikasyon total ki te fè) - (Total Paj Inik) * 2
813813 Se konsa, nòt la bay plis pwa pou divèsite modifikasyon pase kantite modifikasyon yo.
814814 Sa vle di nòt sa la pou mezire paj inik ki te modifye an premye, avèk yon konsiderasyon pou gwo volim modifikasyon – ki konsidere kòm ap bay yon paj ki gen pi bon kalite.',
@@ -950,9 +950,9 @@
951951 $messages['it'] = array(
952952 'contributionscores' => 'Punteggi contributi',
953953 'contributionscores-desc' => 'Interroga il database wiki per il più alto [[Special:ContributionScores|volume di contributi utente]]',
954 - 'contributionscores-info' => 'I punteggi vengono calcolati in questo modo:
955 -*1 punto per ciascuna pagina distinta modificata
956 -*Radice quadrata di (Tutte le modifiche effettuate) - (Totale pagine distinte) * 2
 954+ 'contributionscores-info' => 'I punteggi vengono calcolati in questo modo:
 955+*1 punto per ciascuna pagina distinta modificata
 956+*Radice quadrata di (Tutte le modifiche effettuate) - (Totale pagine distinte) * 2
957957 Questo metodo di calcolo dei punteggi tiene in maggior conto la diversità delle modifiche rispetto al numero dei contributi. Di fondo, questo punteggio misura in primo luogo il numero di pagine distinte modificate, valutando anche un eventuale alto volume di contributi - ciò fa presumere una più elevata qualità della pagina modificata.',
958958 'contributionscores-top' => '(Migliori $1)',
959959 'contributionscores-days' => '{{PLURAL:$1|Ultimo giorno|Ultimi $1 giorni}}',
@@ -1390,7 +1390,7 @@
13911391 $messages['oc'] = array(
13921392 'contributionscores' => 'Puntatge de las contribucions',
13931393 'contributionscores-desc' => 'Espia la banca de donadas wiki pels [[Special:ContributionScores|utilizaires contribuissent mai]]',
1394 - 'contributionscores-info' => "Lo puntatge se calcula coma seguís :
 1394+ 'contributionscores-info' => "Lo puntatge se calcula coma seguís :
13951395 * 1 punt per cada pagina modificada
13961396 * raiç quadrada de (nombre de modificacions) - (nombre de paginas diferentas)
13971397 * 2. D'aqueste biais, lo puntatge calculat preferís la diversitat a la quantitat. Escrich d'un autre biais, aqueste puntatge s'interèssa principalament a far veire lo nombre de modificacions de paginas diferentas, puèi la quantitat totala de modificacions.",
@@ -1479,10 +1479,10 @@
14801480 $messages['pms'] = array(
14811481 'contributionscores' => 'Classìfica dla contribussion',
14821482 'contributionscores-desc' => 'Antéroga ël database wiki an sël pì àut [[Special:ContributionScores|volum dij contribù utent]]',
1483 - 'contributionscores-info' => "La classìfica as càlcola parej:
1484 -*1 pont për minca pàgina modificà
1485 -*Rèis quadra ëd (Total dle Modìfiche Fàite) - (Total dle Pàgine Ùniche) moltiplicà për 2
1486 -Le classìfiche donca as peulo ten-se ën pèisand an manera diferenta ël nùmer dle modìfiche anvers al volum dle modìfiche mideme.
 1483+ 'contributionscores-info' => "La classìfica as càlcola parej:
 1484+*1 pont për minca pàgina modificà
 1485+*Rèis quadra ëd (Total dle Modìfiche Fàite) - (Total dle Pàgine Ùniche) moltiplicà për 2
 1486+Le classìfiche donca as peulo ten-se ën pèisand an manera diferenta ël nùmer dle modìfiche anvers al volum dle modìfiche mideme.
14871487 Sta classìfica a l'amzura dzortut le pàgine ùniche ch'a ven-o modificà, e ën vorend a-j da n'euj ëd rësgoard a cole ch'a l'han n'àot volum ëd modìfica - ch'as pensa ch'a peula esse na marca ëd qualità dl'artìcol.",
14881488 'contributionscores-top' => '(Ij $1 mej)',
14891489 'contributionscores-days' => 'Ùltim Last {{PLURAL:$1|di|$1 di}}',
@@ -1726,7 +1726,7 @@
17271727 'contributionscores' => 'Benutserbiedraage ouskätsje',
17281728 'contributionscores-info' => 'Ouskätsskema:
17291729 *1 Punkt foar älke beoarbaidede Siede
1730 -*Quadroatwuttel fon aal do (Beoarbaidengen) - (Summe fon do beoarbaidede Sieden) * 2
 1730+*Quadroatwuttel fon aal do (Beoarbaidengen) - (Summe fon do beoarbaidede Sieden) * 2
17311731 Ouskätsengen ap disse Gruundloage weege ju Fuulfoold fon do Biedraage swarrer as dät Biedraachsvolumen. Disse Ouschätsenge mät do apaate Sieden, man lukt uk wäls ganse Oarbaid in Reekenge.',
17321732 'contributionscores-top' => '(Buppeste $1)',
17331733 'contributionscores-days' => 'Lääste $1 Deege',
@@ -1982,7 +1982,7 @@
19831983 'contributionscores-info' => 'I punti i vien calcolà come segue:
19841984 *Un (1) punto par ogni diversa pagina modificà
19851985 *Raìsa quadrata de (Tute le modifiche fate) - (Total de le pagine modificà) * 2
1986 -Fasendo i conti in sta maniera pesa piassè la diversità de le modifiche rispeto al nùmaro dei contributi.
 1986+Fasendo i conti in sta maniera pesa piassè la diversità de le modifiche rispeto al nùmaro dei contributi.
19871987 In sostansa, sto puntegio el tien conto sopratuto de le diverse pagine modificà, tegnendo in considerazion anca un alto volume de modifiche - che fa pensar a na pi alta qualità de la pagina modificà.',
19881988 'contributionscores-top' => '(Ultimi $1)',
19891989 'contributionscores-days' => '{{PLURAL:$1|Ultimo zòrno|Ultimi $1 zòrni}}',
Index: trunk/extensions/ContributionScores/ContributionScores.php
@@ -4,9 +4,9 @@
55 */
66
77 # Not a valid entry point, skip unless MEDIAWIKI is defined
8 -if (!defined('MEDIAWIKI')) {
 8+if ( !defined( 'MEDIAWIKI' ) ) {
99 echo "Contribution Scores extension";
10 - exit(1);
 10+ exit( 1 );
1111 }
1212
1313 $wgExtensionCredits['specialpage'][] = array(
@@ -48,44 +48,44 @@
4949 return true;
5050 }
5151
52 -function efContributionScores_Render(&$parser, $usertext, $metric='score') {
 52+function efContributionScores_Render( &$parser, $usertext, $metric = 'score' ) {
5353 global $wgContribScoreDisableCache;
5454
55 - if ($wgContribScoreDisableCache) {
 55+ if ( $wgContribScoreDisableCache ) {
5656 $parser->disableCache();
5757 }
5858
59 - $user = User::newFromName($usertext);
 59+ $user = User::newFromName( $usertext );
6060 $dbr = wfGetDB( DB_SLAVE );
6161
6262 if ( $user instanceof User && $user->isLoggedIn() ) {
6363 global $wgLang;
6464
65 - if ($metric=='score') {
66 - $res = $dbr->select('revision',
 65+ if ( $metric == 'score' ) {
 66+ $res = $dbr->select( 'revision',
6767 'COUNT(DISTINCT rev_page)+SQRT(COUNT(rev_id)-COUNT(DISTINCT rev_page))*2 AS wiki_rank',
68 - array('rev_user' => $user->getID()));
69 - $row = $dbr->fetchObject($res);
70 - $output = $wgLang->formatNum( round($row->wiki_rank,0) );
71 - } elseif ($metric=='changes') {
72 - $res = $dbr->select('revision',
 68+ array( 'rev_user' => $user->getID() ) );
 69+ $row = $dbr->fetchObject( $res );
 70+ $output = $wgLang->formatNum( round( $row->wiki_rank, 0 ) );
 71+ } elseif ( $metric == 'changes' ) {
 72+ $res = $dbr->select( 'revision',
7373 'COUNT(rev_id) AS rev_count',
74 - array('rev_user' => $user->getID()));
75 - $row = $dbr->fetchObject($res);
 74+ array( 'rev_user' => $user->getID() ) );
 75+ $row = $dbr->fetchObject( $res );
7676 $output = $wgLang->formatNum( $row->rev_count );
7777
78 - } elseif ($metric=='pages') {
79 - $res = $dbr->select('revision',
 78+ } elseif ( $metric == 'pages' ) {
 79+ $res = $dbr->select( 'revision',
8080 'COUNT(DISTINCT rev_page) AS page_count',
81 - array('rev_user' => $user->getID()));
82 - $row = $dbr->fetchObject($res);
 81+ array( 'rev_user' => $user->getID() ) );
 82+ $row = $dbr->fetchObject( $res );
8383 $output = $wgLang->formatNum( $row->page_count );
8484 } else {
85 - $output = wfMsg('contributionscores-invalidmetric');
 85+ $output = wfMsg( 'contributionscores-invalidmetric' );
8686 }
8787 } else {
88 - $output = wfMsg('contributionscores-invalidusername');
 88+ $output = wfMsg( 'contributionscores-invalidusername' );
8989 }
9090
91 - return $parser->insertStripItem($output, $parser->mStripState);
 91+ return $parser->insertStripItem( $output, $parser->mStripState );
9292 }

Status & tagging log