Index: trunk/extensions/UserDebugInfo/SpecialUserDebugInfo.php |
— | — | @@ -27,43 +27,35 @@ |
28 | 28 | |
29 | 29 | $wgOut->addHTML( '<tbody>' ); |
30 | 30 | |
31 | | - $wgOut->addHTML( '<tr>' ); |
32 | | - $wgOut->addHTML( '<td>' ); |
33 | | - $wgOut->addWikiMsg( 'userdebuginfo-useragent' ); |
34 | | - $wgOut->addHTML( '</td>' ); |
| 31 | + $this->printRow( 'userdebuginfo-useragent', htmlspecialchars( $_SERVER['HTTP_USER_AGENT'] ) ); |
35 | 32 | |
36 | | - $wgOut->addHTML( '<td>' ); |
37 | | - $wgOut->addHTML( $_SERVER['HTTP_USER_AGENT'] ); |
38 | | - $wgOut->addHTML( '</td>' ); |
39 | | - |
40 | | - $wgOut->addHTML( '</tr>' ); |
41 | | - |
42 | 33 | if ( isset( $_SERVER['REMOTE_HOST'] ) ) { |
43 | | - $wgOut->addHTML( '<tr>' ); |
44 | | - $wgOut->addHTML( '<td>' ); |
45 | | - $wgOut->addWikiMsg( 'userdebuginfo-remotehost' ); |
46 | | - $wgOut->addHTML( '</td>' ); |
| 34 | + $this->printRow( 'userdebuginfo-remotehost', $_SERVER['REMOTE_HOST'] ); |
| 35 | + } |
47 | 36 | |
48 | | - $wgOut->addHTML( '<td>' ); |
49 | | - $wgOut->addHTML( $_SERVER['REMOTE_HOST'] ); |
50 | | - $wgOut->addHTML( '</td>' ); |
| 37 | + $this->printRow( 'userdebuginfo-remoteaddr', $_SERVER['REMOTE_ADDR'] ); |
51 | 38 | |
52 | | - $wgOut->addHTML( '</tr>' ); |
53 | | - } |
| 39 | + $wgOut->addHTML( '</tbody>' ); |
| 40 | + $wgOut->addHTML( '</table>' ); |
| 41 | + } |
54 | 42 | |
| 43 | + /** |
| 44 | + * @param $key |
| 45 | + * @param $value |
| 46 | + * @return void |
| 47 | + */ |
| 48 | + private function printRow( $key, $value ) { |
| 49 | + global $wgOut; |
55 | 50 | $wgOut->addHTML( '<tr>' ); |
56 | 51 | $wgOut->addHTML( '<td>' ); |
57 | | - $wgOut->addWikiMsg( 'userdebuginfo-remoteaddr' ); |
| 52 | + $wgOut->addWikiMsg( $key ); |
58 | 53 | $wgOut->addHTML( '</td>' ); |
59 | 54 | |
60 | 55 | $wgOut->addHTML( '<td>' ); |
61 | | - $wgOut->addHTML( $_SERVER['REMOTE_ADDR'] ); |
| 56 | + $wgOut->addHTML( $value ); |
62 | 57 | $wgOut->addHTML( '</td>' ); |
63 | 58 | |
64 | 59 | $wgOut->addHTML( '</tr>' ); |
65 | | - |
66 | | - $wgOut->addHTML( '</tbody>' ); |
67 | | - $wgOut->addHTML( '</table>' ); |
68 | 60 | } |
69 | 61 | } |
70 | 62 | |