Index: trunk/extensions/FBConnect/PreferencesExtension.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | - |
| 3 | + |
4 | 4 | /** |
5 | 5 | * See: http://www.mediawiki.org/wiki/Extension:PreferencesExtension |
6 | 6 | * |
— | — | @@ -12,37 +12,36 @@ |
13 | 13 | die( 'This is not a valid entry point to MediaWiki.' ); |
14 | 14 | } |
15 | 15 | |
16 | | -$wgExtensionFunctions[] = "wfPreferencesExtension"; |
| 16 | +$wgExtensionFunctions[] = 'wfPreferencesExtension'; |
17 | 17 | $wgExtensionCredits['specialpage'][] = array( |
18 | | - 'name' => 'PreferencesExtension', |
19 | | - 'version' => '2008/02/10.2', |
20 | | - 'author' => 'Austin Che', |
21 | | - 'url' => 'http://openwetware.org/wiki/User:Austin_J._Che/Extensions/PreferencesExtension', |
22 | | - 'description' => 'Enables extending user preferences', |
| 18 | + 'name' => 'PreferencesExtension', |
| 19 | + 'version' => '2008/02/10.2', |
| 20 | + 'author' => 'Austin Che', |
| 21 | + 'url' => 'http://openwetware.org/wiki/User:Austin_J._Che/Extensions/PreferencesExtension', |
| 22 | + 'description' => 'Enables extending user preferences', |
23 | 23 | ); |
24 | | - |
| 24 | + |
25 | 25 | // constants for pref types |
26 | | -define('PREF_USER_T', 1); |
27 | | -define('PREF_TOGGLE_T', 2); |
28 | | -define('PREF_TEXT_T', 3); |
29 | | -define('PREF_PASSWORD_T', 4); |
30 | | -define('PREF_INT_T', 5); |
31 | | -define('PREF_DROPDOWN_T', 6); |
32 | | -define('PREF_CUSTOM_HTML_T', 6); |
33 | | - |
| 26 | +define( 'PREF_USER_T', 1 ); |
| 27 | +define( 'PREF_TOGGLE_T', 2 ); |
| 28 | +define( 'PREF_TEXT_T', 3 ); |
| 29 | +define( 'PREF_PASSWORD_T', 4 ); |
| 30 | +define( 'PREF_INT_T', 5 ); |
| 31 | +define( 'PREF_DROPDOWN_T', 6 ); |
| 32 | +define( 'PREF_CUSTOM_HTML_T', 6 ); |
| 33 | + |
34 | 34 | // each element of the following should be an array that can have keys: |
35 | 35 | // name, section, type, size, validate, load, save, html, min, max, default |
36 | 36 | $wgExtensionPreferences = array(); |
37 | | - |
38 | | -function wfPreferencesExtension() |
39 | | -{ |
40 | | - wfProfileIn(__METHOD__); |
41 | | - |
42 | | -// wfUseMW('1.7'); |
43 | | - global $wgHooks; |
44 | | - $wgHooks['SpecialPage_initList'][] = 'wfOverridePreferences'; |
45 | | - |
46 | | - wfProfileOut(__METHOD__); |
| 37 | + |
| 38 | +function wfPreferencesExtension() { |
| 39 | + wfProfileIn( __METHOD__ ); |
| 40 | + |
| 41 | +// wfUseMW('1.7'); |
| 42 | + global $wgHooks; |
| 43 | + $wgHooks['SpecialPage_initList'][] = 'wfOverridePreferences'; |
| 44 | + |
| 45 | + wfProfileOut( __METHOD__ ); |
47 | 46 | } |
48 | 47 | |
49 | 48 | /** |
— | — | @@ -50,244 +49,244 @@ |
51 | 50 | * |
52 | 51 | * @param array $prefs |
53 | 52 | */ |
54 | | -function wfAddPreferences($prefs) |
55 | | -{ |
56 | | - global $wgExtensionPreferences; |
57 | | - wfProfileIn(__METHOD__); |
58 | | - |
59 | | - foreach ($prefs as $pref) |
60 | | - { |
61 | | - $wgExtensionPreferences[] = $pref; |
62 | | - } |
63 | | - wfProfileOut(__METHOD__); |
| 53 | +function wfAddPreferences( $prefs ) { |
| 54 | + global $wgExtensionPreferences; |
| 55 | + wfProfileIn( __METHOD__ ); |
| 56 | + |
| 57 | + foreach ( $prefs as $pref ) { |
| 58 | + $wgExtensionPreferences[] = $pref; |
| 59 | + } |
| 60 | + wfProfileOut( __METHOD__ ); |
64 | 61 | } |
65 | | - |
66 | | -function wfOverridePreferences(&$list) |
67 | | -{ |
68 | | - wfProfileIn(__METHOD__); |
69 | | - |
70 | | - // we 'override' the default preferences special page with our own |
71 | | - $list["Preferences"] = array("SpecialPage", "Preferences", "", true, "wfSpecialPreferencesExtension"); |
72 | | - |
73 | | - wfProfileOut(__METHOD__); |
74 | | - return true; |
| 62 | + |
| 63 | +function wfOverridePreferences( &$list ) { |
| 64 | + wfProfileIn( __METHOD__ ); |
| 65 | + |
| 66 | + // we 'override' the default preferences special page with our own |
| 67 | + $list['Preferences'] = array( 'SpecialPage', 'Preferences', '', true, 'wfSpecialPreferencesExtension' ); |
| 68 | + |
| 69 | + wfProfileOut( __METHOD__ ); |
| 70 | + return true; |
75 | 71 | } |
76 | | - |
77 | | -function wfSpecialPreferencesExtension() |
78 | | -{ |
79 | | - wfProfileIn(__METHOD__); |
80 | 72 | |
| 73 | +function wfSpecialPreferencesExtension() { |
| 74 | + wfProfileIn( __METHOD__ ); |
| 75 | + |
81 | 76 | global $IP; |
82 | | - require_once($IP . '/includes/specials/SpecialPreferences.php'); |
83 | | - |
84 | | - // override the default preferences form |
85 | | - class SpecialPreferencesExtension extends PreferencesForm |
86 | | - { |
| 77 | + require_once( $IP . '/includes/specials/SpecialPreferences.php' ); |
| 78 | + |
| 79 | + // override the default preferences form |
| 80 | + class SpecialPreferencesExtension extends PreferencesForm { |
87 | 81 | // overload to add new field by hook |
88 | | - function __construct( &$request ) { |
| 82 | + function __construct( &$request ) { |
89 | 83 | global $wgExtensionPreferences, $wgUser; |
90 | | - parent::__construct($request); |
| 84 | + parent::__construct( $request ); |
91 | 85 | wfRunHooks( 'initPreferencesExtensionForm', array( $wgUser, &$wgExtensionPreferences ) ); |
92 | 86 | } |
93 | | - // unlike parent, we don't load in posted form values in constructor |
94 | | - // until savePreferences when we need it |
95 | | - // we also don't need resetPrefs, instead loading the newest values when displaying the form |
96 | | - // finally parent's execute function doesn't need overriding |
97 | | - // this leaves only two functions to override |
98 | | - // one for displaying the form and one for saving the values |
99 | | - |
100 | | - function savePreferences() |
101 | | - { |
102 | | - // handle extension prefs first |
103 | | - global $wgUser, $wgRequest; |
104 | | - global $wgExtensionPreferences; |
105 | | - wfProfileIn(__METHOD__); |
106 | | - |
107 | | - foreach ($wgExtensionPreferences as $p) |
108 | | - { |
109 | | - $name = isset($p['name']) ? $p['name'] : ""; |
110 | | - if ( !$name ) { |
111 | | - continue; |
112 | | - } |
113 | | - |
114 | | - $value = $wgRequest->getVal($name); |
115 | | - $type = isset($p['type']) ? $p['type'] : PREF_USER_T; |
116 | | - |
117 | | - if ( !empty($p['int-type']) ) { |
118 | | - $type = $p['int-type']; |
119 | | - } |
120 | | - |
121 | | - switch ($type) |
122 | | - { |
123 | | - case PREF_TOGGLE_T: |
124 | | - if (isset($p['save'])) |
125 | | - $p['save']($name, $value); |
126 | | - else |
127 | | - $wgUser->setOption($name, $wgRequest->getCheck("wpOp{$name}")); |
128 | | - break; |
129 | | - |
130 | | - case PREF_INT_T: |
131 | | - $min = isset($p['min']) ? $p['min'] : 0; |
132 | | - $max = isset($p['max']) ? $p['max'] : 0x7fffffff; |
133 | | - if (isset($p['save'])) |
134 | | - $p['save']($name, $value); |
135 | | - else |
136 | | - $wgUser->setOption($name, $this->validateIntOrNull($value, $min, $max)); |
137 | | - break; |
138 | | - |
139 | | - case PREF_DROPDOWN_T: |
140 | | - if (isset($p['save'])) |
141 | | - $p['save']($name, $value); |
142 | | - else |
143 | | - $wgUser->setOption($name, $value); |
144 | | - break; |
145 | | - |
146 | | - case PREF_PASSWORD_T: |
147 | | - case PREF_TEXT_T: |
148 | | - case PREF_USER_T: |
149 | | - default: |
150 | | - if (isset($p['validate'])) |
151 | | - $value = $p['validate']($value); |
152 | | - if (isset($p['save'])) |
153 | | - $p['save']($name, $value); |
154 | | - else |
155 | | - $wgUser->setOption($name, $value); |
156 | | - break; |
157 | | - } |
158 | | - } |
159 | | - |
160 | | - // call parent's function which saves the normal prefs and writes to the db |
161 | | - parent::savePreferences(); |
| 87 | + // unlike parent, we don't load in posted form values in constructor |
| 88 | + // until savePreferences when we need it |
| 89 | + // we also don't need resetPrefs, instead loading the newest values when displaying the form |
| 90 | + // finally parent's execute function doesn't need overriding |
| 91 | + // this leaves only two functions to override |
| 92 | + // one for displaying the form and one for saving the values |
162 | 93 | |
| 94 | + function savePreferences() { |
| 95 | + // handle extension prefs first |
| 96 | + global $wgUser, $wgRequest; |
| 97 | + global $wgExtensionPreferences; |
| 98 | + wfProfileIn( __METHOD__ ); |
| 99 | + |
| 100 | + foreach ( $wgExtensionPreferences as $p ) { |
| 101 | + $name = isset( $p['name'] ) ? $p['name'] : ''; |
| 102 | + if ( !$name ) { |
| 103 | + continue; |
| 104 | + } |
| 105 | + |
| 106 | + $value = $wgRequest->getVal( $name ); |
| 107 | + $type = isset( $p['type'] ) ? $p['type'] : PREF_USER_T; |
| 108 | + |
| 109 | + if ( !empty( $p['int-type'] ) ) { |
| 110 | + $type = $p['int-type']; |
| 111 | + } |
| 112 | + |
| 113 | + switch ( $type ) { |
| 114 | + case PREF_TOGGLE_T: |
| 115 | + if ( isset( $p['save'] ) ) { |
| 116 | + $p['save']( $name, $value ); |
| 117 | + } else { |
| 118 | + $wgUser->setOption( $name, $wgRequest->getCheck( "wpOp{$name}" ) ); |
| 119 | + } |
| 120 | + break; |
| 121 | + |
| 122 | + case PREF_INT_T: |
| 123 | + $min = isset( $p['min'] ) ? $p['min'] : 0; |
| 124 | + $max = isset( $p['max'] ) ? $p['max'] : 0x7fffffff; |
| 125 | + if ( isset( $p['save'] ) ) { |
| 126 | + $p['save']( $name, $value ); |
| 127 | + } else { |
| 128 | + $wgUser->setOption( $name, $this->validateIntOrNull( $value, $min, $max ) ); |
| 129 | + } |
| 130 | + break; |
| 131 | + |
| 132 | + case PREF_DROPDOWN_T: |
| 133 | + if ( isset( $p['save'] ) ) { |
| 134 | + $p['save']( $name, $value ); |
| 135 | + } else { |
| 136 | + $wgUser->setOption( $name, $value ); |
| 137 | + } |
| 138 | + break; |
| 139 | + |
| 140 | + case PREF_PASSWORD_T: |
| 141 | + case PREF_TEXT_T: |
| 142 | + case PREF_USER_T: |
| 143 | + default: |
| 144 | + if ( isset( $p['validate'] ) ) { |
| 145 | + $value = $p['validate']( $value ); |
| 146 | + } |
| 147 | + if ( isset( $p['save'] ) ) { |
| 148 | + $p['save']( $name, $value ); |
| 149 | + } else { |
| 150 | + $wgUser->setOption( $name, $value ); |
| 151 | + } |
| 152 | + break; |
| 153 | + } |
| 154 | + } |
| 155 | + |
| 156 | + // call parent's function which saves the normal prefs and writes to the db |
| 157 | + parent::savePreferences(); |
| 158 | + |
163 | 159 | wfProfileOut(__METHOD__); |
164 | | - } |
| 160 | + } |
165 | 161 | |
166 | | - function mainPrefsForm( $status , $message = '' ) |
167 | | - { |
168 | | - global $wgOut, $wgRequest, $wgUser; |
169 | | - global $wgExtensionPreferences; |
170 | | - wfProfileIn(__METHOD__); |
171 | | - |
172 | | - // first get original form, then hack into it new options |
173 | | - parent::mainPrefsForm($status, $message); |
174 | | - $html = $wgOut->getHTML(); |
175 | | - $wgOut->clearHTML(); |
176 | | - $sections = array(); |
177 | | - foreach ($wgExtensionPreferences as $p) |
178 | | - { |
179 | | - if (! isset($p['section']) || ! $p['section']) |
180 | | - continue; |
181 | | - $section = $p['section']; |
182 | | - |
183 | | - $name = isset($p['name']) ? $p['name'] : ""; |
184 | | - |
185 | | - $value = ""; |
186 | | - if ($name) |
187 | | - { |
188 | | - if (isset($p['load'])) |
189 | | - $value = $p['load']($name); |
190 | | - else |
191 | | - $value = $wgUser->getOption($name); |
192 | | - } |
193 | | - if ($value === '' && isset($p['default'])) |
194 | | - $value = $p['default']; |
195 | | - |
196 | | - $sectext = htmlspecialchars(wfMsg($section)); |
197 | | - $regex = "/(<fieldset>\s*<legend>\s*" . preg_quote($sectext) . |
198 | | - "\s*<\/legend>.*?)(<\/fieldset>)/s"; |
199 | | - |
200 | | - // check if $section exists in prefs yet |
201 | | - // cache the existence of sections |
202 | | - if (!isset($sections[$section])) |
203 | | - { |
204 | | - $sections[$section] = true; |
205 | | - |
206 | | - if (! preg_match($regex, $html, $m)) |
207 | | - { |
208 | | - // doesn't exist so add an empty section to end |
209 | | - $addhtml = "<fieldset><legend>$sectext</legend></fieldset>\n"; |
210 | | - $html = preg_replace("/(<(div|table) id='prefsubmit'.*)/s", "$addhtml $1", $html); |
211 | | - } |
| 162 | + function mainPrefsForm( $status, $message = '' ) { |
| 163 | + global $wgOut, $wgRequest, $wgUser; |
| 164 | + global $wgExtensionPreferences; |
| 165 | + wfProfileIn( __METHOD__ ); |
212 | 166 | |
213 | | - } |
| 167 | + // first get original form, then hack into it new options |
| 168 | + parent::mainPrefsForm( $status, $message ); |
| 169 | + $html = $wgOut->getHTML(); |
| 170 | + $wgOut->clearHTML(); |
| 171 | + $sections = array(); |
| 172 | + foreach ( $wgExtensionPreferences as $p ) { |
| 173 | + if ( !isset( $p['section'] ) || !$p['section'] ) { |
| 174 | + continue; |
| 175 | + } |
| 176 | + $section = $p['section']; |
214 | 177 | |
215 | | - $type = isset($p['type']) ? $p['type'] : PREF_USER_T; |
216 | | - |
217 | | - if ( !empty($p['int-type']) ) { |
218 | | - $type = $p['int-type']; |
219 | | - } |
220 | | - $pos = isset($p['pos']) ? $p['pos'] : ''; |
221 | | - switch ($type) |
222 | | - { |
223 | | - case PREF_CUSTOM_HTML_T: |
224 | | - $addhtml = $p['html']; |
225 | | - break; |
226 | | - |
227 | | - case PREF_TOGGLE_T: |
228 | | - $addhtml = $this->getToggle($name); |
229 | | - break; |
| 178 | + $name = isset( $p['name'] ) ? $p['name'] : ''; |
230 | 179 | |
231 | | - case PREF_INT_T: |
232 | | - case PREF_TEXT_T: |
233 | | - case PREF_PASSWORD_T: |
234 | | - $size = isset($p['size']) && $p['size'] ? "size=\"{$p['size']}\"" : ""; |
235 | | - $caption = isset($p['caption']) && $p['caption'] ? $p['caption'] : wfMsg($name); |
236 | | - if ($type == PREF_PASSWORD_T) |
237 | | - $type = "password"; |
238 | | - else |
239 | | - $type = "text"; |
240 | | - |
241 | | - if ($pos == 'first' || $pos == '') |
242 | | - $addhtml = "\n<table>\n"; |
243 | | - else |
244 | | - $addhtml = ''; |
245 | | - $addhtml .= $this->addRow("<label for=\"{$name}\">$caption</label>", |
246 | | - "<input type=\"$type\" id=\"{$name}\" name=\"{$name}\" value=\"{$value}\" $size />")."\n"; |
247 | | - if ($pos == 'last' || $pos == '') |
248 | | - $addhtml .="</table>\n"; |
249 | | - break; |
250 | | - |
251 | | - case PREF_DROPDOWN_T: |
252 | | - $caption = isset($p['caption']) && $p['caption'] ? $p['caption'] : wfMsg($name); |
253 | | - $onchange = isset($p['onchange']) && $p['onchange'] ? (" onchange='" . $p['onchange'] . "'") : ''; |
254 | | - $row = "\n <select id=\"{$name}\"$onchange name=\"{$name}\">\n"; |
255 | | - $options = is_array($p['options']) ? $p['options'] : array(); |
256 | | - foreach($options as $option) |
257 | | - { |
258 | | - $row .= " <option>$option</option>\n"; |
259 | | - } |
260 | | - $row .= " </select>"; |
261 | | - |
262 | | - if ($pos == 'first' || $pos == '') |
263 | | - $addhtml = "\n<table>\n"; |
264 | | - else |
265 | | - $addhtml = ''; |
266 | | - $addhtml .= $this->addRow("<label for=\"{$name}\">$caption</label>", $row)."\n"; |
267 | | - if ($pos == 'last' || $pos == '') |
268 | | - $addhtml .="</table>\n"; |
269 | | - break; |
270 | | - |
271 | | - case PREF_USER_T: |
272 | | - default: |
273 | | - $addhtml = preg_replace("/@VALUE@/", $value, isset($p['html']) ? $p['html'] : ""); |
274 | | - break; |
275 | | - } |
276 | | - |
277 | | - // the section exists |
278 | | - $html = preg_replace($regex, "$1 $addhtml $2", $html); |
279 | | - } |
| 180 | + $value = ''; |
| 181 | + if ( $name ) { |
| 182 | + if ( isset( $p['load'] ) ) { |
| 183 | + $value = $p['load']( $name ); |
| 184 | + } else { |
| 185 | + $value = $wgUser->getOption( $name ); |
| 186 | + } |
| 187 | + } |
| 188 | + if ( $value === '' && isset( $p['default'] ) ) { |
| 189 | + $value = $p['default']; |
| 190 | + } |
280 | 191 | |
281 | | - $wgOut->addHTML($html); |
| 192 | + $sectext = htmlspecialchars( wfMsg( $section ) ); |
| 193 | + $regex = "/(<fieldset>\s*<legend>\s*" . preg_quote( $sectext ) . |
| 194 | + "\s*<\/legend>.*?)(<\/fieldset>)/s"; |
282 | 195 | |
283 | | - // debugging |
284 | | - //$wgOut->addHTML($wgUser->encodeOptions()); |
| 196 | + // check if $section exists in prefs yet |
| 197 | + // cache the existence of sections |
| 198 | + if ( !isset( $sections[$section] ) ) { |
| 199 | + $sections[$section] = true; |
| 200 | + |
| 201 | + if ( !preg_match( $regex, $html, $m ) ) { |
| 202 | + // doesn't exist so add an empty section to end |
| 203 | + $addhtml = "<fieldset><legend>$sectext</legend></fieldset>\n"; |
| 204 | + $html = preg_replace( "/(<(div|table) id='prefsubmit'.*)/s", "$addhtml $1", $html ); |
| 205 | + } |
| 206 | + |
| 207 | + } |
| 208 | + |
| 209 | + $type = isset( $p['type'] ) ? $p['type'] : PREF_USER_T; |
| 210 | + |
| 211 | + if ( !empty( $p['int-type'] ) ) { |
| 212 | + $type = $p['int-type']; |
| 213 | + } |
| 214 | + $pos = isset( $p['pos'] ) ? $p['pos'] : ''; |
| 215 | + switch ( $type ) { |
| 216 | + case PREF_CUSTOM_HTML_T: |
| 217 | + $addhtml = $p['html']; |
| 218 | + break; |
| 219 | + |
| 220 | + case PREF_TOGGLE_T: |
| 221 | + $addhtml = $this->getToggle($name); |
| 222 | + break; |
| 223 | + |
| 224 | + case PREF_INT_T: |
| 225 | + case PREF_TEXT_T: |
| 226 | + case PREF_PASSWORD_T: |
| 227 | + $size = isset( $p['size'] ) && $p['size'] ? "size=\"{$p['size']}\"" : ''; |
| 228 | + $caption = isset( $p['caption'] ) && $p['caption'] ? $p['caption'] : wfMsg( $name ); |
| 229 | + if ( $type == PREF_PASSWORD_T ) { |
| 230 | + $type = 'password'; |
| 231 | + } else { |
| 232 | + $type = 'text'; |
| 233 | + } |
| 234 | + |
| 235 | + if ( $pos == 'first' || $pos == '' ) { |
| 236 | + $addhtml = "\n<table>\n"; |
| 237 | + } else { |
| 238 | + $addhtml = ''; |
| 239 | + } |
| 240 | + $addhtml .= $this->addRow( |
| 241 | + "<label for=\"{$name}\">$caption</label>", |
| 242 | + "<input type=\"$type\" id=\"{$name}\" name=\"{$name}\" value=\"{$value}\" $size />" |
| 243 | + ) . "\n"; |
| 244 | + if ( $pos == 'last' || $pos == '' ) { |
| 245 | + $addhtml .= "</table>\n"; |
| 246 | + } |
| 247 | + break; |
| 248 | + |
| 249 | + case PREF_DROPDOWN_T: |
| 250 | + $caption = isset( $p['caption'] ) && $p['caption'] ? $p['caption'] : wfMsg( $name ); |
| 251 | + $onchange = isset( $p['onchange'] ) && $p['onchange'] ? ( " onchange='" . $p['onchange'] . "'" ) : ''; |
| 252 | + $row = "\n <select id=\"{$name}\"$onchange name=\"{$name}\">\n"; |
| 253 | + $options = is_array( $p['options'] ) ? $p['options'] : array(); |
| 254 | + foreach( $options as $option ) { |
| 255 | + $row .= " <option>$option</option>\n"; |
| 256 | + } |
| 257 | + $row .= " </select>"; |
| 258 | + |
| 259 | + if ( $pos == 'first' || $pos == '' ) { |
| 260 | + $addhtml = "\n<table>\n"; |
| 261 | + } else { |
| 262 | + $addhtml = ''; |
| 263 | + } |
| 264 | + $addhtml .= $this->addRow( "<label for=\"{$name}\">$caption</label>", $row ) . "\n"; |
| 265 | + if ( $pos == 'last' || $pos == '' ) { |
| 266 | + $addhtml .= "</table>\n"; |
| 267 | + } |
| 268 | + break; |
| 269 | + |
| 270 | + case PREF_USER_T: |
| 271 | + default: |
| 272 | + $addhtml = preg_replace( "/@VALUE@/", $value, isset( $p['html'] ) ? $p['html'] : '' ); |
| 273 | + break; |
| 274 | + } |
| 275 | + |
| 276 | + // the section exists |
| 277 | + $html = preg_replace( $regex, "$1 $addhtml $2", $html ); |
| 278 | + } |
| 279 | + |
| 280 | + $wgOut->addHTML( $html ); |
| 281 | + |
| 282 | + // debugging |
| 283 | + //$wgOut->addHTML( $wgUser->encodeOptions() ); |
285 | 284 | wfProfileOut(__METHOD__); |
286 | | - } |
287 | | - } |
| 285 | + } |
| 286 | + } |
288 | 287 | |
289 | | - global $wgRequest; |
290 | | - $prefs = new SpecialPreferencesExtension($wgRequest); |
291 | | - $prefs->execute(); |
292 | | - |
293 | | - wfProfileOut(__METHOD__); |
| 288 | + global $wgRequest; |
| 289 | + $prefs = new SpecialPreferencesExtension( $wgRequest ); |
| 290 | + $prefs->execute(); |
| 291 | + |
| 292 | + wfProfileOut( __METHOD__ ); |
294 | 293 | } |