@@ -161,7 +161,7 @@ |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * @return string |
|
| 164 | + * @return Request |
|
| 165 | 165 | */ |
| 166 | 166 | public function getRequest() |
| 167 | 167 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | protected function updateNumPages() |
| 67 | 67 | { |
| 68 | - $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int) ceil($this->totalItems/$this->itemsPerPage)); |
|
| 68 | + $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int)ceil($this->totalItems / $this->itemsPerPage)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function setMaxPagesToShow($maxPagesToShow) |
| 76 | 76 | { |
| 77 | - if($maxPagesToShow < 4) |
|
| 77 | + if ($maxPagesToShow < 4) |
|
| 78 | 78 | { |
| 79 | 79 | throw new \InvalidArgumentException('maxPagesToShow cannot be less than 4.'); |
| 80 | 80 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $this->request = $request; |
| 156 | 156 | // Append the page number to the parameter list, if not yet given. |
| 157 | - if(($this->request) && !$this->request->hasPageNumber()) |
|
| 157 | + if (($this->request) && !$this->request->hasPageNumber()) |
|
| 158 | 158 | { |
| 159 | 159 | $this->request->addParameter(Parameter::PAGE_NUMBER, 0); |
| 160 | 160 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | public function getNextPage() |
| 199 | 199 | { |
| 200 | - if($this->currentPage < $this->numPages) |
|
| 200 | + if ($this->currentPage < $this->numPages) |
|
| 201 | 201 | { |
| 202 | 202 | return $this->currentPage + 1; |
| 203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | public function getPrevPage() |
| 209 | 209 | { |
| 210 | - if($this->currentPage > 1) |
|
| 210 | + if ($this->currentPage > 1) |
|
| 211 | 211 | { |
| 212 | 212 | return $this->currentPage - 1; |
| 213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | public function getNextCall() |
| 219 | 219 | { |
| 220 | - if(!$this->getNextPage()) |
|
| 220 | + if (!$this->getNextPage()) |
|
| 221 | 221 | { |
| 222 | 222 | return null; |
| 223 | 223 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function getPrevCall() |
| 232 | 232 | { |
| 233 | - if(!$this->getPrevPage()) |
|
| 233 | + if (!$this->getPrevPage()) |
|
| 234 | 234 | { |
| 235 | 235 | return null; |
| 236 | 236 | } |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $pages = []; |
| 260 | 260 | |
| 261 | - if($this->numPages <= 1) |
|
| 261 | + if ($this->numPages <= 1) |
|
| 262 | 262 | { |
| 263 | 263 | return []; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - if($this->numPages <= $this->maxPagesToShow) |
|
| 266 | + if ($this->numPages <= $this->maxPagesToShow) |
|
| 267 | 267 | { |
| 268 | - for($i = 1; $i <= $this->numPages; $i++) |
|
| 268 | + for ($i = 1; $i <= $this->numPages; $i++) |
|
| 269 | 269 | { |
| 270 | 270 | $pages[] = $this->createPage($i); |
| 271 | 271 | } |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | else |
| 274 | 274 | { |
| 275 | 275 | // Determine the sliding range, centered around the current page. |
| 276 | - $numAdjacents = (int) floor(($this->maxPagesToShow - 4) / 2); |
|
| 276 | + $numAdjacents = (int)floor(($this->maxPagesToShow - 4) / 2); |
|
| 277 | 277 | |
| 278 | 278 | $slidingStart = 1; |
| 279 | 279 | $slidingEndOffset = $numAdjacents + 3 - $this->currentPage; |
| 280 | - if($slidingEndOffset < 0) |
|
| 280 | + if ($slidingEndOffset < 0) |
|
| 281 | 281 | { |
| 282 | 282 | $slidingStart = $this->currentPage - $numAdjacents; |
| 283 | 283 | $slidingEndOffset = 0; |
@@ -285,23 +285,23 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $slidingEnd = $this->numPages; |
| 287 | 287 | $slidingStartOffset = $this->currentPage + $numAdjacents + 2 - $this->numPages; |
| 288 | - if($slidingStartOffset < 0) |
|
| 288 | + if ($slidingStartOffset < 0) |
|
| 289 | 289 | { |
| 290 | 290 | $slidingEnd = $this->currentPage + $numAdjacents; |
| 291 | 291 | $slidingStartOffset = 0; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Build the list of pages. |
| 295 | - if($slidingStart > 1) |
|
| 295 | + if ($slidingStart > 1) |
|
| 296 | 296 | { |
| 297 | 297 | $pages[] = $this->createPage(1); |
| 298 | 298 | $pages[] = $this->createPageEllipsis(); |
| 299 | 299 | } |
| 300 | - for($i = $slidingStart - $slidingStartOffset; $i <= $slidingEnd + $slidingEndOffset; $i++) |
|
| 300 | + for ($i = $slidingStart - $slidingStartOffset; $i <= $slidingEnd + $slidingEndOffset; $i++) |
|
| 301 | 301 | { |
| 302 | 302 | $pages[] = $this->createPage($i); |
| 303 | 303 | } |
| 304 | - if($slidingEnd < $this->numPages) |
|
| 304 | + if ($slidingEnd < $this->numPages) |
|
| 305 | 305 | { |
| 306 | 306 | $pages[] = $this->createPageEllipsis(); |
| 307 | 307 | $pages[] = $this->createPage($this->numPages); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | $first = ($this->currentPage - 1) * $this->itemsPerPage + 1; |
| 346 | 346 | |
| 347 | - if($first > $this->totalItems) |
|
| 347 | + if ($first > $this->totalItems) |
|
| 348 | 348 | { |
| 349 | 349 | return null; |
| 350 | 350 | } |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | public function getCurrentPageLastItem() |
| 356 | 356 | { |
| 357 | 357 | $first = $this->getCurrentPageFirstItem(); |
| 358 | - if($first === null) |
|
| 358 | + if ($first === null) |
|
| 359 | 359 | { |
| 360 | 360 | return null; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $last = $first + $this->itemsPerPage - 1; |
| 364 | - if($last > $this->totalItems) |
|
| 364 | + if ($last > $this->totalItems) |
|
| 365 | 365 | { |
| 366 | 366 | return $this->totalItems; |
| 367 | 367 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public function render() |
| 400 | 400 | { |
| 401 | - if($this->getNumPages() <= 1) |
|
| 401 | + if ($this->getNumPages() <= 1) |
|
| 402 | 402 | { |
| 403 | 403 | return ''; |
| 404 | 404 | } |
@@ -269,8 +269,7 @@ |
||
| 269 | 269 | { |
| 270 | 270 | $pages[] = $this->createPage($i); |
| 271 | 271 | } |
| 272 | - } |
|
| 273 | - else |
|
| 272 | + } else |
|
| 274 | 273 | { |
| 275 | 274 | // Determine the sliding range, centered around the current page. |
| 276 | 275 | $numAdjacents = (int) floor(($this->maxPagesToShow - 4) / 2); |
@@ -80,11 +80,11 @@ |
||
| 80 | 80 | protected function includeAssets() |
| 81 | 81 | { |
| 82 | 82 | $sPluginOptionName = 'assets.include.' . $this->getName(); |
| 83 | - if($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName)) |
|
| 83 | + if ($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName)) |
|
| 84 | 84 | { |
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | - if($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all')) |
|
| 87 | + if ($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all')) |
|
| 88 | 88 | { |
| 89 | 89 | return false; |
| 90 | 90 | } |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <ul class="pagination"> |
| 2 | 2 | <?php |
| 3 | - if(($this->prev)) |
|
| 3 | + if (($this->prev)) |
|
| 4 | 4 | { |
| 5 | 5 | echo $this->prev; |
| 6 | 6 | } |
| 7 | 7 | echo $this->links; |
| 8 | - if(($this->next)) |
|
| 8 | + if (($this->next)) |
|
| 9 | 9 | { |
| 10 | 10 | echo $this->next; |
| 11 | 11 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sAlias ?> = function() { |
| 2 | 2 | return jaxon.request( |
| 3 | 3 | { jxnfun: '<?php echo $this->sFunction ?>' }, |
| 4 | - { parameters: arguments<?php foreach($this->aConfig as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
| 4 | + { parameters: arguments<?php foreach ($this->aConfig as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
| 5 | 5 | ); |
| 6 | 6 | }; |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sClass ?> = {}; |
| 2 | -<?php foreach($this->aMethods as $aMethod): ?> |
|
| 2 | +<?php foreach ($this->aMethods as $aMethod): ?> |
|
| 3 | 3 | <?php echo $this->sPrefix ?><?php echo $this->sClass ?>.<?php echo $aMethod['name'] ?> = function() { |
| 4 | 4 | return jaxon.request( |
| 5 | 5 | { jxncls: '<?php echo $this->sClass ?>', jxnmthd: '<?php echo $aMethod['name'] ?>' }, |
| 6 | - { parameters: arguments<?php foreach($aMethod['config'] as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
| 6 | + { parameters: arguments<?php foreach ($aMethod['config'] as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
| 7 | 7 | ); |
| 8 | 8 | }; |
| 9 | 9 | <?php endforeach ?> |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sEvent ?> = function() { |
| 2 | 2 | return jaxon.request( |
| 3 | 3 | { jxnevt: '<?php echo $this->sEvent ?>' }, |
| 4 | - { parameters: arguments<?php if(($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if(($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> } |
|
| 4 | + { parameters: arguments<?php if (($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if (($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> } |
|
| 5 | 5 | ); |
| 6 | 6 | }; |
@@ -1,3 +1,3 @@ |
||
| 1 | -<?php foreach($this->aUrls as $sUrl): ?> |
|
| 1 | +<?php foreach ($this->aUrls as $sUrl): ?> |
|
| 2 | 2 | <script type="text/javascript" src="<?php echo $sUrl ?>" <?php echo $this->sJsOptions ?> charset="UTF-8"></script> |
| 3 | 3 | <?php endforeach ?> |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | } |
| 122 | 122 | if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage])) |
| 123 | 123 | { |
| 124 | - return $sText; |
|
| 124 | + return $sText; |
|
| 125 | 125 | } |
| 126 | 126 | $message = $this->aTranslations[$sLanguage][$sText]; |
| 127 | 127 | foreach($aPlaceHolders as $name => $value) |
@@ -63,8 +63,7 @@ |
||
| 63 | 63 | { |
| 64 | 64 | // Save this translation |
| 65 | 65 | $this->aTranslations[$sLanguage][$sName] = $xTranslation; |
| 66 | - } |
|
| 67 | - else |
|
| 66 | + } else |
|
| 68 | 67 | { |
| 69 | 68 | // Recursively read the translations in the array |
| 70 | 69 | $this->_loadTranslations($sLanguage, $sName, $xTranslation); |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | private function _loadTranslations($sLanguage, $sPrefix, array $aTranslations) |
| 57 | 57 | { |
| 58 | - foreach($aTranslations as $sName => $xTranslation) |
|
| 58 | + foreach ($aTranslations as $sName => $xTranslation) |
|
| 59 | 59 | { |
| 60 | 60 | $sName = trim($sName); |
| 61 | 61 | $sName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName; |
| 62 | - if(!is_array($xTranslation)) |
|
| 62 | + if (!is_array($xTranslation)) |
|
| 63 | 63 | { |
| 64 | 64 | // Save this translation |
| 65 | 65 | $this->aTranslations[$sLanguage][$sName] = $xTranslation; |
@@ -82,17 +82,17 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function loadTranslations($sFilePath, $sLanguage) |
| 84 | 84 | { |
| 85 | - if(!file_exists($sFilePath)) |
|
| 85 | + if (!file_exists($sFilePath)) |
|
| 86 | 86 | { |
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | $aTranslations = require($sFilePath); |
| 90 | - if(!is_array($aTranslations)) |
|
| 90 | + if (!is_array($aTranslations)) |
|
| 91 | 91 | { |
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | 94 | // Load the translations |
| 95 | - if(!array_key_exists($sLanguage, $this->aTranslations)) |
|
| 95 | + if (!array_key_exists($sLanguage, $this->aTranslations)) |
|
| 96 | 96 | { |
| 97 | 97 | $this->aTranslations[$sLanguage] = []; |
| 98 | 98 | } |
@@ -111,20 +111,20 @@ discard block |
||
| 111 | 111 | public function trans($sText, array $aPlaceHolders = [], $sLanguage = null) |
| 112 | 112 | { |
| 113 | 113 | $sText = trim((string)$sText); |
| 114 | - if(!$sLanguage) |
|
| 114 | + if (!$sLanguage) |
|
| 115 | 115 | { |
| 116 | 116 | $sLanguage = $this->xConfig->getOption('language'); |
| 117 | 117 | } |
| 118 | - if(!$sLanguage) |
|
| 118 | + if (!$sLanguage) |
|
| 119 | 119 | { |
| 120 | 120 | $sLanguage = $this->sDefaultLocale; |
| 121 | 121 | } |
| 122 | - if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage])) |
|
| 122 | + if (!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage])) |
|
| 123 | 123 | { |
| 124 | 124 | return $sText; |
| 125 | 125 | } |
| 126 | 126 | $message = $this->aTranslations[$sLanguage][$sText]; |
| 127 | - foreach($aPlaceHolders as $name => $value) |
|
| 127 | + foreach ($aPlaceHolders as $name => $value) |
|
| 128 | 128 | { |
| 129 | 129 | $message = str_replace(':' . $name, $value, $message); |
| 130 | 130 | } |
@@ -217,7 +217,7 @@ |
||
| 217 | 217 | $aFiles[$sVarName] = []; |
| 218 | 218 | foreach($aUserFiles as $aUserFile) |
| 219 | 219 | { |
| 220 | - $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
| 220 | + $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | // Save upload data in a temp file |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | use Jaxon\Plugin\Request as RequestPlugin; |
| 17 | 17 | use Jaxon\Request\Support\UploadedFile; |
| 18 | 18 | use Jaxon\Response\UploadResponse; |
| 19 | - |
|
| 20 | 19 | use Exception; |
| 21 | 20 | use Closure; |
| 22 | 21 | |
@@ -71,8 +71,7 @@ discard block |
||
| 71 | 71 | if(array_key_exists('jxnupl', $_POST)) |
| 72 | 72 | { |
| 73 | 73 | $this->sTempFile = $_POST['jxnupl']; |
| 74 | - } |
|
| 75 | - elseif(array_key_exists('jxnupl', $_GET)) |
|
| 74 | + } elseif(array_key_exists('jxnupl', $_GET)) |
|
| 76 | 75 | { |
| 77 | 76 | $this->sTempFile = $_GET['jxnupl']; |
| 78 | 77 | } |
@@ -212,8 +211,7 @@ discard block |
||
| 212 | 211 | 'extension' => pathinfo($aFile['name'][$i], PATHINFO_EXTENSION), |
| 213 | 212 | ]; |
| 214 | 213 | } |
| 215 | - } |
|
| 216 | - else |
|
| 214 | + } else |
|
| 217 | 215 | { |
| 218 | 216 | if(!$aFile['name']) |
| 219 | 217 | { |
@@ -420,15 +418,13 @@ discard block |
||
| 420 | 418 | { |
| 421 | 419 | $this->saveToTempFile(); |
| 422 | 420 | $xResponse->setUploadedFile($this->sTempFile); |
| 423 | - } |
|
| 424 | - catch(Exception $e) |
|
| 421 | + } catch(Exception $e) |
|
| 425 | 422 | { |
| 426 | 423 | $xResponse->setErrorMessage($e->getMessage()); |
| 427 | 424 | } |
| 428 | 425 | jaxon()->di()->getResponseManager()->append($xResponse); |
| 429 | 426 | } |
| 430 | - } |
|
| 431 | - elseif(($this->sTempFile)) |
|
| 427 | + } elseif(($this->sTempFile)) |
|
| 432 | 428 | { |
| 433 | 429 | // Ajax request following and HTTP upload |
| 434 | 430 | $this->readFromTempFile(); |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $this->sUploadSubdir = uniqid() . DIRECTORY_SEPARATOR; |
| 70 | 70 | |
| 71 | - if(array_key_exists('jxnupl', $_POST)) |
|
| 71 | + if (array_key_exists('jxnupl', $_POST)) |
|
| 72 | 72 | { |
| 73 | 73 | $this->sTempFile = $_POST['jxnupl']; |
| 74 | 74 | } |
| 75 | - elseif(array_key_exists('jxnupl', $_GET)) |
|
| 75 | + elseif (array_key_exists('jxnupl', $_GET)) |
|
| 76 | 76 | { |
| 77 | 77 | $this->sTempFile = $_GET['jxnupl']; |
| 78 | 78 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | protected function filterFilename($sFilename, $sVarName) |
| 102 | 102 | { |
| 103 | - if(($this->cFileFilter)) |
|
| 103 | + if (($this->cFileFilter)) |
|
| 104 | 104 | { |
| 105 | 105 | $cFileFilter = $this->cFileFilter; |
| 106 | 106 | $sFilename = (string)$cFileFilter($sFilename, $sVarName); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $sUploadDir = rtrim(trim($sUploadDir), '/\\') . DIRECTORY_SEPARATOR; |
| 122 | 122 | // Verify that the upload dir exists and is writable |
| 123 | - if(!is_writable($sUploadDir)) |
|
| 123 | + if (!is_writable($sUploadDir)) |
|
| 124 | 124 | { |
| 125 | 125 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
| 126 | 126 | } |
| 127 | 127 | $sUploadDir .= $sUploadSubDir; |
| 128 | - if(!file_exists($sUploadDir) && !@mkdir($sUploadDir)) |
|
| 128 | + if (!file_exists($sUploadDir) && !@mkdir($sUploadDir)) |
|
| 129 | 129 | { |
| 130 | 130 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
| 131 | 131 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $sUploadDir = rtrim(trim($sUploadDir), '/\\') . DIRECTORY_SEPARATOR; |
| 173 | 173 | $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR; |
| 174 | 174 | $sUploadTempFile = $sUploadDir . $this->sTempFile . '.json'; |
| 175 | - if(!is_readable($sUploadTempFile)) |
|
| 175 | + if (!is_readable($sUploadTempFile)) |
|
| 176 | 176 | { |
| 177 | 177 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
| 178 | 178 | } |
@@ -188,18 +188,18 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | // Check validity of the uploaded files |
| 190 | 190 | $aTempFiles = []; |
| 191 | - foreach($_FILES as $sVarName => $aFile) |
|
| 191 | + foreach ($_FILES as $sVarName => $aFile) |
|
| 192 | 192 | { |
| 193 | - if(is_array($aFile['name'])) |
|
| 193 | + if (is_array($aFile['name'])) |
|
| 194 | 194 | { |
| 195 | 195 | $nFileCount = count($aFile['name']); |
| 196 | - for($i = 0; $i < $nFileCount; $i++) |
|
| 196 | + for ($i = 0; $i < $nFileCount; $i++) |
|
| 197 | 197 | { |
| 198 | - if(!$aFile['name'][$i]) |
|
| 198 | + if (!$aFile['name'][$i]) |
|
| 199 | 199 | { |
| 200 | 200 | continue; |
| 201 | 201 | } |
| 202 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
| 202 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
| 203 | 203 | { |
| 204 | 204 | $aTempFiles[$sVarName] = []; |
| 205 | 205 | } |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | else |
| 221 | 221 | { |
| 222 | - if(!$aFile['name']) |
|
| 222 | + if (!$aFile['name']) |
|
| 223 | 223 | { |
| 224 | 224 | continue; |
| 225 | 225 | } |
| 226 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
| 226 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
| 227 | 227 | { |
| 228 | 228 | $aTempFiles[$sVarName] = []; |
| 229 | 229 | } |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // Check uploaded files validity |
| 246 | - foreach($aTempFiles as $sVarName => $aFiles) |
|
| 246 | + foreach ($aTempFiles as $sVarName => $aFiles) |
|
| 247 | 247 | { |
| 248 | - foreach($aFiles as $aFile) |
|
| 248 | + foreach ($aFiles as $aFile) |
|
| 249 | 249 | { |
| 250 | 250 | // Verify upload result |
| 251 | - if($aFile['error'] != 0) |
|
| 251 | + if ($aFile['error'] != 0) |
|
| 252 | 252 | { |
| 253 | 253 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile)); |
| 254 | 254 | } |
| 255 | 255 | // Verify file validity (format, size) |
| 256 | - if(!$this->validateUploadedFile($sVarName, $aFile)) |
|
| 256 | + if (!$this->validateUploadedFile($sVarName, $aFile)) |
|
| 257 | 257 | { |
| 258 | 258 | throw new \Jaxon\Exception\Error($this->getValidatorMessage()); |
| 259 | 259 | } |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Copy the uploaded files from the temp dir to the user dir |
| 266 | - foreach($aTempFiles as $sVarName => $_aTempFiles) |
|
| 266 | + foreach ($aTempFiles as $sVarName => $_aTempFiles) |
|
| 267 | 267 | { |
| 268 | 268 | $this->aUserFiles[$sVarName] = []; |
| 269 | - foreach($_aTempFiles as $aFile) |
|
| 269 | + foreach ($_aTempFiles as $aFile) |
|
| 270 | 270 | { |
| 271 | 271 | // Get the path to the upload dir |
| 272 | 272 | $sUploadDir = $this->getUploadDir($sVarName); |
@@ -288,10 +288,10 @@ discard block |
||
| 288 | 288 | { |
| 289 | 289 | // Convert uploaded file to an array |
| 290 | 290 | $aFiles = []; |
| 291 | - foreach($this->aUserFiles as $sVarName => $aUserFiles) |
|
| 291 | + foreach ($this->aUserFiles as $sVarName => $aUserFiles) |
|
| 292 | 292 | { |
| 293 | 293 | $aFiles[$sVarName] = []; |
| 294 | - foreach($aUserFiles as $aUserFile) |
|
| 294 | + foreach ($aUserFiles as $aUserFile) |
|
| 295 | 295 | { |
| 296 | 296 | $aFiles[$sVarName][] = $aUserFile->toTempData(); |
| 297 | 297 | } |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | // Upload temp file |
| 313 | 313 | $sUploadTempFile = $this->getUploadTempFile(); |
| 314 | 314 | $aFiles = json_decode(file_get_contents($sUploadTempFile), true); |
| 315 | - foreach($aFiles as $sVarName => $aUserFiles) |
|
| 315 | + foreach ($aFiles as $sVarName => $aUserFiles) |
|
| 316 | 316 | { |
| 317 | 317 | $this->aUserFiles[$sVarName] = []; |
| 318 | - foreach($aUserFiles as $aUserFile) |
|
| 318 | + foreach ($aUserFiles as $aUserFile) |
|
| 319 | 319 | { |
| 320 | 320 | $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile); |
| 321 | 321 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public function noRequestPluginFound() |
| 384 | 384 | { |
| 385 | - if(count($_FILES) > 0) |
|
| 385 | + if (count($_FILES) > 0) |
|
| 386 | 386 | { |
| 387 | 387 | $this->bRequestIsHttpUpload = true; |
| 388 | 388 | } |
@@ -405,17 +405,17 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function processRequest() |
| 407 | 407 | { |
| 408 | - if(!$this->canProcessRequest()) |
|
| 408 | + if (!$this->canProcessRequest()) |
|
| 409 | 409 | { |
| 410 | 410 | return false; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if(count($_FILES) > 0) |
|
| 413 | + if (count($_FILES) > 0) |
|
| 414 | 414 | { |
| 415 | 415 | // Ajax request with upload |
| 416 | 416 | $this->readFromHttpData(); |
| 417 | 417 | |
| 418 | - if($this->bRequestIsHttpUpload) |
|
| 418 | + if ($this->bRequestIsHttpUpload) |
|
| 419 | 419 | { |
| 420 | 420 | // Process an HTTP upload request |
| 421 | 421 | // This requires to set the response to be returned. |
@@ -425,14 +425,14 @@ discard block |
||
| 425 | 425 | $this->saveToTempFile(); |
| 426 | 426 | $xResponse->setUploadedFile($this->sTempFile); |
| 427 | 427 | } |
| 428 | - catch(Exception $e) |
|
| 428 | + catch (Exception $e) |
|
| 429 | 429 | { |
| 430 | 430 | $xResponse->setErrorMessage($e->getMessage()); |
| 431 | 431 | } |
| 432 | 432 | jaxon()->di()->getResponseManager()->append($xResponse); |
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | - elseif(($this->sTempFile)) |
|
| 435 | + elseif (($this->sTempFile)) |
|
| 436 | 436 | { |
| 437 | 437 | // Ajax request following and HTTP upload |
| 438 | 438 | $this->readFromTempFile(); |