documentation, a couple notes about code and some whitespaces adjustements to make...
[lhc/web/wiklou.git] / includes / Credits.php
index 7fe2253..e4c8be5 100644 (file)
@@ -1,22 +1,24 @@
 <?php
 /**
- * Credits.php -- formats credits for articles
+ * Formats credits for articles
+ *
  * Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  *
+ * @file
  * @author <evan@wikitravel.org>
  */
 
@@ -119,14 +121,18 @@ class Credits {
                        $cnt--;
                        if ( $user->isLoggedIn() ) {
                                $link = self::link( $user );
-                               if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() )
+                               if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
                                        $real_names[] = $link;
-                               else
+                               } else {
                                        $user_names[] = $link;
+                               }
                        } else {
                                $anon_ips[] = self::link( $user );
                        }
-                       if ( $cnt == 0 ) break;
+
+                       if ( $cnt == 0 ) {
+                               break;
+                       }
                }
 
                if ( count( $real_names ) ) {
@@ -137,15 +143,21 @@ class Credits {
 
                # "ThisSite user(s) A, B and C"
                if ( count( $user_names ) ) {
-                       $user = wfMsgExt( 'siteusers', array( 'parsemag' ),
-                               $wgLang->listToText( $user_names ), count( $user_names ) );
+                       $user = wfMsgExt(
+                               'siteusers',
+                               'parsemag',
+                               $wgLang->listToText( $user_names ), count( $user_names )
+                       );
                } else {
                        $user = false;
                }
 
                if ( count( $anon_ips ) ) {
-                       $anon = wfMsgExt( 'anonusers', array( 'parsemag' ),
-                               $wgLang->listToText( $anon_ips ), count( $anon_ips ) );
+                       $anon = wfMsgExt(
+                               'anonusers',
+                               'parsemag',
+                               $wgLang->listToText( $anon_ips ), count( $anon_ips )
+                       );
                } else {
                        $anon = false;
                }
@@ -174,10 +186,11 @@ class Credits {
         */
        protected static function link( User $user ) {
                global $wgUser, $wgHiddenPrefs;
-               if ( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() )
+               if ( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() ) {
                        $real = $user->getRealName();
-               else
+               } else {
                        $real = false;
+               }
 
                $skin = $wgUser->getSkin();
                $page = $user->isAnon() ?
@@ -198,10 +211,11 @@ class Credits {
                        return wfMsgExt( 'anonuser', array( 'parseinline', 'replaceafter' ), $link );
                } else {
                        global $wgHiddenPrefs;
-                       if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() )
+                       if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
                                return $link;
-                       else
-                               return wfMsgExt( 'siteuser', array( 'parseinline', 'replaceafter' ), $link );
+                       } else {
+                               return wfMsgExt( 'siteuser', 'parsemag', $link, $user->getName() );
+                       }
                }
        }