Index: trunk/extensions/OpenID/OpenID.php |
— | — | @@ -46,8 +46,16 @@ |
47 | 47 | # Whether to hide the "Login with OpenID link" link; set to true if you already have this link in your skin. |
48 | 48 | |
49 | 49 | $wgHideOpenIDLoginLink = false; |
| 50 | + |
| 51 | + # Location of the OpenID login logo. You can copy this to your server if you want. |
| 52 | + |
50 | 53 | $wgOpenIDLoginLogoUrl = 'http://www.openid.net/login-bg.gif'; |
51 | 54 | |
| 55 | + # Whether to show the OpenID identity URL on a user's home page. Possible values are 'always', 'never', or 'user' |
| 56 | + # 'user' lets the user decide. |
| 57 | + |
| 58 | + $wgOpenIDShowUrlOnUserPage = 'user'; |
| 59 | + |
52 | 60 | function setupOpenID() { |
53 | 61 | global $wgMessageCache, $wgOut, $wgRequest, $wgHooks; |
54 | 62 | |
— | — | @@ -93,6 +101,7 @@ |
94 | 102 | 'openidconvertyourstext' => 'That is already your OpenID.', |
95 | 103 | 'openidconvertothertext' => 'That is someone else\'s OpenID.', |
96 | 104 | 'openidalreadyloggedin' => '<strong>User $1, you are already logged in!</strong>', |
| 105 | + 'tog-hideopenid' => 'Hide your <a href="http://openid.net/">OpenID</a> on your user page, if you log in with OpenID.', |
97 | 106 | )); |
98 | 107 | |
99 | 108 | SpecialPage::AddPage(new UnlistedSpecialPage('OpenIDLogin')); |
— | — | @@ -102,6 +111,8 @@ |
103 | 112 | SpecialPage::AddPage(new UnlistedSpecialPage('OpenIDXRDS')); |
104 | 113 | |
105 | 114 | $wgHooks['PersonalUrls'][] = 'OpenIDPersonalUrls'; |
| 115 | + $wgHooks['UserToggles'][] = 'OpenIDUserToggles'; |
| 116 | + |
106 | 117 | $wgOut->addHeadItem('openidloginstyle', OpenIDLoginStyle()); |
107 | 118 | |
108 | 119 | $action = $wgRequest->getText('action', 'view'); |
— | — | @@ -139,12 +150,20 @@ |
140 | 151 | if ($user && $user->getID() != 0) { |
141 | 152 | $openid = OpenIdGetUserUrl($user); |
142 | 153 | if (isset($openid) && strlen($openid) != 0) { |
143 | | - $url = OpenIDToUrl($openid); |
144 | | - $disp = htmlspecialchars($openid); |
145 | | - $wgOut->setSubtitle("<span class='subpages'>" . |
146 | | - "<img src='http://openid.net/login-bg.gif' alt='OpenID' />" . |
147 | | - "<a href='$url'>$disp</a>" . |
148 | | - "</span>"); |
| 154 | + global $wgOpenIDShowUrlOnUserPage; |
| 155 | + |
| 156 | + if ($wgOpenIDShowUrlOnUserPage == 'always' || |
| 157 | + ($wgOpenIDShowUrlOnUserPage == 'user' && !$user->getOption('hideopenid'))) |
| 158 | + { |
| 159 | + global $wgOpenIDLoginLogoUrl; |
| 160 | + |
| 161 | + $url = OpenIDToUrl($openid); |
| 162 | + $disp = htmlspecialchars($openid); |
| 163 | + $wgOut->setSubtitle("<span class='subpages'>" . |
| 164 | + "<img src='$wgOpenIDLoginLogoUrl' alt='OpenID' />" . |
| 165 | + "<a href='$url'>$disp</a>" . |
| 166 | + "</span>"); |
| 167 | + } |
149 | 168 | } else { |
150 | 169 | $wgOut->addLink(array('rel' => 'openid.server', |
151 | 170 | 'href' => OpenIDServerUrl())); |
— | — | @@ -229,6 +248,10 @@ |
230 | 249 | return true; |
231 | 250 | } |
232 | 251 | |
| 252 | + function OpenIDUserToggles(&$extraToggles) { |
| 253 | + $extraToggles[] = 'hideopenid'; |
| 254 | + } |
| 255 | + |
233 | 256 | function OpenIDLoginStyle() { |
234 | 257 | global $wgOpenIDLoginLogoUrl; |
235 | 258 | return <<<EOS |
Index: trunk/extensions/OpenID/README |
— | — | @@ -266,7 +266,11 @@ |
267 | 267 | 'http://www.openid.net/login-bg.gif', but you may want to move it to |
268 | 268 | a local URL, or an URL on a CDN, if that kind of thing floats your |
269 | 269 | boat. |
270 | | - |
| 270 | + |
| 271 | +* $wgOpenIDShowUrlOnUserPage -- whether to show the OpenID identity URL |
| 272 | + on a user's home page. Possible values are 'always', 'never', or 'user' |
| 273 | + (lets the user decide). Default is 'user'. |
| 274 | + |
271 | 275 | == Skins == |
272 | 276 | |
273 | 277 | If you are customizing a skin, and you want to show the OpenID |