Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * a piece of feedback |
28 | 28 | * |
29 | 29 | * A feedback request consists of |
30 | | - * 1. |
| 30 | + * 1. |
31 | 31 | */ |
32 | 32 | public function execute() { |
33 | 33 | |
— | — | @@ -63,13 +63,13 @@ |
64 | 64 | // no-op, because this is already broken |
65 | 65 | $error = 'articlefeedbackv5-invalid-feedback-id'; |
66 | 66 | |
67 | | - } elseif ( 'delete' == $flag && $wgUser->isAllowed( 'aftv5-delete-feedback' )) { |
| 67 | + } elseif ( 'delete' == $flag && $wgUser->isAllowed( 'aftv5-delete-feedback' ) ) { |
68 | 68 | |
69 | 69 | // deleting means to "mark as oversighted" and "delete" it |
70 | 70 | // oversighting also auto-hides the item |
71 | 71 | |
72 | 72 | // increase means "oversight this" |
73 | | - if( $direction == 'increase' ) { |
| 73 | + if ( $direction == 'increase' ) { |
74 | 74 | $activity = 'oversight'; |
75 | 75 | |
76 | 76 | // delete |
— | — | @@ -81,16 +81,16 @@ |
82 | 82 | // delete specific filters |
83 | 83 | $filters['deleted'] = 1; |
84 | 84 | $filters['notdeleted'] = -1; |
85 | | - if (true == $record->af_is_undeleted ) { |
| 85 | + if ( true == $record->af_is_undeleted ) { |
86 | 86 | $filters['undeleted'] = -1; |
87 | 87 | } |
88 | 88 | |
89 | 89 | // This is data for the "hidden by, oversighted by" red line |
90 | | - $results['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink($wgUser); |
| 90 | + $results['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink( $wgUser ); |
91 | 91 | $results['oversight-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
92 | 92 | |
93 | 93 | // autohide if not hidden |
94 | | - if (false == $record->af_is_hidden ) { |
| 94 | + if ( false == $record->af_is_hidden ) { |
95 | 95 | $update['af_is_hidden'] = true; |
96 | 96 | $update['af_is_unhidden'] = false; |
97 | 97 | $filters = $this->changeFilterCounts( $record, $filters, 'hide' ); |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | // tell front-end autohiding was done |
103 | 103 | $results['autohidden'] = 1; |
104 | 104 | // This is data for the "hidden by, oversighted by" red line |
105 | | - $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink(null, $default_user); |
| 105 | + $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink( null, $default_user ); |
106 | 106 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
107 | 107 | } |
108 | 108 | |
— | — | @@ -118,10 +118,10 @@ |
119 | 119 | $filters['notdeleted'] = 1; |
120 | 120 | } |
121 | 121 | |
122 | | - } elseif ( 'hide' == $flag && $wgUser->isAllowed( 'aftv5-hide-feedback' )) { |
| 122 | + } elseif ( 'hide' == $flag && $wgUser->isAllowed( 'aftv5-hide-feedback' ) ) { |
123 | 123 | |
124 | 124 | // increase means "hide this" |
125 | | - if( $direction == 'increase' ) { |
| 125 | + if ( $direction == 'increase' ) { |
126 | 126 | $activity = 'hidden'; |
127 | 127 | |
128 | 128 | // hide |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | $filters = $this->changeFilterCounts( $record, $filters, 'hide' ); |
135 | 135 | |
136 | 136 | // This is data for the "hidden by, oversighted by" red line |
137 | | - $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink($wgUser); |
| 137 | + $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink( $wgUser ); |
138 | 138 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
139 | 139 | |
140 | 140 | } else { |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | $filters = $this->changeFilterCounts( $record, $filters, 'show' ); |
148 | 148 | } |
149 | 149 | |
150 | | - } elseif( 'resetoversight' === $flag && $wgUser->isAllowed( 'aftv5-delete-feedback' )) { |
| 150 | + } elseif ( 'resetoversight' === $flag && $wgUser->isAllowed( 'aftv5-delete-feedback' ) ) { |
151 | 151 | |
152 | 152 | $activity = 'decline'; |
153 | 153 | // oversight request count becomes 0 |
— | — | @@ -155,11 +155,11 @@ |
156 | 156 | $update['af_is_declined'] = true; |
157 | 157 | $filters['declined'] = 1; |
158 | 158 | // if the oversight count was greater then 1 |
159 | | - if(0 < $record->af_oversight_count) { |
| 159 | + if ( 0 < $record->af_oversight_count ) { |
160 | 160 | $filters['needsoversight'] = -1; |
161 | 161 | } |
162 | 162 | |
163 | | - } elseif( 'abuse' === $flag) { |
| 163 | + } elseif ( 'abuse' === $flag ) { |
164 | 164 | |
165 | 165 | // Conditional formatting for abuse flag |
166 | 166 | global $wgArticleFeedbackv5AbusiveThreshold, |
— | — | @@ -168,28 +168,28 @@ |
169 | 169 | $results['abuse_count'] = $record->af_abuse_count; |
170 | 170 | |
171 | 171 | // Make the abuse count in the result reflect this vote. |
172 | | - if( $direction == 'increase' ) { |
173 | | - $results['abuse_count']++; |
174 | | - } else { |
175 | | - $results['abuse_count']--; |
| 172 | + if ( $direction == 'increase' ) { |
| 173 | + $results['abuse_count']++; |
| 174 | + } else { |
| 175 | + $results['abuse_count']--; |
176 | 176 | } |
177 | 177 | // no negative numbers |
178 | | - $results['abuse_count'] = max(0, $results['abuse_count']); |
| 178 | + $results['abuse_count'] = max( 0, $results['abuse_count'] ); |
179 | 179 | |
180 | 180 | // Return a flag in the JSON, that turns the link red. |
181 | | - if( $results['abuse_count'] >= $wgArticleFeedbackv5AbusiveThreshold ) { |
| 181 | + if ( $results['abuse_count'] >= $wgArticleFeedbackv5AbusiveThreshold ) { |
182 | 182 | $results['abusive'] = 1; |
183 | 183 | } |
184 | 184 | |
185 | 185 | // Adding a new abuse flag: abusive++ |
186 | | - if($direction == 'increase') { |
| 186 | + if ( $direction == 'increase' ) { |
187 | 187 | $activity = 'flag'; |
188 | 188 | $filters['abusive'] = 1; |
189 | 189 | // NOTE: we are bypassing traditional sql escaping here |
190 | 190 | $update[] = "af_abuse_count = af_abuse_count + 1"; |
191 | 191 | |
192 | 192 | // Auto-hide after threshold flags |
193 | | - if( $record->af_abuse_count > $wgArticleFeedbackv5HideAbuseThreshold |
| 193 | + if ( $record->af_abuse_count > $wgArticleFeedbackv5HideAbuseThreshold |
194 | 194 | && false == $record->af_is_hidden ) { |
195 | 195 | // hide |
196 | 196 | $update['af_is_hidden'] = true; |
— | — | @@ -205,20 +205,20 @@ |
206 | 206 | // tell front-end autohiding was done |
207 | 207 | $results['autohidden'] = 1; |
208 | 208 | // This is data for the "hidden by, oversighted by" red line |
209 | | - $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink(null, $default_user); |
| 209 | + $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink( null, $default_user ); |
210 | 210 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
211 | 211 | } |
212 | 212 | } |
213 | | - |
| 213 | + |
214 | 214 | // Removing the last abuse flag: abusive-- |
215 | | - elseif($direction == 'decrease') { |
| 215 | + elseif ( $direction == 'decrease' ) { |
216 | 216 | $activity = 'unflag'; |
217 | 217 | $filters['abusive'] = -1; |
218 | 218 | // NOTE: we are bypassing traditional sql escaping here |
219 | 219 | $update[] = "af_abuse_count = GREATEST(CONVERT(af_abuse_count, SIGNED) -1, 0)"; |
220 | 220 | |
221 | 221 | // Un-hide if we don't have 5 flags anymore |
222 | | - if( $record->af_abuse_count == 5 && true == $record->af_is_hidden ) { |
| 222 | + if ( $record->af_abuse_count == 5 && true == $record->af_is_hidden ) { |
223 | 223 | $update['af_is_hidden'] = false; |
224 | 224 | $update['af_is_unhidden'] = true; |
225 | 225 | |
— | — | @@ -232,16 +232,16 @@ |
233 | 233 | } |
234 | 234 | |
235 | 235 | // NOTE: this is actually request/unrequest oversight and works similar to abuse |
236 | | - } elseif( 'oversight' === $flag && $wgUser->isAllowed( 'aftv5-hide-feedback' )) { |
| 236 | + } elseif ( 'oversight' === $flag && $wgUser->isAllowed( 'aftv5-hide-feedback' ) ) { |
237 | 237 | |
238 | | - if($direction == 'increase') { |
| 238 | + if ( $direction == 'increase' ) { |
239 | 239 | $activity = 'request'; |
240 | 240 | $filters['needsoversight'] = 1; |
241 | 241 | // NOTE: we are bypassing traditional sql escaping here |
242 | 242 | $update[] = "af_oversight_count = af_oversight_count + 1"; |
243 | 243 | |
244 | 244 | // autohide if not hidden |
245 | | - if (false == $record->af_is_hidden ) { |
| 245 | + if ( false == $record->af_is_hidden ) { |
246 | 246 | $update['af_is_hidden'] = true; |
247 | 247 | $update['af_is_unhidden'] = false; |
248 | 248 | // 0 is used for "autohidden" purposes, we'll explicitly set it to overwrite last hider |
— | — | @@ -253,17 +253,17 @@ |
254 | 254 | // tell front-end autohiding was done |
255 | 255 | $results['autohidden'] = 1; |
256 | 256 | // This is data for the "hidden by, oversighted by" red line |
257 | | - $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink(null, $default_user); |
| 257 | + $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink( null, $default_user ); |
258 | 258 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
259 | 259 | } |
260 | 260 | |
261 | 261 | // IF the previous setting was 0, send an email |
262 | | - if ( $record->af_oversight_count < 1) { |
| 262 | + if ( $record->af_oversight_count < 1 ) { |
263 | 263 | |
264 | 264 | $this->sendOversightEmail( $record->af_page_id , $feedbackId ); |
265 | 265 | |
266 | 266 | } |
267 | | - } elseif($direction == 'decrease') { |
| 267 | + } elseif ( $direction == 'decrease' ) { |
268 | 268 | $activity = 'unrequest'; |
269 | 269 | $filters['needsoversight'] = -1; |
270 | 270 | // NOTE: we are bypassing traditional sql escaping here |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | } |
276 | 276 | |
277 | 277 | // helpful and unhelpful flagging |
278 | | - } elseif( 'unhelpful' === $flag || 'helpful' === $flag) { |
| 278 | + } elseif ( 'unhelpful' === $flag || 'helpful' === $flag ) { |
279 | 279 | |
280 | 280 | $results['toggle'] = $toggle; |
281 | 281 | $helpful = $record->af_helpful_count; |
— | — | @@ -282,10 +282,10 @@ |
283 | 283 | |
284 | 284 | // if toggle is on, we are decreasing one and increasing the other atomically |
285 | 285 | // means one less http request and the counts don't mess up |
286 | | - if (true == $toggle) { |
| 286 | + if ( true == $toggle ) { |
287 | 287 | |
288 | | - if( ( ($flag == 'helpful' && $direction == 'increase' ) |
289 | | - || ($flag == 'unhelpful' && $direction == 'decrease' ) ) |
| 288 | + if ( ( ( $flag == 'helpful' && $direction == 'increase' ) |
| 289 | + || ( $flag == 'unhelpful' && $direction == 'decrease' ) ) |
290 | 290 | ) { |
291 | 291 | // NOTE: we are bypassing traditional sql escaping here |
292 | 292 | $update[] = "af_helpful_count = af_helpful_count + 1"; |
— | — | @@ -293,8 +293,8 @@ |
294 | 294 | $helpful++; |
295 | 295 | $unhelpful--; |
296 | 296 | |
297 | | - } elseif ( ( ($flag == 'unhelpful' && $direction == 'increase' ) |
298 | | - || ($flag == 'helpful' && $direction == 'decrease' ) ) |
| 297 | + } elseif ( ( ( $flag == 'unhelpful' && $direction == 'increase' ) |
| 298 | + || ( $flag == 'helpful' && $direction == 'decrease' ) ) |
299 | 299 | ) { |
300 | 300 | // NOTE: we are bypassing traditional sql escaping here |
301 | 301 | $update[] = "af_unhelpful_count = af_unhelpful_count + 1"; |
— | — | @@ -305,11 +305,11 @@ |
306 | 306 | |
307 | 307 | } else { |
308 | 308 | |
309 | | - if ( 'unhelpful' === $flag && $direction == 'increase') { |
| 309 | + if ( 'unhelpful' === $flag && $direction == 'increase' ) { |
310 | 310 | // NOTE: we are bypassing traditional sql escaping here |
311 | 311 | $update[] = "af_unhelpful_count = af_unhelpful_count + 1"; |
312 | 312 | $unhelpful++; |
313 | | - } elseif ( 'unhelpful' === $flag && $direction == 'decrease') { |
| 313 | + } elseif ( 'unhelpful' === $flag && $direction == 'decrease' ) { |
314 | 314 | // NOTE: we are bypassing traditional sql escaping here |
315 | 315 | $update[] = "af_unhelpful_count = GREATEST(0, CONVERT(af_unhelpful_count, SIGNED) - 1)"; |
316 | 316 | $unhelpful--; |
— | — | @@ -328,31 +328,31 @@ |
329 | 329 | $netHelpfulness = $helpful - $unhelpful; |
330 | 330 | |
331 | 331 | // increase helpful OR decrease unhelpful |
332 | | - if( ( ($flag == 'helpful' && $direction == 'increase' ) |
333 | | - || ($flag == 'unhelpful' && $direction == 'decrease' ) ) |
| 332 | + if ( ( ( $flag == 'helpful' && $direction == 'increase' ) |
| 333 | + || ( $flag == 'unhelpful' && $direction == 'decrease' ) ) |
334 | 334 | ) { |
335 | 335 | // net was -1: no longer unhelpful |
336 | | - if( $netHelpfulness == -1 ) { |
| 336 | + if ( $netHelpfulness == -1 ) { |
337 | 337 | $filters['unhelpful'] = -1; |
338 | 338 | } |
339 | | - |
| 339 | + |
340 | 340 | // net was 0: now helpful |
341 | | - if( $netHelpfulness == 0 ) { |
| 341 | + if ( $netHelpfulness == 0 ) { |
342 | 342 | $filters['helpful'] = 1; |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | 346 | // increase unhelpful OR decrease unhelpful |
347 | | - if( ( ($flag == 'unhelpful' && $direction == 'increase' ) |
348 | | - || ($flag == 'helpful' && $direction == 'decrease' ) ) |
| 347 | + if ( ( ( $flag == 'unhelpful' && $direction == 'increase' ) |
| 348 | + || ( $flag == 'helpful' && $direction == 'decrease' ) ) |
349 | 349 | ) { |
350 | 350 | // net was 1: no longer helpful |
351 | | - if( $netHelpfulness == 1 ) { |
| 351 | + if ( $netHelpfulness == 1 ) { |
352 | 352 | $filters['helpful'] = -1; |
353 | 353 | } |
354 | | - |
| 354 | + |
355 | 355 | // net was 0: now unhelpful |
356 | | - if( $netHelpfulness == 0 ) { |
| 356 | + if ( $netHelpfulness == 0 ) { |
357 | 357 | $filters['unhelpful'] = 1; |
358 | 358 | } |
359 | 359 | } |
— | — | @@ -362,7 +362,7 @@ |
363 | 363 | } |
364 | 364 | |
365 | 365 | // we were valid |
366 | | - if ( !isset($error) ) { |
| 366 | + if ( !isset( $error ) ) { |
367 | 367 | |
368 | 368 | $success = $dbw->update( |
369 | 369 | 'aft_article_feedback', |
— | — | @@ -377,27 +377,27 @@ |
378 | 378 | $dbw->commit(); // everything went well, so we commit our db changes |
379 | 379 | |
380 | 380 | // helpfulness counts are NOT logged, no activity is set |
381 | | - if (isset($activity)) { |
| 381 | + if ( isset( $activity ) ) { |
382 | 382 | ApiArticleFeedbackv5Utils::logActivity( $activity , $pageId, $feedbackId, $notes ); |
383 | 383 | } |
384 | 384 | |
385 | 385 | // handle implicit hide/show logging |
386 | 386 | if ( isset( $implicit_hide ) && $implicit_hide ) { |
387 | | - ApiArticleFeedbackv5Utils::logActivity( 'hidden' , $pageId, $feedbackId, '', true); |
| 387 | + ApiArticleFeedbackv5Utils::logActivity( 'hidden' , $pageId, $feedbackId, '', true ); |
388 | 388 | } |
389 | 389 | |
390 | 390 | // Update helpful/unhelpful display count after submission. |
391 | 391 | if ( $flag == 'helpful' || $flag == 'unhelpful' ) { |
392 | 392 | |
393 | 393 | // no negative numbers please |
394 | | - $helpful = max(0, $helpful); |
395 | | - $unhelpful = max(0, $unhelpful); |
| 394 | + $helpful = max( 0, $helpful ); |
| 395 | + $unhelpful = max( 0, $unhelpful ); |
396 | 396 | |
397 | | - $results['helpful'] = wfMessage( |
| 397 | + $results['helpful'] = wfMessage( |
398 | 398 | 'articlefeedbackv5-form-helpful-votes', |
399 | 399 | $helpful, $unhelpful |
400 | 400 | )->escaped(); |
401 | | - |
| 401 | + |
402 | 402 | // Update net_helpfulness after flagging as helpful/unhelpful. |
403 | 403 | $dbw->update( |
404 | 404 | 'aft_article_feedback', |
— | — | @@ -449,7 +449,7 @@ |
450 | 450 | 'af_is_undeleted', |
451 | 451 | 'af_is_declined', |
452 | 452 | 'af_has_comment', |
453 | | - 'af_oversight_count'), |
| 453 | + 'af_oversight_count' ), |
454 | 454 | array( 'af_id' => $id ) |
455 | 455 | ); |
456 | 456 | return $record; |
— | — | @@ -468,7 +468,7 @@ |
469 | 469 | // all, deleted, undeleted, and notdeleted |
470 | 470 | |
471 | 471 | // use -1 (decrement) for hide, 1 for increment (show) - default is hide |
472 | | - switch($action) { |
| 472 | + switch( $action ) { |
473 | 473 | case 'show': |
474 | 474 | $int = 1; |
475 | 475 | // if we're showing, this will increment |
— | — | @@ -476,7 +476,7 @@ |
477 | 477 | break; |
478 | 478 | default: |
479 | 479 | // if we're hiding, and was unhidden, decrement |
480 | | - if(true == $record->af_is_unhidden) { |
| 480 | + if ( true == $record->af_is_unhidden ) { |
481 | 481 | $filters['unhidden'] = -1; |
482 | 482 | } |
483 | 483 | $int = -1; |
— | — | @@ -488,18 +488,18 @@ |
489 | 489 | $filters['invisible'] = -$int; // opposite of int |
490 | 490 | |
491 | 491 | // comment |
492 | | - if(true == $record->af_has_comment) { |
| 492 | + if ( true == $record->af_has_comment ) { |
493 | 493 | $filters['comment'] = $int; |
494 | 494 | } |
495 | 495 | |
496 | 496 | // abusive |
497 | | - if( $record->af_abuse_count > 1 ) { |
| 497 | + if ( $record->af_abuse_count > 1 ) { |
498 | 498 | $filters['abusive'] = $int; |
499 | 499 | } |
500 | 500 | // helpful and unhelpful |
501 | | - if( $record->af_net_helpfulness > 1 ) { |
| 501 | + if ( $record->af_net_helpfulness > 1 ) { |
502 | 502 | $filters['helpful'] = $int; |
503 | | - } elseif( $record->af_net_helpfulness < 1 ) { |
| 503 | + } elseif ( $record->af_net_helpfulness < 1 ) { |
504 | 504 | $filters['unhelpful'] = $int; |
505 | 505 | } |
506 | 506 | |
— | — | @@ -618,7 +618,7 @@ |
619 | 619 | * @param int $page_id page id to grab info on |
620 | 620 | * @param int $feedback_id identifier for the feedback item |
621 | 621 | */ |
622 | | - protected function sendOversightEmail( $page_id, $feedback_id) { |
| 622 | + protected function sendOversightEmail( $page_id, $feedback_id ) { |
623 | 623 | global $wgUser; |
624 | 624 | |
625 | 625 | // jobs need a title object |
— | — | @@ -650,7 +650,7 @@ |
651 | 651 | 'user_url' => $user_page->getCanonicalUrl(), |
652 | 652 | 'page_name' => $title_object->getText(), |
653 | 653 | 'page_url' => $title_object->getCanonicalUrl(), |
654 | | - 'permalink' => $permalink->getCanonicalUrl()); |
| 654 | + 'permalink' => $permalink->getCanonicalUrl() ); |
655 | 655 | |
656 | 656 | $job = new ArticleFeedbackv5MailerJob( $title_object, $params ); |
657 | 657 | $job->insert(); |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | |
111 | 111 | // Per Fabrice 1/25, FeedbackPage only cares about option 1, so |
112 | 112 | // don't bother updating the rollups if this is a different one. |
113 | | - if( $bucket == 1 ) { |
| 113 | + if ( $bucket == 1 ) { |
114 | 114 | $this->updateRollupTables( $pageId, $revisionId, $userAnswers ); |
115 | 115 | $this->updateFilterCounts( $dbw, $pageId, $userAnswers ); |
116 | 116 | } |
— | — | @@ -284,7 +284,7 @@ |
285 | 285 | public function updateFilterCounts( $dbw, $pageId, $answers ) { |
286 | 286 | |
287 | 287 | // a new item should be in all and visible by default, increment those counters |
288 | | - $filters = array( 'all' => 1, 'visible' => 1, 'notdeleted' => 1); |
| 288 | + $filters = array( 'all' => 1, 'visible' => 1, 'notdeleted' => 1 ); |
289 | 289 | |
290 | 290 | // if this record has a comment attached then increment comment as well |
291 | 291 | // notice we do not need to walk the entire array, since any one hit |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -95,11 +95,11 @@ |
96 | 96 | // This is in memcache so I don't feel that bad re-fetching it. |
97 | 97 | // Needed to join in the comment and rating tables, for filtering |
98 | 98 | // and sorting, respectively. |
99 | | - foreach( ApiArticleFeedbackv5Utils::getFields() as $field ) { |
100 | | - if( $field['afi_bucket_id'] == 1 && $field['afi_name'] == 'comment' ) { |
| 99 | + foreach ( ApiArticleFeedbackv5Utils::getFields() as $field ) { |
| 100 | + if ( $field['afi_bucket_id'] == 1 && $field['afi_name'] == 'comment' ) { |
101 | 101 | $commentField = $field['afi_id']; |
102 | 102 | } |
103 | | - if( $field['afi_bucket_id'] == 1 && $field['afi_name'] == 'found' ) { |
| 103 | + if ( $field['afi_bucket_id'] == 1 && $field['afi_name'] == 'found' ) { |
104 | 104 | $ratingField = $field['afi_id']; |
105 | 105 | } |
106 | 106 | } |
— | — | @@ -107,26 +107,26 @@ |
108 | 108 | // Build ORDER BY clause. |
109 | 109 | switch( $sort ) { |
110 | 110 | case 'helpful': |
111 | | - $sortField = 'af_net_helpfulness'; |
| 111 | + $sortField = 'af_net_helpfulness'; |
112 | 112 | $order = "af_net_helpfulness $direction, af_id $direction"; |
113 | | - $continueSql = "(af_net_helpfulness $continueDirection ".intVal( $continue ) |
114 | | - ." OR (af_net_helpfulness = ".intVal( $continue ) |
115 | | - ." AND af_id $continueDirection ".intval( $continueId ).") )"; |
| 113 | + $continueSql = "(af_net_helpfulness $continueDirection " . intVal( $continue ) |
| 114 | + . " OR (af_net_helpfulness = " . intVal( $continue ) |
| 115 | + . " AND af_id $continueDirection " . intval( $continueId ) . ") )"; |
116 | 116 | break; |
117 | 117 | case 'rating': |
118 | 118 | # TODO: null ratings don't seem to show up at all. Need to sort that one out. |
119 | 119 | $sortField = 'rating'; |
120 | 120 | $order = "yes_no $direction, af_id $direction"; |
121 | | - $continueSql = "(rating.aa_response_boolean $continueDirection ".intVal( $continue ) |
122 | | - ." OR (rating.aa_response_boolean = ".intVal( $continue ) |
123 | | - ." AND af_id $continueDirection ".intval( $continueId ).") )"; |
| 121 | + $continueSql = "(rating.aa_response_boolean $continueDirection " . intVal( $continue ) |
| 122 | + . " OR (rating.aa_response_boolean = " . intVal( $continue ) |
| 123 | + . " AND af_id $continueDirection " . intval( $continueId ) . ") )"; |
124 | 124 | break; |
125 | 125 | case 'age': |
126 | 126 | # Default field, fall through |
127 | 127 | default: |
128 | | - $sortField = 'af_id'; |
| 128 | + $sortField = 'af_id'; |
129 | 129 | $order = "af_id $direction"; |
130 | | - $continueSql = "af_id $continueDirection ".intVal( $continue ); |
| 130 | + $continueSql = "af_id $continueDirection " . intVal( $continue ); |
131 | 131 | break; |
132 | 132 | } |
133 | 133 | |
— | — | @@ -162,17 +162,17 @@ |
163 | 163 | $where, |
164 | 164 | __METHOD__, |
165 | 165 | array( |
166 | | - 'LIMIT' => ($limit + 1), |
| 166 | + 'LIMIT' => ( $limit + 1 ), |
167 | 167 | 'ORDER BY' => $order |
168 | 168 | ), |
169 | 169 | array( |
170 | 170 | 'rating' => array( |
171 | 171 | 'LEFT JOIN', |
172 | | - 'rating.aa_feedback_id = af_id AND rating.aa_field_id = '.intval( $ratingField ) |
| 172 | + 'rating.aa_feedback_id = af_id AND rating.aa_field_id = ' . intval( $ratingField ) |
173 | 173 | ), |
174 | 174 | 'comment' => array( |
175 | 175 | 'LEFT JOIN', |
176 | | - 'comment.aa_feedback_id = af_id AND comment.aa_field_id = '.intval( $commentField ) |
| 176 | + 'comment.aa_feedback_id = af_id AND comment.aa_field_id = ' . intval( $commentField ) |
177 | 177 | ) |
178 | 178 | ) |
179 | 179 | ); |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | foreach ( $id_query as $id ) { |
182 | 182 | $ids[$id->af_id] = $id->af_id; |
183 | 183 | // Get the continue values from the last counted item. |
184 | | - if( count( $ids ) == $limit ) { |
| 184 | + if ( count( $ids ) == $limit ) { |
185 | 185 | $this->continue = $id->$sortField; |
186 | 186 | $this->continueId = $id->af_id; |
187 | 187 | } |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | foreach ( $rows as $row ) { |
254 | 254 | if ( !array_key_exists( $row->af_id, $ids ) ) { |
255 | 255 | continue; // something has gone dreadfully wrong actually |
256 | | - } elseif ( !is_array( $ids[$row->af_id] )) { |
| 256 | + } elseif ( !is_array( $ids[$row->af_id] ) ) { |
257 | 257 | $ids[$row->af_id] = array(); |
258 | 258 | $ids[$row->af_id][0] = $row; |
259 | 259 | $ids[$row->af_id][0]->user_name = $row->user_name ? $row->user_name : $row->af_user_ip; |
— | — | @@ -271,12 +271,12 @@ |
272 | 272 | |
273 | 273 | // Never show hidden or deleted posts unless specifically requested |
274 | 274 | // and user has access. |
275 | | - if( !in_array( $filter, $deletedFilters ) |
| 275 | + if ( !in_array( $filter, $deletedFilters ) |
276 | 276 | || !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
277 | 277 | $where[] = 'af_is_deleted IS FALSE'; |
278 | 278 | } |
279 | 279 | |
280 | | - if( !in_array( $filter, $hiddenFilters ) |
| 280 | + if ( !in_array( $filter, $hiddenFilters ) |
281 | 281 | || !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
282 | 282 | $where[] = 'af_is_hidden IS FALSE'; |
283 | 283 | } |
— | — | @@ -357,7 +357,7 @@ |
358 | 358 | if ( $can_vote ) { |
359 | 359 | $footer_links .= Html::element( 'span', array( |
360 | 360 | 'class' => 'articleFeedbackv5-helpful-caption' |
361 | | - ), wfMessage( 'articlefeedbackv5-form-helpful-label' )->text() |
| 361 | + ), wfMessage( 'articlefeedbackv5-form-helpful-label' )->text() |
362 | 362 | ) |
363 | 363 | . Html::element( 'a', array( |
364 | 364 | 'id' => "articleFeedbackv5-helpful-link-$id", |
— | — | @@ -371,9 +371,9 @@ |
372 | 372 | $footer_links .= Html::element( 'span', array( |
373 | 373 | 'class' => 'articleFeedbackv5-helpful-votes', |
374 | 374 | 'id' => "articleFeedbackv5-helpful-votes-$id" |
375 | | - ), wfMessage( 'articlefeedbackv5-form-helpful-votes', |
| 375 | + ), wfMessage( 'articlefeedbackv5-form-helpful-votes', |
376 | 376 | $wgLang->formatNum( $record[0]->af_helpful_count ), |
377 | | - $wgLang->formatNum( $record[0]->af_unhelpful_count ) |
| 377 | + $wgLang->formatNum( $record[0]->af_unhelpful_count ) |
378 | 378 | )->text() ); |
379 | 379 | $footer_links .= Html::closeElement( 'div' ); |
380 | 380 | if ( $can_flag ) { |
— | — | @@ -433,7 +433,7 @@ |
434 | 434 | } |
435 | 435 | |
436 | 436 | // !can delete == request oversight |
437 | | - if ( $can_hide && !$can_delete) { |
| 437 | + if ( $can_hide && !$can_delete ) { |
438 | 438 | if ( $record[0]->af_oversight_count > 0 ) { |
439 | 439 | $msg = 'unoversight'; |
440 | 440 | $class = 'unrequestoversight'; |
— | — | @@ -457,7 +457,7 @@ |
458 | 458 | 'id' => "articleFeedbackv5-declineoversight-link-$id", |
459 | 459 | 'class' => "articleFeedbackv5-declineoversight-link", |
460 | 460 | 'href' => '#', |
461 | | - ), wfMessage( "articlefeedbackv5-form-decline")->text() ) ); |
| 461 | + ), wfMessage( "articlefeedbackv5-form-decline" )->text() ) ); |
462 | 462 | } |
463 | 463 | |
464 | 464 | if ( $record[0]->af_is_deleted > 0 ) { |
— | — | @@ -499,12 +499,12 @@ |
500 | 500 | ); |
501 | 501 | if ( $record[0]->af_is_hidden ) { |
502 | 502 | |
503 | | - $attributes['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink($record[0]->af_hide_user_id, $default_user); |
| 503 | + $attributes['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink( $record[0]->af_hide_user_id, $default_user ); |
504 | 504 | $attributes['hide-timestamp'] = wfTimestamp( TS_RFC2822, $record[0]->af_hide_timestamp ); |
505 | 505 | } |
506 | 506 | if ( $record[0]->af_is_deleted ) { |
507 | 507 | |
508 | | - $attributes['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink($record[0]->af_oversight_user_id, $default_user); |
| 508 | + $attributes['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink( $record[0]->af_oversight_user_id, $default_user ); |
509 | 509 | $attributes['oversight-timestamp'] = wfTimestamp( TS_RFC2822, $record[0]->af_oversight_timestamp ); |
510 | 510 | } |
511 | 511 | |
— | — | @@ -515,7 +515,7 @@ |
516 | 516 | . $content |
517 | 517 | . $footer_links |
518 | 518 | . Html::closeElement( 'div' ) |
519 | | - //. $details |
| 519 | + // . $details |
520 | 520 | . $tools |
521 | 521 | . Html::closeElement( 'div' ); |
522 | 522 | } |
— | — | @@ -524,21 +524,21 @@ |
525 | 525 | global $wgLang; |
526 | 526 | $id = $record->af_id; |
527 | 527 | $title = $record->page_title; |
528 | | - |
| 528 | + |
529 | 529 | $blocks = array( |
530 | 530 | array( 'total' => 60 * 60 * 24 * 365, 'name' => 'years' ), |
531 | | - array( 'total' => 60 * 60 * 24 * 30, 'name' => 'months'), |
532 | | - array( 'total' => 60 * 60 * 24 * 7, 'name' => 'weeks'), |
533 | | - array( 'total' => 60 * 60 * 24, 'name' => 'days'), |
534 | | - array( 'total' => 60 * 60, 'name' => 'hours'), |
535 | | - array( 'total' => 60, 'name' => 'minutes') ); |
536 | | - |
| 531 | + array( 'total' => 60 * 60 * 24 * 30, 'name' => 'months' ), |
| 532 | + array( 'total' => 60 * 60 * 24 * 7, 'name' => 'weeks' ), |
| 533 | + array( 'total' => 60 * 60 * 24, 'name' => 'days' ), |
| 534 | + array( 'total' => 60 * 60, 'name' => 'hours' ), |
| 535 | + array( 'total' => 60, 'name' => 'minutes' ) ); |
| 536 | + |
537 | 537 | $since = wfTimestamp( TS_UNIX ) - wfTimestamp( TS_UNIX, $record->af_created ); |
538 | 538 | $displayTime = 0; |
539 | 539 | $displayBlock = ''; |
540 | | - |
| 540 | + |
541 | 541 | // get the largest time block, 1 minute 35 seconds -> 2 minutes |
542 | | - for( $i = 0, $count = count( $blocks ); $i < $count; $i++ ) { |
| 542 | + for ( $i = 0, $count = count( $blocks ); $i < $count; $i++ ) { |
543 | 543 | $seconds = $blocks[$i]['total']; |
544 | 544 | $displayTime = floor( $since / $seconds ); |
545 | 545 | |
— | — | @@ -549,10 +549,10 @@ |
550 | 550 | if ( ( $since % $seconds ) >= ( $seconds / 2 ) ) { |
551 | 551 | $displayTime++; |
552 | 552 | |
553 | | - //advance to upper unit if possible, eg, 24 hours to 1 day |
554 | | - if ( isset( $blocks[$i-1] ) && $displayTime * $seconds == $blocks[$i-1]['total'] ) { |
| 553 | + // advance to upper unit if possible, eg, 24 hours to 1 day |
| 554 | + if ( isset( $blocks[$i -1] ) && $displayTime * $seconds == $blocks[$i -1]['total'] ) { |
555 | 555 | $displayTime = 1; |
556 | | - $displayBlock = $blocks[$i-1]['name']; |
| 556 | + $displayBlock = $blocks[$i -1]['name']; |
557 | 557 | } |
558 | 558 | } |
559 | 559 | break; |
— | — | @@ -583,13 +583,13 @@ |
584 | 584 | ) |
585 | 585 | . Html::closeElement( 'span' ); |
586 | 586 | } |
587 | | - |
588 | 587 | |
| 588 | + |
589 | 589 | private function renderBucket1( $record ) { |
590 | 590 | if ( $record['found']->aa_response_boolean == 1 ) { |
591 | 591 | $msg = 'articlefeedbackv5-form1-header-found'; |
592 | 592 | $class = 'positive'; |
593 | | - } elseif( $record['found']->aa_response_boolean !== null ) { |
| 593 | + } elseif ( $record['found']->aa_response_boolean !== null ) { |
594 | 594 | $msg = 'articlefeedbackv5-form1-header-not-found'; |
595 | 595 | $class = 'negative'; |
596 | 596 | } else { |
— | — | @@ -716,7 +716,7 @@ |
717 | 717 | |
718 | 718 | private function feedbackHead( $message, $class, $record, $extra = '' ) { |
719 | 719 | $name = htmlspecialchars( $record->user_name ); |
720 | | - if( $record->af_user_ip ) { |
| 720 | + if ( $record->af_user_ip ) { |
721 | 721 | // Anonymous user, go to contributions page. |
722 | 722 | $title = SpecialPage::getTitleFor( 'Contributions', $record->user_name ); |
723 | 723 | } else { |
— | — | @@ -726,10 +726,10 @@ |
727 | 727 | |
728 | 728 | // If user page doesn't exist, go someplace else. |
729 | 729 | // Use the contributions page for now, but it's really up to Fabrice. |
730 | | - if( !$title->exists() ) { |
| 730 | + if ( !$title->exists() ) { |
731 | 731 | $title = SpecialPage::getTitleFor( 'Contributions', $record->user_name ); |
732 | 732 | } |
733 | | - |
| 733 | + |
734 | 734 | $details = Html::openElement( 'span', array( |
735 | 735 | 'class' => 'articleFeedbackv5-comment-details-updates' |
736 | 736 | ) ); |
— | — | @@ -741,11 +741,11 @@ |
742 | 742 | ); |
743 | 743 | $details .= Html::closeElement( 'span' ); |
744 | 744 | |
745 | | - return Html::openElement( 'h3', array( 'class' => $class) ) |
| 745 | + return Html::openElement( 'h3', array( 'class' => $class ) ) |
746 | 746 | . Html::element( 'span', array( 'class' => 'icon' ) ) |
747 | 747 | . Html::rawElement( 'span', |
748 | 748 | array( 'class' => 'result' ), |
749 | | - wfMessage( $message, $name )->rawParams( |
| 749 | + wfMessage( $message, $name )->rawParams( |
750 | 750 | Linker::link( $title, $name ) |
751 | 751 | )->escaped() |
752 | 752 | ) |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php |
— | — | @@ -162,11 +162,11 @@ |
163 | 163 | public static function updateFilterCounts( $dbw, $pageId, $filters ) { |
164 | 164 | |
165 | 165 | // Don't do anything unless we have filters to process. |
166 | | - if( empty( $filters ) || count($filters) < 1 ) { |
167 | | - return; |
| 166 | + if ( empty( $filters ) || count( $filters ) < 1 ) { |
| 167 | + return; |
168 | 168 | } |
169 | 169 | |
170 | | - foreach ( $filters as $filter => $direction) { |
| 170 | + foreach ( $filters as $filter => $direction ) { |
171 | 171 | $rows[] = array( |
172 | 172 | 'afc_page_id' => $pageId, |
173 | 173 | 'afc_filter_name' => $filter, |
— | — | @@ -183,8 +183,8 @@ |
184 | 184 | array( 'IGNORE' ) |
185 | 185 | ); |
186 | 186 | |
187 | | - foreach ( $filters as $filter => $direction) { |
188 | | - $value = ($direction > 0) ? 'afc_filter_count + 1' : 'GREATEST(0, CONVERT(afc_filter_count, SIGNED) - 1)'; |
| 187 | + foreach ( $filters as $filter => $direction ) { |
| 188 | + $value = ( $direction > 0 ) ? 'afc_filter_count + 1' : 'GREATEST(0, CONVERT(afc_filter_count, SIGNED) - 1)'; |
189 | 189 | |
190 | 190 | # Update each row with the new count. |
191 | 191 | $dbw->update( |
— | — | @@ -209,14 +209,14 @@ |
210 | 210 | * @param $notes string any notes that were stored with the activity |
211 | 211 | * @param $auto boolean true if this was an "automatic" action, if so the log doer is changed |
212 | 212 | */ |
213 | | - public static function logActivity( $type, $pageId, $itemId, $notes, $auto = false) { |
| 213 | + public static function logActivity( $type, $pageId, $itemId, $notes, $auto = false ) { |
214 | 214 | |
215 | 215 | // These are our valid activity log actions |
216 | 216 | $valid = array( 'oversight', 'unoversight', 'hidden', 'unhidden', |
217 | | - 'decline', 'request', 'unrequest','flag','unflag' ); |
| 217 | + 'decline', 'request', 'unrequest', 'flag', 'unflag' ); |
218 | 218 | |
219 | 219 | // if we do not have a valid action, return immediately |
220 | | - if ( !in_array( $type, $valid )) { |
| 220 | + if ( !in_array( $type, $valid ) ) { |
221 | 221 | return; |
222 | 222 | } |
223 | 223 | |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | $title_object = Title::newFromID( $pageId ); |
226 | 226 | |
227 | 227 | // no title object? no page? well then no logging |
228 | | - if (!$title_object) { |
| 228 | + if ( !$title_object ) { |
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
— | — | @@ -240,11 +240,11 @@ |
241 | 241 | $notes = $wgLang->truncate( $notes, $wgArticleFeedbackv5MaxActivityNoteLength ); |
242 | 242 | |
243 | 243 | // if this is an automatic action, we create our special extension doer and send |
244 | | - if ($auto) { |
| 244 | + if ( $auto ) { |
245 | 245 | $default_user = wfMessage( 'articlefeedbackv5-default-user' )->text(); |
246 | 246 | $doer = User::newFromName( $default_user ); |
247 | 247 | // I cannot see how this could fail, but if it does do not log |
248 | | - if (!$doer) { |
| 248 | + if ( !$doer ) { |
249 | 249 | return; |
250 | 250 | } |
251 | 251 | } else { |
— | — | @@ -253,7 +253,7 @@ |
254 | 254 | |
255 | 255 | $log = new LogPage( 'articlefeedbackv5' ); |
256 | 256 | // comments become the notes section from the feedback |
257 | | - $log->addEntry( $type, $permalink, $notes, array(), $doer); |
| 257 | + $log->addEntry( $type, $permalink, $notes, array(), $doer ); |
258 | 258 | |
259 | 259 | // update our log count by 1 |
260 | 260 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -278,9 +278,9 @@ |
279 | 279 | * @param string $user_ip (name works too) |
280 | 280 | * @return anchor tag link to user |
281 | 281 | */ |
282 | | - public static function getUserLink($user_id, $user_ip = null) { |
| 282 | + public static function getUserLink( $user_id, $user_ip = null ) { |
283 | 283 | // if $user is not an object |
284 | | - if ( !($user_id instanceof User) ){ |
| 284 | + if ( !( $user_id instanceof User ) ) { |
285 | 285 | $userId = (int) $user_id; |
286 | 286 | if ( $userId !== 0 ) { // logged-in users |
287 | 287 | $user = User::newFromId( $userId ); |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php |
— | — | @@ -32,13 +32,13 @@ |
33 | 33 | |
34 | 34 | // If we can't hide, we can't see activity, return an empty string |
35 | 35 | // front-end should never let you get here, but just in case |
36 | | - if( !$wgUser->isAllowed( 'aftv5-hide-feedback' )) { |
| 36 | + if ( !$wgUser->isAllowed( 'aftv5-hide-feedback' ) ) { |
37 | 37 | $this->dieUsage( "You don't have permission to hide feedback", 'permissiondenied' ); |
38 | 38 | } |
39 | 39 | |
40 | 40 | // These are our valid activity log actions |
41 | 41 | $valid = array( 'oversight', 'unoversight', 'hidden', 'unhidden', |
42 | | - 'decline', 'request', 'unrequest','flag','unflag' ); |
| 42 | + 'decline', 'request', 'unrequest', 'flag', 'unflag' ); |
43 | 43 | |
44 | 44 | // get our parameter information |
45 | 45 | $params = $this->extractRequestParams(); |
— | — | @@ -50,19 +50,19 @@ |
51 | 51 | // fetch our activity database information |
52 | 52 | $feedback = $this->fetchFeedback( $feedbackId ); |
53 | 53 | // if this is false, this is bad feedback - move along |
54 | | - if( !$feedback ) { |
| 54 | + if ( !$feedback ) { |
55 | 55 | $this->dieUsage( "Feedback does not exist", 'invalidfeedbackid' ); |
56 | 56 | } |
57 | 57 | |
58 | 58 | // get the string title for the page |
59 | 59 | $page = Title::newFromID( $feedback->af_page_id ); |
60 | | - if( !$page ) { |
| 60 | + if ( !$page ) { |
61 | 61 | $this->dieUsage( "Page for feedback does not exist", 'invalidfeedbackid' ); |
62 | 62 | } |
63 | 63 | $title = $page->getDBKey(); |
64 | 64 | |
65 | 65 | // get our activities |
66 | | - $activities = $this->fetchActivity( $title, $feedbackId, $limit, $continue); |
| 66 | + $activities = $this->fetchActivity( $title, $feedbackId, $limit, $continue ); |
67 | 67 | |
68 | 68 | // generate our html |
69 | 69 | $html = ''; |
— | — | @@ -75,49 +75,49 @@ |
76 | 76 | $html .= Html::openElement( 'div', array( |
77 | 77 | 'class' => 'articleFeedbackv5-activity-pane' |
78 | 78 | ) ); |
79 | | - |
| 79 | + |
80 | 80 | // <div class="articleFeedbackv5-activity-feedback"> |
81 | 81 | $html .= Html::openElement( 'div', array( |
82 | 82 | 'class' => 'articleFeedbackv5-activity-feedback' |
83 | 83 | ) ); |
84 | | - |
| 84 | + |
85 | 85 | // <div>Feedback Post #{$feedbackid} by {$user_link}</div> |
86 | 86 | $html .= Html::openElement( 'div', array() ); |
87 | 87 | $html .= wfMessage( 'articlefeedbackv5-activity-feedback-info', |
88 | | - array($feedback->af_id)) |
89 | | - ->rawParams(ApiArticleFeedbackv5Utils::getUserLink($feedback->af_user_id, $feedback->af_user_ip)) |
| 88 | + array( $feedback->af_id ) ) |
| 89 | + ->rawParams( ApiArticleFeedbackv5Utils::getUserLink( $feedback->af_user_id, $feedback->af_user_ip ) ) |
90 | 90 | ->text(); |
91 | 91 | $html .= Html::closeElement( 'div' ); |
92 | | - |
93 | | - //<div>Posted on {$date} (UTC)</div> |
| 92 | + |
| 93 | + // <div>Posted on {$date} (UTC)</div> |
94 | 94 | $html .= Html::element( 'div', array(), |
95 | 95 | wfMessage( 'articlefeedbackv5-activity-feedback-date', |
96 | | - array( $wgLang->timeanddate( $feedback->af_created ) ))->text() ); |
97 | | - |
| 96 | + array( $wgLang->timeanddate( $feedback->af_created ) ) )->text() ); |
| 97 | + |
98 | 98 | // <div class="articleFeedbackv5-activity-feedback-permalink"> |
99 | 99 | $html .= Html::openElement( 'div', array( |
100 | 100 | 'class' => 'articleFeedbackv5-activity-feedback-permalink' |
101 | 101 | ) ); |
102 | | - |
| 102 | + |
103 | 103 | // <a href="{$permalink}">permalink</a> |
104 | 104 | $html .= Linker::link( |
105 | | - SpecialPage::getTitleFor( 'ArticleFeedbackv5', $title . '/'. $feedback->af_id ), |
106 | | - wfMessage( 'articlefeedbackv5-activity-permalink' )->text()); |
107 | | - |
| 105 | + SpecialPage::getTitleFor( 'ArticleFeedbackv5', $title . '/' . $feedback->af_id ), |
| 106 | + wfMessage( 'articlefeedbackv5-activity-permalink' )->text() ); |
| 107 | + |
108 | 108 | // </div> for class="articleFeedbackv5-activity-feedback-permalink" |
109 | 109 | $html .= Html::closeElement( 'div' ); |
110 | | - |
| 110 | + |
111 | 111 | // </div> for class="articleFeedbackv5-activity-feedback" |
112 | 112 | $html .= Html::closeElement( 'div' ); |
113 | | - |
114 | | - //<div class="articleFeedbackv5-activity-count">$n actions on this post</div> |
115 | | - $html .= Html::element( 'div', array('class' => 'articleFeedbackv5-activity-count'), |
| 113 | + |
| 114 | + // <div class="articleFeedbackv5-activity-count">$n actions on this post</div> |
| 115 | + $html .= Html::element( 'div', array( 'class' => 'articleFeedbackv5-activity-count' ), |
116 | 116 | wfMessage( 'articlefeedbackv5-activity-count' )->numParams( $feedback->af_activity_count )->text() ); |
117 | | - |
| 117 | + |
118 | 118 | // </div> for class="articleFeedbackv5-activity-pane" |
119 | 119 | $html .= Html::closeElement( 'div' ); |
120 | | - |
121 | | - //<div class="articleFeedbackv5-activity-log-items"> |
| 120 | + |
| 121 | + // <div class="articleFeedbackv5-activity-log-items"> |
122 | 122 | $html .= Html::openElement( 'div', array( |
123 | 123 | 'class' => 'articleFeedbackv5-activity-log-items' |
124 | 124 | ) ); |
— | — | @@ -126,17 +126,17 @@ |
127 | 127 | $count = 0; |
128 | 128 | |
129 | 129 | // divs of activity items |
130 | | - foreach($activities as $item) { |
| 130 | + foreach ( $activities as $item ) { |
131 | 131 | |
132 | 132 | // if we do not have a valid action, skip this item |
133 | | - if ( !in_array( $item->log_action, $valid )) { |
| 133 | + if ( !in_array( $item->log_action, $valid ) ) { |
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | 137 | $count++; |
138 | 138 | |
139 | 139 | // figure out if we have more if we have another row past our limit |
140 | | - if($count > $limit) { |
| 140 | + if ( $count > $limit ) { |
141 | 141 | break; |
142 | 142 | } |
143 | 143 | |
— | — | @@ -150,30 +150,30 @@ |
151 | 151 | // or the $user $did_something_on $date : $comment |
152 | 152 | // because the colon hanging around would look utterly stupid |
153 | 153 | |
154 | | - if ($item->log_comment == '') { |
| 154 | + if ( $item->log_comment == '' ) { |
155 | 155 | $html .= wfMessage( 'articlefeedbackv5-activity-item' ) |
156 | 156 | ->rawParams( |
157 | | - ApiArticleFeedbackv5Utils::getUserLink($item->log_user, $item->log_user_text), |
| 157 | + ApiArticleFeedbackv5Utils::getUserLink( $item->log_user, $item->log_user_text ), |
158 | 158 | Html::element( 'span', array( |
159 | 159 | 'class' => 'articleFeedbackv5-activity-item-action' |
160 | 160 | ), |
161 | 161 | wfMessage( 'articlefeedbackv5-activity-' . $item->log_action, |
162 | | - array())->text()), |
163 | | - $wgLang->timeanddate( $item->log_timestamp )) |
| 162 | + array() )->text() ), |
| 163 | + $wgLang->timeanddate( $item->log_timestamp ) ) |
164 | 164 | ->text(); |
165 | 165 | } else { |
166 | 166 | $html .= wfMessage( 'articlefeedbackv5-activity-item-comment' ) |
167 | 167 | ->rawParams( |
168 | | - ApiArticleFeedbackv5Utils::getUserLink($item->log_user, $item->log_user_text), |
| 168 | + ApiArticleFeedbackv5Utils::getUserLink( $item->log_user, $item->log_user_text ), |
169 | 169 | Html::element( 'span', array( |
170 | 170 | 'class' => 'articleFeedbackv5-activity-item-action' |
171 | 171 | ), |
172 | 172 | wfMessage( 'articlefeedbackv5-activity-' . $item->log_action, |
173 | | - array())->text()), |
| 173 | + array() )->text() ), |
174 | 174 | $wgLang->timeanddate( $item->log_timestamp ), |
175 | 175 | Html::element( 'span', |
176 | | - array('class' => 'articlefeedbackv5-activity-notes'), |
177 | | - $item->log_comment)) |
| 176 | + array( 'class' => 'articlefeedbackv5-activity-notes' ), |
| 177 | + $item->log_comment ) ) |
178 | 178 | ->text(); |
179 | 179 | } |
180 | 180 | |
— | — | @@ -181,8 +181,8 @@ |
182 | 182 | $html .= Html::closeElement( 'div' ); |
183 | 183 | } |
184 | 184 | |
185 | | - //optional <a href="#" class="articleFeedbackv5-activity-more">Show more Activity</a> |
186 | | - if ($count > $limit) { |
| 185 | + // optional <a href="#" class="articleFeedbackv5-activity-more">Show more Activity</a> |
| 186 | + if ( $count > $limit ) { |
187 | 187 | $html .= Html::element( 'a', array( |
188 | 188 | 'class' => "articleFeedbackv5-activity-more", |
189 | 189 | 'href' => '#', |
— | — | @@ -191,19 +191,19 @@ |
192 | 192 | |
193 | 193 | // </div> for class="acticleFeedbackv5-activity-log-items" |
194 | 194 | $html .= Html::closeElement( 'div' ); |
195 | | - |
| 195 | + |
196 | 196 | // finally add our generated html data |
197 | 197 | $result->addValue( $this->getModuleName(), 'limit', $limit ); |
198 | 198 | $result->addValue( $this->getModuleName(), 'activity', $html ); |
199 | 199 | |
200 | 200 | // continue only goes in if it's not empty |
201 | | - if ($count > $limit) { |
| 201 | + if ( $count > $limit ) { |
202 | 202 | $this->setContinueEnumParameter( 'continue', $this->getContinue( $item ) ); |
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
207 | | - * Gets some base feedback information |
| 207 | + * Gets some base feedback information |
208 | 208 | * |
209 | 209 | * @param int $feedbackId identifier for the feedback item we are fetching activity for |
210 | 210 | * @return int total number of activity items for feedback item |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | 'af_user_id', |
220 | 220 | 'af_user_ip', |
221 | 221 | 'af_created', |
222 | | - 'af_activity_count'), |
| 222 | + 'af_activity_count' ), |
223 | 223 | array( |
224 | 224 | 'af_id' => $feedbackId, |
225 | 225 | ), |
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | * @param mixed $continue used for offsets |
243 | 243 | * @return array db record rows |
244 | 244 | */ |
245 | | - protected function fetchActivity( $title, $feedbackId, $limit = 25, $continue = null) { |
| 245 | + protected function fetchActivity( $title, $feedbackId, $limit = 25, $continue = null ) { |
246 | 246 | |
247 | 247 | $where = array ( |
248 | 248 | 'log_type' => 'articlefeedbackv5', |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | 'log_user', |
262 | 262 | 'log_user_text', |
263 | 263 | 'log_title', |
264 | | - 'log_comment'), |
| 264 | + 'log_comment' ), |
265 | 265 | $where, |
266 | 266 | __METHOD__, |
267 | 267 | array( |