Index: trunk/extensions/ContributionReporting/ContributionReporting.php |
— | — | @@ -116,17 +116,29 @@ |
117 | 117 | $wgHooks['ParserFirstCallInit'][] = 'efContributionReportingSetup'; |
118 | 118 | $wgHooks['LanguageGetMagic'][] = 'efContributionReportingTotal_Magic'; |
119 | 119 | |
| 120 | +/** |
| 121 | + * @param $parser Parser |
| 122 | + * @return bool |
| 123 | + */ |
120 | 124 | function efContributionReportingSetup( $parser ) { |
121 | 125 | $parser->setFunctionHook( 'contributiontotal', 'efContributionReportingTotal_Render' ); |
122 | 126 | return true; |
123 | 127 | } |
124 | 128 | |
| 129 | +/** |
| 130 | + * @param $magicWords array |
| 131 | + * @param $langCode string |
| 132 | + * @return bool |
| 133 | + */ |
125 | 134 | function efContributionReportingTotal_Magic( &$magicWords, $langCode ) { |
126 | 135 | $magicWords['contributiontotal'] = array( 0, 'contributiontotal' ); |
127 | 136 | return true; |
128 | 137 | } |
129 | 138 | |
130 | 139 | // Automatically use a local or special database connection |
| 140 | +/** |
| 141 | + * @return DatabaseMysql |
| 142 | + */ |
131 | 143 | function efContributionReportingConnection() { |
132 | 144 | global $wgContributionReportingDBserver, $wgContributionReportingDBname; |
133 | 145 | global $wgContributionReportingDBuser, $wgContributionReportingDBpassword; |
— | — | @@ -145,6 +157,9 @@ |
146 | 158 | return $db; |
147 | 159 | } |
148 | 160 | |
| 161 | +/** |
| 162 | + * @return DatabaseMysql |
| 163 | + */ |
149 | 164 | function efContributionTrackingConnection() { |
150 | 165 | global $wgContributionTrackingDBserver, $wgContributionTrackingDBname; |
151 | 166 | global $wgContributionTrackingDBuser, $wgContributionTrackingDBpassword; |
— | — | @@ -163,6 +178,11 @@ |
164 | 179 | return $db; |
165 | 180 | } |
166 | 181 | |
| 182 | +/** |
| 183 | + * @param $start |
| 184 | + * @param $fudgeFactor |
| 185 | + * @return string |
| 186 | + */ |
167 | 187 | function efContributionReportingTotal( $start, $fudgeFactor ) { |
168 | 188 | $db = efContributionReportingConnection(); |
169 | 189 | #$db = wfGetDB( DB_MASTER ); |
— | — | @@ -185,6 +205,9 @@ |
186 | 206 | return $output; |
187 | 207 | } |
188 | 208 | |
| 209 | +/** |
| 210 | + * @return string |
| 211 | + */ |
189 | 212 | function efContributionReportingTotal_Render() { |
190 | 213 | $args = func_get_args(); |
191 | 214 | array_shift( $args ); |
Index: trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php |
— | — | @@ -205,7 +205,12 @@ |
206 | 206 | |
207 | 207 | /* Query Functions */ |
208 | 208 | |
209 | | - // Totals for today |
| 209 | + /** |
| 210 | + * Totals for today |
| 211 | + * |
| 212 | + * @param $timestamp string |
| 213 | + * @return array |
| 214 | + */ |
210 | 215 | public function getDayTotals( $timestamp = 0 ) { |
211 | 216 | $range = array(); |
212 | 217 | $end_format = 'Ymd235959'; |
— | — | @@ -250,15 +255,21 @@ |
251 | 256 | |
252 | 257 | ); |
253 | 258 | |
| 259 | + $result = array(); |
254 | 260 | foreach ( $res as $row ) { |
255 | | - foreach( $row as $key => $value ) { |
| 261 | + foreach( $row as $value ) { |
256 | 262 | $result[] = $value; |
257 | 263 | } |
258 | 264 | } |
259 | 265 | return $result; |
260 | 266 | } |
261 | 267 | |
262 | | - // Given a day figure out what its week bounds are |
| 268 | + /** |
| 269 | + * Given a day figure out what its week bounds are |
| 270 | + * |
| 271 | + * @param $day |
| 272 | + * @return array |
| 273 | + */ |
263 | 274 | public function weekRange( $day ) { |
264 | 275 | $day = wfTimestamp( TS_UNIX, $day ); |
265 | 276 | $start = ( date( 'w', $day ) == 0) ? $day : strtotime('last sunday', $day ); // Use current Sunday |
Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function execute( $sub ) { |
19 | | - global $wgRequest, $wgOut, $wgUser, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; |
| 19 | + global $wgRequest, $wgOut, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; |
20 | 20 | |
21 | 21 | $showYear = array(); |
22 | 22 | foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) { |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | Xml::tags( |
251 | 251 | 'table', |
252 | 252 | array( 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0 ), |
253 | | - Xml::tags( 'tr', null, implode( $chart['data'] ) ) |
| 253 | + Xml::tags( 'tr', null, implode( $chart['data'] ) ) // FIXME: Missing parameter to implode |
254 | 254 | ) |
255 | 255 | ); |
256 | 256 | $first = false; |
— | — | @@ -307,7 +307,7 @@ |
308 | 308 | ); |
309 | 309 | $result = array(); |
310 | 310 | $ytd = 0; |
311 | | - while ( $row = $dbr->fetchRow( $select ) ) { |
| 311 | + foreach( $select as $row ) { |
312 | 312 | $row[] = $ytd += $row[1]; // YTD |
313 | 313 | $result[] = $row; |
314 | 314 | } |
— | — | @@ -371,6 +371,10 @@ |
372 | 372 | return null; |
373 | 373 | } |
374 | 374 | |
| 375 | + /** |
| 376 | + * @param $values |
| 377 | + * @return string |
| 378 | + */ |
375 | 379 | private function dropDownList ( $values ) { |
376 | 380 | $dropDown = ''; |
377 | 381 | foreach ( $values as $value ) { |
Index: trunk/extensions/ContributionReporting/ContributionHistory_body.php |
— | — | @@ -11,7 +11,6 @@ |
12 | 12 | $wgOut->redirect( SpecialPage::getTitleFor( 'FundraiserStatistics' )->getFullURL() ); |
13 | 13 | return; |
14 | 14 | |
15 | | - |
16 | 15 | if ( !preg_match( '/^[a-z-]+$/', $language ) ) { |
17 | 16 | $language = 'en'; |
18 | 17 | } |
Index: trunk/extensions/ContributionReporting/ContributionStatistics_body.php |
— | — | @@ -274,6 +274,10 @@ |
275 | 275 | |
276 | 276 | /* Query Functions */ |
277 | 277 | |
| 278 | + /** |
| 279 | + * @param $limit int |
| 280 | + * @return array |
| 281 | + */ |
278 | 282 | public function getDailyTotals( $limit = 30 ) { |
279 | 283 | // Get connection |
280 | 284 | $dbr = efContributionReportingConnection(); |
— | — | @@ -369,6 +373,9 @@ |
370 | 374 | return $totals; |
371 | 375 | } |
372 | 376 | |
| 377 | + /** |
| 378 | + * @return array |
| 379 | + */ |
373 | 380 | public function getCurrencyTotals() { |
374 | 381 | // Get connection |
375 | 382 | $dbr = efContributionReportingConnection(); |
— | — | @@ -498,6 +505,10 @@ |
499 | 506 | ); |
500 | 507 | } |
501 | 508 | |
| 509 | + /** |
| 510 | + * @param $dbr DatabaseBase |
| 511 | + * @return array |
| 512 | + */ |
502 | 513 | protected function dateConds( $dbr ) { |
503 | 514 | return |
504 | 515 | array( |