Index: trunk/extensions/ContributionReporting/ContributionHistory_body.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | if ( !$language ) { |
12 | 12 | $language = 'en'; |
13 | 13 | } |
| 14 | + $this->lang = Language::factory( $language ); |
14 | 15 | |
15 | 16 | // Get request data |
16 | 17 | $dir = $wgRequest->getText( 'dir', '' ); |
— | — | @@ -34,29 +35,33 @@ |
35 | 36 | $output .= '</style>'; |
36 | 37 | |
37 | 38 | $output .= '<table style="width: 100%">'; |
38 | | - $output .= '<tr><th style="width: 200px;">Name</th><th>Date</th><th style="text-align: right;">Amount</th></tr>'; |
| 39 | + $output .= '<tr>'; |
| 40 | + $output .= '<th style="width: 200px;">' . $this->msg( 'contrib-hist-name' ) . '</th>'; |
| 41 | + $output .= '<th>' . $this->msg( 'contrib-hist-date' ) . '</th>'; |
| 42 | + $output .= '<th style="text-align: right;">' . $this->msg( 'contrib-hist-amount' ) . '</th>'; |
| 43 | + $output .= '</tr>'; |
39 | 44 | |
40 | 45 | $alt = TRUE; |
41 | 46 | while ( $row = $res->fetchRow() ) { |
42 | | - $name = htmlspecialchars( $row['name'] ); |
43 | | - if ( !$name ) { |
44 | | - $name = 'Anonymous'; |
45 | | - } |
| 47 | + $name = $this->formatName( $row ); |
46 | 48 | |
47 | | - $name = '<strong>' . $name . '</strong>'; |
48 | | - |
49 | 49 | if ( $row['note'] ) { |
50 | 50 | $name .= '<br />' . htmlspecialchars( $row['note'] ); |
51 | 51 | } |
52 | 52 | |
53 | 53 | $amount = $this->formatAmount( $row ); |
| 54 | + $date = $this->formatDate( $row ); |
54 | 55 | |
55 | 56 | $class = ''; |
56 | 57 | if ( $alt ) { |
57 | 58 | $class = ' alt'; |
58 | 59 | } |
59 | 60 | |
60 | | - $output .= '<tr><td class="left' . $class . '">' . $name . '</td><td class="left' . $class . '" style="width: 50px;">' . date( 'Y-m-j', $row['received'] ) . '</td><td class="right' . $class . '" style="width: 75px;">' . $amount . '</td></tr>'; |
| 61 | + $output .= "<tr>"; |
| 62 | + $output .= "<td class=\"left $class\">$name</td>"; |
| 63 | + $output .= "<td class=\"left $class\" style=\"width: 100px;\">$date</td>"; |
| 64 | + $output .= "<td class=\"right $class\" style=\"width: 75px;\">$amount</td>"; |
| 65 | + $output .= "</tr>"; |
61 | 66 | |
62 | 67 | $alt = !$alt; |
63 | 68 | } |
— | — | @@ -66,12 +71,31 @@ |
67 | 72 | header( 'Cache-Control: max-age=300,s-maxage=300' ); |
68 | 73 | $wgOut->addWikiText( '{{Template:Donate-header/' . $language . '}}' ); |
69 | 74 | $wgOut->addWikiText( '<skin>Tomas</skin>' ); |
70 | | - $wgOut->addHTML( '<h1>Real-time donor comments from around the world</h1>' ); |
| 75 | + $wgOut->addHTML( '<h1>' . $this->msg( 'contrib-hist-header' ) . '</h1>' ); |
71 | 76 | $wgOut->addWikiText( '<strong>{{Template:Contribution history introduction/' . $language . '}}</strong>' ); |
72 | 77 | $wgOut->addHTML( $output ); |
73 | 78 | $wgOut->addWikiText( '{{Template:Donate-footer/' . $language . '}}' ); |
74 | 79 | } |
| 80 | + |
| 81 | + function msg( $key ) { |
| 82 | + return wfMsgExt( $key, array( 'escape', 'lang' => $this->lang ) ); |
| 83 | + } |
| 84 | + |
| 85 | + function formatName( $row ) { |
| 86 | + $name = htmlspecialchars( $row['name'] ); |
| 87 | + if ( !$name ) { |
| 88 | + $name = $this->msg( 'contrib-hist-anonymous' ); |
| 89 | + } |
75 | 90 | |
| 91 | + $name = '<strong>' . $name . '</strong>'; |
| 92 | + return $name; |
| 93 | + } |
| 94 | + |
| 95 | + function formatDate( $row ) { |
| 96 | + $ts = wfTimestamp( TS_MW, $row['received'] ); |
| 97 | + return $this->lang->timeanddate( $ts ); |
| 98 | + } |
| 99 | + |
76 | 100 | function formatAmount( $row ) { |
77 | 101 | if ( $row['original_currency'] ) { |
78 | 102 | $currency = $row['original_currency']; |
Index: trunk/extensions/ContributionReporting/ContributionReporting.i18n.php |
— | — | @@ -14,4 +14,12 @@ |
15 | 15 | $messages['en'] = array( |
16 | 16 | 'contributiontotal' => 'Contribution total', |
17 | 17 | 'contributionhistory' => 'Contribution history', |
| 18 | + |
| 19 | + 'contrib-hist-header' => 'Real-time donor comments from around the world', |
| 20 | + |
| 21 | + 'contrib-hist-name' => 'Name', |
| 22 | + 'contrib-hist-date' => 'Time and date', |
| 23 | + 'contrib-hist-amount' => 'Amount', |
| 24 | + |
| 25 | + 'contrib-hist-anonymous' => 'Anonymous', |
18 | 26 | ); |