- # Two strings: real names, and user names
-
- $real = $wgLang->listToText($real_names);
- $user = $wgLang->listToText($user_names);
-
- # "ThisSite user(s) A, B and C"
-
- if (!empty($user)) {
- $user = wfMsg('siteusers', $user);
- }
-
- # This is the big list, all mooshed together. We sift for blank strings
-
- $fulllist = array();
-
- foreach (array($real, $user, $anon, $others_link) as $s) {
- if (!empty($s)) {
- array_push($fulllist, $s);
+ $contributors = $article->getContributors();
+
+ $others_link = '';
+
+ # Hmm... too many to fit!
+ if( $cnt > 0 && $contributors->count() > $cnt ){
+ $others_link = self::othersLink( $article );
+ if( !$showIfMax )
+ return wfMsg( 'othercontribs', $others_link );
+ }
+
+ $real_names = array();
+ $user_names = array();
+ $anon = 0;
+
+ # Sift for real versus user names
+ foreach( $contributors as $user ) {
+ $cnt--;
+ if( $user->isLoggedIn() ){
+ $link = self::link( $user );
+ if( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() )
+ $real_names[] = $link;
+ else
+ $user_names[] = $link;
+ } else {
+ $anon++;
+ }
+ if( $cnt == 0 ) break;
+ }
+
+ # Two strings: real names, and user names
+ $real = $wgLang->listToText( $real_names );
+ $user = $wgLang->listToText( $user_names );
+ if( $anon )
+ $anon = wfMsgExt( 'anonymous', array( 'parseinline' ), $anon );
+
+ # "ThisSite user(s) A, B and C"
+ if( !empty( $user ) ){
+ $user = wfMsgExt( 'siteusers', array( 'parsemag' ), $user, count( $user_names ) );
+ }
+
+ # This is the big list, all mooshed together. We sift for blank strings
+ $fulllist = array();
+ foreach( array( $real, $user, $anon, $others_link ) as $s ){
+ if( !empty( $s ) ){
+ array_push( $fulllist, $s );
+ }
+ }
+
+ # Make the list into text...
+ $creds = $wgLang->listToText( $fulllist );
+
+ # "Based on work by ..."
+ return empty( $creds ) ? '' : wfMsg( 'othercontribs', $creds );