Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php |
— | — | @@ -249,8 +249,17 @@ |
250 | 250 | |
251 | 251 | return true; |
252 | 252 | } |
253 | | - |
| 253 | + |
254 | 254 | /** |
| 255 | + * Given twitter handle, return an HTML link to the account. Make sure to use rawElement to wrap this. |
| 256 | + * @param string twitter handle, assumed to be in ascii, without leading at-sign |
| 257 | + * @return string HTML for the link |
| 258 | + */ |
| 259 | + private function getTwitterHtml( $handle ) { |
| 260 | + return Html::element( 'a', array( 'target' => '_blank', 'href' => 'http://twitter.com/!#/' . $handle ), '@' . $handle ); |
| 261 | + } |
| 262 | + |
| 263 | + /** |
255 | 264 | * Get an HTML table of data for the user's congressional representatives |
256 | 265 | * @return string HTML for the table |
257 | 266 | */ |
— | — | @@ -280,7 +289,7 @@ |
281 | 290 | |
282 | 291 | if ( $myRepresentative['twitter'] ) { |
283 | 292 | $congressTable .= "\n" . Html::rawElement( 'tr', array(), |
284 | | - Html::element( 'td', array(), wfMsg( 'congresslookup-twitter', $myRepresentative['twitter'] ) ) |
| 293 | + Html::rawElement( 'td', array(), wfMsg( 'congresslookup-twitter', self::getTwitterHtml( $myRepresentative['twitter'] ) ) ) |
285 | 294 | ); |
286 | 295 | } |
287 | 296 | |
— | — | @@ -322,7 +331,7 @@ |
323 | 332 | |
324 | 333 | if ( $senator['twitter'] ) { |
325 | 334 | $congressTable .= "\n" . Html::rawElement( 'tr', array(), |
326 | | - Html::element( 'td', array(), wfMsg( 'congresslookup-twitter', $senator['twitter'] ) ) |
| 335 | + Html::rawElement( 'td', array(), wfMsg( 'congresslookup-twitter', self::getTwitterHtml( $senator['twitter'] ) ) ) |
327 | 336 | ); |
328 | 337 | } |
329 | 338 | |