@@ -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 ?> |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | // Verify the file extension |
| 130 | 130 | $xDefault = $this->xConfig->getOption('upload.default.types'); |
| 131 | 131 | $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.types', $xDefault); |
| 132 | - if(is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed)) |
|
| 132 | + if (is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed)) |
|
| 133 | 133 | { |
| 134 | 134 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.type', $aUploadedFile); |
| 135 | 135 | return false; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // Verify the file extension |
| 138 | 138 | $xDefault = $this->xConfig->getOption('upload.default.extensions'); |
| 139 | 139 | $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.extensions', $xDefault); |
| 140 | - if(is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed)) |
|
| 140 | + if (is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed)) |
|
| 141 | 141 | { |
| 142 | 142 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.extension', $aUploadedFile); |
| 143 | 143 | return false; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | // Verify the max size |
| 146 | 146 | $xDefault = $this->xConfig->getOption('upload.default.max-size', 0); |
| 147 | 147 | $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.max-size', $xDefault); |
| 148 | - if($iSize > 0 && $aUploadedFile['size'] > $iSize) |
|
| 148 | + if ($iSize > 0 && $aUploadedFile['size'] > $iSize) |
|
| 149 | 149 | { |
| 150 | 150 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.max-size', $aUploadedFile); |
| 151 | 151 | return false; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | // Verify the min size |
| 154 | 154 | $xDefault = $this->xConfig->getOption('upload.default.min-size', 0); |
| 155 | 155 | $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.min-size', $xDefault); |
| 156 | - if($iSize > 0 && $aUploadedFile['size'] < $iSize) |
|
| 156 | + if ($iSize > 0 && $aUploadedFile['size'] < $iSize) |
|
| 157 | 157 | { |
| 158 | 158 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.min-size', $aUploadedFile); |
| 159 | 159 | return false; |
@@ -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 | } |