Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -5,7 +5,6 @@ |
6 | 6 | * @ingroup Upload |
7 | 7 | * |
8 | 8 | * Form for handling uploads and special page. |
9 | | - * |
10 | 9 | */ |
11 | 10 | |
12 | 11 | class SpecialUpload extends SpecialPage { |
— | — | @@ -33,7 +32,7 @@ |
34 | 33 | public $mDesiredDestName; // The requested target file name |
35 | 34 | protected $mComment; |
36 | 35 | protected $mLicense; |
37 | | - |
| 36 | + |
38 | 37 | /** User input variables from the root section **/ |
39 | 38 | protected $mIgnoreWarning; |
40 | 39 | protected $mWatchThis; |
— | — | @@ -46,11 +45,10 @@ |
47 | 46 | protected $mCancelUpload; // The user clicked "Cancel and return to upload form" button |
48 | 47 | protected $mTokenOk; |
49 | 48 | protected $mUploadSuccessful = false; // Subclasses can use this to determine whether a file was uploaded |
50 | | - |
| 49 | + |
51 | 50 | /** Text injection points for hooks not using HTMLForm **/ |
52 | 51 | public $uploadFormTextTop; |
53 | 52 | public $uploadFormTextAfterSummary; |
54 | | - |
55 | 53 | |
56 | 54 | /** |
57 | 55 | * Initialize instance variables from request and create an Upload handler |
— | — | @@ -63,14 +61,15 @@ |
64 | 62 | $this->mRequest = $request; |
65 | 63 | $this->mSourceType = $request->getVal( 'wpSourceType', 'file' ); |
66 | 64 | $this->mUpload = UploadBase::createFromRequest( $request ); |
67 | | - $this->mUploadClicked = $request->wasPosted() |
68 | | - && ( $request->getCheck( 'wpUpload' ) |
| 65 | + $this->mUploadClicked = $request->wasPosted() |
| 66 | + && ( $request->getCheck( 'wpUpload' ) |
69 | 67 | || $request->getCheck( 'wpUploadIgnoreWarning' ) ); |
70 | 68 | |
71 | 69 | // Guess the desired name from the filename if not provided |
72 | 70 | $this->mDesiredDestName = $request->getText( 'wpDestFile' ); |
73 | | - if( !$this->mDesiredDestName ) |
| 71 | + if( !$this->mDesiredDestName ) { |
74 | 72 | $this->mDesiredDestName = $request->getText( 'wpUploadFile' ); |
| 73 | + } |
75 | 74 | $this->mComment = $request->getText( 'wpUploadDescription' ); |
76 | 75 | $this->mLicense = $request->getText( 'wpLicense' ); |
77 | 76 | |
— | — | @@ -97,7 +96,7 @@ |
98 | 97 | } else { |
99 | 98 | $this->mTokenOk = $wgUser->matchEditToken( $token ); |
100 | 99 | } |
101 | | - |
| 100 | + |
102 | 101 | $this->uploadFormTextTop = ''; |
103 | 102 | $this->uploadFormTextAfterSummary = ''; |
104 | 103 | } |
— | — | @@ -156,33 +155,37 @@ |
157 | 156 | |
158 | 157 | # Unsave the temporary file in case this was a cancelled upload |
159 | 158 | if ( $this->mCancelUpload ) { |
160 | | - if ( !$this->unsaveUploadedFile() ) |
| 159 | + if ( !$this->unsaveUploadedFile() ) { |
161 | 160 | # Something went wrong, so unsaveUploadedFile showed a warning |
162 | 161 | return; |
| 162 | + } |
163 | 163 | } |
164 | 164 | |
165 | 165 | # Process upload or show a form |
166 | | - if ( $this->mTokenOk && !$this->mCancelUpload |
167 | | - && ( $this->mUpload && $this->mUploadClicked ) ) { |
| 166 | + if ( |
| 167 | + $this->mTokenOk && !$this->mCancelUpload && |
| 168 | + ( $this->mUpload && $this->mUploadClicked ) |
| 169 | + ) |
| 170 | + { |
168 | 171 | $this->processUpload(); |
169 | 172 | } else { |
170 | 173 | # Backwards compatibility hook |
171 | | - if( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) |
172 | | - { |
| 174 | + if( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) { |
173 | 175 | wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" ); |
174 | 176 | return; |
175 | 177 | } |
176 | | - |
| 178 | + |
177 | 179 | $this->showUploadForm( $this->getUploadForm() ); |
178 | 180 | } |
179 | 181 | |
180 | 182 | # Cleanup |
181 | | - if ( $this->mUpload ) |
| 183 | + if ( $this->mUpload ) { |
182 | 184 | $this->mUpload->cleanupTempFile(); |
| 185 | + } |
183 | 186 | } |
184 | 187 | |
185 | 188 | /** |
186 | | - * Show the main upload form |
| 189 | + * Show the main upload form |
187 | 190 | * |
188 | 191 | * @param mixed $form An HTMLForm instance or HTML string to show |
189 | 192 | */ |
— | — | @@ -191,14 +194,14 @@ |
192 | 195 | if ( !$this->mDesiredDestName ) { |
193 | 196 | $this->showViewDeletedLinks(); |
194 | 197 | } |
195 | | - |
| 198 | + |
196 | 199 | if ( $form instanceof HTMLForm ) { |
197 | 200 | $form->show(); |
198 | 201 | } else { |
199 | 202 | global $wgOut; |
200 | 203 | $wgOut->addHTML( $form ); |
201 | 204 | } |
202 | | - |
| 205 | + |
203 | 206 | } |
204 | 207 | |
205 | 208 | /** |
— | — | @@ -210,23 +213,26 @@ |
211 | 214 | */ |
212 | 215 | protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) { |
213 | 216 | global $wgOut; |
214 | | - |
| 217 | + |
215 | 218 | # Initialize form |
216 | 219 | $form = new UploadForm( array( |
217 | | - 'watch' => $this->getWatchCheck(), |
218 | | - 'forreupload' => $this->mForReUpload, |
| 220 | + 'watch' => $this->getWatchCheck(), |
| 221 | + 'forreupload' => $this->mForReUpload, |
219 | 222 | 'sessionkey' => $sessionKey, |
220 | 223 | 'hideignorewarning' => $hideIgnoreWarning, |
221 | 224 | 'destwarningack' => (bool)$this->mDestWarningAck, |
222 | | - |
| 225 | + |
223 | 226 | 'texttop' => $this->uploadFormTextTop, |
224 | 227 | 'textaftersummary' => $this->uploadFormTextAfterSummary, |
225 | 228 | ) ); |
226 | 229 | $form->setTitle( $this->getTitle() ); |
227 | 230 | |
228 | 231 | # Check the token, but only if necessary |
229 | | - if( !$this->mTokenOk && !$this->mCancelUpload |
230 | | - && ( $this->mUpload && $this->mUploadClicked ) ) { |
| 232 | + if( |
| 233 | + !$this->mTokenOk && !$this->mCancelUpload && |
| 234 | + ( $this->mUpload && $this->mUploadClicked ) |
| 235 | + ) |
| 236 | + { |
231 | 237 | $form->addPreText( wfMsgExt( 'session_fail_preview', 'parseinline' ) ); |
232 | 238 | } |
233 | 239 | |
— | — | @@ -234,16 +240,16 @@ |
235 | 241 | $form->addPreText( '<div id="uploadtext">' . wfMsgExt( 'uploadtext', 'parse' ) . '</div>'); |
236 | 242 | # Add upload error message |
237 | 243 | $form->addPreText( $message ); |
238 | | - |
| 244 | + |
239 | 245 | # Add footer to form |
240 | 246 | $uploadFooter = wfMsgNoTrans( 'uploadfooter' ); |
241 | 247 | if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) ) { |
242 | 248 | $form->addPostText( '<div id="mw-upload-footer-message">' |
243 | 249 | . $wgOut->parse( $uploadFooter ) . "</div>\n" ); |
244 | 250 | } |
245 | | - |
246 | | - return $form; |
247 | 251 | |
| 252 | + return $form; |
| 253 | + |
248 | 254 | } |
249 | 255 | |
250 | 256 | /** |
— | — | @@ -290,7 +296,7 @@ |
291 | 297 | $sessionKey = $this->mUpload->stashSession(); |
292 | 298 | $message = '<h2>' . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" . |
293 | 299 | '<div class="error">' . $message . "</div>\n"; |
294 | | - |
| 300 | + |
295 | 301 | $form = $this->getUploadForm( $message, $sessionKey ); |
296 | 302 | $form->setSubmitText( wfMsg( 'upload-tryagain' ) ); |
297 | 303 | $this->showUploadForm( $form ); |
— | — | @@ -300,42 +306,42 @@ |
301 | 307 | * Also checks whether there are actually warnings to display. |
302 | 308 | * |
303 | 309 | * @param array $warnings |
304 | | - * @return boolean true if warnings were displayed, false if there are no |
| 310 | + * @return boolean true if warnings were displayed, false if there are no |
305 | 311 | * warnings and the should continue processing like there was no warning |
306 | 312 | */ |
307 | 313 | protected function showUploadWarning( $warnings ) { |
308 | | - global $wgUser; |
309 | | - |
310 | 314 | # If there are no warnings, or warnings we can ignore, return early |
311 | | - if ( !$warnings || ( count( $warnings ) == 1 && |
312 | | - isset( $warnings['exists']) && $this->mDestWarningAck ) ) { |
313 | | - return false; |
| 315 | + if ( |
| 316 | + !$warnings || ( count( $warnings ) == 1 && |
| 317 | + isset( $warnings['exists']) && $this->mDestWarningAck ) |
| 318 | + ) |
| 319 | + { |
| 320 | + return false; |
314 | 321 | } |
315 | 322 | |
316 | 323 | $sessionKey = $this->mUpload->stashSession(); |
317 | 324 | |
318 | | - $sk = $wgUser->getSkin(); |
319 | | - |
320 | 325 | $warningHtml = '<h2>' . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" |
321 | 326 | . '<ul class="warning">'; |
322 | 327 | foreach( $warnings as $warning => $args ) { |
323 | | - $msg = ''; |
324 | | - if( $warning == 'exists' ) { |
325 | | - $msg = "\t<li>" . self::getExistsWarning( $args ) . "</li>\n"; |
326 | | - } elseif( $warning == 'duplicate' ) { |
327 | | - $msg = self::getDupeWarning( $args ); |
328 | | - } elseif( $warning == 'duplicate-archive' ) { |
329 | | - $msg = "\t<li>" . wfMsgExt( 'file-deleted-duplicate', 'parseinline', |
330 | | - array( Title::makeTitle( NS_FILE, $args )->getPrefixedText() ) ) |
331 | | - . "</li>\n"; |
332 | | - } else { |
333 | | - if ( $args === true ) |
334 | | - $args = array(); |
335 | | - elseif ( !is_array( $args ) ) |
336 | | - $args = array( $args ); |
337 | | - $msg = "\t<li>" . wfMsgExt( $warning, 'parseinline', $args ) . "</li>\n"; |
| 328 | + $msg = ''; |
| 329 | + if( $warning == 'exists' ) { |
| 330 | + $msg = "\t<li>" . self::getExistsWarning( $args ) . "</li>\n"; |
| 331 | + } elseif( $warning == 'duplicate' ) { |
| 332 | + $msg = self::getDupeWarning( $args ); |
| 333 | + } elseif( $warning == 'duplicate-archive' ) { |
| 334 | + $msg = "\t<li>" . wfMsgExt( 'file-deleted-duplicate', 'parseinline', |
| 335 | + array( Title::makeTitle( NS_FILE, $args )->getPrefixedText() ) ) |
| 336 | + . "</li>\n"; |
| 337 | + } else { |
| 338 | + if ( $args === true ) { |
| 339 | + $args = array(); |
| 340 | + } elseif ( !is_array( $args ) ) { |
| 341 | + $args = array( $args ); |
338 | 342 | } |
339 | | - $warningHtml .= $msg; |
| 343 | + $msg = "\t<li>" . wfMsgExt( $warning, 'parseinline', $args ) . "</li>\n"; |
| 344 | + } |
| 345 | + $warningHtml .= $msg; |
340 | 346 | } |
341 | 347 | $warningHtml .= "</ul>\n"; |
342 | 348 | $warningHtml .= wfMsgExt( 'uploadwarning-text', 'parse' ); |
— | — | @@ -346,7 +352,7 @@ |
347 | 353 | $form->addButton( 'wpCancelUpload', wfMsg( 'reuploaddesc' ) ); |
348 | 354 | |
349 | 355 | $this->showUploadForm( $form ); |
350 | | - |
| 356 | + |
351 | 357 | # Indicate that we showed a form |
352 | 358 | return true; |
353 | 359 | } |
— | — | @@ -384,8 +390,7 @@ |
385 | 391 | } |
386 | 392 | |
387 | 393 | // Deprecated backwards compatibility hook |
388 | | - if( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) |
389 | | - { |
| 394 | + if( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) { |
390 | 395 | wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" ); |
391 | 396 | return array( 'status' => UploadBase::BEFORE_PROCESSING ); |
392 | 397 | } |
— | — | @@ -425,7 +430,6 @@ |
426 | 431 | $this->mUploadSuccessful = true; |
427 | 432 | wfRunHooks( 'SpecialUploadComplete', array( &$this ) ); |
428 | 433 | $wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() ); |
429 | | - |
430 | 434 | } |
431 | 435 | |
432 | 436 | /** |
— | — | @@ -438,15 +442,15 @@ |
439 | 443 | if ( $license != '' ) { |
440 | 444 | $licensetxt = '== ' . wfMsgForContent( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n"; |
441 | 445 | } |
442 | | - $pageText = '== ' . wfMsgForContent ( 'filedesc' ) . " ==\n" . $comment . "\n" . |
443 | | - '== ' . wfMsgForContent ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" . |
444 | | - "$licensetxt" . |
445 | | - '== ' . wfMsgForContent ( 'filesource' ) . " ==\n" . $source ; |
| 446 | + $pageText = '== ' . wfMsgForContent( 'filedesc' ) . " ==\n" . $comment . "\n" . |
| 447 | + '== ' . wfMsgForContent( 'filestatus' ) . " ==\n" . $copyStatus . "\n" . |
| 448 | + "$licensetxt" . |
| 449 | + '== ' . wfMsgForContent( 'filesource' ) . " ==\n" . $source; |
446 | 450 | } else { |
447 | 451 | if ( $license != '' ) { |
448 | | - $filedesc = $comment == '' ? '' : '== ' . wfMsgForContent ( 'filedesc' ) . " ==\n" . $comment . "\n"; |
449 | | - $pageText = $filedesc . |
450 | | - '== ' . wfMsgForContent ( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n"; |
| 452 | + $filedesc = $comment == '' ? '' : '== ' . wfMsgForContent( 'filedesc' ) . " ==\n" . $comment . "\n"; |
| 453 | + $pageText = $filedesc . |
| 454 | + '== ' . wfMsgForContent( 'license-header' ) . " ==\n" . '{{' . $license . '}}' . "\n"; |
451 | 455 | } else { |
452 | 456 | $pageText = $comment; |
453 | 457 | } |
— | — | @@ -552,15 +556,15 @@ |
553 | 557 | |
554 | 558 | /** |
555 | 559 | * Remove a temporarily kept file stashed by saveTempUploadedFile(). |
556 | | - * @access private |
557 | 560 | * @return success |
558 | 561 | */ |
559 | 562 | protected function unsaveUploadedFile() { |
560 | 563 | global $wgOut; |
561 | | - if ( !( $this->mUpload instanceof UploadFromStash ) ) |
| 564 | + if ( !( $this->mUpload instanceof UploadFromStash ) ) { |
562 | 565 | return true; |
| 566 | + } |
563 | 567 | $success = $this->mUpload->unsaveUploadedFile(); |
564 | | - if ( ! $success ) { |
| 568 | + if ( !$success ) { |
565 | 569 | $wgOut->showFileDeleteError( $this->mUpload->getTempPath() ); |
566 | 570 | return false; |
567 | 571 | } else { |
— | — | @@ -580,8 +584,9 @@ |
581 | 585 | public static function getExistsWarning( $exists ) { |
582 | 586 | global $wgUser, $wgContLang; |
583 | 587 | |
584 | | - if ( !$exists ) |
| 588 | + if ( !$exists ) { |
585 | 589 | return ''; |
| 590 | + } |
586 | 591 | |
587 | 592 | $file = $exists['file']; |
588 | 593 | $filename = $file->getTitle()->getPrefixedText(); |
— | — | @@ -657,15 +662,15 @@ |
658 | 663 | public static function getDupeWarning( $dupes ) { |
659 | 664 | if( $dupes ) { |
660 | 665 | global $wgOut; |
661 | | - $msg = "<gallery>"; |
| 666 | + $msg = '<gallery>'; |
662 | 667 | foreach( $dupes as $file ) { |
663 | 668 | $title = $file->getTitle(); |
664 | 669 | $msg .= $title->getPrefixedText() . |
665 | | - "|" . $title->getText() . "\n"; |
| 670 | + '|' . $title->getText() . "\n"; |
666 | 671 | } |
667 | | - $msg .= "</gallery>"; |
668 | | - return "<li>" . |
669 | | - wfMsgExt( "file-exists-duplicate", array( "parse" ), count( $dupes ) ) . |
| 672 | + $msg .= '</gallery>'; |
| 673 | + return '<li>' . |
| 674 | + wfMsgExt( 'file-exists-duplicate', array( 'parse' ), count( $dupes ) ) . |
670 | 675 | $wgOut->parse( $msg ) . |
671 | 676 | "</li>\n"; |
672 | 677 | } else { |
— | — | @@ -684,22 +689,20 @@ |
685 | 690 | protected $mSessionKey; |
686 | 691 | protected $mHideIgnoreWarning; |
687 | 692 | protected $mDestWarningAck; |
688 | | - |
| 693 | + |
689 | 694 | protected $mTextTop; |
690 | 695 | protected $mTextAfterSummary; |
691 | | - |
| 696 | + |
692 | 697 | protected $mSourceIds; |
693 | 698 | |
694 | 699 | public function __construct( $options = array() ) { |
695 | | - global $wgLang; |
696 | | - |
697 | 700 | $this->mWatch = !empty( $options['watch'] ); |
698 | 701 | $this->mForReUpload = !empty( $options['forreupload'] ); |
699 | | - $this->mSessionKey = isset( $options['sessionkey'] ) |
| 702 | + $this->mSessionKey = isset( $options['sessionkey'] ) |
700 | 703 | ? $options['sessionkey'] : ''; |
701 | 704 | $this->mHideIgnoreWarning = !empty( $options['hideignorewarning'] ); |
702 | 705 | $this->mDestWarningAck = !empty( $options['destwarningack'] ); |
703 | | - |
| 706 | + |
704 | 707 | $this->mTextTop = $options['texttop']; |
705 | 708 | $this->mTextAfterSummary = $options['textaftersummary']; |
706 | 709 | |
— | — | @@ -720,16 +723,17 @@ |
721 | 724 | # Build a list of IDs for javascript insertion |
722 | 725 | $this->mSourceIds = array(); |
723 | 726 | foreach ( $sourceDescriptor as $key => $field ) { |
724 | | - if ( !empty( $field['id'] ) ) |
| 727 | + if ( !empty( $field['id'] ) ) { |
725 | 728 | $this->mSourceIds[] = $field['id']; |
| 729 | + } |
726 | 730 | } |
727 | 731 | |
728 | 732 | } |
729 | 733 | |
730 | 734 | /** |
731 | | - * Get the descriptor of the fieldset that contains the file source |
| 735 | + * Get the descriptor of the fieldset that contains the file source |
732 | 736 | * selection. The section is 'source' |
733 | | - * |
| 737 | + * |
734 | 738 | * @return array Descriptor array |
735 | 739 | */ |
736 | 740 | protected function getSourceSection() { |
— | — | @@ -761,22 +765,22 @@ |
762 | 766 | 'raw' => true, |
763 | 767 | ); |
764 | 768 | } |
765 | | - |
| 769 | + |
766 | 770 | $descriptor['UploadFile'] = array( |
767 | | - 'class' => 'UploadSourceField', |
768 | | - 'section' => 'source', |
769 | | - 'type' => 'file', |
770 | | - 'id' => 'wpUploadFile', |
771 | | - 'label-message' => 'sourcefilename', |
772 | | - 'upload-type' => 'File', |
773 | | - 'radio' => &$radio, |
774 | | - 'help' => wfMsgExt( 'upload-maxfilesize', |
775 | | - array( 'parseinline', 'escapenoentities' ), |
776 | | - $wgLang->formatSize( |
777 | | - wfShorthandToInteger( ini_get( 'upload_max_filesize' ) ) |
778 | | - ) |
779 | | - ) . ' ' . wfMsgHtml( 'upload_source_file' ), |
780 | | - 'checked' => $selectedSourceType == 'file', |
| 771 | + 'class' => 'UploadSourceField', |
| 772 | + 'section' => 'source', |
| 773 | + 'type' => 'file', |
| 774 | + 'id' => 'wpUploadFile', |
| 775 | + 'label-message' => 'sourcefilename', |
| 776 | + 'upload-type' => 'File', |
| 777 | + 'radio' => &$radio, |
| 778 | + 'help' => wfMsgExt( 'upload-maxfilesize', |
| 779 | + array( 'parseinline', 'escapenoentities' ), |
| 780 | + $wgLang->formatSize( |
| 781 | + wfShorthandToInteger( ini_get( 'upload_max_filesize' ) ) |
| 782 | + ) |
| 783 | + ) . ' ' . wfMsgHtml( 'upload_source_file' ), |
| 784 | + 'checked' => $selectedSourceType == 'file', |
781 | 785 | ); |
782 | 786 | if ( $canUploadByUrl ) { |
783 | 787 | global $wgMaxUploadSize; |
— | — | @@ -805,10 +809,9 @@ |
806 | 810 | return $descriptor; |
807 | 811 | } |
808 | 812 | |
809 | | - |
810 | 813 | /** |
811 | 814 | * Get the messages indicating which extensions are preferred and prohibitted. |
812 | | - * |
| 815 | + * |
813 | 816 | * @return string HTML string containing the message |
814 | 817 | */ |
815 | 818 | protected function getExtensionsMessage() { |
— | — | @@ -845,7 +848,7 @@ |
846 | 849 | /** |
847 | 850 | * Get the descriptor of the fieldset that contains the file description |
848 | 851 | * input. The section is 'description' |
849 | | - * |
| 852 | + * |
850 | 853 | * @return array Descriptor array |
851 | 854 | */ |
852 | 855 | protected function getDescriptionSection() { |
— | — | @@ -883,7 +886,7 @@ |
884 | 887 | 'raw' => true, |
885 | 888 | ); |
886 | 889 | } |
887 | | - |
| 890 | + |
888 | 891 | $descriptor += array( |
889 | 892 | 'EditTools' => array( |
890 | 893 | 'type' => 'edittools', |
— | — | @@ -897,8 +900,9 @@ |
898 | 901 | 'label-message' => 'license', |
899 | 902 | ), |
900 | 903 | ); |
901 | | - if ( $this->mForReUpload ) |
| 904 | + if ( $this->mForReUpload ) { |
902 | 905 | $descriptor['DestFile']['readonly'] = true; |
| 906 | + } |
903 | 907 | |
904 | 908 | global $wgUseCopyrightUpload; |
905 | 909 | if ( $wgUseCopyrightUpload ) { |
— | — | @@ -920,13 +924,13 @@ |
921 | 925 | } |
922 | 926 | |
923 | 927 | /** |
924 | | - * Get the descriptor of the fieldset that contains the upload options, |
| 928 | + * Get the descriptor of the fieldset that contains the upload options, |
925 | 929 | * such as "watch this file". The section is 'options' |
926 | | - * |
| 930 | + * |
927 | 931 | * @return array Descriptor array |
928 | 932 | */ |
929 | 933 | protected function getOptionsSection() { |
930 | | - global $wgUser, $wgOut; |
| 934 | + global $wgUser; |
931 | 935 | |
932 | 936 | if( $wgUser->isLoggedIn() ) { |
933 | 937 | $descriptor = array( |
— | — | @@ -954,7 +958,6 @@ |
955 | 959 | ); |
956 | 960 | |
957 | 961 | return $descriptor; |
958 | | - |
959 | 962 | } |
960 | 963 | |
961 | 964 | /** |
— | — | @@ -967,11 +970,11 @@ |
968 | 971 | |
969 | 972 | /** |
970 | 973 | * Add upload JS to $wgOut |
971 | | - * |
972 | | - * @param bool $autofill Whether or not to autofill the destination |
| 974 | + * |
| 975 | + * @param $autofill Boolean: Whether or not to autofill the destination |
973 | 976 | * filename text box |
974 | 977 | */ |
975 | | - protected function addUploadJS( ) { |
| 978 | + protected function addUploadJS() { |
976 | 979 | global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI; |
977 | 980 | global $wgOut; |
978 | 981 | |
— | — | @@ -986,7 +989,7 @@ |
987 | 990 | ); |
988 | 991 | |
989 | 992 | $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
990 | | - |
| 993 | + |
991 | 994 | // For <charinsert> support |
992 | 995 | $wgOut->addScriptFile( 'edit.js' ); |
993 | 996 | $wgOut->addScriptFile( 'upload.js' ); |
— | — | @@ -994,7 +997,7 @@ |
995 | 998 | |
996 | 999 | /** |
997 | 1000 | * Empty function; submission is handled elsewhere. |
998 | | - * |
| 1001 | + * |
999 | 1002 | * @return bool false |
1000 | 1003 | */ |
1001 | 1004 | function trySubmit() { |
— | — | @@ -1009,7 +1012,7 @@ |
1010 | 1013 | class UploadSourceField extends HTMLTextField { |
1011 | 1014 | function getLabelHtml() { |
1012 | 1015 | $id = "wpSourceType{$this->mParams['upload-type']}"; |
1013 | | - $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel ); |
| 1016 | + $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel ); |
1014 | 1017 | |
1015 | 1018 | if ( !empty( $this->mParams['radio'] ) ) { |
1016 | 1019 | $attribs = array( |
— | — | @@ -1018,13 +1021,15 @@ |
1019 | 1022 | 'id' => $id, |
1020 | 1023 | 'value' => $this->mParams['upload-type'], |
1021 | 1024 | ); |
1022 | | - if ( !empty( $this->mParams['checked'] ) ) |
| 1025 | + if ( !empty( $this->mParams['checked'] ) ) { |
1023 | 1026 | $attribs['checked'] = 'checked'; |
| 1027 | + } |
1024 | 1028 | $label .= Html::element( 'input', $attribs ); |
1025 | 1029 | } |
1026 | 1030 | |
1027 | 1031 | return Html::rawElement( 'td', array( 'class' => 'mw-label' ), $label ); |
1028 | 1032 | } |
| 1033 | + |
1029 | 1034 | function getSize() { |
1030 | 1035 | return isset( $this->mParams['size'] ) |
1031 | 1036 | ? $this->mParams['size'] |