Index: trunk/extensions/ContributionScores/ContributionScores_body.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * \brief Contains code for the ContributionScores Class (extends SpecialPage). |
5 | 5 | */ |
6 | 6 | |
7 | | -///Special page class for the Contribution Scores extension |
| 7 | +/// Special page class for the Contribution Scores extension |
8 | 8 | /** |
9 | 9 | * Special page that generates a list of wiki contributors based |
10 | 10 | * on edit diversity (unique pages edited) and edit volume (total |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | parent::__construct( 'ContributionScores' ); |
19 | 19 | } |
20 | 20 | |
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 |
22 | 22 | /** |
23 | 23 | * Function generates Contribution Scores tables in HTML format (not wikiText) |
24 | 24 | * |
— | — | @@ -33,17 +33,17 @@ |
34 | 34 | |
35 | 35 | $dbr = wfGetDB( DB_SLAVE ); |
36 | 36 | |
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' ); |
41 | 41 | |
42 | 42 | $sqlWhere = ""; |
43 | 43 | $nextPrefix = "WHERE"; |
44 | 44 | |
45 | 45 | 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 ); |
48 | 48 | $sqlWhere .= " {$nextPrefix} rev_timestamp > '$dateString'"; |
49 | 49 | $nextPrefix = "AND"; |
50 | 50 | } |
— | — | @@ -90,8 +90,8 @@ |
91 | 91 | |
92 | 92 | $sortable = in_array( 'nosort', $opts ) ? '' : ' sortable'; |
93 | 93 | |
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" . |
96 | 96 | Html::element( 'th', array(), wfMsg( 'contributionscores-score' ) ) . |
97 | 97 | Html::element( 'th', array(), wfMsg( 'contributionscores-pages' ) ) . |
98 | 98 | Html::element( 'th', array(), wfMsg( 'contributionscores-changes' ) ) . |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | |
103 | 103 | foreach ( $res as $row ) { |
104 | 104 | // Use real name if option used and real name present. |
105 | | - if( $wgContribScoresUseRealName && $row->user_real_name !== '' ) { |
| 105 | + if ( $wgContribScoresUseRealName && $row->user_real_name !== '' ) { |
106 | 106 | $userLink = Linker::userLink( |
107 | 107 | $row->user_id, |
108 | 108 | $row->user_name, |
— | — | @@ -142,12 +142,12 @@ |
143 | 143 | if ( !empty( $title ) ) |
144 | 144 | $output = Html::rawElement( 'table', array( 'cellspacing' => 0, 'cellpadding' => 0, |
145 | 145 | '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" . |
152 | 152 | "</tr>\n" ); |
153 | 153 | |
154 | 154 | return $output; |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | function execute( $par ) { |
158 | 158 | $this->setHeaders(); |
159 | 159 | |
160 | | - if( $this->including() ) { |
| 160 | + if ( $this->including() ) { |
161 | 161 | $this->showInclude( $par ); |
162 | 162 | } else { |
163 | 163 | $this->showPage(); |
— | — | @@ -178,7 +178,7 @@ |
179 | 179 | $options = 'none'; |
180 | 180 | |
181 | 181 | if ( !empty( $par ) ) { |
182 | | - $params = explode('/', $par ); |
| 182 | + $params = explode( '/', $par ); |
183 | 183 | |
184 | 184 | $limit = intval( $params[0] ); |
185 | 185 | |
— | — | @@ -231,7 +231,7 @@ |
232 | 232 | } else { |
233 | 233 | $reportTitle = wfMsg( 'contributionscores-allrevisions' ); |
234 | 234 | } |
235 | | - $reportTitle .= " " . wfMsgExt('contributionscores-top', 'parsemag', $wgLang->formatNum( $revs ) ); |
| 235 | + $reportTitle .= " " . wfMsgExt( 'contributionscores-top', 'parsemag', $wgLang->formatNum( $revs ) ); |
236 | 236 | $title = Xml::element( 'h2', array( 'class' => 'contributionscores-title' ), $reportTitle ) . "\n"; |
237 | 237 | $wgOut->addHTML( $title ); |
238 | 238 | $wgOut->addHTML( $this->genContributionScoreTable( $days, $revs ) ); |
Index: trunk/extensions/ContributionScores/ContributionScores.i18n.php |
— | — | @@ -405,7 +405,7 @@ |
406 | 406 | *Jaden (1) dypk za kuždy wobźěłany bok |
407 | 407 | *Kwadratny kórjeń (wšych cynjonych změnow) - (cełkowna licba bokow) * 2 |
408 | 408 | 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 - |
410 | 410 | pód wuměnjenim až to by było bok z wušeju kwalitu.', |
411 | 411 | 'contributionscores-top' => '({{PLURAL:$1|Nejlěpšy $1|Nejlěpšej $1|Nejlěpše $1|Nejlěpšych $1}})', |
412 | 412 | 'contributionscores-days' => '{{PLURAL:$1|Slědny $1 źeń|Slědnej $1 dnja|Slědne $1 dny|Slědnych $1 dnjow}}', |
— | — | @@ -807,7 +807,7 @@ |
808 | 808 | 'contributionscores' => 'Nòt pou kontribisyon yo', |
809 | 809 | 'contributionscores-desc' => 'Sonde bazdone wiki a pou pi gwo [[Special:ContributionScores|kantite kontribisyon pa itilizatè]]', |
810 | 810 | '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 |
812 | 812 | *Rasin Kare de (kantite modifikasyon total ki te fè) - (Total Paj Inik) * 2 |
813 | 813 | Se konsa, nòt la bay plis pwa pou divèsite modifikasyon pase kantite modifikasyon yo. |
814 | 814 | 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 @@ |
951 | 951 | $messages['it'] = array( |
952 | 952 | 'contributionscores' => 'Punteggi contributi', |
953 | 953 | '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 |
957 | 957 | 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.', |
958 | 958 | 'contributionscores-top' => '(Migliori $1)', |
959 | 959 | 'contributionscores-days' => '{{PLURAL:$1|Ultimo giorno|Ultimi $1 giorni}}', |
— | — | @@ -1390,7 +1390,7 @@ |
1391 | 1391 | $messages['oc'] = array( |
1392 | 1392 | 'contributionscores' => 'Puntatge de las contribucions', |
1393 | 1393 | '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 : |
1395 | 1395 | * 1 punt per cada pagina modificada |
1396 | 1396 | * raiç quadrada de (nombre de modificacions) - (nombre de paginas diferentas) |
1397 | 1397 | * 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 @@ |
1480 | 1480 | $messages['pms'] = array( |
1481 | 1481 | 'contributionscores' => 'Classìfica dla contribussion', |
1482 | 1482 | '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. |
1487 | 1487 | 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.", |
1488 | 1488 | 'contributionscores-top' => '(Ij $1 mej)', |
1489 | 1489 | 'contributionscores-days' => 'Ùltim Last {{PLURAL:$1|di|$1 di}}', |
— | — | @@ -1726,7 +1726,7 @@ |
1727 | 1727 | 'contributionscores' => 'Benutserbiedraage ouskätsje', |
1728 | 1728 | 'contributionscores-info' => 'Ouskätsskema: |
1729 | 1729 | *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 |
1731 | 1731 | 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.', |
1732 | 1732 | 'contributionscores-top' => '(Buppeste $1)', |
1733 | 1733 | 'contributionscores-days' => 'Lääste $1 Deege', |
— | — | @@ -1982,7 +1982,7 @@ |
1983 | 1983 | 'contributionscores-info' => 'I punti i vien calcolà come segue: |
1984 | 1984 | *Un (1) punto par ogni diversa pagina modificà |
1985 | 1985 | *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. |
1987 | 1987 | 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à.', |
1988 | 1988 | 'contributionscores-top' => '(Ultimi $1)', |
1989 | 1989 | 'contributionscores-days' => '{{PLURAL:$1|Ultimo zòrno|Ultimi $1 zòrni}}', |
Index: trunk/extensions/ContributionScores/ContributionScores.php |
— | — | @@ -4,9 +4,9 @@ |
5 | 5 | */ |
6 | 6 | |
7 | 7 | # Not a valid entry point, skip unless MEDIAWIKI is defined |
8 | | -if (!defined('MEDIAWIKI')) { |
| 8 | +if ( !defined( 'MEDIAWIKI' ) ) { |
9 | 9 | echo "Contribution Scores extension"; |
10 | | - exit(1); |
| 10 | + exit( 1 ); |
11 | 11 | } |
12 | 12 | |
13 | 13 | $wgExtensionCredits['specialpage'][] = array( |
— | — | @@ -48,44 +48,44 @@ |
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
52 | | -function efContributionScores_Render(&$parser, $usertext, $metric='score') { |
| 52 | +function efContributionScores_Render( &$parser, $usertext, $metric = 'score' ) { |
53 | 53 | global $wgContribScoreDisableCache; |
54 | 54 | |
55 | | - if ($wgContribScoreDisableCache) { |
| 55 | + if ( $wgContribScoreDisableCache ) { |
56 | 56 | $parser->disableCache(); |
57 | 57 | } |
58 | 58 | |
59 | | - $user = User::newFromName($usertext); |
| 59 | + $user = User::newFromName( $usertext ); |
60 | 60 | $dbr = wfGetDB( DB_SLAVE ); |
61 | 61 | |
62 | 62 | if ( $user instanceof User && $user->isLoggedIn() ) { |
63 | 63 | global $wgLang; |
64 | 64 | |
65 | | - if ($metric=='score') { |
66 | | - $res = $dbr->select('revision', |
| 65 | + if ( $metric == 'score' ) { |
| 66 | + $res = $dbr->select( 'revision', |
67 | 67 | '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', |
73 | 73 | '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 ); |
76 | 76 | $output = $wgLang->formatNum( $row->rev_count ); |
77 | 77 | |
78 | | - } elseif ($metric=='pages') { |
79 | | - $res = $dbr->select('revision', |
| 78 | + } elseif ( $metric == 'pages' ) { |
| 79 | + $res = $dbr->select( 'revision', |
80 | 80 | '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 ); |
83 | 83 | $output = $wgLang->formatNum( $row->page_count ); |
84 | 84 | } else { |
85 | | - $output = wfMsg('contributionscores-invalidmetric'); |
| 85 | + $output = wfMsg( 'contributionscores-invalidmetric' ); |
86 | 86 | } |
87 | 87 | } else { |
88 | | - $output = wfMsg('contributionscores-invalidusername'); |
| 88 | + $output = wfMsg( 'contributionscores-invalidusername' ); |
89 | 89 | } |
90 | 90 | |
91 | | - return $parser->insertStripItem($output, $parser->mStripState); |
| 91 | + return $parser->insertStripItem( $output, $parser->mStripState ); |
92 | 92 | } |