| @@ -22,10 +22,10 @@ | ||
| 22 | 22 | * @ingroup ExtensionManager | 
| 23 | 23 | */ | 
| 24 | 24 | |
| 25 | -$specialPageAliases = []; | |
| 25 | +$specialPageAliases = [ ]; | |
| 26 | 26 | |
| 27 | 27 | /** English | 
| 28 | 28 | */ | 
| 29 | -$specialPageAliases['en'] = [ | |
| 29 | +$specialPageAliases[ 'en' ] = [ | |
| 30 | 30 | 'BatchUpload' => [ 'BatchUpload' ], | 
| 31 | 31 | ]; | 
| @@ -22,10 +22,10 @@ | ||
| 22 | 22 | * @ingroup ExtensionManager | 
| 23 | 23 | */ | 
| 24 | 24 | |
| 25 | -$magicWords = []; | |
| 25 | +$magicWords = [ ]; | |
| 26 | 26 | |
| 27 | 27 | /** English | 
| 28 | 28 | */ | 
| 29 | -$magicWords['en'] = [ | |
| 29 | +$magicWords[ 'en' ] = [ | |
| 30 | 30 | 'batchupload' => [ 0, 'batchupload' ], | 
| 31 | 31 | ]; | 
| 32 | 32 | \ No newline at end of file | 
| @@ -95,17 +95,17 @@ | ||
| 95 | 95 | |
| 96 | 96 | return | 
| 97 | 97 | |
| 98 | - '<span class="fileupload-container"> ' . | |
| 99 | - '<span class="fileupload-dropzone fileinput-button"> ' . | |
| 100 | - '<i class="glyphicon glyphicon-plus"></i> ' . | |
| 101 | - '<span>' . \Message::newFromKey( 'simplebatchupload-buttonlabel' )->escaped() . '</span> ' . | |
| 102 | - '<!-- The file input field used as target for the file upload widget -->' . | |
| 103 | - '<input class="fileupload" type="file" name="file" multiple ' . | |
| 104 | - ' data-url="' . wfScript( 'api' ) . '" ' . | |
| 105 | - ' data-comment="' . $escapedUploadComment . '" ' . | |
| 106 | - ' data-text="' . $escapedUploadPageText . '" ' . | |
| 107 | - '> ' . | |
| 108 | - '</span><ul class="fileupload-results"></ul> ' . | |
| 98 | + '<span class="fileupload-container"> '. | |
| 99 | + '<span class="fileupload-dropzone fileinput-button"> '. | |
| 100 | + '<i class="glyphicon glyphicon-plus"></i> '. | |
| 101 | + '<span>'.\Message::newFromKey( 'simplebatchupload-buttonlabel' )->escaped().'</span> '. | |
| 102 | + '<!-- The file input field used as target for the file upload widget -->'. | |
| 103 | + '<input class="fileupload" type="file" name="file" multiple '. | |
| 104 | + ' data-url="'.wfScript( 'api' ).'" '. | |
| 105 | + ' data-comment="'.$escapedUploadComment.'" '. | |
| 106 | + ' data-text="'.$escapedUploadPageText.'" '. | |
| 107 | + '> '. | |
| 108 | + '</span><ul class="fileupload-results"></ul> '. | |
| 109 | 109 | '</span>'; | 
| 110 | 110 | } | 
| 111 | 111 | |
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | return ''; | 
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | -		return '{{' . $this->getEscapedParameter( self::IDX_TEMPLATENAME ) . $this->getEscapedParameter( self::IDX_TEMPLATEPARAMETERS ) . '}}'; | |
| 61 | +		return '{{'.$this->getEscapedParameter( self::IDX_TEMPLATENAME ).$this->getEscapedParameter( self::IDX_TEMPLATEPARAMETERS ).'}}'; | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | /** | 
| @@ -157,7 +157,7 @@ discard block | ||
| 157 | 157 | $this->populateParameters(); | 
| 158 | 158 | } | 
| 159 | 159 | |
| 160 | - $this->parameters[ self::IDX_TEMPLATEPARAMETERS ] .= '|' . $parameter; | |
| 160 | + $this->parameters[ self::IDX_TEMPLATEPARAMETERS ] .= '|'.$parameter; | |
| 161 | 161 | } | 
| 162 | 162 | |
| 163 | 163 | /** | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | /** | 
| 48 | 48 | * @param $targetConfiguration | 
| 49 | 49 | */ | 
| 50 | -	public function registerEarlyConfiguration( &$targetConfiguration ){ | |
| 50 | +	public function registerEarlyConfiguration( &$targetConfiguration ) { | |
| 51 | 51 | $sourceConfiguration = $this->getEarlyConfiguration(); | 
| 52 | 52 | $this->mergeConfiguration( $sourceConfiguration, $targetConfiguration ); | 
| 53 | 53 | } | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | /** | 
| 56 | 56 | * @param $targetConfiguration | 
| 57 | 57 | */ | 
| 58 | -	public function registerLateConfiguration( &$targetConfiguration ){ | |
| 58 | +	public function registerLateConfiguration( &$targetConfiguration ) { | |
| 59 | 59 | $sourceConfiguration = $this->getLateConfiguration(); | 
| 60 | 60 | $this->mergeConfiguration( $sourceConfiguration, $targetConfiguration ); | 
| 61 | 61 | } | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | */ | 
| 66 | 66 |  	protected function mergeConfiguration( $sourceConfiguration, &$targetConfiguration ) { | 
| 67 | 67 |  		foreach ( $sourceConfiguration as $varname => $value ) { | 
| 68 | - $targetConfiguration[ $varname ] = array_key_exists( $varname, $targetConfiguration )?array_replace_recursive( $targetConfiguration[ $varname ], $value ):$value; | |
| 68 | + $targetConfiguration[ $varname ] = array_key_exists( $varname, $targetConfiguration ) ?array_replace_recursive( $targetConfiguration[ $varname ], $value ) : $value; | |
| 69 | 69 | } | 
| 70 | 70 | } | 
| 71 | 71 | |
| @@ -74,16 +74,16 @@ discard block | ||
| 74 | 74 | */ | 
| 75 | 75 |  	protected function getEarlyConfiguration(): array { | 
| 76 | 76 | |
| 77 | - $configuration = []; | |
| 77 | + $configuration = [ ]; | |
| 78 | 78 | |
| 79 | - $configuration[ 'wgExtensionMessagesFiles' ][ 'SimpleBatchUploadAlias' ] = __DIR__ . '/SimpleBatchUpload.alias.php'; | |
| 80 | - $configuration[ 'wgExtensionMessagesFiles' ][ 'SimpleBatchUploadMagic' ] = __DIR__ . '/SimpleBatchUpload.magic.php'; | |
| 79 | + $configuration[ 'wgExtensionMessagesFiles' ][ 'SimpleBatchUploadAlias' ] = __DIR__.'/SimpleBatchUpload.alias.php'; | |
| 80 | + $configuration[ 'wgExtensionMessagesFiles' ][ 'SimpleBatchUploadMagic' ] = __DIR__.'/SimpleBatchUpload.magic.php'; | |
| 81 | 81 | |
| 82 | 82 | $configuration[ 'wgSpecialPages' ][ 'BatchUpload' ] = '\SimpleBatchUpload\SpecialBatchUpload'; | 
| 83 | 83 | |
| 84 | 84 | $configuration[ 'wgHooks' ][ 'ParserFirstCallInit' ][ 'ext.simplebatchupload' ] = [ $this, 'registerParserFunction' ]; | 
| 85 | 85 | $configuration[ 'wgHooks' ][ 'MakeGlobalVariablesScript' ][ 'ext.simplebatchupload' ] = [ $this, 'onMakeGlobalVariablesScript' ]; | 
| 86 | - $configuration[ 'wgHooks' ][ 'SetupAfterCache' ][ 'ext.simplebatchupload' ] = [ $this, 'onSetupAfterCache']; | |
| 86 | + $configuration[ 'wgHooks' ][ 'SetupAfterCache' ][ 'ext.simplebatchupload' ] = [ $this, 'onSetupAfterCache' ]; | |
| 87 | 87 | |
| 88 | 88 | return $configuration; | 
| 89 | 89 | } | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 | */ | 
| 95 | 95 |  	protected function getLateConfiguration(): array { | 
| 96 | 96 | |
| 97 | - $configuration = []; | |
| 97 | + $configuration = [ ]; | |
| 98 | 98 | $configuration[ 'wgResourceModules' ] = $this->getUploadSupportModuleDefinition() + $this->getUploadModuleDefinition(); | 
| 99 | 99 | |
| 100 | 100 | return $configuration; | 
| @@ -139,9 +139,9 @@ discard block | ||
| 139 | 139 | $dependencies = [ 'ext.SimpleBatchUpload.jquery-file-upload', 'mediawiki.Title', 'mediawiki.jqueryMsg' ]; | 
| 140 | 140 | |
| 141 | 141 |  		if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.32.0', '>' ) ) { | 
| 142 | - $dependencies[] = 'mediawiki.api'; | |
| 142 | + $dependencies[ ] = 'mediawiki.api'; | |
| 143 | 143 |  		} else { | 
| 144 | - $dependencies[] = 'mediawiki.api.edit'; | |
| 144 | + $dependencies[ ] = 'mediawiki.api.edit'; | |
| 145 | 145 | } | 
| 146 | 146 | |
| 147 | 147 | return [ 'ext.SimpleBatchUpload' => | 
| @@ -164,7 +164,7 @@ discard block | ||
| 164 | 164 |  	protected function getBasePathsForNonComposerModules() { | 
| 165 | 165 | return [ | 
| 166 | 166 | 'localBasePath' => dirname( __DIR__ ), | 
| 167 | - 'remoteBasePath' => $GLOBALS[ 'wgExtensionAssetsPath' ] . '/SimpleBatchUpload', | |
| 167 | + 'remoteBasePath' => $GLOBALS[ 'wgExtensionAssetsPath' ].'/SimpleBatchUpload', | |
| 168 | 168 | ]; | 
| 169 | 169 | } | 
| 170 | 170 | |
| @@ -173,7 +173,7 @@ discard block | ||
| 173 | 173 | * @param \OutputPage $out | 
| 174 | 174 | */ | 
| 175 | 175 |  	public function onMakeGlobalVariablesScript( &$vars, $out ) { | 
| 176 | - $vars['simpleBatchUploadMaxFilesPerBatch'] = $this->getMaxFilesPerBatchConfig(); | |
| 176 | + $vars[ 'simpleBatchUploadMaxFilesPerBatch' ] = $this->getMaxFilesPerBatchConfig(); | |
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | 179 |  	public function onSetupAfterCache() { | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | /** | 
| 48 | 48 | * @param $targetConfiguration | 
| 49 | 49 | */ | 
| 50 | -	public function registerEarlyConfiguration( &$targetConfiguration ){ | |
| 50 | +	public function registerEarlyConfiguration( &$targetConfiguration ) { | |
| 51 | 51 | $sourceConfiguration = $this->getEarlyConfiguration(); | 
| 52 | 52 | $this->mergeConfiguration( $sourceConfiguration, $targetConfiguration ); | 
| 53 | 53 | } | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | /** | 
| 56 | 56 | * @param $targetConfiguration | 
| 57 | 57 | */ | 
| 58 | -	public function registerLateConfiguration( &$targetConfiguration ){ | |
| 58 | +	public function registerLateConfiguration( &$targetConfiguration ) { | |
| 59 | 59 | $sourceConfiguration = $this->getLateConfiguration(); | 
| 60 | 60 | $this->mergeConfiguration( $sourceConfiguration, $targetConfiguration ); | 
| 61 | 61 | } | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | |
| 47 | 47 |  	public function testRegisterEarlyConfiguraion() { | 
| 48 | 48 | $sbu = new SimpleBatchUpload(); | 
| 49 | - $config = []; | |
| 49 | + $config = [ ]; | |
| 50 | 50 | |
| 51 | 51 | $sbu->registerEarlyConfiguration( $config ); | 
| 52 | 52 | $this->assertEarlyConfiguration( $config ); | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | |
| 55 | 55 |  	public function testRegisterLateConfiguraion() { | 
| 56 | 56 | $sbu = new SimpleBatchUpload(); | 
| 57 | - $config = []; | |
| 57 | + $config = [ ]; | |
| 58 | 58 | |
| 59 | 59 | $sbu->registerLateConfiguration( $config ); | 
| 60 | 60 | $this->assertLateConfiguration( $config ); | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | ->method( 'setFunctionHook' ) | 
| 71 | 71 | ->with( | 
| 72 | 72 | $this->equalTo( 'batchupload' ), | 
| 73 | -				$this->callback( function ( $param ) { | |
| 73 | +				$this->callback( function( $param ) { | |
| 74 | 74 | return is_callable( $param ); | 
| 75 | 75 | } ), | 
| 76 | 76 | $this->equalTo( Parser::SFH_OBJECT_ARGS ) ) | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | 83 |  	public function testOnMakeGlobalVariablesScript() { | 
| 84 | - $vars = []; | |
| 84 | + $vars = [ ]; | |
| 85 | 85 | $out = $this->getMockBuilder( OutputPage::class ) | 
| 86 | 86 | ->disableOriginalConstructor() | 
| 87 | 87 | ->getMock(); | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | $this->assertArrayHasKey( 'ext.SimpleBatchUpload.jquery-file-upload', $configuration[ 'wgResourceModules' ] ); | 
| 137 | 137 | $this->assertTrue( $configuration[ 'wgResourceModules' ][ 'ext.SimpleBatchUpload.jquery-file-upload' ] === [ | 
| 138 | 138 | 'localBasePath' => dirname( dirname( __DIR__ ) ), | 
| 139 | - 'remoteBasePath' => $GLOBALS[ 'wgExtensionAssetsPath' ] . '/SimpleBatchUpload', | |
| 139 | + 'remoteBasePath' => $GLOBALS[ 'wgExtensionAssetsPath' ].'/SimpleBatchUpload', | |
| 140 | 140 | 'scripts' => [ 'res/jquery.fileupload.js' ], | 
| 141 | 141 | 'styles' => [ 'res/jquery.fileupload.css' ], | 
| 142 | 142 | 'position' => 'top', | 
| @@ -146,21 +146,21 @@ discard block | ||
| 146 | 146 | $dependencies = [ 'ext.SimpleBatchUpload.jquery-file-upload', 'mediawiki.Title', 'mediawiki.jqueryMsg' ]; | 
| 147 | 147 | |
| 148 | 148 |  		if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.32.0', '>' ) ) { | 
| 149 | - $dependencies[] = 'mediawiki.api'; | |
| 149 | + $dependencies[ ] = 'mediawiki.api'; | |
| 150 | 150 |  		} else { | 
| 151 | - $dependencies[] = 'mediawiki.api.edit'; | |
| 151 | + $dependencies[ ] = 'mediawiki.api.edit'; | |
| 152 | 152 | } | 
| 153 | 153 | |
| 154 | 154 | $this->assertArrayHasKey( 'ext.SimpleBatchUpload', $configuration[ 'wgResourceModules' ] ); | 
| 155 | 155 | $this->assertTrue( $configuration[ 'wgResourceModules' ][ 'ext.SimpleBatchUpload' ] === [ | 
| 156 | 156 | 'localBasePath' => dirname( dirname( __DIR__ ) ), | 
| 157 | - 'remoteBasePath' => $GLOBALS[ 'wgExtensionAssetsPath' ] . '/SimpleBatchUpload', | |
| 157 | + 'remoteBasePath' => $GLOBALS[ 'wgExtensionAssetsPath' ].'/SimpleBatchUpload', | |
| 158 | 158 | 'scripts' => [ 'res/ext.SimpleBatchUpload.js' ], | 
| 159 | 159 | 'styles' => [ 'res/ext.SimpleBatchUpload.css' ], | 
| 160 | 160 | 'position' => 'top', | 
| 161 | 161 | 'dependencies' => $dependencies, | 
| 162 | 162 | 'messages' => [ 'simplebatchupload-comment', 'simplebatchupload-max-files-alert' ], | 
| 163 | - ]); | |
| 163 | + ] ); | |
| 164 | 164 | |
| 165 | 165 | } | 
| 166 | 166 | |
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 | $json[ 'repositories' ] = [ | 
| 13 | 13 | [ | 
| 14 | 14 | 'type' => 'vcs', | 
| 15 | - 'url' => 'https://github.com' . substr( $argv[3], 1 ) . '.git', | |
| 15 | + 'url' => 'https://github.com'.substr( $argv[ 3 ], 1 ).'.git', | |
| 16 | 16 | ], | 
| 17 | 17 | ]; | 
| 18 | 18 | |