Index: trunk/extensions/OpenID/OpenID.i18n.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | |
94 | 94 | There are many [http://openid.net/get/ OpenID providers], and you may already have an OpenID-enabled account on another service.', |
95 | 95 | 'openidupdateuserinfo' => 'Update my personal information', |
96 | | - 'openid-prefs' => 'OpenID', |
| 96 | + 'prefs-openid' => 'OpenID', |
97 | 97 | 'openid-prefstext' => '[http://openid.net/ OpenID] preferences', |
98 | 98 | 'openid-pref-hide' => 'Hide your OpenID URL on your user page, if you log in with OpenID.', |
99 | 99 | 'openid-pref-update-userinfo-on-login' => 'Update my information from OpenID persona every time I login', |
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | 'openidlanguage' => '{{Identical|Language}}', |
121 | 121 | 'openidchoosepassword' => '{{Identical|Password}}', |
122 | 122 | 'openidalreadyloggedin' => '$1 is a user name.', |
123 | | - 'openid-prefs' => '{{optional}} |
| 123 | + 'prefs-openid' => '{{optional}} |
124 | 124 | OpenID preferences tab title', |
125 | 125 | 'openid-prefstext' => 'OpenID preferences tab text above the list of preferences', |
126 | 126 | 'openid-pref-hide' => 'OpenID preference label (Hide your OpenID URL on your user page, if you log in with OpenID)', |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | |
231 | 231 | يوجد العديد من [http://wiki.openid.net/Public_OpenID_providers موفري الهوية المفتوحة العلنيين]، وربما يكون لديك حسابك بهوية مفتوحة على خدمة أخرى.', |
232 | 232 | 'openidupdateuserinfo' => 'تحديث معلوماتي الشخصية', |
233 | | - 'openid-prefs' => 'هوية مفتوحة', |
| 233 | + 'prefs-openid' => 'هوية مفتوحة', |
234 | 234 | 'openid-prefstext' => 'تفضيلات [http://openid.net/ OpenID]', |
235 | 235 | 'openid-pref-hide' => 'أخف هويتك <a href="http://openid.net/">هويتك المفتوحة</a> على صفحتك الشخصية، لو سجلت الدخول بالهوية المفتوحة.', |
236 | 236 | 'openid-pref-update-userinfo-on-login' => 'حدث معلوماتي من شخصية الهوية المفتوحة كل مرة أسجل الدخول', |
Index: trunk/extensions/OpenID/OpenID.hooks.php |
— | — | @@ -104,64 +104,25 @@ |
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | |
108 | | - # list of preferences used by extension |
109 | | - private static $oidPrefs = array( 'hide', 'update-userinfo-on-login' ); |
110 | | - |
111 | | - public static function onInitPreferencesForm( $prefs, $request ) { |
112 | | - foreach ( self::$oidPrefs as $oidPref ) |
113 | | - { |
114 | | - $prefs->mToggles['openid-' . $oidPref] |
115 | | - = $request->getCheck( "wpOpOpenID-" . $oidPref ) ? 1 : 0; |
116 | | - } |
117 | | - |
118 | | - return true; |
119 | | - } |
120 | | - |
121 | | - public static function onRenderPreferencesForm( $prefs, $out ) { |
| 108 | + public static function onGetPreferences( $user, &$preferences ) { |
122 | 109 | wfLoadExtensionMessages( 'OpenID' ); |
| 110 | + |
| 111 | + $preferences['openid-hide'] = |
| 112 | + array( |
| 113 | + 'type' => 'toggle', |
| 114 | + 'section' => 'openid', |
| 115 | + 'label-message' => 'openid-pref-hide', |
| 116 | + ); |
123 | 117 | |
124 | | - $out->addHTML( "\n<fieldset>\n<legend>" . wfMsgHtml( 'openid-prefs' ) . "</legend>\n" ); |
| 118 | + $preferences['openid-update-userinfo-on-login'] = |
| 119 | + array( |
| 120 | + 'type' => 'toggle', |
| 121 | + 'section' => 'openid', |
| 122 | + 'label-message' => 'openid-pref-update-userinfo-on-login', |
| 123 | + ); |
125 | 124 | |
126 | | - $out->addWikiText( wfMsg( 'openid-prefstext' ) ); |
127 | | - |
128 | | - foreach ( self::$oidPrefs as $oidPref ) |
129 | | - { |
130 | | - $out->addHTML( '<div class="toggle"><input type="checkbox" value="1" ' . |
131 | | - 'id="openid-' . $oidPref . '" name="wpOpOpenID-' . $oidPref . '"' . |
132 | | - ( $prefs->mToggles['openid-' . $oidPref] == 1 ? ' checked="checked"' : '' ) . |
133 | | - '/> ' . |
134 | | - '<span class="toggletext">' . |
135 | | - '<label for="openid-' . $oidPref . '">' . wfMsg( 'openid-pref-' . $oidPref ) . '</label>' . |
136 | | - "</span></div>\n" ); |
137 | | - } |
138 | | - |
139 | | - $out->addHTML( "</fieldset>\n\n" ); |
140 | | - |
141 | 125 | return true; |
142 | 126 | } |
143 | | - |
144 | | - public static function onSavePreferences( $prefs, $user, &$message, $old ) |
145 | | - { |
146 | | - foreach ( self::$oidPrefs as $oidPref ) |
147 | | - { |
148 | | - $user->setOption( 'openid-' . $oidPref, $prefs->mToggles['openid-' . $oidPref] ); |
149 | | - wfDebugLog( 'OpenID', 'Setting user preferences: ' . print_r( $user, true ) ); |
150 | | - } |
151 | | - |
152 | | - $user->saveSettings(); |
153 | | - |
154 | | - return true; |
155 | | - } |
156 | | - |
157 | | - public static function onResetPreferences( $prefs, $user ) |
158 | | - { |
159 | | - foreach ( self::$oidPrefs as $oidPref ) { |
160 | | - $prefs->mToggles['openid-' . $oidPref] = $user->getOption( 'openid-' . $oidPref ); |
161 | | - } |
162 | | - |
163 | | - return true; |
164 | | - } |
165 | | - |
166 | 127 | public static function onLoadExtensionSchemaUpdates() { |
167 | 128 | global $wgDBtype, $wgExtNewTables; |
168 | 129 | |
Index: trunk/extensions/OpenID/OpenID.setup.php |
— | — | @@ -155,9 +155,6 @@ |
156 | 156 | $wgHooks['ArticleViewHeader'][] = 'OpenIDHooks::onArticleViewHeader'; |
157 | 157 | $wgHooks['SpecialPage_initList'][] = 'OpenIDHooks::onSpecialPage_initList'; |
158 | 158 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'OpenIDHooks::onLoadExtensionSchemaUpdates'; |
159 | | -$wgHooks['RenderPreferencesForm'][] = 'OpenIDHooks::onRenderPreferencesForm'; |
160 | | -$wgHooks['InitPreferencesForm'][] = 'OpenIDHooks::onInitPreferencesForm'; |
161 | | -$wgHooks['ResetPreferences'][] = 'OpenIDHooks::onResetPreferences'; |
162 | | -$wgHooks['SavePreferences'][] = 'OpenIDHooks::onSavePreferences'; |
| 159 | +$wgHooks['GetPreferences'][] = 'OpenIDHooks::onGetPreferences'; |
163 | 160 | # FIXME, function does not exist |
164 | 161 | # $wgHooks['UserLoginForm'][] = 'OpenIDHooks::onUserLoginForm'; |