@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $this->getPage()->ensureRenderInForm($this); |
| 85 | 85 | parent::addAttributesToRender($writer); |
| 86 | - $writer->addAttribute('type','file'); |
|
| 86 | + $writer->addAttribute('type', 'file'); |
|
| 87 | 87 | $name=$this->getUniqueID(); |
| 88 | 88 | if($this->getMultiple()) |
| 89 | 89 | { |
| 90 | 90 | $name.='[]'; |
| 91 | - $writer->addAttribute('multiple','multiple'); |
|
| 91 | + $writer->addAttribute('multiple', 'multiple'); |
|
| 92 | 92 | } |
| 93 | - $writer->addAttribute('name',$name); |
|
| 93 | + $writer->addAttribute('name', $name); |
|
| 94 | 94 | $isEnabled=$this->getEnabled(true); |
| 95 | 95 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
| 96 | - $writer->addAttribute('disabled','disabled'); |
|
| 96 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | else |
| 112 | 112 | $form->setEnctype('multipart/form-data'); |
| 113 | 113 | } |
| 114 | - $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE',$this->getMaxFileSize()); |
|
| 114 | + $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize()); |
|
| 115 | 115 | if($this->getEnabled(true)) |
| 116 | 116 | $this->getPage()->registerRequiresPostData($this); |
| 117 | 117 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function getMaxFileSize() |
| 124 | 124 | { |
| 125 | - return $this->getViewState('MaxFileSize',self::MAX_FILE_SIZE); |
|
| 125 | + return $this->getViewState('MaxFileSize', self::MAX_FILE_SIZE); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function setMaxFileSize($size) |
| 137 | 137 | { |
| 138 | - $this->setViewState('MaxFileSize',TPropertyValue::ensureInteger($size),self::MAX_FILE_SIZE); |
|
| 138 | + $this->setViewState('MaxFileSize', TPropertyValue::ensureInteger($size), self::MAX_FILE_SIZE); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function getFileName($index=0) |
| 147 | 147 | { |
| 148 | - return isset($this->_files[$index])?$this->_files[$index]->getFileName():''; |
|
| 148 | + return isset($this->_files[$index]) ? $this->_files[$index]->getFileName() : ''; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function getFileSize($index=0) |
| 157 | 157 | { |
| 158 | - return isset($this->_files[$index])?$this->_files[$index]->getFileSize():0; |
|
| 158 | + return isset($this->_files[$index]) ? $this->_files[$index]->getFileSize() : 0; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function getFileType($index=0) |
| 168 | 168 | { |
| 169 | - return isset($this->_files[$index])?$this->_files[$index]->getFileType():''; |
|
| 169 | + return isset($this->_files[$index]) ? $this->_files[$index]->getFileType() : ''; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function getLocalName($index=0) |
| 179 | 179 | { |
| 180 | - return isset($this->_files[$index])?$this->_files[$index]->getLocalName():''; |
|
| 180 | + return isset($this->_files[$index]) ? $this->_files[$index]->getLocalName() : ''; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function getErrorCode($index=0) |
| 191 | 191 | { |
| 192 | - return isset($this->_files[$index])?$this->_files[$index]->getErrorCode():UPLOAD_ERR_NO_FILE; |
|
| 192 | + return isset($this->_files[$index]) ? $this->_files[$index]->getErrorCode() : UPLOAD_ERR_NO_FILE; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getHasFile($index=0) |
| 201 | 201 | { |
| 202 | - return isset($this->_files[$index])?$this->_files[$index]->getHasFile():false; |
|
| 202 | + return isset($this->_files[$index]) ? $this->_files[$index]->getHasFile() : false; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | * @param integer the index of the uploaded file, defaults to 0. |
| 224 | 224 | * @return boolean true if the file saving is successful |
| 225 | 225 | */ |
| 226 | - public function saveAs($fileName,$deleteTempFile=true,$index=0) |
|
| 226 | + public function saveAs($fileName, $deleteTempFile=true, $index=0) |
|
| 227 | 227 | { |
| 228 | - return isset($this->_files[$index])?$this->_files[$index]->saveAs($fileName,$deleteTempFile):false; |
|
| 228 | + return isset($this->_files[$index]) ? $this->_files[$index]->saveAs($fileName, $deleteTempFile) : false; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -235,17 +235,17 @@ discard block |
||
| 235 | 235 | * @param array the input data collection |
| 236 | 236 | * @return boolean whether the data of the control has been changed |
| 237 | 237 | */ |
| 238 | - public function loadPostData($key,$values) |
|
| 238 | + public function loadPostData($key, $values) |
|
| 239 | 239 | { |
| 240 | 240 | if(isset($_FILES[$key])) |
| 241 | 241 | { |
| 242 | - if($this->getMultiple()||is_array($_FILES[$key]['name'])) |
|
| 242 | + if($this->getMultiple() || is_array($_FILES[$key]['name'])) |
|
| 243 | 243 | { |
| 244 | 244 | foreach($_FILES[$key]['name'] as $index => $name) |
| 245 | - $this->_files[$index]=new TFileUploadItem($name,$_FILES[$key]['size'][$index],$_FILES[$key]['type'][$index],$_FILES[$key]['error'][$index],$_FILES[$key]['tmp_name'][$index]); |
|
| 245 | + $this->_files[$index]=new TFileUploadItem($name, $_FILES[$key]['size'][$index], $_FILES[$key]['type'][$index], $_FILES[$key]['error'][$index], $_FILES[$key]['tmp_name'][$index]); |
|
| 246 | 246 | } |
| 247 | 247 | else |
| 248 | - $this->_files[0]=new TFileUploadItem($_FILES[$key]['name'],$_FILES[$key]['size'],$_FILES[$key]['type'],$_FILES[$key]['error'],$_FILES[$key]['tmp_name']); |
|
| 248 | + $this->_files[0]=new TFileUploadItem($_FILES[$key]['name'], $_FILES[$key]['size'], $_FILES[$key]['type'], $_FILES[$key]['error'], $_FILES[$key]['tmp_name']); |
|
| 249 | 249 | return $this->_dataChanged=true; |
| 250 | 250 | } |
| 251 | 251 | else |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function onFileUpload($param) |
| 273 | 273 | { |
| 274 | - $this->raiseEvent('OnFileUpload',$this,$param); |
|
| 274 | + $this->raiseEvent('OnFileUpload', $this, $param); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function getValidationPropertyValue() |
| 293 | 293 | { |
| 294 | - return implode(',',array_map(function($file){return $file->getFileName();},$this->_files)); |
|
| 294 | + return implode(',', array_map(function($file) {return $file->getFileName(); },$this->_files)); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |