r109311 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109310‎ | r109311 | r109312 >
Date:05:04, 18 January 2012
Author:neilk
Status:ok
Tags:
Comment:
do proper twitter links
Modified paths:
  • /trunk/extensions/CongressLookup/SpecialCongressLookup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php
@@ -249,8 +249,17 @@
250250
251251 return true;
252252 }
253 -
 253+
254254 /**
 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+ /**
255264 * Get an HTML table of data for the user's congressional representatives
256265 * @return string HTML for the table
257266 */
@@ -280,7 +289,7 @@
281290
282291 if ( $myRepresentative['twitter'] ) {
283292 $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'] ) ) )
285294 );
286295 }
287296
@@ -322,7 +331,7 @@
323332
324333 if ( $senator['twitter'] ) {
325334 $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'] ) ) )
327336 );
328337 }
329338

Status & tagging log