r108126 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108125‎ | r108126 | r108127 >
Date:09:33, 5 January 2012
Author:siebrand
Status:ok
Tags:
Comment:
Add additional parameter $altUserName to Linker::userLink to make it possible to override the displayed user name.
Renamed $userText to $userName following Nikerabbit's advice.
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -918,16 +918,23 @@
919919 /**
920920 * Make user link (or user contributions for unregistered users)
921921 * @param $userId Integer: user id in database.
922 - * @param $userText String: user name in database
 922+ * @param $userName String: user name in database.
 923+ * @param $altUserName String: text to display instead of the user name (optional)
923924 * @return String: HTML fragment
 925+ * @since 1.19 Method exists for a long time. $displayText was added in 1.19.
924926 */
925 - public static function userLink( $userId, $userText ) {
 927+ public static function userLink( $userId, $userName, $altUserName = false ) {
926928 if ( $userId == 0 ) {
927 - $page = SpecialPage::getTitleFor( 'Contributions', $userText );
 929+ $page = SpecialPage::getTitleFor( 'Contributions', $userName );
928930 } else {
929 - $page = Title::makeTitle( NS_USER, $userText );
 931+ $page = Title::makeTitle( NS_USER, $userName );
930932 }
931 - return self::link( $page, htmlspecialchars( $userText ), array( 'class' => 'mw-userlink' ) );
 933+
 934+ return self::link(
 935+ $page,
 936+ htmlspecialchars( $altUserName !== false ? $altUserName : $userName ),
 937+ array( 'class' => 'mw-userlink' )
 938+ );
932939 }
933940
934941 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r108127* format number output of cscore parser function....siebrand09:43, 5 January 2012

Status & tagging log