r26939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26938‎ | r26939 | r26940 >
Date:05:00, 25 October 2007
Author:aaron
Status:old
Tags:
Comment:
*Improve link output
Modified paths:
  • /trunk/extensions/ConfirmAccount/ConfirmAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/ConfirmAccount_body.php
@@ -860,13 +860,18 @@
861861 $count = 0;
862862
863863 $linkList = '';
864 - $lines = explode( "\n", htmlspecialchars($text) );
 864+ # Normalize space characters
 865+ $text = str_replace( array("\r","\t"), array("\n"," "), htmlspecialchars($text) );
 866+ # Split out each line as a link
 867+ $lines = explode( "\n", $text );
865868 foreach( $lines as $line ) {
866 - $links = explode("\n",$line);
 869+ $links = explode(" ",$line,2);
867870 $link = $links[0];
 871+ # Any explanation text is not part of the link...
 872+ $extra = isset($links[1]) ? ' '.$links[1] : '';
868873 if( strpos($link,'.') ) {
869874 $link = ( strpos($link,'http://')===false ) ? 'http://'.$link : $link;
870 - $linkList .= "<li><a href='$link'>$link</a></li>\n";
 875+ $linkList .= "<li><a href='$link'>$link</a>$extra</li>\n";
871876 }
872877 $count++;
873878 if( $count >= $max )

Status & tagging log