Index: trunk/extensions/SpecialFileList/SpecialFilelist.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | $dir = dirname(__FILE__) . '/'; |
24 | 24 | $wgExtensionMessagesFiles['Filelist'] = $dir . 'SpecialFilelist.i18n.php'; |
25 | 25 | |
26 | | -$wgSpecialPages[] = 'SpecialFilelist'; |
| 26 | +$wgSpecialPages['Filelist'] = 'SpecialFilelist'; |
27 | 27 | |
28 | 28 | class SpecialFilelist extends SpecialPage { |
29 | 29 | |
Index: trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php |
— | — | @@ -78,12 +78,19 @@ |
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | | -$wgSpecialPages['CustomToolbarUpload'] = array( 'UnlistedSpecialPage', 'CustomToolbarUpload' ); |
| 82 | +$wgSpecialPages['CustomToolbarUpload'] = 'SpecialCustomToolbarUpload'; |
83 | 83 | |
84 | | -function wfSpecialCustomToolbarUpload() { |
85 | | - global $wgRequest; |
86 | | - $form = new CustomToolbarUploadForm($wgRequest); |
87 | | - $form->execute(); |
| 84 | +class SpecialCustomToolbarUpload extends SpecialPage { |
| 85 | + |
| 86 | + public function __construct(){ |
| 87 | + parent::__construct( 'CustomToolbarUpload' ); |
| 88 | + } |
| 89 | + |
| 90 | + function execute() { |
| 91 | + global $wgRequest; |
| 92 | + $form = new CustomToolbarUploadForm($wgRequest); |
| 93 | + $form->execute(); |
| 94 | + } |
88 | 95 | } |
89 | 96 | $wgHooks['UploadComplete'][] = array('CustomToolbarUploadForm::showSuccess'); |
90 | 97 | //XX TODO investigate FileUpload hook for attachment purposes |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php |
— | — | @@ -196,50 +196,50 @@ |
197 | 197 | ///// Register specials, do that early on in case some other extension calls "addPage" ///// |
198 | 198 | $wgAutoloadClasses['SMWQueryPage'] = $smwgIP . 'specials/QueryPages/SMW_QueryPage.php'; |
199 | 199 | // $wgAutoloadClasses['SMWAskPage'] = $smwgIP . 'specials/AskSpecial/SMW_SpecialAsk.php'; |
200 | | -// $wgSpecialPages['Ask'] = array( 'SMWAskPage' ); |
| 200 | +// $wgSpecialPages['Ask'] = 'SMWAskPage'; |
201 | 201 | // $wgSpecialPageGroups['Ask'] = 'smw_group'; |
202 | 202 | |
203 | 203 | $wgAutoloadClasses['SMWSpecialBrowse'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialBrowse.php'; |
204 | | - $wgSpecialPages['Browse'] = array( 'SMWSpecialBrowse' ); |
| 204 | + $wgSpecialPages['Browse'] = 'SMWSpecialBrowse'; |
205 | 205 | $wgSpecialPageGroups['Browse'] = 'smw_group'; |
206 | 206 | |
207 | 207 | $wgAutoloadClasses['SMWPageProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialPageProperty.php'; |
208 | | - $wgSpecialPages['PageProperty'] = array( 'SMWPageProperty' ); |
| 208 | + $wgSpecialPages['PageProperty'] = 'SMWPageProperty'; |
209 | 209 | $wgSpecialPageGroups['PageProperty'] = 'smw_group'; |
210 | 210 | |
211 | 211 | $wgAutoloadClasses['SMWSearchByProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialSearchByProperty.php'; |
212 | | - $wgSpecialPages['SearchByProperty'] = array( 'SMWSearchByProperty' ); |
| 212 | + $wgSpecialPages['SearchByProperty'] = 'SMWSearchByProperty'; |
213 | 213 | $wgSpecialPageGroups['SearchByProperty'] = 'smw_group'; |
214 | 214 | |
215 | 215 | // $wgAutoloadClasses['SMWURIResolver'] = $smwgIP . 'specials/URIResolver/SMW_SpecialURIResolver.php'; |
216 | | -// $wgSpecialPages['URIResolver'] = array( 'SMWURIResolver' ); |
| 216 | +// $wgSpecialPages['URIResolver'] = 'SMWURIResolver'; |
217 | 217 | |
218 | 218 | $wgAutoloadClasses['SMWAdmin'] = $smwgIP . 'specials/SMWAdmin/SMW_SpecialSMWAdmin.php'; |
219 | | - $wgSpecialPages['SMWAdmin'] = array( 'SMWAdmin' ); |
| 219 | + $wgSpecialPages['SMWAdmin'] = 'SMWAdmin'; |
220 | 220 | $wgSpecialPageGroups['SMWAdmin'] = 'smw_group'; |
221 | 221 | |
222 | 222 | // $wgAutoloadClasses['SMWSpecialSemanticStatistics'] = $smwgIP . 'specials/Statistics/SMW_SpecialStatistics.php'; |
223 | | -// $wgSpecialPages['SemanticStatistics'] = array( 'SMWSpecialSemanticStatistics' ); |
| 223 | +// $wgSpecialPages['SemanticStatistics'] = 'SMWSpecialSemanticStatistics'; |
224 | 224 | // $wgSpecialPageGroups['SemanticStatistics'] = 'wiki'; // Similar to Special:Statistics |
225 | 225 | // |
226 | 226 | // $wgAutoloadClasses['SMWSpecialOWLExport'] = $smwgIP . 'specials/Export/SMW_SpecialOWLExport.php'; |
227 | | -// $wgSpecialPages['ExportRDF'] = array( 'SMWSpecialOWLExport' ); |
| 227 | +// $wgSpecialPages['ExportRDF'] = 'SMWSpecialOWLExport'; |
228 | 228 | // $wgSpecialPageGroups['ExportRDF'] = 'smw_group'; |
229 | 229 | // |
230 | 230 | // $wgAutoloadClasses['SMWSpecialProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialProperties.php'; |
231 | | -// $wgSpecialPages['Properties'] = array( 'SMWSpecialProperties' ); |
| 231 | +// $wgSpecialPages['Properties'] = 'SMWSpecialProperties'; |
232 | 232 | // $wgSpecialPageGroups['Properties'] = 'pages'; |
233 | 233 | // |
234 | 234 | // $wgAutoloadClasses['SMWSpecialTypes'] = $smwgIP . 'specials/QueryPages/SMW_SpecialTypes.php'; |
235 | | -// $wgSpecialPages['Types'] = array( 'SMWSpecialTypes' ); |
| 235 | +// $wgSpecialPages['Types'] = 'SMWSpecialTypes'; |
236 | 236 | // $wgSpecialPageGroups['Types'] = 'pages'; |
237 | 237 | // |
238 | 238 | // $wgAutoloadClasses['SMWSpecialUnusedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialUnusedProperties.php'; |
239 | | -// $wgSpecialPages['UnusedProperties'] = array( 'SMWSpecialUnusedProperties' ); |
| 239 | +// $wgSpecialPages['UnusedProperties'] = 'SMWSpecialUnusedProperties'; |
240 | 240 | // $wgSpecialPageGroups['UnusedProperties'] = 'maintenance'; |
241 | 241 | // |
242 | 242 | // $wgAutoloadClasses['SMWSpecialWantedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialWantedProperties.php'; |
243 | | -// $wgSpecialPages['WantedProperties'] = array( 'SMWSpecialWantedProperties' ); |
| 243 | +// $wgSpecialPages['WantedProperties'] = 'SMWSpecialWantedProperties'; |
244 | 244 | // $wgSpecialPageGroups['WantedProperties'] = 'maintenance'; |
245 | 245 | |
246 | 246 | // Register Jobs |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -227,50 +227,50 @@ |
228 | 228 | ///// Register specials, do that early on in case some other extension calls "addPage" ///// |
229 | 229 | $wgAutoloadClasses['SMWQueryPage'] = $smwgIP . 'specials/QueryPages/SMW_QueryPage.php'; |
230 | 230 | $wgAutoloadClasses['SMWAskPage'] = $smwgIP . 'specials/AskSpecial/SMW_SpecialAsk.php'; |
231 | | - $wgSpecialPages['Ask'] = array( 'SMWAskPage' ); |
| 231 | + $wgSpecialPages['Ask'] = 'SMWAskPage'; |
232 | 232 | $wgSpecialPageGroups['Ask'] = 'smw_group'; |
233 | 233 | |
234 | 234 | $wgAutoloadClasses['SMWSpecialBrowse'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialBrowse.php'; |
235 | | - $wgSpecialPages['Browse'] = array( 'SMWSpecialBrowse' ); |
| 235 | + $wgSpecialPages['Browse'] = 'SMWSpecialBrowse'; |
236 | 236 | $wgSpecialPageGroups['Browse'] = 'smw_group'; |
237 | 237 | |
238 | 238 | $wgAutoloadClasses['SMWPageProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialPageProperty.php'; |
239 | | - $wgSpecialPages['PageProperty'] = array( 'SMWPageProperty' ); |
| 239 | + $wgSpecialPages['PageProperty'] = 'SMWPageProperty'; |
240 | 240 | $wgSpecialPageGroups['PageProperty'] = 'smw_group'; |
241 | 241 | |
242 | 242 | $wgAutoloadClasses['SMWSearchByProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialSearchByProperty.php'; |
243 | | - $wgSpecialPages['SearchByProperty'] = array( 'SMWSearchByProperty' ); |
| 243 | + $wgSpecialPages['SearchByProperty'] = 'SMWSearchByProperty'; |
244 | 244 | $wgSpecialPageGroups['SearchByProperty'] = 'smw_group'; |
245 | 245 | |
246 | 246 | $wgAutoloadClasses['SMWURIResolver'] = $smwgIP . 'specials/URIResolver/SMW_SpecialURIResolver.php'; |
247 | | - $wgSpecialPages['URIResolver'] = array( 'SMWURIResolver' ); |
| 247 | + $wgSpecialPages['URIResolver'] = 'SMWURIResolver'; |
248 | 248 | |
249 | 249 | $wgAutoloadClasses['SMWAdmin'] = $smwgIP . 'specials/SMWAdmin/SMW_SpecialSMWAdmin.php'; |
250 | | - $wgSpecialPages['SMWAdmin'] = array( 'SMWAdmin' ); |
| 250 | + $wgSpecialPages['SMWAdmin'] = 'SMWAdmin'; |
251 | 251 | $wgSpecialPageGroups['SMWAdmin'] = 'smw_group'; |
252 | 252 | |
253 | 253 | $wgAutoloadClasses['SMWSpecialSemanticStatistics'] = $smwgIP . 'specials/Statistics/SMW_SpecialStatistics.php'; |
254 | | - $wgSpecialPages['SemanticStatistics'] = array( 'SMWSpecialSemanticStatistics' ); |
| 254 | + $wgSpecialPages['SemanticStatistics'] = 'SMWSpecialSemanticStatistics'; |
255 | 255 | $wgSpecialPageGroups['SemanticStatistics'] = 'wiki'; // Similar to Special:Statistics |
256 | 256 | |
257 | 257 | $wgAutoloadClasses['SMWSpecialOWLExport'] = $smwgIP . 'specials/Export/SMW_SpecialOWLExport.php'; |
258 | | - $wgSpecialPages['ExportRDF'] = array( 'SMWSpecialOWLExport' ); |
| 258 | + $wgSpecialPages['ExportRDF'] = 'SMWSpecialOWLExport'; |
259 | 259 | $wgSpecialPageGroups['ExportRDF'] = 'smw_group'; |
260 | 260 | |
261 | 261 | $wgAutoloadClasses['SMWSpecialProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialProperties.php'; |
262 | | - $wgSpecialPages['Properties'] = array( 'SMWSpecialProperties' ); |
| 262 | + $wgSpecialPages['Properties'] = 'SMWSpecialProperties'; |
263 | 263 | $wgSpecialPageGroups['Properties'] = 'pages'; |
264 | 264 | |
265 | 265 | $wgAutoloadClasses['SMWSpecialTypes'] = $smwgIP . 'specials/QueryPages/SMW_SpecialTypes.php'; |
266 | | - $wgSpecialPages['Types'] = array( 'SMWSpecialTypes' ); |
| 266 | + $wgSpecialPages['Types'] = 'SMWSpecialTypes'; |
267 | 267 | $wgSpecialPageGroups['Types'] = 'pages'; |
268 | 268 | |
269 | 269 | $wgAutoloadClasses['SMWSpecialUnusedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialUnusedProperties.php'; |
270 | | - $wgSpecialPages['UnusedProperties'] = array( 'SMWSpecialUnusedProperties' ); |
| 270 | + $wgSpecialPages['UnusedProperties'] = 'SMWSpecialUnusedProperties'; |
271 | 271 | $wgSpecialPageGroups['UnusedProperties'] = 'maintenance'; |
272 | 272 | |
273 | 273 | $wgAutoloadClasses['SMWSpecialWantedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialWantedProperties.php'; |
274 | | - $wgSpecialPages['WantedProperties'] = array( 'SMWSpecialWantedProperties' ); |
| 274 | + $wgSpecialPages['WantedProperties'] = 'SMWSpecialWantedProperties'; |
275 | 275 | $wgSpecialPageGroups['WantedProperties'] = 'maintenance'; |
276 | 276 | |
277 | 277 | // Register Jobs |
Index: trunk/extensions/WikiSync/WikiSync.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $dir = dirname(__FILE__); |
51 | 51 | $wgExtensionMessagesFiles['WikiSync'] = $dir . '/WikiSync.i18n.php'; |
52 | 52 | $wgExtensionAliasesFiles['WikiSync'] = $dir . '/WikiSync.alias.php'; |
53 | | -$wgSpecialPages['WikiSync'] = array( 'WikiSyncPage' ); |
| 53 | +$wgSpecialPages['WikiSync'] = 'WikiSyncPage'; |
54 | 54 | $wgSpecialPageGroups['WikiSync'] = 'pagetools'; |
55 | 55 | |
56 | 56 | if ( !isset( $wgAutoloadClasses['FormatJson'] ) ) { |
Index: trunk/extensions/ConfirmEdit/ConfirmEdit.php |
— | — | @@ -179,7 +179,7 @@ |
180 | 180 | $wgCaptchaRegexes = array(); |
181 | 181 | |
182 | 182 | /** Register special page */ |
183 | | -$wgSpecialPages['Captcha'] = array( /*class*/'CaptchaSpecialPage', /*name*/'Captcha' ); |
| 183 | +$wgSpecialPages['Captcha'] = 'CaptchaSpecialPage'; |
184 | 184 | |
185 | 185 | $wgConfirmEditIP = dirname( __FILE__ ); |
186 | 186 | $wgExtensionMessagesFiles['ConfirmEdit'] = "$wgConfirmEditIP/ConfirmEdit.i18n.php"; |
Index: trunk/extensions/ConfirmEdit/ConfirmEdit_body.php |
— | — | @@ -53,6 +53,9 @@ |
54 | 54 | } |
55 | 55 | |
56 | 56 | class CaptchaSpecialPage extends UnlistedSpecialPage { |
| 57 | + public function __construct(){ |
| 58 | + parent::__construct( 'Captcha' ); |
| 59 | + } |
57 | 60 | function execute( $par ) { |
58 | 61 | $this->setHeaders(); |
59 | 62 | $instance = ConfirmEditHooks::getInstance(); |
Index: trunk/extensions/Special404/Special404.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | $wgExtensionMessagesFiles['Special404'] = $dir . '/Special404.i18n.php'; |
29 | 29 | $wgExtensionAliasesFiles['Special404'] = $dir . '/Special404.alias.php'; |
30 | 30 | |
31 | | -$wgSpecialPages['Error404'] = array( 'Special404' ); |
| 31 | +$wgSpecialPages['Error404'] = 'Special404'; |
32 | 32 | $wgAutoloadClasses['Special404'] = $dir . '/Special404_body.php'; |
33 | 33 | |
34 | 34 | // Enable this to force an automatic 301 Moved Permanently redirect if a matching title exists |
Index: trunk/extensions/SemanticNotifyMe/includes/SNM_Initialize.php |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | } |
102 | 102 | } else { // otherwise register special pages |
103 | 103 | $wgAutoloadClasses['SMWNotifyMe'] = $smwgNMIP . '/specials/SMWNotifyMe/SMWNotifyMe.php'; |
104 | | - $wgSpecialPages['NotifyMe'] = array( 'SMWNotifyMe' ); |
| 104 | + $wgSpecialPages['NotifyMe'] = 'SMWNotifyMe'; |
105 | 105 | $wgSpecialPageGroups['NotifyMe'] = 'smw_group'; |
106 | 106 | } |
107 | 107 | |
Index: trunk/extensions/CategoryBrowser/CategoryBrowser.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | $dir = dirname(__FILE__); |
56 | 56 | $wgExtensionMessagesFiles['CategoryBrowser'] = $dir . '/CategoryBrowser.i18n.php'; |
57 | 57 | $wgExtensionAliasesFiles['CategoryBrowser'] = $dir . '/CategoryBrowser.alias.php'; |
58 | | -$wgSpecialPages['CategoryBrowser'] = array( 'CategoryBrowserPage' ); |
| 58 | +$wgSpecialPages['CategoryBrowser'] = 'CategoryBrowserPage'; |
59 | 59 | $wgSpecialPageGroups['CategoryBrowser'] = 'pages'; |
60 | 60 | |
61 | 61 | CB_Setup::init(); |
Index: trunk/extensions/Aggregator/Aggregator.php |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | require_once 'rss_fetch.inc'; |
39 | 39 | } |
40 | 40 | |
41 | | -$wgSpecialPages[] = array( 'Aggregator', /*perm*/false, /*listed*/ true, /*function*/ false, /*file*/ false ); |
| 41 | +$wgSpecialPages['Aggregator'] = 'SpecialAggregator'; |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Parser extension hook |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | } |
95 | 95 | |
96 | 96 | function _feedLink( $type, $mime ) { |
97 | | - $special = wfAggregatorFeedPage( $this->mName, $type ); |
| 97 | + $special = SpecialPage::getTitleFor( 'Aggregator', "$type/{$this->mName}" ); |
98 | 98 | $link = Xml::element( 'link', array( |
99 | 99 | 'rel' => 'alternate', |
100 | 100 | 'type' => $mime, |
— | — | @@ -102,41 +102,30 @@ |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | | -function wfAggregatorFeedPage( $name, $type ) { |
107 | | - return SpecialPage::getTitleFor( 'Aggregator', "$type/$name" ); |
108 | | -} |
109 | | - |
110 | | - |
111 | 106 | /** |
112 | 107 | * Special page management interface |
113 | 108 | */ |
114 | | -function wfSpecialAggregator( $par = null ) { |
115 | | - $bits = explode( '/', $par, 2 ); |
116 | | - if ( count( $bits ) < 2 ) { |
117 | | - // editor form not yet implemented |
118 | | - } else { |
119 | | - list( $type, $target ) = $bits; |
120 | | - return wfAggregatorFeed( $target, $type ); |
| 109 | +class SpecialAggregator extends SpecialPage { |
| 110 | + |
| 111 | + function __construct(){ |
| 112 | + parent::__construct( 'Aggregator' ); |
121 | 113 | } |
122 | | -} |
123 | 114 | |
124 | | -/** |
125 | | - * Spit out a re-exported feed |
126 | | - */ |
127 | | -function wfAggregatorFeed( $target, $type ) { |
128 | | - global $wgFeedClasses, $wgOut; |
129 | | - $wgOut->disable(); |
| 115 | + function execute( $par = null ) { |
| 116 | + $bits = explode( '/', $par, 2 ); |
| 117 | + if ( count( $bits ) < 2 ) { |
| 118 | + // editor form not yet implemented |
| 119 | + } else { |
| 120 | + list( $type, $target ) = $bits; |
| 121 | + global $wgFeedClasses, $wgOut; |
| 122 | + $wgOut->disable(); |
130 | 123 | |
131 | | - $aggro = new Aggregator( $target ); |
132 | | - $aggro->outputFeed( $type, 10 ); |
| 124 | + $aggro = new Aggregator( $target ); |
| 125 | + $aggro->outputFeed( $type, 10 ); |
| 126 | + } |
| 127 | + } |
133 | 128 | } |
134 | 129 | |
135 | | -function wfAggregatorFeedError( $message ) { |
136 | | - wfHttpError( 400, "Bad request", $message ); |
137 | | -} |
138 | | - |
139 | | - |
140 | | - |
141 | 130 | class Aggregator { |
142 | 131 | public function __construct( $target ) { |
143 | 132 | $this->mName = $target; |
— | — | @@ -177,10 +166,10 @@ |
178 | 167 | public function outputFeed( $type, $count ) { |
179 | 168 | global $wgFeedClasses; |
180 | 169 | if ( !isset( $wgFeedClasses[$type] ) ) { |
181 | | - return wfAggregatorFeedError( "Requested feed type \"$type\" not recognized." ); |
| 170 | + return wfHttpError( 400, "Bad request", "Requested feed type \"$type\" not recognized." ); |
182 | 171 | } |
183 | 172 | |
184 | | - $special = wfAggregatorFeedPage( $this->mName, $type ); |
| 173 | + $special = SpecialPage::getTitleFor( 'Aggregator', "$type/{$this->mName}" ); |
185 | 174 | $feed = new $wgFeedClasses[$type]( 'my cool feed', 'my feed rocks', |
186 | 175 | $special->getFullUrl() ); |
187 | 176 | |
Index: trunk/extensions/QPoll/qp_user.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | $wgAutoloadClasses['qp_QuestionData'] = self::$ExtDir . '/qp_pollstore.php'; |
164 | 164 | $wgAutoloadClasses['qp_QueryPage'] = self::$ExtDir . '/qp_results.php'; |
165 | 165 | // TODO: Use the new technique for i18n of special page aliases |
166 | | - $wgSpecialPages['PollResults'] = array('PollResults'); |
| 166 | + $wgSpecialPages['PollResults'] = 'PollResults'; |
167 | 167 | // TODO: Use the new technique for i18n of magic words |
168 | 168 | // instantiating fake instance for PHP < 5.2.3, which does not support 'Class::method' type of callbacks |
169 | 169 | $wgHooks['LanguageGetMagic'][] = |
Index: trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber.php |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | */ |
90 | 90 | $wgExtensionMessagesFiles['PlayerStatsGrabber'] = dirname( __FILE__ ) . '/PlayerStatsGrabber.i18n.php'; |
91 | 91 | $wgAutoloadClasses['SpecialPlayerStatsGrabber'] = dirname( __FILE__ ) . '/PlayerStatsGrabber_body.php'; |
92 | | -$wgSpecialPages['PlayerStatsGrabber'] = array( 'SpecialPlayerStatsGrabber' ); |
| 92 | +$wgSpecialPages['PlayerStatsGrabber'] = 'SpecialPlayerStatsGrabber'; |
93 | 93 | |
94 | 94 | $wgSpecialPageGroups['PlayerStatsGrabber'] = 'wiki'; // like Special:Statistics |
95 | 95 | |
Index: trunk/extensions/ArticleComments/ArticleComments.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | $wgArticleCommentsNSDisplayList = array(); |
118 | 118 | |
119 | 119 | # Sets up special page to handle comment submission |
120 | | -$wgSpecialPages[] = array( 'ProcessComment', '', true, 'specialProcessComment', false ); |
| 120 | +$wgSpecialPages['ProcessComment'] = 'SpecialProcessComment'; |
121 | 121 | |
122 | 122 | # Sets up the ArticleComments Parser hook for <comments /> |
123 | 123 | function wfArticleCommentsParserSetup( &$parser ) { |
— | — | @@ -358,161 +358,167 @@ |
359 | 359 | /** |
360 | 360 | * Special page for comment processing. |
361 | 361 | */ |
362 | | -function specialProcessComment() { |
363 | | - global $wgOut, $wgParser, $wgUser, $wgContLang, $wgRequest; |
| 362 | +class SpecialProcessComment extends SpecialPage { |
| 363 | + function __construct(){ |
| 364 | + parent::__construct( 'ProcessComment' ); |
| 365 | + } |
364 | 366 | |
365 | | - # Retrieve submitted values |
366 | | - $titleText = $wgRequest->getVal( 'commentArticle' ); |
367 | | - $commenterName = $wgRequest->getVal( 'commenterName' ); |
368 | | - $commenterURL = trim( $wgRequest->getVal( 'commenterURL' ) ); |
369 | | - $comment = $wgRequest->getVal( 'comment' ); |
| 367 | + function execute() { |
| 368 | + global $wgOut, $wgParser, $wgUser, $wgContLang, $wgRequest; |
370 | 369 | |
371 | | - // The default value is the same as not providing a URL |
372 | | - if ( $commenterURL == 'http://' ) { |
373 | | - $commenterURL = ''; |
374 | | - } |
| 370 | + # Retrieve submitted values |
| 371 | + $titleText = $wgRequest->getVal( 'commentArticle' ); |
| 372 | + $commenterName = $wgRequest->getVal( 'commenterName' ); |
| 373 | + $commenterURL = trim( $wgRequest->getVal( 'commenterURL' ) ); |
| 374 | + $comment = $wgRequest->getVal( 'comment' ); |
375 | 375 | |
376 | | - $title = Title::newFromText( $titleText ); |
| 376 | + // The default value is the same as not providing a URL |
| 377 | + if ( $commenterURL == 'http://' ) { |
| 378 | + $commenterURL = ''; |
| 379 | + } |
377 | 380 | |
378 | | - # Perform validation checks on supplied fields |
379 | | - $messages = array(); |
| 381 | + $title = Title::newFromText( $titleText ); |
380 | 382 | |
381 | | - if ( !$wgRequest->wasPosted() ) { |
382 | | - $messages[] = wfMsg( 'article-comments-not-posted' ); |
383 | | - } |
| 383 | + # Perform validation checks on supplied fields |
| 384 | + $messages = array(); |
384 | 385 | |
385 | | - if ( $titleText === '' || !$title ) { |
386 | | - $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-title-string' ), $titleText ); |
387 | | - } |
| 386 | + if ( !$wgRequest->wasPosted() ) { |
| 387 | + $messages[] = wfMsg( 'article-comments-not-posted' ); |
| 388 | + } |
388 | 389 | |
389 | | - if ( !$commenterName || strpos( $commenterName, "\n" ) !== false ) { |
390 | | - $messages[] = wfMsg( 'article-comments-required-field', wfMsgForContent( 'article-comments-name-string' ) ); |
391 | | - } |
| 390 | + if ( $titleText === '' || !$title ) { |
| 391 | + $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-title-string' ), $titleText ); |
| 392 | + } |
392 | 393 | |
393 | | - if ( ( $commenterURL != '' ) && !preg_match( "/^(" . wfUrlProtocols() . ')' . Parser::EXT_LINK_URL_CLASS . '+$/', $commenterURL ) ) { |
394 | | - $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-url-string' ), $commenterURL ); |
395 | | - } |
| 394 | + if ( !$commenterName || strpos( $commenterName, "\n" ) !== false ) { |
| 395 | + $messages[] = wfMsg( 'article-comments-required-field', wfMsgForContent( 'article-comments-name-string' ) ); |
| 396 | + } |
396 | 397 | |
397 | | - if ( !$comment ) { |
398 | | - $messages[] = wfMsg( 'article-comments-required-field', wfMsg( 'article-comments-comment-string' ) ); |
399 | | - } |
| 398 | + if ( ( $commenterURL != '' ) && !preg_match( "/^(" . wfUrlProtocols() . ')' . Parser::EXT_LINK_URL_CLASS . '+$/', $commenterURL ) ) { |
| 399 | + $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-url-string' ), $commenterURL ); |
| 400 | + } |
400 | 401 | |
401 | | - if ( !empty( $messages ) ) { |
402 | | - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) ); |
403 | | - $wikiText = "<div class='errorbox'>\n"; |
404 | | - $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', count( $messages ) ) . "\n\n"; |
405 | | - foreach ( $messages as $message ) { |
406 | | - $wikiText .= "* $message\n"; |
| 402 | + if ( !$comment ) { |
| 403 | + $messages[] = wfMsg( 'article-comments-required-field', wfMsg( 'article-comments-comment-string' ) ); |
407 | 404 | } |
408 | | - $wgOut->addWikiText( $wikiText . '</div>' ); |
409 | | - return; |
410 | | - } |
411 | 405 | |
412 | | - # Setup title and talkTitle object |
413 | | - $article = new Article( $title ); |
| 406 | + if ( !empty( $messages ) ) { |
| 407 | + $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) ); |
| 408 | + $wikiText = "<div class='errorbox'>\n"; |
| 409 | + $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', count( $messages ) ) . "\n\n"; |
| 410 | + foreach ( $messages as $message ) { |
| 411 | + $wikiText .= "* $message\n"; |
| 412 | + } |
| 413 | + $wgOut->addWikiText( $wikiText . '</div>' ); |
| 414 | + return; |
| 415 | + } |
414 | 416 | |
415 | | - $talkTitle = $title->getTalkPage(); |
416 | | - $talkArticle = new Article( $talkTitle ); |
| 417 | + # Setup title and talkTitle object |
| 418 | + $article = new Article( $title ); |
417 | 419 | |
418 | | - # Check whether user is blocked from editing the talk page |
419 | | - if ( $wgUser->isBlockedFrom( $talkTitle ) ) { |
420 | | - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) ); |
421 | | - $wikiText = "<div class='errorbox'>\n"; |
422 | | - # 1 error only but message is used above for n errors too |
423 | | - $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', 1 ) . "\n\n"; |
424 | | - $wikiText .= '* ' . wfMsg( 'article-comments-user-is-blocked', $talkTitle->getPrefixedText() ) . "\n"; |
425 | | - $wgOut->addWikiText( $wikiText . '</div>' ); |
426 | | - return; |
427 | | - } |
| 420 | + $talkTitle = $title->getTalkPage(); |
| 421 | + $talkArticle = new Article( $talkTitle ); |
428 | 422 | |
429 | | - # Retrieve article content |
430 | | - $articleContent = ''; |
431 | | - if ( $title->exists() ) { |
432 | | - $articleContent = $article->getContent(); |
433 | | - } |
| 423 | + # Check whether user is blocked from editing the talk page |
| 424 | + if ( $wgUser->isBlockedFrom( $talkTitle ) ) { |
| 425 | + $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) ); |
| 426 | + $wikiText = "<div class='errorbox'>\n"; |
| 427 | + # 1 error only but message is used above for n errors too |
| 428 | + $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', 1 ) . "\n\n"; |
| 429 | + $wikiText .= '* ' . wfMsg( 'article-comments-user-is-blocked', $talkTitle->getPrefixedText() ) . "\n"; |
| 430 | + $wgOut->addWikiText( $wikiText . '</div>' ); |
| 431 | + return; |
| 432 | + } |
434 | 433 | |
435 | | - # Retrieve existing talk content |
436 | | - $talkContent = ''; |
437 | | - if ( $talkTitle->exists() ) { |
438 | | - $talkContent = $talkArticle->getContent(); |
439 | | - } |
| 434 | + # Retrieve article content |
| 435 | + $articleContent = ''; |
| 436 | + if ( $title->exists() ) { |
| 437 | + $articleContent = $article->getContent(); |
| 438 | + } |
440 | 439 | |
441 | | - # Check if talk NS is in the namespace display list |
442 | | - # Note: if so, then there's no need to confirm that <comments /> appears in the article or talk page. |
443 | | - global $wgArticleCommentsNSDisplayList; |
444 | | - $skipCheck = ( |
445 | | - is_array( $wgArticleCommentsNSDisplayList ) ? |
446 | | - in_array( $talkTitle->getNamespace(), $wgArticleCommentsNSDisplayList ): |
447 | | - false |
448 | | - ); |
| 440 | + # Retrieve existing talk content |
| 441 | + $talkContent = ''; |
| 442 | + if ( $talkTitle->exists() ) { |
| 443 | + $talkContent = $talkArticle->getContent(); |
| 444 | + } |
449 | 445 | |
450 | | - # Check whether the article or its talk page contains a <comments /> flag |
451 | | - if ( !$skipCheck && |
452 | | - preg_match( '/<comments( +[^>]*)?\\/>/', $articleContent ) === 0 && |
453 | | - preg_match( '/<comments( +[^>]*)?\\/>/', $talkContent ) === 0 |
454 | | - ) { |
455 | | - $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) ); |
456 | | - $wgOut->addWikiText( |
457 | | - '<div class="errorbox">' . |
458 | | - wfMsg( 'article-comments-no-comments', $title->getPrefixedText() ) . |
459 | | - '</div>' |
| 446 | + # Check if talk NS is in the namespace display list |
| 447 | + # Note: if so, then there's no need to confirm that <comments /> appears in the article or talk page. |
| 448 | + global $wgArticleCommentsNSDisplayList; |
| 449 | + $skipCheck = ( |
| 450 | + is_array( $wgArticleCommentsNSDisplayList ) ? |
| 451 | + in_array( $talkTitle->getNamespace(), $wgArticleCommentsNSDisplayList ): |
| 452 | + false |
460 | 453 | ); |
461 | | - return; |
462 | | - } |
463 | 454 | |
464 | | - # Run spam checks |
465 | | - $isSpam = false; |
466 | | - wfRunHooks( 'ArticleCommentsSpamCheck', array( $comment, $commenterName, $commenterURL, &$isSpam ) ); |
| 455 | + # Check whether the article or its talk page contains a <comments /> flag |
| 456 | + if ( !$skipCheck && |
| 457 | + preg_match( '/<comments( +[^>]*)?\\/>/', $articleContent ) === 0 && |
| 458 | + preg_match( '/<comments( +[^>]*)?\\/>/', $talkContent ) === 0 |
| 459 | + ) { |
| 460 | + $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) ); |
| 461 | + $wgOut->addWikiText( |
| 462 | + '<div class="errorbox">' . |
| 463 | + wfMsg( 'article-comments-no-comments', $title->getPrefixedText() ) . |
| 464 | + '</div>' |
| 465 | + ); |
| 466 | + return; |
| 467 | + } |
467 | 468 | |
468 | | - # If it's spam - it's gone! |
469 | | - if ( $isSpam ) { |
470 | | - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) ); |
471 | | - $wgOut->addWikiText( |
472 | | - '<div class="errorbox">' . |
473 | | - wfMsg( 'article-comments-no-spam' ) . |
474 | | - '</div>' |
475 | | - ); |
476 | | - return; |
477 | | - } |
| 469 | + # Run spam checks |
| 470 | + $isSpam = false; |
| 471 | + wfRunHooks( 'ArticleCommentsSpamCheck', array( $comment, $commenterName, $commenterURL, &$isSpam ) ); |
478 | 472 | |
479 | | - # Initialize the talk page's content. |
480 | | - if ( $talkContent == '' ) { |
481 | | - $talkContent = wfMsgForContent( 'article-comments-talk-page-starter', $title->getPrefixedText() ); |
482 | | - } |
| 473 | + # If it's spam - it's gone! |
| 474 | + if ( $isSpam ) { |
| 475 | + $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) ); |
| 476 | + $wgOut->addWikiText( |
| 477 | + '<div class="errorbox">' . |
| 478 | + wfMsg( 'article-comments-no-spam' ) . |
| 479 | + '</div>' |
| 480 | + ); |
| 481 | + return; |
| 482 | + } |
483 | 483 | |
484 | | - # Search for insertion point, or append most recent comment. |
485 | | - $commentText = wfMsgForContent( 'article-comments-new-comment-heading', $commenterName, $commenterURL, '~~~~', $comment ); |
486 | | - $commentText .= '<comment date="' . htmlspecialchars( wfTimestamp( TS_ISO_8601 ) ) . '" name="' . htmlspecialchars( $commenterName ) . '"'; |
487 | | - if ( $commenterURL != '' ) { |
488 | | - $commentText .= ' url="' . htmlspecialchars( $commenterURL ) . '"'; |
489 | | - } |
490 | | - if ( $wgUser->isLoggedIn() ) { |
491 | | - $commentText .= ' signature="' . htmlspecialchars( $wgParser->getUserSig( $wgUser ) ) . '"'; |
492 | | - } |
493 | | - $commentText .= ">\n" . str_replace( '</comment', '</comment', $comment ) . "\n</comment>"; |
| 484 | + # Initialize the talk page's content. |
| 485 | + if ( $talkContent == '' ) { |
| 486 | + $talkContent = wfMsgForContent( 'article-comments-talk-page-starter', $title->getPrefixedText() ); |
| 487 | + } |
494 | 488 | |
495 | | - $posAbove = stripos( $talkContent, '<!--COMMENTS_ABOVE-->' ); |
496 | | - if ( $posAbove === false ) { |
497 | | - $posBelow = stripos( $talkContent, '<!--COMMENTS_BELOW-->' ); |
498 | | - } |
499 | | - if ( $posAbove !== false ) { |
500 | | - # Insert comments above HTML marker |
501 | | - $talkContent = substr( $talkContent, 0, $posAbove ) . $commentText . substr( $talkContent, $posAbove ); |
502 | | - } elseif ( $posBelow !== false ) { |
503 | | - # Insert comments below HTML marker |
504 | | - $talkContent = substr( $talkContent, 0, $posBelow + 21 ) . $commentText . substr( $talkContent, $posBelow + 21 ); |
505 | | - } else { |
506 | | - # No marker found, append to bottom (default) |
507 | | - $talkContent .= $commentText; |
508 | | - } |
| 489 | + # Search for insertion point, or append most recent comment. |
| 490 | + $commentText = wfMsgForContent( 'article-comments-new-comment-heading', $commenterName, $commenterURL, '~~~~', $comment ); |
| 491 | + $commentText .= '<comment date="' . htmlspecialchars( wfTimestamp( TS_ISO_8601 ) ) . '" name="' . htmlspecialchars( $commenterName ) . '"'; |
| 492 | + if ( $commenterURL != '' ) { |
| 493 | + $commentText .= ' url="' . htmlspecialchars( $commenterURL ) . '"'; |
| 494 | + } |
| 495 | + if ( $wgUser->isLoggedIn() ) { |
| 496 | + $commentText .= ' signature="' . htmlspecialchars( $wgParser->getUserSig( $wgUser ) ) . '"'; |
| 497 | + } |
| 498 | + $commentText .= ">\n" . str_replace( '</comment', '</comment', $comment ) . "\n</comment>"; |
509 | 499 | |
510 | | - # Update the talkArticle with the new comment |
511 | | - $summary = wfMsgForContent( 'article-comments-summary', $commenterName ); |
512 | | - $talkArticle->doEdit( $talkContent, $summary ); |
| 500 | + $posAbove = stripos( $talkContent, '<!--COMMENTS_ABOVE-->' ); |
| 501 | + if ( $posAbove === false ) { |
| 502 | + $posBelow = stripos( $talkContent, '<!--COMMENTS_BELOW-->' ); |
| 503 | + } |
| 504 | + if ( $posAbove !== false ) { |
| 505 | + # Insert comments above HTML marker |
| 506 | + $talkContent = substr( $talkContent, 0, $posAbove ) . $commentText . substr( $talkContent, $posAbove ); |
| 507 | + } elseif ( $posBelow !== false ) { |
| 508 | + # Insert comments below HTML marker |
| 509 | + $talkContent = substr( $talkContent, 0, $posBelow + 21 ) . $commentText . substr( $talkContent, $posBelow + 21 ); |
| 510 | + } else { |
| 511 | + # No marker found, append to bottom (default) |
| 512 | + $talkContent .= $commentText; |
| 513 | + } |
513 | 514 | |
514 | | - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-succeeded' ) ); |
515 | | - $wgOut->addWikiMsg( 'article-comments-submission-success', $title->getPrefixedText() ); |
516 | | - $wgOut->addWikiMsg( 'article-comments-submission-view-all', $talkTitle->getPrefixedText() ); |
| 515 | + # Update the talkArticle with the new comment |
| 516 | + $summary = wfMsgForContent( 'article-comments-summary', $commenterName ); |
| 517 | + $talkArticle->doEdit( $talkContent, $summary ); |
| 518 | + |
| 519 | + $wgOut->setPageTitle( wfMsg( 'article-comments-submission-succeeded' ) ); |
| 520 | + $wgOut->addWikiMsg( 'article-comments-submission-success', $title->getPrefixedText() ); |
| 521 | + $wgOut->addWikiMsg( 'article-comments-submission-view-all', $talkTitle->getPrefixedText() ); |
| 522 | + } |
517 | 523 | } |
518 | 524 | |
519 | 525 | /** |
Index: trunk/extensions/Rdf/Rdf.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | $wgHooks['TitleMoveComplete'][] = 'MwRdfOnTitleMoveComplete'; |
101 | 101 | $wgHooks['ArticleDeleteComplete'][] = 'MwRdfOnArticleDeleteComplete'; |
102 | 102 | |
103 | | -$wgSpecialPages[] = array( 'Rdf', '', true, 'wfSpecialRdf', 'extensions/MwRdf.php' ); |
| 103 | +$wgSpecialPages['Rdf'] = 'SpecialRdf'; |
104 | 104 | |
105 | 105 | function setupMwRdf() { |
106 | 106 | global $wgRequest, $wgOut; |
— | — | @@ -153,43 +153,49 @@ |
154 | 154 | return true; |
155 | 155 | } |
156 | 156 | |
157 | | -function wfSpecialRdf($par) { |
158 | | - global $wgRequest, $wgRdfDefaultModels, $wgRdfOutputFunctions; |
| 157 | +class SpecialRdf extends SpecialPage { |
| 158 | + public function __construct(){ |
| 159 | + parent::__construct( 'Rdf' ); |
| 160 | + } |
159 | 161 | |
160 | | - $target = $wgRequest->getVal('target'); |
| 162 | + function execute( $par ) { |
| 163 | + global $wgRequest, $wgRdfDefaultModels, $wgRdfOutputFunctions; |
161 | 164 | |
162 | | - if (!isset($target)) { # no target parameter |
163 | | - MwRdfShowForm(); |
164 | | - } else if (strlen($target) == 0) { # no target contents |
165 | | - MwRdfShowForm(wfMsg('badtitle')); |
166 | | - } else { |
167 | | - $nt = Title::newFromText($target); |
168 | | - if ($nt->getArticleID() == 0) { # not an article |
| 165 | + $target = $wgRequest->getVal('target'); |
| 166 | + |
| 167 | + if (!isset($target)) { # no target parameter |
| 168 | + MwRdfShowForm(); |
| 169 | + } else if (strlen($target) == 0) { # no target contents |
169 | 170 | MwRdfShowForm(wfMsg('badtitle')); |
170 | 171 | } else { |
171 | | - $article = new Article($nt); |
| 172 | + $nt = Title::newFromText($target); |
| 173 | + if ($nt->getArticleID() == 0) { # not an article |
| 174 | + MwRdfShowForm(wfMsg('badtitle')); |
| 175 | + } else { |
| 176 | + $article = new Article($nt); |
172 | 177 | |
173 | | - # Note: WebRequest chokes on arrays here |
174 | | - $modelnames = $_REQUEST['modelnames']; |
175 | | - if (is_null($modelnames)) { |
176 | | - $modelnames = $wgRdfDefaultModels; |
177 | | - } |
| 178 | + # Note: WebRequest chokes on arrays here |
| 179 | + $modelnames = $_REQUEST['modelnames']; |
| 180 | + if (is_null($modelnames)) { |
| 181 | + $modelnames = $wgRdfDefaultModels; |
| 182 | + } |
178 | 183 | |
179 | | - if (is_string($modelnames)) { |
180 | | - $modelnames = explode(',', $modelnames); |
181 | | - } |
| 184 | + if (is_string($modelnames)) { |
| 185 | + $modelnames = explode(',', $modelnames); |
| 186 | + } |
182 | 187 | |
183 | | - $format = $wgRequest->getVal('format', 'xml'); |
| 188 | + $format = $wgRequest->getVal('format', 'xml'); |
184 | 189 | |
185 | | - $outfun = $wgRdfOutputFunctions[$format]; |
| 190 | + $outfun = $wgRdfOutputFunctions[$format]; |
186 | 191 | |
187 | | - if (!isset($outfun)) { |
188 | | - wfDebugDieBacktrace("No output function for format '$format'."); |
189 | | - } |
| 192 | + if (!isset($outfun)) { |
| 193 | + wfDebugDieBacktrace("No output function for format '$format'."); |
| 194 | + } |
190 | 195 | |
191 | | - $fullModel = MwRdfGetModel($article, $modelnames); |
| 196 | + $fullModel = MwRdfGetModel($article, $modelnames); |
192 | 197 | |
193 | | - $outfun($fullModel); |
| 198 | + $outfun($fullModel); |
| 199 | + } |
194 | 200 | } |
195 | 201 | } |
196 | 202 | } |
Index: trunk/extensions/GoogleMaps/GoogleMaps.php |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | $wgParser->setHook( 'googlemapkml', array( $wgGoogleMaps, 'renderKmlLink' ) ); |
144 | 144 | |
145 | 145 | // Set up the special page |
146 | | - $wgSpecialPages['GoogleMapsKML'] = array('GoogleMapsKML', 'GoogleMapsKML'); |
| 146 | + $wgSpecialPages['GoogleMapsKML'] = 'GoogleMapsKML'; |
147 | 147 | } |
148 | 148 | |
149 | 149 | // add the install extension function |
Index: trunk/extensions/MogileClient/SpecialUploadMogile.php |
— | — | @@ -18,6 +18,8 @@ |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Entry point |
| 22 | + * FIXME: this isn't actually called from anywhere?!? The wfSpecialFoo() function method |
| 23 | + * is deprecated unofficially since forever, officially sinc e1.18 |
22 | 24 | */ |
23 | 25 | function wfSpecialUploadMogile() { |
24 | 26 | global $wgRequest; |
Index: trunk/extensions/GetFamily/GetFamily.php |
— | — | @@ -31,181 +31,191 @@ |
32 | 32 | $dir = dirname( __FILE__ ) . '/'; |
33 | 33 | $wgExtensionMessagesFiles['GetFamily'] = $dir . 'GetFamily.i18n.php'; |
34 | 34 | // FIXME: add $wgExtensionAliasesFiles |
35 | | -$wgSpecialPages['GetFamily'] = array( 'SpecialPage', 'GetFamily', 'getfamily' ); |
| 35 | +$wgSpecialPages['GetFamily'] = 'SpecialGetFamily'; |
36 | 36 | |
37 | 37 | // New user right |
38 | 38 | $wgAvailableRights[] = 'getfamily'; |
39 | 39 | $wgGroupPermissions['*']['getfamily'] = true; |
40 | 40 | |
41 | 41 | // FIXME: split off into GetFamily_body.php |
42 | | -function wfSpecialGetFamily() { |
43 | | - global $wgRequest, $wgLanguageNames; |
44 | | - global $wgScript, $wgDBname, $wgLanguageCode, $wgSitename, $wgServer, $wgArticlePath, $wgVersion; |
| 42 | +class SpecialGetFamily extends SpecialPage { |
| 43 | + public function __construct(){ |
| 44 | + parent::__construct( 'GetFamily' ); |
| 45 | + } |
45 | 46 | |
46 | | - $out = ''; |
| 47 | + function execute() { |
| 48 | + global $wgRequest, $wgLanguageNames, $wgUser, $wgOut; |
| 49 | + global $wgScript, $wgDBname, $wgLanguageCode, $wgSitename, $wgServer, $wgArticlePath, $wgVersion; |
47 | 50 | |
48 | | - if ( $wgRequest->getVal( 'action' ) == 'GetLocal' ) { |
49 | | - $dbr = wfGetDB( DB_SLAVE ); |
50 | | - $fromLang = $wgRequest->getVal( 'fromLang' ); |
51 | | - $result = $dbr->select( 'interwiki', array( 'iw_url' ), array( 'iw_prefix' => $fromLang ), __METHOD__ ); |
52 | | - if ( $object = $dbr->fetchObject( $result ) ) { |
53 | | - $fromLang = $object->iw_url; |
54 | | - } else { |
55 | | - $fromLang = ''; |
| 51 | + if( !$wgUser->isAllowed( 'getfamily' ) ){ |
| 52 | + $wgOut->permissionRequired( 'getfamily' ); |
56 | 53 | } |
57 | 54 | |
58 | | - header( 'Content-Type: text/xml' ); |
59 | | - $out .= "<family>\n"; |
| 55 | + $out = ''; |
60 | 56 | |
61 | | - $out .= Xml::element( 'urlcheck', array(), $fromLang ) . "\n"; |
62 | | - $out .= Xml::element( 'language', array(), $wgLanguageCode ) . "\n"; |
63 | | - $out .= Xml::element( 'hostname', array(), str_replace( 'http://', '', $wgServer ) ) . "\n"; |
64 | | - $out .= Xml::element( 'path', array(), $wgScript ) . "\n"; |
| 57 | + if ( $wgRequest->getVal( 'action' ) == 'GetLocal' ) { |
| 58 | + $dbr = wfGetDB( DB_SLAVE ); |
| 59 | + $fromLang = $wgRequest->getVal( 'fromLang' ); |
| 60 | + $result = $dbr->select( 'interwiki', array( 'iw_url' ), array( 'iw_prefix' => $fromLang ), __METHOD__ ); |
| 61 | + if ( $object = $dbr->fetchObject( $result ) ) { |
| 62 | + $fromLang = $object->iw_url; |
| 63 | + } else { |
| 64 | + $fromLang = ''; |
| 65 | + } |
65 | 66 | |
66 | | - // $keys = array_keys ($wgCanonicalNamespaceNames); |
67 | | - $language = Language::factory( $wgLanguageCode ); |
68 | | - $array = $language->getNamespaces(); |
69 | | - $keys = array_keys( $array ); |
| 67 | + header( 'Content-Type: text/xml' ); |
| 68 | + $out .= "<family>\n"; |
70 | 69 | |
71 | | - foreach ( $keys as $key ) { |
72 | | - $out .= Xml::openElement( 'namespace', array() ) . "\n"; |
73 | | - $out .= Xml::element( 'key', array(), $key ) . "\n"; |
74 | | - // $out .= Xml::element('name', array(), $wgCanonicalNamespaceNames[$key]) . "\n"; |
75 | | - $out .= Xml::element( 'name', array(), $array[$key] ) . "\n"; |
76 | | - $out .= Xml::closeElement( 'namespace' ); |
77 | | - } |
78 | | - $out .= "</family>\n"; |
79 | | - } else { |
80 | | - header( 'Content-Type: text/plain' ); |
| 70 | + $out .= Xml::element( 'urlcheck', array(), $fromLang ) . "\n"; |
| 71 | + $out .= Xml::element( 'language', array(), $wgLanguageCode ) . "\n"; |
| 72 | + $out .= Xml::element( 'hostname', array(), str_replace( 'http://', '', $wgServer ) ) . "\n"; |
| 73 | + $out .= Xml::element( 'path', array(), $wgScript ) . "\n"; |
81 | 74 | |
82 | | - $langcodes = array_keys( $wgLanguageNames ); |
| 75 | + // $keys = array_keys ($wgCanonicalNamespaceNames); |
| 76 | + $language = Language::factory( $wgLanguageCode ); |
| 77 | + $array = $language->getNamespaces(); |
| 78 | + $keys = array_keys( $array ); |
83 | 79 | |
84 | | - $dbr = wfGetDB( DB_SLAVE ); |
85 | | - foreach ( $langcodes as $lang_code ) { |
86 | | - $where .= ', ' . $dbr->addQuotes( $lang_code ); |
87 | | - } |
88 | | - $where = substr( $where, 1 ); |
89 | | - $result = $dbr->select( 'interwiki', array( 'iw_prefix', 'iw_url' ), |
90 | | - array( "iw_prefix IN ( $where )" ), __METHOD__ ); |
| 80 | + foreach ( $keys as $key ) { |
| 81 | + $out .= Xml::openElement( 'namespace', array() ) . "\n"; |
| 82 | + $out .= Xml::element( 'key', array(), $key ) . "\n"; |
| 83 | + // $out .= Xml::element('name', array(), $wgCanonicalNamespaceNames[$key]) . "\n"; |
| 84 | + $out .= Xml::element( 'name', array(), $array[$key] ) . "\n"; |
| 85 | + $out .= Xml::closeElement( 'namespace' ); |
| 86 | + } |
| 87 | + $out .= "</family>\n"; |
| 88 | + } else { |
| 89 | + header( 'Content-Type: text/plain' ); |
91 | 90 | |
92 | | - $datalinks = array(); |
| 91 | + $langcodes = array_keys( $wgLanguageNames ); |
93 | 92 | |
94 | | - while ( $dbObject = $dbr->fetchObject( $result ) ) { |
95 | | - $datalinks[$dbObject->iw_prefix] = $dbObject->iw_url; |
96 | | - } |
| 93 | + $dbr = wfGetDB( DB_SLAVE ); |
| 94 | + foreach ( $langcodes as $lang_code ) { |
| 95 | + $where .= ', ' . $dbr->addQuotes( $lang_code ); |
| 96 | + } |
| 97 | + $where = substr( $where, 1 ); |
| 98 | + $result = $dbr->select( 'interwiki', array( 'iw_prefix', 'iw_url' ), |
| 99 | + array( "iw_prefix IN ( $where )" ), __METHOD__ ); |
97 | 100 | |
98 | | - $datalinks[$wgLanguageCode] = $wgServer . $wgArticlePath; |
| 101 | + $datalinks = array(); |
99 | 102 | |
100 | | - unset( $datalinks['bug'] ); |
| 103 | + while ( $dbObject = $dbr->fetchObject( $result ) ) { |
| 104 | + $datalinks[$dbObject->iw_prefix] = $dbObject->iw_url; |
| 105 | + } |
101 | 106 | |
102 | | - $metadata = array(); |
103 | | - $metadata['langs'] = array(); |
104 | | - $metadata['path'] = array(); |
105 | | - $namespacedata = array(); |
| 107 | + $datalinks[$wgLanguageCode] = $wgServer . $wgArticlePath; |
106 | 108 | |
107 | | - foreach ( $datalinks as $lang => $link ) { |
108 | | - $link = str_replace( '$1', 'Special:GetFamily?action=GetLocal&fromLang=' . $wgLanguageCode, $link ); |
109 | | - if ( !class_exists( 'WikiCurl' ) ) { |
110 | | - global $IP; |
111 | | - require_once( "$IP/extensions/WikiCurl/WikiCurl.php" ); |
112 | | - } |
113 | | - $handler = new WikiCurl(); |
114 | | - $content = $handler->get( $link ); |
115 | | - if ( strpos( $content, '<family>' ) === false ) { |
| 109 | + unset( $datalinks['bug'] ); |
| 110 | + |
| 111 | + $metadata = array(); |
| 112 | + $metadata['langs'] = array(); |
| 113 | + $metadata['path'] = array(); |
| 114 | + $namespacedata = array(); |
| 115 | + |
| 116 | + foreach ( $datalinks as $lang => $link ) { |
| 117 | + $link = str_replace( '$1', 'Special:GetFamily?action=GetLocal&fromLang=' . $wgLanguageCode, $link ); |
| 118 | + if ( !class_exists( 'WikiCurl' ) ) { |
| 119 | + global $IP; |
| 120 | + require_once( "$IP/extensions/WikiCurl/WikiCurl.php" ); |
| 121 | + } |
| 122 | + $handler = new WikiCurl(); |
| 123 | + $content = $handler->get( $link ); |
| 124 | + if ( strpos( $content, '<family>' ) === false ) { |
| 125 | + unset( $handler ); |
| 126 | + continue; |
| 127 | + } |
| 128 | + $content = substr( $content, strpos( $content, "\r\n\r\n" ) + 4 ); |
116 | 129 | unset( $handler ); |
117 | | - continue; |
118 | | - } |
119 | | - $content = substr( $content, strpos( $content, "\r\n\r\n" ) + 4 ); |
120 | | - unset( $handler ); |
121 | 130 | |
122 | | - try { |
123 | | - $xml = new SimpleXMLElement( $content ); |
124 | | - } catch ( Exception $e ) { |
125 | | - continue; |
126 | | - } |
| 131 | + try { |
| 132 | + $xml = new SimpleXMLElement( $content ); |
| 133 | + } catch ( Exception $e ) { |
| 134 | + continue; |
| 135 | + } |
127 | 136 | |
128 | | - // $urlcheck = (string)$xml->urlcheck; |
129 | | - // if ( strcmp( $urlcheck, $wgServer.$wgArticlePath ) != 0 ){ |
130 | | - // continue; |
131 | | - // } |
132 | | - $metadata['langs'][$lang] = (string)$xml->hostname; |
133 | | - $metadata['path'][$lang] = (string)$xml->path; |
| 137 | + // $urlcheck = (string)$xml->urlcheck; |
| 138 | + // if ( strcmp( $urlcheck, $wgServer.$wgArticlePath ) != 0 ){ |
| 139 | + // continue; |
| 140 | + // } |
| 141 | + $metadata['langs'][$lang] = (string)$xml->hostname; |
| 142 | + $metadata['path'][$lang] = (string)$xml->path; |
134 | 143 | |
135 | | - foreach ( $xml->namespace as $namespace ) { |
136 | | - $namespacedata[(int)$namespace->key][$lang] = (string)$namespace->name; |
| 144 | + foreach ( $xml->namespace as $namespace ) { |
| 145 | + $namespacedata[(int)$namespace->key][$lang] = (string)$namespace->name; |
| 146 | + } |
137 | 147 | } |
138 | | - } |
139 | 148 | |
140 | | - if ( $namespacedata != array() ) { |
141 | | - $out .= "# -*- coding: utf-8 -*- |
| 149 | + if ( $namespacedata != array() ) { |
| 150 | + $out .= "# -*- coding: utf-8 -*- |
142 | 151 | |
143 | | -''' |
144 | | -The $wgSitename family. |
| 152 | + ''' |
| 153 | + The $wgSitename family. |
145 | 154 | |
146 | | -This is config file for pywikipediabot framework. |
147 | | -It was generated by Special:GetFamily (a Wikia extension). |
| 155 | + This is config file for pywikipediabot framework. |
| 156 | + It was generated by Special:GetFamily (a Wikia extension). |
148 | 157 | |
149 | | -Save this file to families/{$wgDBname}_family.py in your pywikibot installation |
150 | | -The pywikipediabot itself is available for free download from svn.wikimedia.org |
151 | | -''' |
| 158 | + Save this file to families/{$wgDBname}_family.py in your pywikibot installation |
| 159 | + The pywikipediabot itself is available for free download from svn.wikimedia.org |
| 160 | + ''' |
152 | 161 | |
153 | | -import family |
| 162 | + import family |
154 | 163 | |
155 | | -class Family(family.Family): |
| 164 | + class Family(family.Family): |
156 | 165 | |
157 | | - def __init__(self): |
158 | | - family.Family.__init__(self) |
159 | | - self.name = '$wgDBname' # Set the family name; this should be the same as in the filename. |
| 166 | + def __init__(self): |
| 167 | + family.Family.__init__(self) |
| 168 | + self.name = '$wgDBname' # Set the family name; this should be the same as in the filename. |
160 | 169 | |
161 | | - self.langs = {\n"; |
| 170 | + self.langs = {\n"; |
162 | 171 | |
163 | | - $keys = array_keys( $metadata['langs'] ); |
| 172 | + $keys = array_keys( $metadata['langs'] ); |
164 | 173 | |
165 | | - foreach ( $keys as $key ) { |
166 | | - $out .= " '$key': '{$metadata['langs'][$key]}', \n"; |
167 | | - } |
| 174 | + foreach ( $keys as $key ) { |
| 175 | + $out .= " '$key': '{$metadata['langs'][$key]}', \n"; |
| 176 | + } |
168 | 177 | |
169 | | - $out .= " }\n \n"; |
| 178 | + $out .= " }\n \n"; |
170 | 179 | |
171 | | - $namespace_keys = array_keys( $namespacedata ); |
| 180 | + $namespace_keys = array_keys( $namespacedata ); |
172 | 181 | |
173 | | - foreach ( $namespace_keys as $key ) { |
174 | | - $langs = array_keys( $namespacedata[$key] ); |
175 | | - $out .= " self.namespaces[$key] = {\n"; |
| 182 | + foreach ( $namespace_keys as $key ) { |
| 183 | + $langs = array_keys( $namespacedata[$key] ); |
| 184 | + $out .= " self.namespaces[$key] = {\n"; |
176 | 185 | |
177 | | - foreach ( $langs as $lang ) { |
178 | | - $out .= " '$lang': u'{$namespacedata[$key][$lang]}',\n"; |
| 186 | + foreach ( $langs as $lang ) { |
| 187 | + $out .= " '$lang': u'{$namespacedata[$key][$lang]}',\n"; |
| 188 | + } |
| 189 | + $out .= " }\n \n"; |
179 | 190 | } |
180 | | - $out .= " }\n \n"; |
181 | | - } |
182 | | - $version = array(); |
183 | | - preg_match( '/[0-9]*\.[0-9]*/', $wgVersion, $version ); |
184 | | - $version = $version[0]; |
| 191 | + $version = array(); |
| 192 | + preg_match( '/[0-9]*\.[0-9]*/', $wgVersion, $version ); |
| 193 | + $version = $version[0]; |
185 | 194 | |
186 | | - $out .= " |
187 | | - def hostname(self, code): |
188 | | - return self.langs[code] |
| 195 | + $out .= " |
| 196 | + def hostname(self, code): |
| 197 | + return self.langs[code] |
189 | 198 | |
190 | | - def path(self, code): |
191 | | - path = ''\n"; |
| 199 | + def path(self, code): |
| 200 | + path = ''\n"; |
192 | 201 | |
193 | | - $keys = array_keys( $metadata['langs'] ); |
| 202 | + $keys = array_keys( $metadata['langs'] ); |
194 | 203 | |
195 | | - foreach ( $keys as $key ) { |
196 | | - $out .= " if code == '$key':\n path = '{$metadata['path'][$key]}'\n"; |
197 | | - } |
| 204 | + foreach ( $keys as $key ) { |
| 205 | + $out .= " if code == '$key':\n path = '{$metadata['path'][$key]}'\n"; |
| 206 | + } |
198 | 207 | |
199 | | - $out .= " return path |
| 208 | + $out .= " return path |
200 | 209 | |
201 | | - def login_address(self, code): |
202 | | - return '%s?title=%s:Userlogin&action=submitlogin' % (self.path(code), self.special_namespace_url(code)) |
| 210 | + def login_address(self, code): |
| 211 | + return '%s?title=%s:Userlogin&action=submitlogin' % (self.path(code), self.special_namespace_url(code)) |
203 | 212 | |
204 | | - def version(self, code): |
205 | | - return '" . $version . "' # The MediaWiki version used. Not very important in most cases. |
206 | | -"; |
207 | | - } else { |
208 | | - $out .= wfMsg( 'getfamily-interwikierror' ); |
| 213 | + def version(self, code): |
| 214 | + return '" . $version . "' # The MediaWiki version used. Not very important in most cases. |
| 215 | + "; |
| 216 | + } else { |
| 217 | + $out .= wfMsg( 'getfamily-interwikierror' ); |
| 218 | + } |
209 | 219 | } |
| 220 | + die( $out ); |
210 | 221 | } |
211 | | - die( $out ); |
212 | 222 | } |
Index: trunk/extensions/EditConflict/EditConflict.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | |
59 | 59 | $wgExtensionMessagesFiles['EditConflict'] = EditConflict::$ExtDir . '/EditConflict_i18n.php'; |
60 | 60 | $wgAutoloadClasses['ec_CurrentEdits'] = EditConflict::$ExtDir . '/CurrentEdits.php'; |
61 | | -$wgSpecialPages['CurrentEdits'] = array( 'ec_CurrentEdits' ); |
| 61 | +$wgSpecialPages['CurrentEdits'] = 'ec_CurrentEdits'; |
62 | 62 | |
63 | 63 | $wgHooks['EditPageMergeChanges'][] = 'EditConflict::doEditConflict'; |
64 | 64 | $wgHooks['MakeGlobalVariablesScript'][] = 'EditConflict::jsWikiMessages'; |
Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php |
— | — | @@ -144,10 +144,10 @@ |
145 | 145 | /***** register special pages hooks *****/ |
146 | 146 | /**********************************************/ |
147 | 147 | $wgAutoloadClasses['MV_SpecialCRUDStream'] = dirname( __FILE__ ) . '/specials/MV_SpecialCRUDStream.php'; |
148 | | - $wgSpecialPages['Mv_Add_Stream'] = array( 'MV_SpecialCRUDStream' ); |
| 148 | + $wgSpecialPages['Mv_Add_Stream'] = 'MV_SpecialCRUDStream'; |
149 | 149 | |
150 | 150 | $wgAutoloadClasses['MV_SpecialListStreams'] = dirname( __FILE__ ) . '/specials/MV_SpecialListStreams.php'; |
151 | | - $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' ); |
| 151 | + $wgSpecialPages['Mv_List_Streams'] = 'MV_SpecialListStreams'; |
152 | 152 | |
153 | 153 | /* special export views */ |
154 | 154 | $wgAutoloadClasses['MV_SpecialExport'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php'; |
— | — | @@ -158,21 +158,21 @@ |
159 | 159 | $wgAutoloadClasses['MvExportSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php'; |
160 | 160 | $wgAutoloadClasses['MvExportAsk'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php'; |
161 | 161 | |
162 | | - $wgSpecialPages['MvVideoFeed'] = array( 'MvVideoFeed' ); |
163 | | - $wgSpecialPages['MvExportStream'] = array( 'MvExportStream' ); |
164 | | - $wgSpecialPages['MvExportSequence'] = array( 'MvExportSequence' ); |
165 | | - $wgSpecialPages['MvExportSearch'] = array( 'MvExportSearch' ); |
166 | | - $wgSpecialPages['MvExportAsk'] = array( 'MvExportAsk' ); |
| 162 | + $wgSpecialPages['MvVideoFeed'] = 'MvVideoFeed'; |
| 163 | + $wgSpecialPages['MvExportStream'] = 'MvExportStream'; |
| 164 | + $wgSpecialPages['MvExportSequence'] = 'MvExportSequence'; |
| 165 | + $wgSpecialPages['MvExportSearch'] = 'MvExportSearch'; |
| 166 | + $wgSpecialPages['MvExportAsk'] = 'MvExportAsk'; |
167 | 167 | |
168 | 168 | $wgAutoloadClasses['MV_SpecialMediaSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php'; |
169 | | - $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' ); |
| 169 | + $wgSpecialPages['Mv_List_Streams'] = 'MV_SpecialListStreams'; |
170 | 170 | |
171 | 171 | $wgAutoloadClasses['MediaSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php'; |
172 | | - $wgSpecialPages['MediaSearch'] = array( 'MediaSearch' ); |
173 | | - $wgSpecialPages['MV_SpecialSearch'] = array( 'MV_SpecialSearch' ); |
| 172 | + $wgSpecialPages['MediaSearch'] = 'MediaSearch'; |
| 173 | + $wgSpecialPages['MV_SpecialSearch'] = 'MV_SpecialSearch'; |
174 | 174 | |
175 | 175 | $wgAutoloadClasses['MVAdmin'] = dirname( __FILE__ ) . '/specials/MV_SpecialMVAdmin.php'; |
176 | | - $wgSpecialPages['MVAdmin'] = array( 'MVAdmin' ); |
| 176 | + $wgSpecialPages['MVAdmin'] = 'MVAdmin'; |
177 | 177 | // require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php'); |
178 | 178 | // require_once( dirname(__FILE__) . '/specials/MV_SpecialListStreams.php'); |
179 | 179 | // require_once( dirname(__FILE__) . '/specials/MV_SpecialExport.php'); |