Display the file sha1 value in the file info page
[lhc/web/wiklou.git] / includes / actions / CreditsAction.php
index c19e8fa..ed58686 100644 (file)
@@ -23,6 +23,8 @@
  * @author <evan@wikitravel.org>
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * @ingroup Actions
  */
@@ -42,14 +44,13 @@ class CreditsAction extends FormlessAction {
         * @return string HTML
         */
        public function onView() {
-
                if ( $this->page->getID() == 0 ) {
                        $s = $this->msg( 'nocredits' )->parse();
                } else {
                        $s = $this->getCredits( -1 );
                }
 
-               return Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $s );
+               return Html::rawElement( 'div', [ 'id' => 'mw-credits' ], $s );
        }
 
        /**
@@ -125,12 +126,12 @@ class CreditsAction extends FormlessAction {
                        }
                }
 
-               $real_names = array();
-               $user_names = array();
-               $anon_ips = array();
+               $real_names = [];
+               $user_names = [];
+               $anon_ips = [];
 
                # Sift for real versus user names
-               /** @var $user User */
+               /** @var User $user */
                foreach ( $contributors as $user ) {
                        $cnt--;
                        if ( $user->isLoggedIn() ) {
@@ -173,8 +174,8 @@ class CreditsAction extends FormlessAction {
                }
 
                # This is the big list, all mooshed together. We sift for blank strings
-               $fulllist = array();
-               foreach ( array( $real, $user, $anon, $others_link ) as $s ) {
+               $fulllist = [];
+               foreach ( [ $real, $user, $anon, $others_link ] as $s ) {
                        if ( $s !== false ) {
                                array_push( $fulllist, $s );
                        }
@@ -197,15 +198,19 @@ class CreditsAction extends FormlessAction {
        protected function link( User $user ) {
                if ( $this->canShowRealUserName() && !$user->isAnon() ) {
                        $real = $user->getRealName();
+                       if ( $real === '' ) {
+                               $real = $user->getName();
+                       }
                } else {
-                       $real = false;
+                       $real = $user->getName();
                }
 
                $page = $user->isAnon()
                        ? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
                        : $user->getUserPage();
 
-               return Linker::link( $page, htmlspecialchars( $real ? $real : $user->getName() ) );
+               return MediaWikiServices::getInstance()
+                       ->getLinkRenderer()->makeLink( $page, $real );
        }
 
        /**
@@ -231,11 +236,11 @@ class CreditsAction extends FormlessAction {
         * @return string HTML link
         */
        protected function othersLink() {
-               return Linker::linkKnown(
+               return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
                        $this->getTitle(),
-                       $this->msg( 'others' )->escaped(),
-                       array(),
-                       array( 'action' => 'credits' )
+                       $this->msg( 'others' )->text(),
+                       [],
+                       [ 'action' => 'credits' ]
                );
        }
 }