Siebrand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/56903


Change subject: Reformat code
......................................................................

Reformat code

Also remove unneeded else{} in getOpenIDSmallLogoUrl().

Change-Id: I9c95f5462cb74c50f98323a635f27d4fac9c1c18
---
M OpenID.hooks.php
1 file changed, 107 insertions(+), 127 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenID 
refs/changes/03/56903/1

diff --git a/OpenID.hooks.php b/OpenID.hooks.php
index 43bf548..98dcf82 100644
--- a/OpenID.hooks.php
+++ b/OpenID.hooks.php
@@ -10,6 +10,7 @@
                parent::__construct( 'SpecialOpenIDCreateAccount', 
'OpenIDLogin' );
        }
 }
+
 class SpecialOpenIDUserLogin extends SpecialRedirectToSpecial {
        function __construct() {
                parent::__construct( 'SpecialOpenIDUserLogin', 'OpenIDLogin', 
false, array( 'returnto', 'returntoquery' ) );
@@ -64,10 +65,10 @@
 
                /* pre-version-2.00 behaviour: OpenID Server was only supported 
for existing userpages */
 
-               if ( $nt 
+               if ( $nt
                        && ( $nt->getNamespace() == NS_USER )
-                       && ( strpos( $nt->getText(), '/' ) === false ) ) {
-
+                       && ( strpos( $nt->getText(), '/' ) === false )
+               ) {
                        $user = User::newFromName( $nt->getText() );
 
                        if ( $user && ( $user->getID() != 0 ) ) {
@@ -138,8 +139,8 @@
                $rows = '';
 
                foreach ( $openid_urls_registration as $url_reg ) {
-               
-                       if ( !empty( $url_reg->uoi_user_registration ) ) { 
+
+                       if ( !empty( $url_reg->uoi_user_registration ) ) {
                                $registrationTime = wfMessage(
                                        'openid-urls-registration-date-time',
                                        $wgLang->timeanddate( 
$url_reg->uoi_user_registration, true ),
@@ -157,32 +158,32 @@
                                                " " .
                                                Xml::element( 'a', array( 
'href' => $url_reg->uoi_openid ), $url_reg->uoi_openid )
                                ) .
-                               Xml::tags( 'td',
-                                       array(),
-                                       $registrationTime
-                               ) .
-                               Xml::tags( 'td',
-                                       array(),
-                                       Linker::link( $delTitle, wfMessage( 
'openid-urls-delete' )->text(),
+                                       Xml::tags( 'td',
                                                array(),
-                                               array( 'url' => 
$url_reg->uoi_openid ) 
-                                       ) 
-                               )
+                                               $registrationTime
+                                       ) .
+                                       Xml::tags( 'td',
+                                               array(),
+                                               Linker::link( $delTitle, 
wfMessage( 'openid-urls-delete' )->text(),
+                                                       array(),
+                                                       array( 'url' => 
$url_reg->uoi_openid )
+                                               )
+                                       )
                        ) . "\n";
                }
                $info = Xml::tags( 'table', array( 'class' => 'wikitable' ),
                        Xml::tags( 'tr', array(),
                                Xml::element( 'th',
-                                       array(), 
+                                       array(),
                                        wfMessage( 'openid-urls-url' )->text() 
) .
-                               Xml::element( 'th',
-                                       array(), 
-                                       wfMessage( 'openid-urls-registration' 
)->text() ) .
-                               Xml::element( 'th', 
-                                       array(), 
-                                       wfMessage( 'openid-urls-action' 
)->text() )
-                               ) . "\n" .
-                       $rows
+                                       Xml::element( 'th',
+                                               array(),
+                                               wfMessage( 
'openid-urls-registration' )->text() ) .
+                                       Xml::element( 'th',
+                                               array(),
+                                               wfMessage( 'openid-urls-action' 
)->text() )
+                       ) . "\n" .
+                               $rows
                );
                $info .= Linker::link(
                        SpecialPage::getTitleFor( 'OpenIDConvert' ),
@@ -210,37 +211,33 @@
                                                array(),
                                                Xml::element( 'a', array( 
'href' => $key ), $key )
                                        ) .
-                                       Xml::tags( 'td',
-                                               array(),
-                                               Linker::link( 
$deleteTrustedSiteTitle,
-                                                       wfMessage( 
'openid-trusted-sites-delete-link-action-text' )->text(),
+                                               Xml::tags( 'td',
                                                        array(),
-                                                       array( 'url' => $key )
+                                                       Linker::link( 
$deleteTrustedSiteTitle,
+                                                               wfMessage( 
'openid-trusted-sites-delete-link-action-text' )->text(),
+                                                               array(),
+                                                               array( 'url' => 
$key )
+                                                       )
                                                )
-                                       )
                                ) . "\n";
-
                        }
-
                }
 
                if ( $rows !== "" ) {
-
                        $rows .= Xml::tags( 'tr', array(),
                                Xml::tags( 'td',
                                        array(),
                                        " "
                                ) .
-                               Xml::tags( 'td',
-                                       array(),
-                                       Linker::link( $deleteTrustedSiteTitle,
-                                               wfMessage( 
'openid-trusted-sites-delete-all-link-action-text' )->text(),
+                                       Xml::tags( 'td',
                                                array(),
-                                               array( 'url' => "*" )
+                                               Linker::link( 
$deleteTrustedSiteTitle,
+                                                       wfMessage( 
'openid-trusted-sites-delete-all-link-action-text' )->text(),
+                                                       array(),
+                                                       array( 'url' => "*" )
+                                               )
                                        )
-                               )
                        ) . "\n";
-
                }
 
                return Xml::tags( 'table', array( 'class' => 'wikitable' ),
@@ -248,11 +245,11 @@
                                Xml::element( 'th',
                                        array(),
                                        wfMessage( 
'openid-trusted-sites-table-header-column-url' )->text() ) .
-                               Xml::element( 'th',
-                                       array(),
-                                       wfMessage( 
'openid-trusted-sites-table-header-column-action' )->text() )
+                                       Xml::element( 'th',
+                                               array(),
+                                               wfMessage( 
'openid-trusted-sites-table-header-column-action' )->text() )
                        ) . "\n" .
-                       $rows
+                               $rows
                );
        }
 
@@ -263,43 +260,37 @@
         */
        public static function onGetPreferences( $user, &$preferences ) {
                global $wgOpenIDShowUrlOnUserPage, $wgHiddenPrefs,
-                       $wgAuth, $wgUser, $wgLang, $wgOpenIDClientOnly;
+                          $wgAuth, $wgUser, $wgLang, $wgOpenIDClientOnly;
 
                if ( !$wgOpenIDClientOnly ) {
-
                        switch ( $wgOpenIDShowUrlOnUserPage ) {
-
-                       case 'user':
-                               $preferences['openid-hide-openid'] =
-                                       array(
-                                               'section' => 
'openid/openid-hide-openid',
-                                               'type' => 'toggle',
-                                               'label-message' => 
'openid-hide-openid-label',
-                                       );
-                               break;
-
-                       case 'always':
-                               $preferences['openid-hide-openid'] =
-                                       array(
-                                               'section' => 
'openid/openid-hide-openid',
-                                               'type' => 'info',
-                                               'label-message' => 
'openid-hide-openid-label',
-                                               'default' => wfMessage( 
'openid-show-openid-url-on-userpage-always' )->text(),
-                                       );
-                               break;
-
-                       case 'never':
-                               $preferences['openid-hide-openid'] =
-                                       array(
-                                               'section' => 
'openid/openid-hide-openid',
-                                               'type' => 'info',
-                                               'label-message' => 
'openid-hide-openid-label',
-                                               'default' => wfMessage( 
'openid-show-openid-url-on-userpage-never' )->text(),
-                                       );
-                               break;
-
+                               case 'user':
+                                       $preferences['openid-hide-openid'] =
+                                               array(
+                                                       'section' => 
'openid/openid-hide-openid',
+                                                       'type' => 'toggle',
+                                                       'label-message' => 
'openid-hide-openid-label',
+                                               );
+                                       break;
+                               case 'always':
+                                       $preferences['openid-hide-openid'] =
+                                               array(
+                                                       'section' => 
'openid/openid-hide-openid',
+                                                       'type' => 'info',
+                                                       'label-message' => 
'openid-hide-openid-label',
+                                                       'default' => wfMessage( 
'openid-show-openid-url-on-userpage-always' )->text(),
+                                               );
+                                       break;
+                               case 'never':
+                                       $preferences['openid-hide-openid'] =
+                                               array(
+                                                       'section' => 
'openid/openid-hide-openid',
+                                                       'type' => 'info',
+                                                       'label-message' => 
'openid-hide-openid-label',
+                                                       'default' => wfMessage( 
'openid-show-openid-url-on-userpage-never' )->text(),
+                                               );
+                                       break;
                        }
-
                }
 
                // setting up user_properties up_property database key names
@@ -307,55 +298,50 @@
                // FIXME: this could better be saved as a JSON encoded array in 
a single key
 
                $update = array();
-               $update[ wfMessage( 'openidnickname' )->text() ] = '-nickname';
-               $update[ wfMessage( 'openidemail' )->text() ] = '-email';
+               $update[wfMessage( 'openidnickname' )->text()] = '-nickname';
+               $update[wfMessage( 'openidemail' )->text()] = '-email';
+
                if ( !in_array( 'realname', $wgHiddenPrefs ) ) {
-                       $update[ wfMessage( 'openidfullname' )->text() ] = 
'-fullname';
+                       $update[wfMessage( 'openidfullname' )->text()] = 
'-fullname';
                }
-               $update[ wfMessage( 'openidlanguage' )->text() ] = '-language';
-               $update[ wfMessage( 'openidtimezone' )->text() ] = '-timezone';
+               $update[wfMessage( 'openidlanguage' )->text()] = '-language';
+               $update[wfMessage( 'openidtimezone' )->text()] = '-timezone';
 
-               $preferences['openid-userinfo-update-on-login'] =
-                       array(
-                               'section' => 
'openid/openid-userinfo-update-on-login',
-                               'type' => 'multiselect',
-                               'label-message' => 
'openid-userinfo-update-on-login-label',
-                               'options' => $update,
-                       );
+               $preferences['openid-userinfo-update-on-login'] = array(
+                       'section' => 'openid/openid-userinfo-update-on-login',
+                       'type' => 'multiselect',
+                       'label-message' => 
'openid-userinfo-update-on-login-label',
+                       'options' => $update,
+               );
 
-               $preferences['openid-associated-openids'] =
-                       array(
-                               'section' => 'openid/openid-associated-openids',
+               $preferences['openid-associated-openids'] = array(
+                       'section' => 'openid/openid-associated-openids',
+                       'type' => 'info',
+                       'label-message' => 'openid-associated-openids-label',
+                       'default' => self::getAssociatedOpenIDsTable( $user ),
+                       'raw' => true,
+               );
+
+               $preferences['openid_trust'] = array(
+                       'type' => 'hidden',
+               );
+
+               if ( !$wgOpenIDClientOnly ) {
+                       $preferences['openid-your-openid'] = array(
+                               'section' => 'openid/openid-local-identity',
                                'type' => 'info',
-                               'label-message' => 
'openid-associated-openids-label',
-                               'default' => self::getAssociatedOpenIDsTable( 
$user ),
+                               'label-message' => 'openid-local-identity',
+                               'default' => 
self::getOpenIDSmallLogoUrlImageTag() . " " . 
SpecialOpenIDServer::getLocalIdentityLink( $user ),
                                'raw' => true,
                        );
 
-               $preferences['openid_trust'] =
-                       array(
-                               'type' => 'hidden',
+                       $preferences['openid-trusted-sites'] = array(
+                               'section' => 'openid/openid-trusted-sites',
+                               'type' => 'info',
+                               'label-message' => 'openid-trusted-sites-label',
+                               'default' => self::getTrustTable( $user ),
+                               'raw' => true,
                        );
-
-               if ( !$wgOpenIDClientOnly ) {
-
-                       $preferences['openid-your-openid'] =
-                               array(
-                                       'section' => 
'openid/openid-local-identity',
-                                       'type' => 'info',
-                                       'label-message' => 
'openid-local-identity',
-                                       'default' => 
self::getOpenIDSmallLogoUrlImageTag() . " " . 
SpecialOpenIDServer::getLocalIdentityLink( $user ),
-                                       'raw' => true,
-                               );
-
-                       $preferences['openid-trusted-sites'] =
-                               array(
-                                       'section' => 
'openid/openid-trusted-sites',
-                                       'type' => 'info',
-                                       'label-message' => 
'openid-trusted-sites-label',
-                                       'default' => self::getTrustTable( $user 
),
-                                       'raw' => true,
-                               );
 
                }
 
@@ -368,7 +354,7 @@
                        );
 
                        if ( empty( $wgUser->mPassword ) && empty( 
$wgUser->mNewpassword ) ) {
-                               $preferences['password'] = array(
+                               $preferences['password'] = array(
                                        'section' => 'personal/info',
                                        'type' => 'info',
                                        'raw' => true,
@@ -394,10 +380,9 @@
                                        'label' => wfMessage(
                                                'tog-rememberpassword',
                                                $wgLang->formatNum( ceil( 
$wgCookieExpiration / ( 3600 * 24 ) ) )
-                                               )->escaped(),
+                                       )->escaped(),
                                );
                        }
-
                }
 
                return true;
@@ -411,21 +396,18 @@
                global $wgOut;
 
                if ( is_object( $user ) ) {
-
                        $username = $user->getName();
                        $userID = $user->getID();
 
-                       $dbw = wfGetDB( DB_MASTER );
+                       $dbw = wfGetDB( DB_MASTER );
 
                        $dbw->delete( 'user_openid', array( 'uoi_user' => 
$userID ) );
                        $wgOut->addHTML( "OpenID " . wfMessage( 
'usermerge-userdeleted', $username, $userID )->escaped() );
 
                        wfDebug( "OpenID: deleted OpenID user $username 
($userID)\n" );
-
                }
 
                return true;
-
        }
 
        /**
@@ -449,7 +431,6 @@
                                $wgOut->addHTML( "OpenID " . wfMessage( 
'usermerge-updating', 'user_openid', $fromUsername, $toUsername )->escaped() . 
"<br />\n" );
 
                                wfDebug( "OpenID: transferred OpenID(s) of 
$fromUsername ($fromUserID) => $toUsername ($toUserID)\n" );
-
                        } else {
                                $wgOut->addHTML( wfMessage( 
'openid-openids-were-not-merged' )->escaped() . "<br />\n" );
                                wfDebug( "OpenID: OpenID(s) were not merged for 
merged users $fromUsername ($fromUserID) => $toUsername ($toUserID)\n" );
@@ -494,10 +475,9 @@
 
                if ( !$wgOpenIDSmallLogoUrl ) {
                        return $wgExtensionAssetsPath . 
'/OpenID/skin/icons/openid-inputicon.png';
-               } else {
-                       return $wgOpenIDSmallLogoUrl;
                }
 
+               return $wgOpenIDSmallLogoUrl;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/56903
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c95f5462cb74c50f98323a635f27d4fac9c1c18
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenID
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to